mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-01-19 18:44:45 +00:00
Vehicle Loadout Weapon Ammunition (#914)
* correcting vehicle loadout change to account for capacity of weapon magazine, not default ammunition box capacity * inventory items in vehicle trunks express proper ammunition capacity
This commit is contained in:
parent
e0b3ed6fbf
commit
0bbe7e3959
|
|
@ -183,7 +183,7 @@ object Tool {
|
|||
private var ammoTypeIndex: Int = 0
|
||||
|
||||
/** a reference to the actual `AmmoBox` of this slot */
|
||||
private var box: AmmoBox = AmmoBox(AmmoDefinition, fdef.Magazine)
|
||||
private var box: AmmoBox = AmmoBox(AmmoDefinition, MaxMagazine())
|
||||
private var chamber = fdef.Chamber
|
||||
|
||||
def AmmoTypeIndex: Int = ammoTypeIndex
|
||||
|
|
@ -223,6 +223,13 @@ object Tool {
|
|||
Chamber
|
||||
}
|
||||
|
||||
def MaxMagazine(): Int = {
|
||||
fdef.CustomMagazine.get(AmmoType) match {
|
||||
case Some(value) => value
|
||||
case None => fdef.Magazine
|
||||
}
|
||||
}
|
||||
|
||||
def Box: AmmoBox = box
|
||||
|
||||
def Box_=(toBox: AmmoBox): Option[AmmoBox] = {
|
||||
|
|
|
|||
|
|
@ -178,10 +178,10 @@ class VehicleControl(vehicle: Vehicle)
|
|||
// (oldWeapons, weapons, afterInventory)
|
||||
//TODO for now, just refill ammo; assume weapons stay the same
|
||||
vehicle.Weapons
|
||||
.collect { case (_, slot : EquipmentSlot) if slot.Equipment.nonEmpty => slot.Equipment.get }
|
||||
.collect { case (_, slot: EquipmentSlot) if slot.Equipment.nonEmpty => slot.Equipment.get }
|
||||
.collect {
|
||||
case weapon : Tool =>
|
||||
weapon.AmmoSlots.foreach { ammo => ammo.Box.Capacity = ammo.Box.Definition.Capacity }
|
||||
case weapon: Tool =>
|
||||
weapon.AmmoSlots.foreach { ammo => ammo.Box.Capacity = ammo.MaxMagazine() }
|
||||
}
|
||||
(Nil, Nil, afterInventory)
|
||||
}
|
||||
|
|
@ -486,11 +486,11 @@ class VehicleControl(vehicle: Vehicle)
|
|||
if (obj.VisibleSlots.contains(slot)) zone.id else channel,
|
||||
VehicleAction.SendResponse(
|
||||
Service.defaultPlayerGUID,
|
||||
ObjectCreateMessage(
|
||||
ObjectCreateDetailedMessage(
|
||||
definition.ObjectId,
|
||||
iguid,
|
||||
ObjectCreateMessageParent(oguid, slot),
|
||||
definition.Packet.ConstructorData(item).get
|
||||
definition.Packet.DetailedConstructorData(item).get
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue