Fixed #11320
This commit is contained in:
@@ -363,7 +363,7 @@ public class ContentPatcher{
|
||||
|
||||
try{
|
||||
if(value instanceof JsonValue jsv){ //setting values from object
|
||||
if(prevValue == null || !jsv.isObject() || jsv.has("type") || (metadata != null && metadata.type == Attributes.class)){
|
||||
if(prevValue == null || !jsv.isObject() || (jsv.has("type") && metadata.type != MappableContent.class) || (metadata != null && metadata.type == Attributes.class)){
|
||||
if(UnlockableContent.class.isAssignableFrom(metadata.type) && jsv.isObject()){
|
||||
warn("New content must not be instantiated: @", jsv);
|
||||
return;
|
||||
|
||||
@@ -829,6 +829,28 @@ public class UnitType extends UnlockableContent implements Senseable{
|
||||
}
|
||||
}
|
||||
|
||||
void initPathType(){
|
||||
if(flowfieldPathType == -1){
|
||||
flowfieldPathType =
|
||||
naval ? Pathfinder.costNaval :
|
||||
allowLegStep ? Pathfinder.costLegs :
|
||||
flying ? Pathfinder.costNone :
|
||||
hovering ? Pathfinder.costHover :
|
||||
Pathfinder.costGround;
|
||||
}
|
||||
|
||||
if(pathCost == null){
|
||||
pathCost =
|
||||
naval ? ControlPathfinder.costNaval :
|
||||
allowLegStep ? ControlPathfinder.costLegs :
|
||||
hovering ? ControlPathfinder.costHover :
|
||||
ControlPathfinder.costGround;
|
||||
}
|
||||
|
||||
pathCostId = ControlPathfinder.costTypes.indexOf(pathCost);
|
||||
if(pathCostId == -1) pathCostId = 0;
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
@Override
|
||||
public void init(){
|
||||
@@ -852,25 +874,7 @@ public class UnitType extends UnlockableContent implements Senseable{
|
||||
}
|
||||
}
|
||||
|
||||
if(flowfieldPathType == -1){
|
||||
flowfieldPathType =
|
||||
naval ? Pathfinder.costNaval :
|
||||
allowLegStep ? Pathfinder.costLegs :
|
||||
flying ? Pathfinder.costNone :
|
||||
hovering ? Pathfinder.costHover :
|
||||
Pathfinder.costGround;
|
||||
}
|
||||
|
||||
if(pathCost == null){
|
||||
pathCost =
|
||||
naval ? ControlPathfinder.costNaval :
|
||||
allowLegStep ? ControlPathfinder.costLegs :
|
||||
hovering ? ControlPathfinder.costHover :
|
||||
ControlPathfinder.costGround;
|
||||
}
|
||||
|
||||
pathCostId = ControlPathfinder.costTypes.indexOf(pathCost);
|
||||
if(pathCostId == -1) pathCostId = 0;
|
||||
initPathType();
|
||||
|
||||
if(flying){
|
||||
envEnabled |= Env.space;
|
||||
@@ -1232,6 +1236,12 @@ public class UnitType extends UnlockableContent implements Senseable{
|
||||
public void afterPatch(){
|
||||
super.afterPatch();
|
||||
totalRequirements = cachedRequirements = firstRequirements = null;
|
||||
|
||||
//this will technically reset any assigned values, but in vanilla, they're not reassigned anyway
|
||||
flowfieldPathType = -1;
|
||||
pathCost = null;
|
||||
pathCostId = -1;
|
||||
initPathType();
|
||||
}
|
||||
|
||||
/** @return the time required to build this unit, as a value that takes into account reconstructors */
|
||||
|
||||
@@ -11,6 +11,7 @@ import mindustry.entities.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.logic.*;
|
||||
import mindustry.mod.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.liquid.Conduit.*;
|
||||
@@ -43,6 +44,7 @@ public class GenericCrafter extends Block{
|
||||
public float updateEffectSpread = 4f;
|
||||
public float warmupSpeed = 0.019f;
|
||||
/** Only used for legacy cultivator blocks. */
|
||||
@NoPatch
|
||||
public boolean legacyReadWarmup = false;
|
||||
|
||||
public DrawBlock drawer = new DrawDefault();
|
||||
|
||||
Reference in New Issue
Block a user