Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missionrefactor #33

Merged
merged 12 commits into from
Apr 6, 2017
179 changes: 8 additions & 171 deletions TransCore/CharonPirates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -542,160 +542,6 @@
</Events>
</ShipClass>

<!-- The Kronosaurus

GLOBAL DATA

status: Status of Kronosaurus
Nil = never encountered
"huntPlayer" = hunting the player
"destroyed" = destroyed
"destroyedByPlayer" = player has destroyed it
-->

<ShipClass UNID="&scCharonFrigateKronosaurus;"
manufacturer= "Charon Pirates"
class= "Charon frigate"
type= ""

attributes= "capitalShip, charonPirates, charonFrigate, majorShip"

size= "120"
mass= "7500"
cargoSpace= "1000"
thrustRatio= "2"
maxSpeed= "18"

explosionType= "&vtKineticExplosion4;"
>

<Names definiteArticle="true">pirate ship Kronosaurus</Names>

<!-- Configuration -->

<Armor
armorID= "&itBlastPlate;"
count= "12"
/>

<Devices>
<Device deviceID="&itNAMIMissileLauncher;" omnidirectional="true"/>
<Device deviceID="&itTurbolaserCannon;" secondaryWeapon="true" minFireArc="0" maxFireArc="170" posAngle="43" posRadius="29" posZ="0"/>
<Device deviceID="&itTurbolaserCannon;" secondaryWeapon="true" minFireArc="190" maxFireArc="0" posAngle="320" posRadius="32" posZ="0"/>
<Device deviceID="&itTurbolaserCannon;" secondaryWeapon="true" minFireArc="5" maxFireArc="175" posAngle="118" posRadius="25" posZ="0"/>
<Device deviceID="&itTurbolaserCannon;" secondaryWeapon="true" minFireArc="185" maxFireArc="355" posAngle="238" posRadius="25" posZ="0"/>
</Devices>

<Maneuver
maxRotationRate= "4.0"
rotationAccel= "0.25"
/>

<Interior>
<Compartment name="interior"
hitPoints= "100"
/>

<Compartment name="main drive"
type= "mainDrive"
hitPoints= "50"

posX= "-52"
posY= "0"
sizeX= "26"
sizeY= "42"
/>
</Interior>

<Items>
<Item count="2d6" item="&itHelium3FuelRod;"/>
<Item count="20d20" item="&itKM500Missile;"/>
</Items>

<!-- Image and Effects -->

<Image imageID="&rsCharonFrigateImage;" imageWidth="140" imageHeight="140"/>

<Effects>
<Effect type="thrustMain" posAngle="171" posRadius="67" posZ="0" rotation="180"/>
<Effect type="thrustMain" posAngle="180" posRadius="66" posZ="0" rotation="180"/>
<Effect type="thrustMain" posAngle="-171" posRadius="67" posZ="0" rotation="180"/>
</Effects>

<!-- AI and Behavior -->

<AISettings
aggressor= "true"
fireRateAdj= "25"
fireAccuracy= "95"
perception= "4"

combatStyle= "standOff"
/>

