Licenses - Developer Notes
First, a guide:
- BM_Licenses is the central script
- BM_Player is for Player Quest Alias and any Events that run with said alias
- BM_Licenses_Utility holds shared/common functions AND functions that external mods may wish to use
- Scripts prefixed with BM_ME indicate that they are Magic Effects linked to a spell or enchantment
- Scripts prefixed with BM_D indicate they are dialogue scripts holding start and end fragments
- Scripts prefixed with BM_Licenses indicate they are quest scripts
If there's a license you'd like to hook into, check the corresponding license variable. For example, checking Armor License validity is just a simple check of [hasArmorLicense] == true. Some notes on these license variables:
- If a license feature is disabled, the corresponding license variable is always true.
-
If a license feature is enabled, the corresponding license validity is updated based on two conditions. Pseudocode for Armor License, which doesn't consider state of the license feature itself:
-
IF player has more than one of the corresponding license book item AND expiration time isn't -1
- player has armor license
-
ELSE
- player doesn't have armor license
-
IF player has more than one of the corresponding license book item AND expiration time isn't -1
To check whether a license feature is enabled/disabled, check the MCM variable. Ex. isArmorLicenseFeatureEnabled
To check whether a license is in an active cycle, verify that the corresponding BM_Licenses variable != -1. Ex. armorLicenseExpirationTime != -1
To check whether a license is in cooldown, verify that the corresponding BM_Licenses variable != -1. Ex. armorLicenseCooldownTime != -1
An alternative method that doesn't check internal values, thereby avoiding Licenses as a hard dependency, is to check StorageUtil Global variables.
StorageUtil.GetIntValue(None, "LPO_ArmorLicense", Missing = -2)
- -2 : Missing variable / mod
- -1 : License feature is disabled
- 0 : Player doesn't have the requested license
- 1 : Player has the requested license
Current API function coverage only includes public utility functions under BM_Licenses_Utility. License documents can be purchased via manual script function calls under this script. Similarly, violations can be flagged and pushed to bounty quest under the same utility script.
---
"Licenses" is the name of this mod and its MCM menu; this is the name by which this mod should be referred to.
"LPO" is the internally-used identifier for Licenses with 1.16 onward. Log traces are prefixed with the "BM-LPO" identifier. The "BM_" keyword can be used to identify scripts. The "BM-L" keyword can be used to identify Licenses' debug outputs. Previous versions identified log traces with "BMLE", which is an acronym of "BananasManiac's Licenses - Enhanced."
Below are several additional names that Licenses may be, or may have been, referred to:
- "Licenses (LPO)": Suitable for use in formality. Good as unique public identifier.
- "Licenses - Player Oppression": Suitable for use in formality. Good as unique public identifier.
- "BM Licenses": Suitable when comparing with alternative mods, or when referring to LPO's development or in informality. This name should be avoided in formality to help non-developers differentiate LPO from its BML predecessor.
- "BM Licenses Enhanced": Suitable when comparing with alternative mods, or when referring to LPO's development or in informality. This name should be avoided in formality to help non-developers differentiate Licenses from pre-1.12 versions, which some people are definitely still using.
Edited by Nuascura
0 Comments
Recommended Comments
There are no comments to display.