Integrated geiger counters now generate audio based on dosage AFTER protection

This commit is contained in:
George Paton 2024-04-07 16:39:33 +10:00
parent 0146e82866
commit 180234e245

View File

@ -12,6 +12,7 @@ import org.lwjgl.opengl.GL11;
import com.hbm.extprop.HbmLivingProps; import com.hbm.extprop.HbmLivingProps;
import com.hbm.handler.radiation.ChunkRadiationManager; import com.hbm.handler.radiation.ChunkRadiationManager;
import com.hbm.util.ContaminationUtil;
import com.hbm.util.I18nUtil; import com.hbm.util.I18nUtil;
import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.common.gameevent.TickEvent;
@ -48,8 +49,8 @@ public class ArmorFSB extends ItemArmor implements IArmorDisableModel {
private String texture = ""; private String texture = "";
private ResourceLocation overlay = null; private ResourceLocation overlay = null;
public List<PotionEffect> effects = new ArrayList(); public List<PotionEffect> effects = new ArrayList<PotionEffect>();
public HashMap<String, Float> resistance = new HashMap(); public HashMap<String, Float> resistance = new HashMap<String, Float>();
public float blastProtection = -1; public float blastProtection = -1;
public float projectileProtection = -1; public float projectileProtection = -1;
public float damageCap = -1; public float damageCap = -1;
@ -572,34 +573,31 @@ public class ArmorFSB extends ItemArmor implements IArmorDisableModel {
if(this.armorType != 1) if(this.armorType != 1)
return; return;
if(!this.hasFSBArmor(entity) || !this.geigerSound) if(!hasFSBArmor(entity) || !this.geigerSound)
return; return;
if(world.getTotalWorldTime() % 5 == 0) { if(world.getTotalWorldTime() % 5 == 0) {
float x = HbmLivingProps.getRadBuf((EntityLivingBase)entity); // Armor piece dosimeters indicate radiation dosage inside the armor, so reduce the counts by the effective protection
float mod = ContaminationUtil.calculateRadiationMod(entity);
float x = HbmLivingProps.getRadBuf(entity) * mod;
if(x > 1E-5) { if(x > 1E-5) {
List<Integer> list = new ArrayList<Integer>();
if(x > 0) {
List<Integer> list = new ArrayList<Integer>(); if(x < 1) list.add(0);
if(x < 5) list.add(0);
if(x < 1) list.add(0); if(x < 10) list.add(1);
if(x < 5) list.add(0); if(x > 5 && x < 15) list.add(2);
if(x < 10) list.add(1); if(x > 10 && x < 20) list.add(3);
if(x > 5 && x < 15) list.add(2); if(x > 15 && x < 25) list.add(4);
if(x > 10 && x < 20) list.add(3); if(x > 20 && x < 30) list.add(5);
if(x > 15 && x < 25) list.add(4); if(x > 25) list.add(6);
if(x > 20 && x < 30) list.add(5);
if(x > 25) list.add(6); int r = list.get(world.rand.nextInt(list.size()));
int r = list.get(world.rand.nextInt(list.size())); if(r > 0)
world.playSoundAtEntity(entity, "hbm:item.geiger" + r, 1.0F, 1.0F);
if(r > 0)
world.playSoundAtEntity(entity, "hbm:item.geiger" + r, 1.0F, 1.0F);
} else if(world.rand.nextInt(50) == 0) {
world.playSoundAtEntity(entity, "hbm:item.geiger" + (1 + world.rand.nextInt(1)), 1.0F, 1.0F);
}
} }
} }
} }
@ -645,7 +643,7 @@ public class ArmorFSB extends ItemArmor implements IArmorDisableModel {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
} }
private HashSet<EnumPlayerPart> hidden = new HashSet(); private HashSet<EnumPlayerPart> hidden = new HashSet<EnumPlayerPart>();
private boolean needsFullSet = false; private boolean needsFullSet = false;
public ArmorFSB hides(EnumPlayerPart... parts) { public ArmorFSB hides(EnumPlayerPart... parts) {