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