Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Version 3 (modified by noep, 10 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.

NOTE: A part's destructionevents are not executed, if said part was destroyed by another part's destructionevent.
E.g: If destroying part A triggers an event destroying part B, the destructionevents of part B are ignored!

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:

ParameterFunctionValid inputsDescription
targetTypeSelection 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
targetNameSelection of the engine/weapon/part
to be modified
[string]-
targetParamSelection 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
operationSelection 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)
valueValue used to apply the operation[float]-
messageMessage 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