<Events>
<OrderHuntPlayer>
(block Nil
(typSetGlobalData &scCharonFrigateKronosaurus; "status" 'huntPlayer)

; Attack the player
(shpCancelOrders gSource)
(shpOrder gSource "attack" gPlayerShip)

; Register for events
(objRegisterForEvents gSource gPlayerShip)
)
</OrderHuntPlayer>

<OnCreate>
</OnCreate>

<OnDestroy>
; If we're destroyed while on a mission (as opposed to after entering a gate)
; then mark ourselves so that we cannot come back
(if (typGetGlobalData &scCharonFrigateKronosaurus; "status")
(if (and gPlayerShip (eq aOrderGiver gPlayerShip))
(typSetGlobalData &scCharonFrigateKronosaurus; "status" 'destroyedByPlayer)
(typSetGlobalData &scCharonFrigateKronosaurus; "status" 'destroyed)
)
)
</OnDestroy>

<OnEnteredGate>
; If we entered a gate, then reset our status (we can come back later)
(typSetGlobalData &scCharonFrigateKronosaurus; "status" Nil)
</OnEnteredGate>

<OnObjDestroyed>
(switch
; If the player was destroyed, then we're done
(and (eq aObjDestroyed gPlayerShip) (not (eq aDestroyReason 'enteredStargate)))
(block Nil
(shpCancelOrders gSource)
(shpOrder gSource "gate")
)
)
</OnObjDestroyed>

<OnPlayerEnteredSystem>
(if (eq (typGetGlobalData &scCharonFrigateKronosaurus; "status") 'huntPlayer)
(block Nil
(shpCancelOrders gSource)
(shpOrder gSource "attack" gPlayerShip)
(objRegisterForEvents gSource gPlayerShip)
)
)
</OnPlayerEnteredSystem>

<OnPlayerLeftSystem>
(if (eq (typGetGlobalData &scCharonFrigateKronosaurus; "status") 'huntPlayer)
'waitForPlayer
Nil
)
</OnPlayerLeftSystem>
</Events>
</ShipClass>

<!-- Charon Pirate Cache -->

<StationType UNID="&stCharonPirateOutpost;"
Expand Down Expand Up @@ -1900,22 +1746,13 @@
))

(setq chrDeployKronosaurus (lambda ()
(if (not (typGetGlobalData &scCharonFrigateKronosaurus; "status"))
(block (kronosaurus)
; Create the Kronosaurus
(setq kronosaurus
(sysCreateShip
&scCharonFrigateKronosaurus;
(sysFindObject gPlayerShip "GR -uncharted;")
&svPirates;
)
)

; Order the Kronosaurus to attack the player
(objFireEvent kronosaurus "OrderHuntPlayer")
)
)
))
(block (
(theStation (sysFindObject Nil "ATN +korolovShipping;"))
(theMission (msnCreate &msKronosaurus; theStation))
)
(if theMission (msnAccept theMission))
)
))

(setq chrGetPrimaryStronghold (lambda (sourceObj)
(block (primaryObj)
Expand Down Expand Up @@ -2153,4 +1990,4 @@

<Image UNID="&rsCharonFrigateImage;" bitmap="Resources\CharonFrigate.jpg" bitmask="Resources\CharonFrigateMask.bmp" loadOnUse="true"/>

</TranscendenceModule>
</TranscendenceModule>
56 changes: 30 additions & 26 deletions TransCore/CommonwealthFleet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2058,20 +2058,27 @@ PLAYER DATA

<Globals>
(block Nil
(setq intFleetCreateWingmen (lambda (aStation aCount theClass)
(block Nil
(setq intFleetCreateWingmen (lambda (missionObj aCount theClass)
(block (
(baseObj (objGetObjByID (msnGetProperty missionObj 'ownerID)))
(missionID (msnGetProperty missionObj 'id))
)
(if (not theClass)
(setq theClass &scCenturion;)
)

(for i 0 (subtract aCount 1)
(block (ship)
(setq ship (sysCreateShip theClass aStation &svCommonwealthFleet; "fleet"))
(shpOrderEscort ship gPlayerShip i)

; Remember the escorts we assigned
(objSetObjRefData aStation (cat "Wingman" i) ship)
(objRegisterForEvents aStation ship)
(for i 0 (- aCount 1)
(block (wingmanObj)
(setq wingmanObj (sysCreateShip
theClass
baseObj
&svCommonwealthFleet;
'fleet
))
(shpOrder wingmanObj 'escort gPlayerShip i)

; Keep track of wingmen
(objSetData wingmanObj (cat missionID "_wingman") True)
(msnRegisterForEvents missionObj wingmanObj)
)
)
)
Expand All @@ -2086,23 +2093,20 @@ PLAYER DATA
)
))

(setq intFleetDisperseWingmen (lambda (aStation aCount)
(block (i shipsLeft)
(setq shipsLeft 0)
(for i 0 (subtract aCount 1)
(block (ship)
(setq ship (objGetObjRefData aStation (cat "Wingman" i)))
(if ship
(block Nil
(setq shipsLeft (add shipsLeft 1))
(shpCancelOrders ship)
(shpOrderDock ship aStation)
(shpOrderGate ship)
)
)
(setq intFleetDisperseWingmen (lambda (missionObj)
(block (
(baseObj (objGetObjByID (msnGetProperty missionObj 'ownerID)))
(missionID (msnGetProperty missionObj 'id))
(wingmen (sysFindObject Nil (cat "sA D:" missionID "_wingman;")))
)
(enum wingmen wingmanObj
(block Nil
(shpCancelOrders wingmanObj)
(shpOrder wingmanObj 'dock baseObj)
(shpOrder wingmanObj 'gate)
)
)
shipsLeft
(count wingmen)
)
))

Expand Down
2 changes: 1 addition & 1 deletion TransCore/CommonwealthFleetMission01.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

======================================================================== -->

<MissionType UNID="&msCFRecon;"
<MissionType UNID="&msCSCRecon;"
name= "Recon Ares station"
attributes= "commonwealthFleet, cscTaskForce, rank1"

Expand Down
2 changes: 1 addition & 1 deletion TransCore/CommonwealthFleetMission02.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

======================================================================== -->

<MissionType UNID="&msCFSupplyDelivery;"
<MissionType UNID="&msCSCSupplyDelivery;"
name= "Deliver supplies"
attributes= "commonwealthFleet, cscTaskForce, rank1, deliveryMission"

Expand Down