Skip to content

Commit

Permalink
medical: Fix trauma kit not consuming items properly
Browse files Browse the repository at this point in the history
  • Loading branch information
dastrukar committed Sep 29, 2023
1 parent 0d1bda1 commit 23a9e21
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions medical/module/traumakit/traumakit_supplies.zsc
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,28 @@ extend class UaS_TraumaKit {
// Copied from HD to avoid inheritance chain
// Thanks to MarinaGryphon (jade-2562) for figuring this out
void TakeInjector(class<inventory> injectortype) {
let mmm=HDMagAmmo(owner.findinventory(injectortype));
if(mmm){
mmm.amount--;
if(mmm.amount<1)mmm.destroy();
else if(mmm.mags.size())mmm.mags.pop();
// for pre-injector overhaul
let mmm = HDMagAmmo(owner.FindInventory(injectortype));
if (mmm) {
mmm.Amount--;
if (mmm.Amount < 1) { mmm.Destroy(); }
else if (mmm.Mags.Size()) { mmm.Mags.Pop(); }
return;
}

// for post-injector overhaul
let spw = SpareWeapons(owner.FindInventory("SpareWeapons"));
if (HDWeapon.GetActualAmount(owner, injectortype.GetClassName()) == 1 || !spw) {
let item = owner.FindInventory(injectortype);
item.Destroy();
return;
}

int i = spw.weapontype.Find(injectortype.GetClassName());
if (i == spw.weapontype.Size()) { return; }
spw.weapontype.Delete(i);
spw.weaponbulk.Delete(i);
spw.weaponstatus.Delete(i);
}

void HandleSupplies() {
Expand Down

0 comments on commit 23a9e21

Please sign in to comment.