Modding:Active Parts: Difference between revisions

Jump to navigation Jump to search
3,517 bytes added ,  22:30, 15 September 2022
add missing parens to constructor definition
(add missing parens to constructor definition)
 
(17 intermediate revisions by 2 users not shown)
Line 8: Line 8:
These are the possible active part statuses. Only the status Operational represents working functionality; other statuses are failure modes.
These are the possible active part statuses. Only the status Operational represents working functionality; other statuses are failure modes.


The order shown indicates when in the process of evaluating status the given status occurs. If more than one status potentially applies, the earlier one is used.
Statuses are evaluated in the order listed. If more than one status potentially applies, the earlier one is used.
{| class="wikitable"
{| class="wikitable"
|-
|-
! Active Part Statuses
! Active Part Statuses
! Order
|-
|-
| NeedsSubject
| NeedsSubject
| 1
|-
|-
| SwitchedOff
| SwitchedOff
| 2
|-
|-
| EMP
| EMP
| 3
|-
|-
| Broken
| Broken
| 4
|-
|-
| Rusted
| Rusted
| 5
|-
|-
| Booting
| Booting
| 6
|-
|-
| NotHanging
| NotHanging
| 7
|-
|-
| LimbIncompatible
| LimbIncompatible
| 8
|-
|-
| RealityStabilized
| RealityStabilized
| 9
|-
|-
| LocallyDefinedFailure
| LocallyDefinedFailure
| 10
|-
|-
| PrimarySystemOffline
| PrimarySystemOffline
| 11
|-
|-
| Unpowered
| Unpowered
| 12
|-
|-
| Operational
| Operational
| 13
|}
|}


==Status-determining configuration points==
==Status-determining configuration points==


The following configuration points control the determination of an active part's status. Defaults indicated are at the <code>IActivePart</code> level. Many individual parts set different defaults.
The following configuration points control the determination of an active part's status. Defaults indicated are at the <code>IActivePart</code> level. Many individual parts set different defaults, and in particular see [[#IPoweredPart|IPoweredPart]].


Individual parts can also override the method <code>public virtual bool GetActivePartLocallyDefinedFailure()</code> to implement their own failure modes; if this method returns true, the part's status will be LocallyDefinedFailure. Generally <code>public virtual string GetActivePartLocallyDefinedFailureDescription()</code> should also be overridden; its return value will be used instead of "LocallyDefinedFailure" for status display (see below).
Individual parts can also override the method <code>public virtual bool GetActivePartLocallyDefinedFailure()</code> to implement their own failure modes; if this method returns true, the part's status will be LocallyDefinedFailure. Generally <code>public virtual string GetActivePartLocallyDefinedFailureDescription()</code> should also be overridden; its return value will be used instead of "LocallyDefinedFailure" for status display (see below).
Line 94: Line 80:
| IsEMPSensitive
| IsEMPSensitive
| bool
| bool
| Fails if the parent object is [[ElectromagneticPulsed]].
| Fails if the parent object is [[Pulsed]].
| EMP
| EMP
| false
| false
Line 172: Line 158:
|-
|-
| WorksOnEquipper
| 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.
| An object that has the parent object "equipped properly" is a valid subject, which means being bound to a body part or body parts appropriate to the object's design. For an implant, this means being implanted. Other objects can have their body part binding altered, for example by being [[magnetized]], in which case the object is properly equipped when bound in its new fashion (for [[magnetized]] items, this means being in a Floating Nearby slot). Otherwise, specific item categories define proper binding. Armor binds to body parts appopriately to its type. Shields normally bind to hands or arms. Missile weapons normally bind to missile weapon slots. Melee weapons (which anything that doesn't fall into one of these categories is by default) normally bind to hands.
|-
|-
| WorksOnHolder
| WorksOnHolder
| An object that has the parent object equipped in a hand or missile weapon is a valid subject.
| An object that has the parent object equipped in a hand or missile weapon slot is a valid subject.
|-
|-
| WorksOnImplantee
| WorksOnImplantee
Line 240: Line 226:
! Behavior if set
! Behavior if set
! Default
! Default
|-
| IsPowerLoadSensitive
| bool
| If true, the parent object becomes eligible to receive the [[Overloaded]] mod if it was not already, charge consumption processed via <code>IActivePart</code> support methods is increased as standard for that part, and the results of [[#MyPowerLoadBonus()|<code>MyPowerLoadBonus()</code>]] and [[#MyPowerLoadLevel()|<code>MyPowerLoadLevel()</code>]] are adjusted appropriately.
| false
|-
|-
| ReadyColorString
| ReadyColorString
Line 264: Line 255:
==IPoweredPart==
==IPoweredPart==


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


{| class="wikitable"
{| class="wikitable"
Line 288: Line 279:


==Scripting integration==
==Scripting integration==
{{Modding Topic Prerequisites | Modding:C Sharp Scripting}}


===Introduction===
===Introduction===
Line 303: Line 296:
     {
     {


         public HealSelfEveryTurn
         public HealSelfEveryTurn()
         {
         {
             WorksOnSelf = true;
             WorksOnSelf = true;
Line 476: Line 469:
</syntaxhighlight>
</syntaxhighlight>


Identical to <code>IsReady()</code>, but returns an <code>ActivePartStatus</code> that can be used to determine what failure mode the part is in. Useful for constructing more helpful failure messaging.
Like <code>IsReady()</code>, but returns an <code>ActivePartStatus</code> that can be used to determine what failure mode the part is in. Useful for constructing more helpful failure messaging.


Triggers any appropriate render color changes. Updates the last known status.
Triggers any appropriate render color changes. Updates the last known status.
Line 560: Line 553:
</syntaxhighlight>
</syntaxhighlight>


Returns the first of the active part's subject that matches the filter specified, or null if none do.
Returns the first of the active part's subjects that matches the filter specified, or null if none do.


====IsObjectActivePartSubject()====
====IsObjectActivePartSubject()====
Line 589: Line 582:


<syntaxhighlight lang="csharp">
<syntaxhighlight lang="csharp">
public virtual bool ForeachActivePartSubjectWhile(Predicate <GameObject> pProc, bool MayMoveAddOrDestroy = false)
public virtual bool ForeachActivePartSubjectWhile(Predicate<GameObject> pProc, bool MayMoveAddOrDestroy = false)
</syntaxhighlight>
</syntaxhighlight>


Calls <code>pProc</code> on each of the active part's subjects, terminating if <code>pProc</code> returns false. <code>MayMoveAddOrDestroy</code> should be set to true if the code in <code>pProc</code> might result in any object being moved, created, or destroyed.
Calls <code>pProc</code> on each of the active part's subjects, terminating if <code>pProc</code> returns false.
 
<code>MayMoveAddOrDestroy</code> should be set to true if the code in <code>pProc</code> might result in any object being moved, created, or destroyed; otherwise, there is a risk of exceptions being thrown due to loop control disruption.


====AnyActivePartSubjectWantsEvent()====
====AnyActivePartSubjectWantsEvent()====
Line 659: Line 654:
| <nowiki>"{{b|warming up}}"</nowiki>
| <nowiki>"{{b|warming up}}"</nowiki>
|-
|-
| any other status besides Operational and NeedsSubject
| NeedsSubject
| null
|-
| Operational
| null
|-
| any other status
| <nowiki>"{{r|nonfunctional}}"</nowiki>
| <nowiki>"{{r|nonfunctional}}"</nowiki>
|}
|}
Line 694: Line 695:


Returns a readable general description of what objects the part operates on, based on its subject-determining configuration points. Example return values might be "its user" or "itself and its vicinity".
Returns a readable general description of what objects the part operates on, based on its subject-determining configuration points. Example return values might be "its user" or "itself and its vicinity".
====MyPowerLoadBonus()====
<syntaxhighlight lang="csharp">
public override int MyPowerLoadBonus(int Load = int.MinValue, int Baseline = 100, int Divisor = 150)
</syntaxhighlight>
Returns a value intended to be used as a performance bonus based on power load, integrating with IsPowerLoadSensitive and ModOverloaded (and any other future features which may modify power load level). When the Load argument is set to the default int.MinValue, the current power load level will be automatically calculated and used, otherwise the level specified will be used (this is supported so that an already known level may be sent, for efficiency). The return value is ((WorkingLoadValue - Baseline) / Divisor). With IsPowerLoadSensitive set to true and ModOverloaded present, the return value of this method will be 2 (because ModOverloaded increases the power load value from 100 to 400, so ((400 - 100) / 150) = 2). Different Divisor numbers are typically used with different applications depending on what performance characteristics are desired. If IsPowerLoadSensitive is false, this method will return 0.
This method is an overload of the same method present in the base <code>IPart</code>, which normally returns values based on similar logic (without sensitivity to any configuration value like IsPowerLoadSensitive, since <code>IPart</code> has nothing similar).
====MyPowerLoadLevel()====
<syntaxhighlight lang="csharp">
public override int MyPowerLoadLevel()
</syntaxhighlight>
Returns the power load level the part is currently operating under. If IsPowerLoadSensitive is false, it will always be 100. If IsPowerLoadSensitive is true and ModOverloaded is present, it will be 400. Other functionality may potentially result in different power load levels in the future.


==List of active parts==
==List of active parts==
Line 707: Line 726:
|-
|-
| AddsRep
| AddsRep
|-
| AdjustSpecialEffectChances
|-
| AilingQuickness
|-
|-
| AloePorta
| AloePorta
Line 713: Line 736:
|-
|-
| AnimateObject
| AnimateObject
|-
| ArtifactDetection
|-
|-
| ArtificialIntelligence
| ArtificialIntelligence
|-
| AutomatedExternalDefibrillator
|-
|-
| Banner
| Banner
Line 737: Line 764:
|-
|-
| Capacitor
| Capacitor
|-
| CardiacArrestOnHit
|-
|-
| CatacombsExitTeleporter
| CatacombsExitTeleporter
Line 747: Line 776:
|-
|-
| Clockwork
| Clockwork
|-
| CompanionCapacity
|-
|-
| ComputeNode
| ComputeNode
Line 754: Line 785:
| Cursed
| Cursed
|-
|-
| Cybernetics2BiodynamicPowerPlant
| CyberneticsAutomatedInternalDefibrillator
|-
| CyberneticsBiodynamicPowerPlant
|-
| CyberneticsEffectSuppressor
|-
|-
| Cybernetics2MedassistModule
| CyberneticsMedassistModule
|-
|-
| Cybernetics2MicromanipulatorArray
| CyberneticsMicromanipulatorArray
|-
|-
| Cybernetics2OnboardRecoilerImprinting
| CyberneticsOnboardRecoilerImprinting
|-
|-
| Cybernetics2OnboardRecoilerTeleporter
| CyberneticsOnboardRecoilerTeleporter
|-
|-
| Cybernetics2PenetratingRadar
| CyberneticsPenetratingRadar
|-
|-
| CyberneticsTerminal2
| CyberneticsTerminal2
Line 773: Line 808:
|-
|-
| DeploymentMaintainer
| DeploymentMaintainer
|-
| DepositCorpses
|-
|-
| DestroyMe
| DestroyMe
|-
| DiggingTool
|-
|-
| DischargeOnHit
| DischargeOnHit
|-
|-
| DischargeOnStep
| DischargeOnStep
|-
| DismemberAdjacentHostiles
|-
|-
| Displacement
| Displacement
|-
|-
| Displacer
| Displacer
|-
| Drill
|-
| DrinkMagnifier
|-
|-
| ElectricalPowerTransmission
| ElectricalPowerTransmission
|-
|-
| EmergencyTeleporter
| EmergencyTeleporter
|-
| EmitGasOnHit
|-
|-
| Enclosing
| Enclosing
Line 793: Line 840:
|-
|-
| EnergyCell
| EnergyCell
|-
| EnergyCellRack
|-
|-
| EnergyCellSocket
| EnergyCellSocket
Line 807: Line 856:
|-
|-
| Fan
| Fan
|-
| FeelingOnTarget
|-
| FireSuppressionSystem
|-
|-
| FlareCompensation
| FlareCompensation
Line 823: Line 876:
|-
|-
| FugueOnStep
| FugueOnStep
|-
| FungalFortitude
|-
|-
| FusionReactor
| FusionReactor
|-
|-
| Gaslight
| Gaslight
|-
| GasTumbler
|-
|-
| GenericPowerTransmission
| GenericPowerTransmission
Line 837: Line 894:
|-
|-
| GritGateMainframeTerminal
| GritGateMainframeTerminal
|-
| GroundOnHit
|-
| HighBitBonus
|-
|-
| HologramMaterialPrimary
| HologramMaterialPrimary
Line 895: Line 956:
|-
|-
| NavigationBonus
| NavigationBonus
|-
| NightSightInterpolators
|-
|-
| NightVision
| NightVision
Line 904: Line 967:
| PointDefense
| PointDefense
|-
|-
| PowerCord
| Pounder
|-
|-
| PoweredFloating
| PoweredFloating
|-
| PowerOutlet
|-
|-
| PowerSwitch
| PowerSwitch
|-
|-
| ProgrammableRecoiler
| ProgrammableRecoiler
|-
| PsychicMeridian
|-
|-
| RadiusEventSender
| RadiusEventSender
|-
|-
| RealityStabilization
| RealityStabilization
|-
| RealityStabilizeOnHit
|-
|-
| ReclamationCist
| ReclamationCist
Line 939: Line 1,004:
|-
|-
| SaveModifiers
| SaveModifiers
|-
| SlipRing
|-
|-
| SlottedCellCharger
| SlottedCellCharger
Line 947: Line 1,014:
|-
|-
| Stopsvaalinn
| Stopsvaalinn
|-
| StrideMason
|-
|-
| StunOnHit
| StunOnHit
|-
|-
| Suspensor
| Suspensor
|-
| SwapOnHit
|-
|-
| TattooGun
| TattooGun
|-
|-
| Teleporter
| Teleporter
|-
| TeleportGate
|-
|-
| TeleporterPair
| TeleporterPair
Line 961: Line 1,034:
|-
|-
| TemplarPhylactery
| TemplarPhylactery
|-
| ThermalAmp
|-
|-
| Toolbox
| Toolbox
Line 971: Line 1,046:
|-
|-
| VibroWeapon
| VibroWeapon
|-
| Waldopack
|-
| WaterRitualDiscount
|-
|-
| WindTurbine
| WindTurbine
Line 981: Line 1,060:
|}
|}


[[Category:Modding]]
{{Modding Navbox}}
 
[[Category:Modding]][[Category:Script Modding]]

Navigation menu