Refactor how we get an actors weapons
Intent
We have a _getEquippedWeapons
function in CPRActor
which will return equipped weapons but not itemUpgrades/cyberweapons
This MR replaces this function with a more general function: getWeapons
in ActorWeaponSchema
with the following filters:
What are considered weapons:
* item.type === weapon
* item.type === cyberware.isWeapon
* item.type === itemUpgrade.modifiers.secondaryWeapon.configuired
`all`: everything considered a weapon above
`available`: weapon: owned/carried/equipped
cyberWeapon: isWeapon && isInstalledInActor
itemUpgrade: secondaryWeapon.configuired &&
installedIn weapon that is owned/carried/equipped
`owned`: weapon: owned
itemUpgrade: secondaryWeapon.configuired &&
installedIn weapon that is owned
`carried`: weapon: carried
itemUpgrade: secondaryWeapon.configuired &&
installedIn weapon that is carried
`equipped`: weapon: equipped
cyberWeapon: isWeapon && isInstalledInActor
itemUpgrade: secondaryWeapon.configuired &&
installedIn weapon that is equipped
This then provides a set of getters to allow access of these with actor.system.weapons.equipped
etc.
-
This is meant for a hotfix -
This is meant for the next release (see milestone) -
This needs more reviewers than normal; there may be controversy or high complexity -
This intentionally introduces regressions that will be addressed later -
There is/will be documentation changes on the wiki -
Please do not send commits here without coordinating closely with the owner -
This is a Build System change
Related Issues
- N/A
Steps to Test
- Read the diff
In game (functionality):
- Checkout/Build/Load
- Create Actor
- Add
Assault Rifle
- Add
Bow
- Add
Bayonet
- Add
Cyberarm
- Add
Wolvers
- Equip
Assault Rifle
-
Assault Rifle
Shows in Fight Tab/Weapons
-
- Equip
Bow
- Receive yellow warning box about hands
- Install
Bayonet
inAssault Rifle
-
Bayonet
shows in fight tab whenAssault Rifle
is equipped -
Bayonet
does not show in fight tab whenAssault Rifle
is not equipped
-
- Install
Wolvers
inCyberarm
-
Wolvers
show in fight tab once installed, not when not installed
-
In game (console):
- Access the various states of weapons ad described above using the console
game.actors.get("Lb9fE5V3PhDKBTlL").system.weapons.all
game.actors.get("Lb9fE5V3PhDKBTlL").system.weapons.available
game.actors.get("Lb9fE5V3PhDKBTlL").system.weapons.owned
game.actors.get("Lb9fE5V3PhDKBTlL").system.weapons.carried
-
game.actors.get("Lb9fE5V3PhDKBTlL").system.weapons.equipped
- All results should match the description at the top of the MR description
Edited by Ryan Walder