Made unlocked blocks in campaign reflect host research

This commit is contained in:
Anuken 2024-10-13 22:57:53 -04:00
parent a7c3ce5d8c
commit e2019fd5dc
4 changed files with 7 additions and 4 deletions

View File

@ -222,6 +222,7 @@ public abstract class UnlockableContent extends MappableContent{
}
}
/** @return in multiplayer, whether this is unlocked for the host player, otherwise, whether it is unlocked for the local player (same as unlocked()) */
public boolean unlockedNowHost(){
if(!state.isCampaign()) return true;
return net != null && net.client() ?

View File

@ -1728,7 +1728,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
}
boolean canRepairDerelict(Tile tile){
return tile != null && tile.build != null && !state.rules.editor && player.team() != Team.derelict && tile.build.team == Team.derelict && tile.build.block.unlockedNow() &&
return tile != null && tile.build != null && !state.rules.editor && player.team() != Team.derelict && tile.build.team == Team.derelict && tile.build.block.unlockedNowHost() &&
Build.validPlace(tile.block(), player.team(), tile.build.tileX(), tile.build.tileY(), tile.build.rotation);
}

View File

@ -739,8 +739,8 @@ public class PlacementFragment{
}
boolean unlocked(Block block){
return block.unlockedNow() && block.placeablePlayer && block.environmentBuildable() &&
block.supportsEnv(state.rules.env); //TODO this hides env unsupported blocks, not always a good thing
return block.unlockedNowHost() && block.placeablePlayer && block.environmentBuildable() &&
block.supportsEnv(state.rules.env);
}
boolean hasInfoBox(){

View File

@ -285,6 +285,8 @@ public class UnitFactory extends UnitBlock{
rebuildCommands.run();
//Since the menu gets hidden when a new unit is selected, this is unnecessary.
/*
UnitType[] lastUnit = {unit()};
commands.update(() -> {
@ -292,7 +294,7 @@ public class UnitFactory extends UnitBlock{
lastUnit[0] = unit();
rebuildCommands.run();
}
});
});*/
table.row();