Skip to content

Commit

Permalink
Merge pull request #33 from UndeadZeratul/main
Browse files Browse the repository at this point in the history
Add Spawn Replacer for RocketBox w/ H.E.A.T. round
  • Loading branch information
UndeadZeratul authored Mar 3, 2024
2 parents 53f6583 + de1bcc8 commit 702b4b2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion zscript/ReusableAmmoboxes/Vanilla/rocketBox.zs
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ class ReusableRocketBox : ReusableAmmobox {
RBOX W -1 { brollsprite = true; brollcenter = true; roll = 180; }
stop;
}
}
}
20 changes: 15 additions & 5 deletions zscript/ReusableAmmoboxes/spawnReplacer.zs
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ class ReusableAmmoboxesSpawner : EventHandler {
addItem('HD7mBoxPickup', 'Reusable7mmBox', 'SevenMilAmmo', 10, 'TEN7A0', '7RNDA0');
addItem('HD355BoxPickup', 'Reusable355Box', 'HDRevolverAmmo', 10, 'TEN9A0', 'PRNDA0');
addItem('RocketBigPickup', 'ReusableRocketBox', 'HDRocketAmmo', 1, 'ROQPA0', 'ROQPA0');
addItem('RocketBoxPickup', 'ReusableRocketBox', 'HDRocketAmmo', 1, 'ROQPA0', 'ROQPA0');

// --------------------
// HDBulletLib Ammoboxes
Expand Down Expand Up @@ -520,14 +521,23 @@ class ReusableAmmoboxesSpawner : EventHandler {
// Iterate through the list of ammo candidates for spawned item.
foreach (itemSpawn : itemSpawnList) {
if (itemSpawn.spawnName ~== candidateName) {
let p = HDRoundAmmo(Actor.spawn(itemSpawn.ammoName, item.pos));
let r = Actor.spawn(itemSpawn.ammoName, item.pos);
let p = HDRoundAmmo(r);

p.amount = item.amount;
p.vel = item.vel;
if (p) {
// If we can split the rounds, do so
p.amount = item.amount;
p.vel = item.vel;

p.splitPickupBoxableRound(itemSpawn.bundleSize, -1, candidateName, itemSpawn.bundleSprite, itemSpawn.roundSprite);
p.splitPickupBoxableRound(itemSpawn.bundleSize, -1, candidateName, itemSpawn.bundleSprite, itemSpawn.roundSprite);

item.destroy();
item.destroy();
} else {
// Otherwise, just replace the box
handleMapSpawns(item, candidateName);

r.destroy();
}

return;
}
Expand Down

0 comments on commit 702b4b2

Please sign in to comment.