Modding:Active Parts: Difference between revisions

Jump to navigation Jump to search
3,537 bytes added ,  22:30, 15 September 2022
add missing parens to constructor definition
(add missing parens to constructor definition)
 
(12 intermediate revisions by 2 users not shown)
Line 42: Line 42:
==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 80: 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 158: 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 226: 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 250: 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 274: Line 279:


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


===Introduction===
===Introduction===
Line 289: Line 296:
     {
     {


         public HealSelfEveryTurn
         public HealSelfEveryTurn()
         {
         {
             WorksOnSelf = true;
             WorksOnSelf = true;
Line 575: 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>


Line 688: 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 701: Line 726:
|-
|-
| AddsRep
| AddsRep
|-
| AdjustSpecialEffectChances
|-
| AilingQuickness
|-
|-
| AloePorta
| AloePorta
Line 707: Line 736:
|-
|-
| AnimateObject
| AnimateObject
|-
| ArtifactDetection
|-
|-
| ArtificialIntelligence
| ArtificialIntelligence
|-
| AutomatedExternalDefibrillator
|-
|-
| Banner
| Banner
Line 731: Line 764:
|-
|-
| Capacitor
| Capacitor
|-
| CardiacArrestOnHit
|-
|-
| CatacombsExitTeleporter
| CatacombsExitTeleporter
Line 741: Line 776:
|-
|-
| Clockwork
| Clockwork
|-
| CompanionCapacity
|-
|-
| ComputeNode
| ComputeNode
Line 748: Line 785:
| Cursed
| Cursed
|-
|-
| Cybernetics2BiodynamicPowerPlant
| CyberneticsAutomatedInternalDefibrillator
|-
| CyberneticsBiodynamicPowerPlant
|-
|-
| Cybernetics2MedassistModule
| CyberneticsEffectSuppressor
|-
|-
| Cybernetics2MicromanipulatorArray
| CyberneticsMedassistModule
|-
|-
| Cybernetics2OnboardRecoilerImprinting
| CyberneticsMicromanipulatorArray
|-
|-
| Cybernetics2OnboardRecoilerTeleporter
| CyberneticsOnboardRecoilerImprinting
|-
|-
| Cybernetics2PenetratingRadar
| CyberneticsOnboardRecoilerTeleporter
|-
| CyberneticsPenetratingRadar
|-
|-
| CyberneticsTerminal2
| CyberneticsTerminal2
Line 767: 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 787: Line 840:
|-
|-
| EnergyCell
| EnergyCell
|-
| EnergyCellRack
|-
|-
| EnergyCellSocket
| EnergyCellSocket
Line 801: Line 856:
|-
|-
| Fan
| Fan
|-
| FeelingOnTarget
|-
| FireSuppressionSystem
|-
|-
| FlareCompensation
| FlareCompensation
Line 817: Line 876:
|-
|-
| FugueOnStep
| FugueOnStep
|-
| FungalFortitude
|-
|-
| FusionReactor
| FusionReactor
|-
|-
| Gaslight
| Gaslight
|-
| GasTumbler
|-
|-
| GenericPowerTransmission
| GenericPowerTransmission
Line 831: Line 894:
|-
|-
| GritGateMainframeTerminal
| GritGateMainframeTerminal
|-
| GroundOnHit
|-
| HighBitBonus
|-
|-
| HologramMaterialPrimary
| HologramMaterialPrimary
Line 889: Line 956:
|-
|-
| NavigationBonus
| NavigationBonus
|-
| NightSightInterpolators
|-
|-
| NightVision
| NightVision
Line 898: Line 967:
| PointDefense
| PointDefense
|-
|-
| PowerCord
| Pounder
|-
|-
| PoweredFloating
| PoweredFloating
|-
| PowerOutlet
|-
|-
| PowerSwitch
| PowerSwitch
|-
|-
| ProgrammableRecoiler
| ProgrammableRecoiler
|-
| PsychicMeridian
|-
|-
| RadiusEventSender
| RadiusEventSender
|-
|-
| RealityStabilization
| RealityStabilization
|-
| RealityStabilizeOnHit
|-
|-
| ReclamationCist
| ReclamationCist
Line 933: Line 1,004:
|-
|-
| SaveModifiers
| SaveModifiers
|-
| SlipRing
|-
|-
| SlottedCellCharger
| SlottedCellCharger
Line 941: Line 1,014:
|-
|-
| Stopsvaalinn
| Stopsvaalinn
|-
| StrideMason
|-
|-
| StunOnHit
| StunOnHit
|-
|-
| Suspensor
| Suspensor
|-
| SwapOnHit
|-
|-
| TattooGun
| TattooGun
|-
|-
| Teleporter
| Teleporter
|-
| TeleportGate
|-
|-
| TeleporterPair
| TeleporterPair
Line 955: Line 1,034:
|-
|-
| TemplarPhylactery
| TemplarPhylactery
|-
| ThermalAmp
|-
|-
| Toolbox
| Toolbox
Line 965: Line 1,046:
|-
|-
| VibroWeapon
| VibroWeapon
|-
| Waldopack
|-
| WaterRitualDiscount
|-
|-
| WindTurbine
| WindTurbine
Line 975: Line 1,060:
|}
|}


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

Navigation menu