Payload unit update rule
This commit is contained in:
@@ -50,8 +50,6 @@ public class Planets{
|
||||
totalRadius += 2.6f;
|
||||
lightSrcTo = 0.5f;
|
||||
lightDstFrom = 0.2f;
|
||||
//TODO
|
||||
alwaysUnlocked = true;
|
||||
}};
|
||||
|
||||
makeAsteroid("gier", erekir, Blocks.ferricStoneWall, Blocks.carbonWall, 0.4f, 7, 1f, gen -> {
|
||||
@@ -76,7 +74,6 @@ public class Planets{
|
||||
startSector = 10;
|
||||
atmosphereRadIn = -0.01f;
|
||||
atmosphereRadOut = 0.3f;
|
||||
alwaysUnlocked = true;
|
||||
}};
|
||||
|
||||
serpulo = new Planet("serpulo", sun, 1f, 3){{
|
||||
@@ -105,7 +102,6 @@ public class Planets{
|
||||
private static void makeAsteroid(String name, Planet parent, Block base, Block tint, float tintThresh, int pieces, float scale, Cons<AsteroidGenerator> cgen){
|
||||
new Planet(name, parent, 0.12f){{
|
||||
hasAtmosphere = false;
|
||||
alwaysUnlocked = true; //for testing only!
|
||||
updateLighting = false;
|
||||
sectors.add(new Sector(this, Ptile.empty));
|
||||
camRadius = 0.68f * scale;
|
||||
|
||||
@@ -1465,7 +1465,9 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
if(power != null){
|
||||
power.graph = new PowerGraph();
|
||||
power.links.clear();
|
||||
power.status = 0f;
|
||||
if(block.consumes.hasPower() && !block.consumes.getPower().buffered){
|
||||
power.status = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,50 +11,59 @@ import mindustry.content.*;
|
||||
import mindustry.core.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.payloads.*;
|
||||
import mindustry.world.blocks.power.*;
|
||||
|
||||
/** An entity that holds a payload. */
|
||||
@Component
|
||||
abstract class PayloadComp implements Posc, Rotc, Hitboxc, Unitc{
|
||||
@Import float x, y, rotation;
|
||||
@Import Team team;
|
||||
@Import UnitType type;
|
||||
|
||||
Seq<Payload> payloads = new Seq<>();
|
||||
|
||||
//uncomment for insanity
|
||||
|
||||
/*
|
||||
|
||||
|
||||
private transient @Nullable PowerGraph payloadPower;
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
if(payloadPower != null){
|
||||
payloadPower.clear();
|
||||
}
|
||||
if(Vars.state.rules.unitPayloadUpdate){
|
||||
if(payloadPower != null){
|
||||
payloadPower.clear();
|
||||
}
|
||||
|
||||
//update power graph first, resolve everything
|
||||
for(Payload pay : payloads){
|
||||
if(pay instanceof BuildPayload pb && pb.build.power != null){
|
||||
if(payloadPower == null) payloadPower = new PowerGraph();
|
||||
//update power graph first, resolve everything
|
||||
for(Payload pay : payloads){
|
||||
if(pay instanceof BuildPayload pb && pb.build.power != null){
|
||||
if(payloadPower == null) payloadPower = new PowerGraph();
|
||||
|
||||
pb.build.power.graph = null;
|
||||
payloadPower.add(pb.build);
|
||||
pb.build.team = team;
|
||||
pb.build.power.graph = null;
|
||||
payloadPower.add(pb.build);
|
||||
}
|
||||
}
|
||||
|
||||
if(payloadPower != null){
|
||||
payloadPower.update();
|
||||
}
|
||||
|
||||
for(Payload pay : payloads){
|
||||
if(pay instanceof BuildPayload build){
|
||||
build.build.team = team;
|
||||
}
|
||||
pay.set(x, y, rotation);
|
||||
pay.update(true);
|
||||
}
|
||||
}
|
||||
|
||||
if(payloadPower != null){
|
||||
payloadPower.update();
|
||||
}
|
||||
|
||||
for(Payload pay : payloads){
|
||||
pay.set(x, y, rotation);
|
||||
pay.update(true);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
float payloadUsed(){
|
||||
return payloads.sumf(p -> p.size() * p.size());
|
||||
|
||||
@@ -49,6 +49,8 @@ public class Rules{
|
||||
public boolean fire = true;
|
||||
/** Whether units use and require ammo. */
|
||||
public boolean unitAmmo = false;
|
||||
/** EXPERIMENTAL! If true, blocks will update in units and share power. */
|
||||
public boolean unitPayloadUpdate = false;
|
||||
/** Whether cores add to unit limit */
|
||||
public boolean unitCapVariable = true;
|
||||
/** If true, unit spawn points are shown. */
|
||||
|
||||
@@ -126,7 +126,7 @@ public class Block extends UnlockableContent{
|
||||
public boolean autoResetEnabled = true;
|
||||
/** if true, the block stops updating when disabled */
|
||||
public boolean noUpdateDisabled = false;
|
||||
/** if true, this block updates when it's a payload in a unit. Currently unused! */
|
||||
/** if true, this block updates when it's a payload in a unit. */
|
||||
public boolean updateInUnits = true;
|
||||
/** Whether to use this block's color in the minimap. Only used for overlays. */
|
||||
public boolean useColor = true;
|
||||
|
||||
@@ -36,7 +36,6 @@ public class BaseTurret extends Block{
|
||||
priority = TargetPriority.turret;
|
||||
group = BlockGroup.turrets;
|
||||
flags = EnumSet.of(BlockFlag.turret);
|
||||
updateInUnits = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -49,7 +49,6 @@ public class NuclearReactor extends PowerGenerator{
|
||||
|
||||
public NuclearReactor(String name){
|
||||
super(name);
|
||||
updateInUnits = false;
|
||||
itemCapacity = 30;
|
||||
liquidCapacity = 30;
|
||||
hasItems = true;
|
||||
|
||||
Reference in New Issue
Block a user