mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-12 15:04:39 +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
2 changed files with 13 additions and 6 deletions
|
|
@ -183,7 +183,7 @@ object Tool {
|
||||||
private var ammoTypeIndex: Int = 0
|
private var ammoTypeIndex: Int = 0
|
||||||
|
|
||||||
/** a reference to the actual `AmmoBox` of this slot */
|
/** 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
|
private var chamber = fdef.Chamber
|
||||||
|
|
||||||
def AmmoTypeIndex: Int = ammoTypeIndex
|
def AmmoTypeIndex: Int = ammoTypeIndex
|
||||||
|
|
@ -223,6 +223,13 @@ object Tool {
|
||||||
Chamber
|
Chamber
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def MaxMagazine(): Int = {
|
||||||
|
fdef.CustomMagazine.get(AmmoType) match {
|
||||||
|
case Some(value) => value
|
||||||
|
case None => fdef.Magazine
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def Box: AmmoBox = box
|
def Box: AmmoBox = box
|
||||||
|
|
||||||
def Box_=(toBox: AmmoBox): Option[AmmoBox] = {
|
def Box_=(toBox: AmmoBox): Option[AmmoBox] = {
|
||||||
|
|
|
||||||
|
|
@ -178,10 +178,10 @@ class VehicleControl(vehicle: Vehicle)
|
||||||
// (oldWeapons, weapons, afterInventory)
|
// (oldWeapons, weapons, afterInventory)
|
||||||
//TODO for now, just refill ammo; assume weapons stay the same
|
//TODO for now, just refill ammo; assume weapons stay the same
|
||||||
vehicle.Weapons
|
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 {
|
.collect {
|
||||||
case weapon : Tool =>
|
case weapon: Tool =>
|
||||||
weapon.AmmoSlots.foreach { ammo => ammo.Box.Capacity = ammo.Box.Definition.Capacity }
|
weapon.AmmoSlots.foreach { ammo => ammo.Box.Capacity = ammo.MaxMagazine() }
|
||||||
}
|
}
|
||||||
(Nil, Nil, afterInventory)
|
(Nil, Nil, afterInventory)
|
||||||
}
|
}
|
||||||
|
|
@ -486,11 +486,11 @@ class VehicleControl(vehicle: Vehicle)
|
||||||
if (obj.VisibleSlots.contains(slot)) zone.id else channel,
|
if (obj.VisibleSlots.contains(slot)) zone.id else channel,
|
||||||
VehicleAction.SendResponse(
|
VehicleAction.SendResponse(
|
||||||
Service.defaultPlayerGUID,
|
Service.defaultPlayerGUID,
|
||||||
ObjectCreateMessage(
|
ObjectCreateDetailedMessage(
|
||||||
definition.ObjectId,
|
definition.ObjectId,
|
||||||
iguid,
|
iguid,
|
||||||
ObjectCreateMessageParent(oguid, slot),
|
ObjectCreateMessageParent(oguid, slot),
|
||||||
definition.Packet.ConstructorData(item).get
|
definition.Packet.DetailedConstructorData(item).get
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue