Skip to content

Universal Installation System

Darin Sorrentino requested to merge dsorrent-installable-recode into dev

Intent

  • 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
  • This intentionally introduces regressions that will be addressed later
  • There is/will be documentation changes on the wiki

Features

  • Install Upgrades into Items
  • Install Programs into Cyberdecks
  • Install Cyberware into Actors
  • Install Upgrades/Programs into unowned items
  • Transfer Items containing Items from one Actor to Another Actor
  • Transfer Items containing Items from the World to an Actor
  • Transfer Items containing Items from an Actor to the World
  • Transfer loaded weapons from one Actor to Another Actor
  • Handle deletion of installed items where applicable
  • Ability to create a Compendium of Upgraded Items -> Deferring to a future MR

Description

In CPR-Core, we were handling all of the following differently:

  1. Installing Upgrades into Items
  2. Installing Programs into Cyberdecks
  3. Installing Cyberware into Actors

The problem with this is that it would require custom code for installations such as a Cyberdeck into a Bodyweight Suit or Cyber Arm. Additionally, it would need custom code for inserting a Skill Chip into a Chipware Socket. The purpose of this merge request is to consolidate the code path for installing items into objects (items/actors) and allow for scenarios as the ones mentioned here.

When the mixins were added, the slots data point moved to the upgradable mixin, however, the code for the Cyberdeck was still using this data point to track the number of Programs that were allowed to be installed. Fortunately, Cyberdecks were upgradable so it actually didn't cause any noticeable code issues, but it did combine the capacity of upgrade slots and the program slots into a single value. Cyberware, however had it's own slot count and tracking code.

With this merge, slots is removed from upgradable and Cyberware loses the following data points:

"hasOptionalSlots": false,
"optionSlots": 0,
"installedOptionSlots": 0,
"optionalIds": [],

The base common template was modified for Actors and Items with the following:

Actor - template common

"installedItems": {
  "allowedTypes": ["cyberware"],
  "allowed": true,
  "list": []
}

Item - template container

"installedItems": {
  "allowedTypes": ["itemUpgrade"],
  "allowed": true,
  "list": [],
  "usedSlots": 0,
  "slots": 3
}

The primary difference here being that Actors don't have slots and usedSlots as they don't have a limited capacity for items to be installed into them.

allowed - Boolean whether or not items can be installed into this item. allowedTypes - List of item.type that are allowed to be installed into this item. list - List of UUID's of the items that are installed into this item.

Upgrade data remains in the upgradable template and is used for applying upgrades to data points. Program data remains in the programs data point on a cyberdeck item.type and is used for execution/utilization on the Cyberdeck.

The only real change here is that the installedItems.list is considered the "source of truth" as to what upgrades or programs should be installed in the item. As such, the upgradable mixin received a new function called syncUpgrades() which will synchronize upgrade data with installedItems. Likewise, cyberdeck item.type received a new function called syncPrograms() which will synchronize the program data with the installedItems.

This change also includes code so that installed items now "transfer" with the item they are installed in. So a Cyberdeck containing programs that is dragged from one actor to another will move the Cyberdeck and all installed programs from one actor to the other actor. This functionality/concept of transferring "dependent items" has been extended to also include ammo loaded into a weapon that is transferred from one actor to another. This did require a change from just storing the ammoId. The loadable mixin has been modified to store the ammo UUID and name instead of just the ID. The loadable mixin changes from:

      "loadable": {
        "usesType": "magazine",
        "magazine": {
          "value": 0,
          "max": 0,
          "ammoId": ""
        },
        "ammoVariety": []
      },

to

      "loadable": {
        "usesType": "magazine",
        "magazine": {
          "value": 0,
          "max": 0,
          "ammoData": {
            "name": "",
            "uuid": ""
          }
        },
        "ammoVariety": []
      },

Furthermore, an upgraded item that exists on an actor can be dragged to the right side Item Pane to create an upgraded world item. Any installed items are created in a folder called CPR-Core Installed Items (in English, the actual name is controlled by the localized variable CPR.settings.installedItemsFolder). Any attempt to delete a World Item that is referenced as being installed in another World Item will fail displaying a dialog that provides information as to where the item is installed in, including the Folder that World Item may be located in.

Any loaded weapons dragged to the right side Item Pane will have their ammo removed/deleted from the item. There's no real need to have a million ammo item references in the world for these items.

Unloading a weapon which an actor does not have the ammo for will do a "best attempt" to identify/re-create an Ammo item in the Actors inventory. Best attempt includes:

  • See if there is a matching owned ammo item of the same name as the loaded ammo, if so, use that
  • See if there is a matching world ammo item of the same name as the loaded ammo and re-create it on the actor

Lastly, there have been some style changes/indicators added to the Gear and Cyber tabs to indicate items are installed and/or have installed items.

Some sample screen shots:

Here we show a Cyberdeck install in an arm as well as some Kung Fu Chipware installed in a Chipware socket: image

Icon indicating item is installed in another item, hovering shows which item, clicking will open the sheet of the item it is installed in: image

Viewing an item that has other items installed: image

Related Issues

Steps to Test

Testing Installed Items

  1. Create actor (myActor) and add the following Compendium items:
  • Cyberware
    • Cyberarm
    • Cyberdeck (Hardwired)
    • Big Knucks
    • Kerenzikov
    • Interface Plugs
    • Neural Link
    • Chipware Socket
  • Gear
    • Cyberdeck
  • Programs
    • See Ya
    • Speedy Gonzalez
  • Weapon
    • Assault Rifle
  • Ammo
    • Basic Rife (adjust amount to 100)
  1. Open Cyberdeck (Hardwired)
  • Settings Tab: Click Installed Items at the bottom
  • Select Cyberdeck
  • Click Confirm
  1. Note the following changes:
  • Cyberdeck now has a i icon next to the name. Hovering shows where it is installed. Clicking i opens the item it was installed in.
  • View item sheet for Cyberdeck (Hardwired) and note under the name it states it has installed items
  1. Delete Cyberdeck (Hardwired), note the i is now gone from the Cyberdeck indicating it is no longer installed.

  2. Re-add Cyberdeck (Hardwired) from the Compendium.

  3. Repeat Step 2 to re-install Cyberdeck. Open Cyberdeck (Hardwired) and confirm it shows it has Installed Items.

  4. Click arrow next to Cyberdeck, install any/all Programs.

  5. Delete Cyberdeck, note Programs returned to inventory. Open Cyberdeck (Hardwired), note the Cyberdeck is no longer installed.

  6. Re-add Cyberdeck (Hardwired) from the Compendium.

  7. Repeat Step 2 to re-install Cyberdeck.

  8. Click arrow next to Cyberdeck, install all Programs.

  9. Install Cyberarm & Cyberdeck (Hardwired).

  10. View Cyber tab and note indentation indicating installation location.

  11. Import "Skill Chip" Cyberware Item to World

  12. Edit imported Skill Chip:

  • Settings Tab: Change name to "Skill Chip (Kung Fu)"
  • Effects Tab: Create Effect
  • Change When to Enable to When Installed
  • Edit New Effect
    • Details: Effect Label: Kung Fu
    • Effects: Click Plus to add an effect
      • Change Perception to Martial Arts
      • Set Effect Value to 3
      • Click Submit Changes
  1. Create Item: Name: Asp Type: Program

  2. Configure Program Asp

  • Set class to Black ICE
  • Program Size: 2
  • Per: 2
  • Spd: 3
  • Atk: 4
  • Def: 5
  • Rez: 15
  1. Drag Program Asp and Skill Chip (Kung Fu) to Actor

  2. Create a Scene (myScene)

  • Under Lighting, disable Token Vision to make things easier to see
  1. Drag Actor (myActor) to Scene

  2. Open Token Actor

  3. Click arrow next to Cyberdeck, install Asp.

  4. Install Cyberware:

  • Neural Link - Foundational, roll dice if you want
  • Chipware Socket - Select target install drop down and choose Neural Link - Notice Neural Link is the ONLY option here
  • Kerenzikov - Select target install drop down and notice there's now two options, Neural Link and Chipware Socket. Select Neural Link as that is the only thing that makes sense.
  • Skill Chip (Kung Fu) - Select target install drop down and notice there's now two options, Neural Link and Chipware Socket. Select Chipware Socket as that is where Chipware is installed into.
  • Interface Plugs - Select target install drop down and choose Neural Link - Notice Neural Link is the ONLY option here now, because the Chipware Socket only has space for 1 item and that is now occupied by Skill Chip (Kung Fu)
  1. View Cyber tab and note indentation indicating installation location.

  2. Confirm Martial Arts Bonus Effect.

  3. Equip Cyberdeck, switch to Fight: Net tab

  4. Rez various Programs and confirm they are working as expected.

  5. De-rez Black Ice and confirm token goes away.

  6. Test various Cyberware Uninstallation Scenarios:

  • Uninstall Skill Chip (Kung Fu) / Re-install
  • Uninstall populated Chipware Socket, ensure all items return to inventory / Re-install
  • Uninstall Neural Link, ensure all items return to inventory / Re-install

Test Installed Item Transfer

  1. Create second actor (myActor2)
  2. Drag cyberdeck from myActor to myActor2 and ensure all of the installed programs go with it
  3. Drag cyberdeck from myActor2 to the right side Items Pane creating a world item.
  4. A new folder will be created to store the installed programs.
  5. Open new cyberdeck world item sheet, inspect settings to ensure programs are listed.
  6. Drag the cyberdeck world item to myActor and ensure all of the programs copy over as well.
  7. Ensure install/uninstall/rez/de-rez functionality on myActor
  8. Try to delete a program listed in the "CPR-Core Installed Items", should fail referencing install in cyberdeck

Test Weapon Ammo Transfers

  1. Load Assault Rifle on myActor with Basic Rifle ammo
  2. Drag Assault Rifle from myActor to myActor2
  3. Note new Basic Rifle Ammo Item exists in myActor2
  4. Test unload/load/reload functions of Assault Rifle on myActor2.
  5. Load Assault Rifle on myActor2
  6. Delete Basic Rifle ammo on myActor2. There should also be no Basic Rifle ammo world items that exist.
  7. Attempt to unload Assault Rifle. Warning is displayed that it is unable to determine the ammo object, the weapon is unloaded and the ammo is lost.
  8. Add Basic Rifle ammo to myActor2
  9. Load Assault Rifle.
  10. Drag Basic Rifle ammo to the right side Item Pane to create a World Item called Basic Rifle.
  11. Delete Basic Rifle ammo on myActor2
  12. Unload Assault Rifle
  13. Note new Basic Rifle ammo is created as it is found as a world item and the item is unloaded as expected.

Migration

  1. Load an existing world
  2. Repeat all tests above in existing world after migration, using items that pre-existed as well as new items on the world actors.

Future Work

  • Ability to create a Compendium of Upgraded Items
  • The only way to install an item into another item is to do it from the "containerized item". We need to implement code to install the item into the "containerized item" from the "installable" item.

Additional Notes

  • Uninstalling a Cyberarm that has a Cyberdeck (Hardwired) & Cyberdeck installed, will uninstall everything, including the Programs. This is because uninstalled of Cyberware is always recursive. We could make it recursive until it hits a non-cyberware item, which would prevent this, but I haven't fully processed the implications of that.
Edited by Darin Sorrentino

Merge request reports