Modding:Active Parts: Difference between revisions

m
(add scripting integration information)
Line 316: Line 316:
In this very basic integration, the <code>UseCharge: true</code> parameter makes the part consume the amount of charge in its <code>ChargeUse</code> field. Without further configuration, this will have defaulted to 0. We want to call for charge to be used as the appropriate time to enable specific configurations that do use charge to be created.
In this very basic integration, the <code>UseCharge: true</code> parameter makes the part consume the amount of charge in its <code>ChargeUse</code> field. Without further configuration, this will have defaulted to 0. We want to call for charge to be used as the appropriate time to enable specific configurations that do use charge to be created.


This part is directly acting on its parent object, without checking any information about subjects provided by <code>IActivePart</code>. It sets <code>WorksOnSelf</code> because without any identifiable subject, the part will not be operational. Instances could set other subject-determining configuration points, which could change when the part works (since it won't work without a subject), but won't change what object the healing is applied to.  A more flexible integration could look like:
The part above is directly acting on its parent object, without checking any information about subjects provided by <code>IActivePart</code>. It sets <code>WorksOnSelf</code> because without any identifiable subject, the part will not be operational. Instances could set other subject-determining configuration points, which could change when the part works (since it won't work without a subject), but won't change what object the healing is applied to.  A more flexible integration could look like:


<syntaxhighlight lang="csharp">
<syntaxhighlight lang="csharp">
671

edits