Updated forcefield upgrades (wip)
This commit is contained in:
parent
0390516a96
commit
ff1f873fa5
2 changed files with 26 additions and 9 deletions
|
@ -8,6 +8,7 @@ public enum EnumForceFieldUpgrade {
|
||||||
CAMOUFLAGE ("camouflage" , false, true ),
|
CAMOUFLAGE ("camouflage" , false, true ),
|
||||||
COOL ("cool" , true , true ),
|
COOL ("cool" , true , true ),
|
||||||
FUSION ("fusion" , true , true ),
|
FUSION ("fusion" , true , true ),
|
||||||
|
INVERT ("invert" , true , false),
|
||||||
MUTE ("mute" , true , false),
|
MUTE ("mute" , true , false),
|
||||||
RANGE ("range" , true , true ),
|
RANGE ("range" , true , true ),
|
||||||
ROTATION ("rotation" , true , false),
|
ROTATION ("rotation" , true , false),
|
||||||
|
@ -17,7 +18,6 @@ public enum EnumForceFieldUpgrade {
|
||||||
THICKNESS ("thickness" , true , true ),
|
THICKNESS ("thickness" , true , true ),
|
||||||
TRANSLATION ("translation" , true , false),
|
TRANSLATION ("translation" , true , false),
|
||||||
WARM ("warm" , true , true ),
|
WARM ("warm" , true , true ),
|
||||||
// reserved 13
|
|
||||||
// reserved 14
|
// reserved 14
|
||||||
// reserved 15
|
// reserved 15
|
||||||
;
|
;
|
||||||
|
|
|
@ -20,7 +20,15 @@ public class ForceFieldSetup extends GlobalPosition {
|
||||||
public ItemStack itemStackCamouflage;
|
public ItemStack itemStackCamouflage;
|
||||||
private Block blockCamouflage_cache;
|
private Block blockCamouflage_cache;
|
||||||
private static final List<Integer> ALLOWED_RENDER_TYPES = Arrays.asList(0, 1, 4, 5, 6, 8, 7, 12, 13, 14, 16, 17, 20, 23, 29, 30, 31, 39);
|
private static final List<Integer> ALLOWED_RENDER_TYPES = Arrays.asList(0, 1, 4, 5, 6, 8, 7, 12, 13, 14, 16, 17, 20, 23, 29, 30, 31, 39);
|
||||||
private final HashMap<String, Integer> upgrades = new HashMap<>(EnumForceFieldUpgrade.length);
|
private final HashMap<String, Integer> mapUpgradeValues = new HashMap<>(EnumForceFieldUpgrade.length);
|
||||||
|
private final HashMap<String, IForceFieldUpgrade> mapUpgradeObjects = new HashMap<>(EnumForceFieldUpgrade.length);
|
||||||
|
public boolean hasFusion;
|
||||||
|
public boolean isInverted;
|
||||||
|
public float startupEnergyCost;
|
||||||
|
public float scanEnergyCost;
|
||||||
|
public float placeEnergyCost;
|
||||||
|
public float scanSpeed = 100000;
|
||||||
|
public float placeSpeed = 100000;
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
public Set<TileEntityProjector> projectors = new HashSet<>();
|
public Set<TileEntityProjector> projectors = new HashSet<>();
|
||||||
|
@ -28,8 +36,6 @@ public class ForceFieldSetup extends GlobalPosition {
|
||||||
public int disintegrationLevel;
|
public int disintegrationLevel;
|
||||||
public int temperatureLevel;
|
public int temperatureLevel;
|
||||||
public boolean hasStabilize;
|
public boolean hasStabilize;
|
||||||
public boolean isInverted = false;
|
|
||||||
public boolean hasFusion;
|
|
||||||
|
|
||||||
// Projector provided properties
|
// Projector provided properties
|
||||||
public float rotationYaw;
|
public float rotationYaw;
|
||||||
|
@ -94,6 +100,7 @@ public class ForceFieldSetup extends GlobalPosition {
|
||||||
vTranslation = new VectorI(projector);
|
vTranslation = new VectorI(projector);
|
||||||
// TODO vMin = projector.vMin;
|
// TODO vMin = projector.vMin;
|
||||||
// TODO vMax = projector.vMax;
|
// TODO vMax = projector.vMax;
|
||||||
|
// TODO item upgrades
|
||||||
} else {
|
} else {
|
||||||
if ((((TileEntityProjector) tileEntity).isEnabled)
|
if ((((TileEntityProjector) tileEntity).isEnabled)
|
||||||
&& (((TileEntityProjector) tileEntity).isCalculated())
|
&& (((TileEntityProjector) tileEntity).isCalculated())
|
||||||
|
@ -106,16 +113,26 @@ public class ForceFieldSetup extends GlobalPosition {
|
||||||
if (tileEntity instanceof IForceFieldUpgrade) {
|
if (tileEntity instanceof IForceFieldUpgrade) {
|
||||||
String upgradeKey = ((IForceFieldUpgrade)tileEntity).getUpgradeKey();
|
String upgradeKey = ((IForceFieldUpgrade)tileEntity).getUpgradeKey();
|
||||||
if (!upgradeKey.isEmpty()) {
|
if (!upgradeKey.isEmpty()) {
|
||||||
Integer count = upgrades.get(upgradeKey);
|
Integer value = mapUpgradeValues.get(upgradeKey);
|
||||||
if (count == null) {
|
if (value == null) {
|
||||||
count = 0;
|
value = 0;
|
||||||
|
mapUpgradeObjects.put(upgradeKey, (IForceFieldUpgrade)tileEntity);
|
||||||
}
|
}
|
||||||
upgrades.put(upgradeKey, count + ((IForceFieldUpgrade)tileEntity).getUpgradeValue());
|
mapUpgradeValues.put(upgradeKey, value + ((IForceFieldUpgrade)tileEntity).getUpgradeValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hasFusion = upgrades.containsKey(EnumForceFieldUpgrade.FUSION.unlocalizedName);
|
// compute results
|
||||||
|
hasFusion = mapUpgradeObjects.containsKey(EnumForceFieldUpgrade.FUSION.unlocalizedName);
|
||||||
|
isInverted = mapUpgradeObjects.containsKey(EnumForceFieldUpgrade.INVERT.unlocalizedName);
|
||||||
|
for (Map.Entry<String, IForceFieldUpgrade> entry : mapUpgradeObjects.entrySet()) {
|
||||||
|
startupEnergyCost += entry.getValue().getStartupEnergyCost(entry.getKey(), mapUpgradeValues.get(entry.getKey()));
|
||||||
|
scanEnergyCost += entry.getValue().getScanEnergyCost(entry.getKey(), mapUpgradeValues.get(entry.getKey()));
|
||||||
|
placeEnergyCost += entry.getValue().getPlaceEnergyCost(entry.getKey(), mapUpgradeValues.get(entry.getKey()));
|
||||||
|
scanSpeed = Math.min(scanSpeed, entry.getValue().getMaxScanSpeed(entry.getKey(), mapUpgradeValues.get(entry.getKey())));
|
||||||
|
placeSpeed = Math.min(placeSpeed, entry.getValue().getMaxPlaceSpeed(entry.getKey(), mapUpgradeValues.get(entry.getKey())));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue