Code: Select all
<Power UNID="&pwEscapePod;"
name= "Escape Pod"
attributes= "RPC!"
key= "G"
>
<OnShow>
(domShowPower 1)
</OnShow>
<OnDestroyCheck>
(if (ObjGetData gPlayership "EscapePod")
(block Nil
(objJumpTo gSource (sysVectorPolarOffset gSource (shpGetDirection gSource) 500))
(objSendMessage gSource Nil "Escape pod deployed.")
(ObjSetData gSource "EscapePod" Nil)
(block (newShip oldship)
(setq oldship gSource)
;(setq newShip (sysCreateShip &scEscapeEarthzone; (ObjGetPos gPlayership) &svPlayer;))
(setq newShip (sysCreateShip &scMayfly; (ObjGetPos gSource) &svPlayer;))
(plyChangeShip gPlayer newShip)
(shpCancelOrders oldShip)
(shpOrder oldShip 'hold)
)
; Avoid destruction
Nil
)
; Destruction proceeds
True
)
</OnDestroyCheck>
<Invoke>
(block Nil
(objSendMessage gSource Nil "You magically spawn something important!")
(setq newShip (sysCreateShip &scMayfly; (ObjGetPos gSource) &svPlayer;))
(ObjSetData gPlayership "EscapePod" True)
)
</Invoke>
</Power>