Version 2 (modified by noep, 11 years ago) (diff) |
---|
PartDestructionEvent
NOTE: Not all features mentioned in this article are implemented yet. |
PartDestructionEvents are used to modify a [BigShip ModularSpaceShip]'s behaviour when one if its ShipParts is destroyed.
Implementation
To add a PartDestructionEvent to a ShipPart, add it as seen below:
<ModularSpaceShip . . . > <attached> <StaticEntity name="wing" . . . /> <StaticEntity name="tail" . . . /> </attached> <parts> <ShipPart name="wing" . . . > <destructionevents> <PartDestructionEvent . . . /> <PartDestructionEvent . . . /> </destructionevents> </ShipPart> <ShipPart name="tail" . . . > <destructionevents> <PartDestructionEvent . . . /> </destructionevents> </ShipPart> </parts> <engines> <Engine /> <Engine /> </engines> </ModularSpaceShip>
PartDestructionEvents have the following parameters which can be used to define its behaviour:
Parameter | Function | Valid inputs | Description |
targetType | Selection of the type of the target to be modified | ship engine weapon part | The ModularSpaceShip itself An attached engine An attached weapon An attached Part |
targetName | Selection of the engine/weapon/part to be modified | [string] | - |
targetParam | Selection of the parameter to be modified | For targetType ship: shieldhealth boostpower boostpowerrate rotationthrust For targetType engine: NULL boostfactor speedfront accelerationfront | Health of the ship's shield Maximum available boost Recharging-rate of boost Rotationthrust of ship The strength of the boost Maximum forward-speed Forward-acceleration |
operation | Selection of the operation to be executed on the parameter/target | - + * set destroy | Substracts value from parameter Adds value to parameter Multiplies parameter with value Sets parameter to value Deletes target (or sets value to 0) |
value | Value used to apply the operation | [float] | - |
message | Message to be shown in chat upon destruction of the ShipPart | [string] | - |
Example
Here's a few examples of PartDestructionEvents.
<PartDestructionEvent targetType="ship" targetParam="boostpowerrate" operation="-" value="0.5" message="One of your ship's generators was destroyed!"/>
Description: Reduces the ship's boost-recharging-rate by 0.5 and shows a message in chat.
<PartDestructionEvent targetType="engine" targetName="bodyengine" targetParam="boostfactor" operation="set" value="1"/>
Description: Sets the booststrength of the engine named "bodyengine" to 1 (= no boost).
<PartDestructionEvent targetType="part" targetName="sidearmLfront" operation="destroy"/>
Description: Destroys the ShipPart named "sidearmLfront".
Look at the HeavyCruiser.oxt template to see a working implementation of this!
Development
TODO
- Expand functionality of PartDestructionEvents
Problems
- Not all currently implemented functions seem to work?
More Ideas
- N/A