Merge pull request #1193 from ScrawnyRonnie/trades

No More Kill Trades?
This commit is contained in:
ScrawnyRonnie 2024-04-18 09:01:01 -04:00 committed by GitHub
commit 21637108c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -609,11 +609,13 @@ private[support] class WeaponAndProjectileOperations(
if (tool.Magazine <= 0) { //safety: enforce ammunition depletion if (tool.Magazine <= 0) { //safety: enforce ammunition depletion
prefire -= weaponGUID prefire -= weaponGUID
EmptyMagazine(weaponGUID, tool) EmptyMagazine(weaponGUID, tool)
(o, Some(tool))
} else if (!player.isAlive) { //proper internal accounting, but no projectile } else if (!player.isAlive) { //proper internal accounting, but no projectile
prefire += weaponGUID prefire += weaponGUID
tool.Discharge() tool.Discharge()
projectiles(projectileGUID.guid - Projectile.baseUID) = None projectiles(projectileGUID.guid - Projectile.baseUID) = None
shotsWhileDead += 1 shotsWhileDead += 1
(None, None)
} else { //shooting } else { //shooting
if ( if (
avatar.stamina > 0 && avatar.stamina > 0 &&
@ -628,9 +630,9 @@ private[support] class WeaponAndProjectileOperations(
tool.Discharge() tool.Discharge()
prefire += weaponGUID prefire += weaponGUID
addShotsFired(tool.Definition.ObjectId, tool.AmmoSlot.Chamber) addShotsFired(tool.Definition.ObjectId, tool.AmmoSlot.Chamber)
}
(o, Some(tool)) (o, Some(tool))
} }
}
collectedTools.headOption.getOrElse((None, None)) collectedTools.headOption.getOrElse((None, None))
} else { } else {
(None, None) (None, None)