mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Add guns to spawn pool and prevent dropping of guns on death
This commit is contained in:
parent
ddfe24e680
commit
2fed17bac7
@ -87,7 +87,7 @@ public class EntityAIFireGun extends EntityAIBase {
|
|||||||
GunConfig config = gun.getConfig(stack, 0);
|
GunConfig config = gun.getConfig(stack, 0);
|
||||||
Receiver rec = config.getReceivers(stack)[0];
|
Receiver rec = config.getReceivers(stack)[0];
|
||||||
if(rec.getMagazine(stack).getAmount(stack) <= 0) {
|
if(rec.getMagazine(stack).getAmount(stack) <= 0) {
|
||||||
updateState(FireState.RELOADING, 40, gun, stack);
|
updateState(FireState.RELOADING, 20, gun, stack);
|
||||||
} else if(ItemGunBaseNT.getState(stack, 0) == GunState.IDLE) {
|
} else if(ItemGunBaseNT.getState(stack, 0) == GunState.IDLE) {
|
||||||
updateState(FireState.FIRING, host.worldObj.rand.nextInt(burstTime), gun, stack);
|
updateState(FireState.FIRING, host.worldObj.rand.nextInt(burstTime), gun, stack);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -428,10 +428,21 @@ public class ModEventHandler {
|
|||||||
if(rand.nextDouble() > Math.log(soot) * 0.25) return null;
|
if(rand.nextDouble() > Math.log(soot) * 0.25) return null;
|
||||||
|
|
||||||
ArrayList<WeightedRandomObject> pool = new ArrayList<WeightedRandomObject>();
|
ArrayList<WeightedRandomObject> pool = new ArrayList<WeightedRandomObject>();
|
||||||
pool.add(new WeightedRandomObject(new ItemStack(ModItems.gun_heavy_revolver), 12));
|
pool.add(new WeightedRandomObject(new ItemStack(ModItems.gun_light_revolver), 12));
|
||||||
|
pool.add(new WeightedRandomObject(new ItemStack(ModItems.gun_heavy_revolver), 8));
|
||||||
|
|
||||||
|
if(soot > 2) pool.add(new WeightedRandomObject(new ItemStack(ModItems.gun_pepperbox), 10));
|
||||||
|
if(soot > 2) pool.add(new WeightedRandomObject(new ItemStack(ModItems.gun_henry), 8));
|
||||||
|
if(soot > 2) pool.add(new WeightedRandomObject(new ItemStack(ModItems.gun_greasegun), 6));
|
||||||
|
|
||||||
|
if(soot > 4) pool.add(new WeightedRandomObject(new ItemStack(ModItems.gun_maresleg), 4));
|
||||||
|
if(soot > 4) pool.add(new WeightedRandomObject(new ItemStack(ModItems.gun_uzi), 6));
|
||||||
|
|
||||||
|
if(soot > 8) pool.add(new WeightedRandomObject(new ItemStack(ModItems.gun_spas12), 3));
|
||||||
if(soot > 8) pool.add(new WeightedRandomObject(new ItemStack(ModItems.gun_am180), 4));
|
if(soot > 8) pool.add(new WeightedRandomObject(new ItemStack(ModItems.gun_am180), 4));
|
||||||
|
|
||||||
|
if(soot > 12) pool.add(new WeightedRandomObject(new ItemStack(ModItems.gun_congolake), 1));
|
||||||
|
|
||||||
WeightedRandomObject selected = (WeightedRandomObject) WeightedRandom.getRandomItem(rand, pool);
|
WeightedRandomObject selected = (WeightedRandomObject) WeightedRandom.getRandomItem(rand, pool);
|
||||||
|
|
||||||
return selected.asStack();
|
return selected.asStack();
|
||||||
@ -439,6 +450,8 @@ public class ModEventHandler {
|
|||||||
|
|
||||||
// these fucking tasks keep stacking on top of themselves
|
// these fucking tasks keep stacking on top of themselves
|
||||||
private static void addFireTask(EntityLiving entity) {
|
private static void addFireTask(EntityLiving entity) {
|
||||||
|
entity.setEquipmentDropChance(0, 0); // Prevent dropping guns
|
||||||
|
|
||||||
for(Object entry : entity.tasks.taskEntries) {
|
for(Object entry : entity.tasks.taskEntries) {
|
||||||
EntityAITasks.EntityAITaskEntry task = (EntityAITasks.EntityAITaskEntry) entry;
|
EntityAITasks.EntityAITaskEntry task = (EntityAITasks.EntityAITaskEntry) entry;
|
||||||
if(task.action instanceof EntityAIFireGun) return;
|
if(task.action instanceof EntityAIFireGun) return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user