Modding:Active Parts: Difference between revisions

From Caves of Qud Wiki
Jump to navigation Jump to search
(WorksOnCarrier also covers thrown weapon eq)
Line 150: Line 150:
|-
|-
| WorksOnCellContents
| WorksOnCellContents
| Objects in the parent object's current cell are valid subjects.
| Objects in the parent object's current cell, other than the parent object, are valid subjects.
|-
|-
| WorksOnEnclosed
| WorksOnEnclosed

Revision as of 22:28, 12 August 2020

This page is about modding. See the modding overview for an abstract on modding.
This page is about modding. See the modding overview for an abstract on modding.

Many object parts (the entity components specified in ObjectBlueprints.xml with part tags) are based on IActivePart architecture. IActivePart provides standardized support functionality for parts that actively, conditionally enact behavior. Much of this support can be powerfully reconfigured at the object blueprint level without requiring scripting intervention, though whether a given variation in behavior will actually work depends on the quality of the final part's integration with IActivePart.

The most crucial concepts to how active parts work are subjects, the objects the part operates on, and status, the part's operational state. The basic form of a part's integration with its IActivePart support is for it to check its status, and if it is operational, to apply its behavior to its subjects.

Statuses

These are the possible active part statuses. Only the status Operational represents working functionality; other statuses are explications of failure modes.

Active Part Statuses
Operational
NeedsSubject
EMP
Broken
Rusted
Booting
NotHanging
SwitchedOff
RealityStabilized
LimbIncompatible
PrimarySystemOffline
Unpowered
LocallyDefinedFailure

Status determining configuration points

The following configuration points control the determination of an active part's status. Defaults indicated are at the IActivePart level. Many individual parts set different defaults.

Individual parts can also override the method public virtual bool GetActivePartLocallyDefinedFailure() to implement their own failure modes; if this method returns true, the part's status will be LocallyDefinedFailure. Generally public virtual string GetActivePartLocallyDefinedFailureDescription() should also be overridden; its return value will be used instead of "LocallyDefinedFailure" for status display (see below).

Name Type Behavior if enabled Status on failure Default
ChargeUse int An amount of charge the part consumes in order to operate. Fails if the parent object does not have at least this much charge available. The implementing part chooses when to actively consume charge; when it does, this amount will be consumed unless overridden. Unpowered 0
ChargeMinimum int An amount of charge the part requires to be available in order to operate. Fails if the parent object does not have at least this much charge available. Unpowered 0
IsBootSensitive bool Looks for a sibling BootSequence part; fails if it finds one and its boot sequence is currently in progress. Booting false
IsBreakageSensitive bool Fails if the parent object is Broken. Broken true
IsEMPSensitive bool Fails if the parent object is ElectromagneticPulsed. EMP false
IsHangingSensitive bool Looks for a sibling Hangable part; fails if it finds one and it is not hanging. NotHanging false
IsPowerSwitchSensitive bool Looks for a sibling PowerSwitch part; fails if it finds one and it is switched off. SwitchedOff false
IsRealityDistortionBased bool Fails if normality in the parent object's immediate context prevents reality distortion. RealityStabilized false
IsRustSensitive bool Fails if the parent object is Rusted. Rusted true
NeedsOtherActivePartOperational string Looks for a sibling active part of the name specified. Fails if it does not find one, or that part's status is not Operational. PrimarySystemOffline null
NeedsOtherActivePartEngaged string Looks for a sibling active part of the name specified. Fails if it does not find one, or that part returns false from the method IsActivePartEngaged(). (By default, this is the same as a check for Operational status, but particular parts can override the method to implement different behavior, for whatever usage of "engaged" is desired.) PrimarySystemOffline null
RequiresBodyPartCategory string Fails if the parent object is not equipped on a body part of the category specified. The body part categories are Animal, Arthropod, Plant, Fungal, Protoplasmic, Cybernetic, Mechanical, Metal, Wooden, Stone, Glass, Leather, Bone, Chitin, Plastic, Cloth, Psionic, and Extradimensional. LimbIncompatible null

Subject determining configuration points

The following boolean configuration points control identification of an active part's subject or subjects. All default to false at the IActivePart level. Many individual parts set different defaults.

Individual parts can also override the method public virtual bool WorksFor(GameObject obj) in order to implement additional restrictions on what objects are valid subjects.

If an active part has no valid subjects, its status will be NeedsSubject.

Where the parent object's current cell is referred to, it only applies to a cell the parent object is directly present in (not a cell its carrier or equipper is in, for example).

Name Behavior if enabled
MustBeUnderstood Filters the results from other settings. The player is only a valid subject if they understand the parent object (i.e. they have it identified). Other objects are only valid subjects if they have an Intelligence stat.
WorksOnAdjacentCellContents Objects in cells adjacent to the parent object's current cell are valid subjects.
WorksOnCarrier The parent object's InInventory (i.e. an object containing the parent object as inventory) is a valid subject. An object that has the parent object equipped as a thrown weapon is also a valid subject.
WorksOnCellContents Objects in the parent object's current cell, other than the parent object, are valid subjects.
WorksOnEnclosed An object the parent object has Enclosed via the Enclosing part is a valid subject.
WorksOnEquipper An object that has the parent object "equipped properly" is a valid subject. For an armor or shield, this means being worn on the appropriate body part. For an implant, this means being implanted. Otherwise, this means being equipped other than as a thrown weapon.
WorksOnHolder An object that has the parent object equipped in a hand or missile weapon is a valid subject.
WorksOnImplantee An object that has the parent object implanted is a valid subject.
WorksOnInventory Objects in the parent object's inventory, if any, are valid subjects.
WorksOnSelf The parent object is a valid subject.
WorksOnWearer An object that has the parent object equipped on the appropriate body part for its armor or shield configuration is a valid subject.

Status display configuration points

These fields control the display of the active part's status in the parent object's short description.

Name Type Behavior if set Default
DescribeStatusForProperty string Status will be described if the player has a positive value for this int property. This field is not normally used directly; usually it is set via IsTechScannable. null
IsBioScannable bool Sets DescribeStatusForProperty to the property corresponding to bioscanning and StatusStyle to "bio". false
IsStructureScannable bool Sets DescribeStatusForProperty to the property corresponding to structural scanning and StatusStyle to "structure". false
IsTechScannable bool Sets DescribeStatusForProperty to the property corresponding to techscanning and StatusStyle to "tech". false
NameForStatus string Replaces the default name shown for the part in status display. The default is the name of the part class (so this is particularly crucial for very generic parts like IntPropertyChanger). null
StatusStyle string The display style to use for status if it is displayed. The possible styles are angry, bio, leet, ooc, plain, structure, and tech. This field is not normally used directly; usually it is set via IsTechScannable. plain

Other configuration points

Name Type Behavior if set Default
ReadyColorString string When the part determines its status to be Operational, it sets the ColorString field on the parent object's Render part to this value. null
ReadyDetailColor string When the part determines its status to be Operational, it sets the DetailColor field on the parent object's Render part to this value. null
DisabledColorString string When the part determines its status to be other than Operational, it sets the ColorString field on the parent object's Render part to this value. null
DisabledDetailColor string When the part determines its status to be other than Operational, it sets the DetailColor field on the parent object's Render part to this value. null

IPoweredPart

Many active parts inherit IPoweredPart, which is a variant of IActivePart intended for more technical applications. It sets the following defaults:

Field Default
ChargeUse 1
IsBootSensitive true
IsEMPSensitive true
IsPowerSwitchSensitive true
IsTechScannable true

List of active parts

Active Parts
AccelerativeTeleporter
ActiveLightSource
AddsMutationOnEquip
AddsRep
AloePorta
AmbientCollector
AnimateObject
ArtificialIntelligence
Banner
Bed
BioAmmoLoader
BleedingOnHit
BootSequence
BroadcastPowerReceiver
BroadcastPowerTransmitter
BurnMe
Campfire
CannotBeInfluenced
Capacitor
CatacombsExitTeleporter
Chair
ChargeSink
Circuitry
Clockwork
ComputeNode
CrossFlameOnStep
Cursed
Cybernetics2BiodynamicPowerPlant
Cybernetics2MedassistModule
Cybernetics2MicromanipulatorArray
Cybernetics2OnboardRecoilerImprinting
Cybernetics2OnboardRecoilerTeleporter
Cybernetics2PenetratingRadar
CyberneticsTerminal2
DamageContents
DecoyHologramEmitter
DeploymentMaintainer
DestroyMe
DischargeOnHit
DischargeOnStep
Displacement
Displacer
ElectricalPowerTransmission
EmergencyTeleporter
Enclosing
EnergyAmmoLoader
EnergyCell
EnergyCellSocket
Engulfing
EquipCharge
EquipIntProperties
EquipStatBoost
FabricateFromSelf
Fan
FlareCompensation
Flywheel
FoliageCamouflage
FollowersGetTeleport
FoodProcessor
ForceEmitter
ForceProjector
FugueOnStep
FusionReactor
Gaslight
GenericPowerTransmission
GenericTerminal
GlimmerAlteration
GrandfatherHorn
GritGateMainframeTerminal
HologramMaterialPrimary
HUD
HydraulicPowerTransmission
HydroTurbine
InductionCharger
InductionChargeReceiver
IntegralRecharger
IntegratedPowerSystems
IntPropertyChanger
ItemElements
LatchesOn
LeaksFluid
LifeSaver
LiquidFueledEnergyCell
LiquidFueledPowerPlant
LiquidProducer
LiquidPump
LiquidRepellent
LowStatBooster
MagazineAmmoLoader
MechanicalPowerTransmission
MechanicalWings
MentalScreen
Mill
MissilePerformance
Mod* (IModification, which all mods inherit, is an IActivePart)
MultiIntPropertyChanger
MultiNavigationBonus
NavigationBonus
NightVision
NoKnockdown
PartsGas
PointDefense
PowerCord
PoweredFloating
PowerOutlet
PowerSwitch
ProgrammableRecoiler
RadiusEventSender
RealityStabilization
ReclamationCist
RecoilOnDeath
ReduceCooldowns
ReduceEnergyCosts
ReflectProjectiles
RemotePowerSwitch
RespondToEvent
RocketSkates
SapChargeOnHit
SaveModifier
SaveModifiers
SlottedCellCharger
Smartgun
SolarArray
Stopsvaalinn
StunOnHit
Suspensor
TattooGun
Teleporter
TeleporterPair
TemperatureAdjuster
TemplarPhylactery
Toolbox
UniversalCharger
UrbanCamouflage
VampiricWeapon
VibroWeapon
WindTurbine
Windup
ZeroPointEnergyCollector
ZoneAdjust