~harrison-rt/+junk/jaguar_company

« back to all changes in this revision

Viewing changes to tags/2.3/jaguar_company_2.3.oxp/AIs/jaguar_company_minerAI.plist

  • Committer: Richard Harrison
  • Date: 2013-01-19 23:01:03 UTC
  • Revision ID: harrison.rt@gmail.com-20130119230103-hukuh0h9jorz3hk1
Tags: 2.4
* Bug fix for spawning Jaguar Company. Potential to spawn the base at all times if the Galactic Navy wasn't present.
* Bug fix for checking the safe zone around the base. Wasn't checking to see if it actually existed.
* Main world script saves the last system ID that was visited for interstellar space.
* Timer on start up for the worldscripts has been added to allow each worldscript to be loaded in. Stops a potential dependency error happening.
* Stray commas in the route list arrays removed.
* Welcome code has been cleaned up.
* missiontext.plist and descriptions.plist cleaned up.
* Altered all player consoleMessage's to show messages for the default time limit.
* Changed all player commsMessage's to consoleMessage.
* Changed some of the player consoleMessage's back into commsMessage.
* Only insert news into Snoopers about battle help if more than 10 minutes has passed since the last news item was inserted.
* If you set $alwaysSpawn to true with OXPConfig the base will be spawned if it doesn't exist.
* Patrol ships follow the Galactic Navy.
** If by some freak accident, all of the Galactic Navy is destroyed, the patrol ships will go back to base if it exists. Otherwise they will patrol the witchpoint to planet lane.
* New reputation level. Shows the location of Jaguar Company Bases in the current galaxy.
** Re-implementation of the game random number generators for system.pseudoRandomNumber and system.scrambledPseudoRandomNumber, to allow checking of all the systems in the current galaxy. The system versions only gives back a value for the current system.
** Oolite v1.76.1 or older only show a list of system names. Go to the long range chart then select the status screen (F6, F6, F5). Borrowed some code from Spara's Trophy Collector OXP for this.
** Oolite v1.77 or newer display the locations on the long range chart. Uses the new object method of mission.markSystem so it won't intefere with other OXPs. (Hopefully)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* jaguar_company_minerAI.plist
 
2
 *
 
3
 * Copyright © 2012 Richard Thomas Harrison (Tricky)
 
4
 *
 
5
 * This work is licensed under the Creative Commons
 
6
 * Attribution-Noncommercial-Share Alike 3.0 Unported License.
 
7
 *
 
8
 * To view a copy of this license, visit
 
9
 * http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter
 
10
 * to Creative Commons, 171 Second Street, Suite 300, San Francisco,
 
11
 * California, 94105, USA.
 
12
 *
 
13
 * AI for the Jaguar Company miner.
 
14
 */
 
15
 
 
16
{
 
17
    GLOBAL =
 
18
    {
 
19
        ENTER = ("setSpeedFactorTo: 0.1", "setStateTo: LOOK_FOR_SPLINTERS");
 
20
        /* Exited witchspace from interstellar space. Go to the nearest base or station. */
 
21
        "EXITED WITCHSPACE" = ("setStateTo: GO_TO_STATION");
 
22
    };
 
23
 
 
24
    "LOOK_FOR_ROCKS" =
 
25
    {
 
26
        ENTER = (performIdle);
 
27
        /* This will be caught by $scanForCascadeWeapon which should work for Oolite v1.74+
 
28
         * Emulates the Oolite v1.77 and newer method of supplying a message for cascade weapons being deployed.
 
29
         */
 
30
        "CASCADE_WEAPON_FOUND" = ("sendScriptMessage: $saveAIState", "setStateTo: CASCADE_WEAPON_FOUND");
 
31
        /* Let everyone know that someone is shooting at us.
 
32
         * See $shipIsBeingAttacked in jaguar_company_attackers.js
 
33
         * JAGUAR_COMPANY_ATTACK_TARGET is returned to the caller and other Jaguar Company ships not fighting.
 
34
         */
 
35
        "HOSTILE_FIRE" = (setTargetToPrimaryAggressor, "sendScriptMessage: $performJaguarCompanyAttackTarget");
 
36
        /* Deal with incoming missile. */
 
37
        "INCOMING_MISSILE" =
 
38
        (
 
39
            "sendScriptMessage: $saveAIState",
 
40
            "setStateTo: MISSILE_DETECTED",
 
41
            "randomPauseAI: 0.25 0.75"
 
42
        );
 
43
        /* Respond to an attack call by fleeing. */
 
44
        "JAGUAR_COMPANY_ATTACK_TARGET" = ("setStateTo: FLEE");
 
45
        "TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: BREAK_ROCKS");
 
46
        "NOTHING_FOUND" = ("setStateTo: GO_TO_STATION");
 
47
        UPDATE = ("pauseAI: 8.0", scanForRocks, "sendScriptMessage: $scanForCascadeWeapon");
 
48
    };
 
49
 
 
50
    "BREAK_ROCKS" =
 
51
    {
 
52
        ENTER = (performMining);
 
53
        /* Combat messages. See LOOK_FOR_ROCKS. */
 
54
        "CASCADE_WEAPON_FOUND" =
 
55
        (
 
56
            "sendScriptMessage: $saveAIState LOOK_FOR_SPLINTERS",
 
57
            "setStateTo: CASCADE_WEAPON_FOUND"
 
58
        );
 
59
        "HOSTILE_FIRE" = (setTargetToPrimaryAggressor, "sendScriptMessage: $performJaguarCompanyAttackTarget");
 
60
        "INCOMING_MISSILE" =
 
61
        (
 
62
            "sendScriptMessage: $saveAIState",
 
63
            "setStateTo: MISSILE_DETECTED",
 
64
            "randomPauseAI: 0.25 0.75"
 
65
        );
 
66
        /* Respond to an attack call by fleeing. */
 
67
        "JAGUAR_COMPANY_ATTACK_TARGET" = ("setStateTo: FLEE");
 
68
        "TARGET_DESTROYED" = ("setStateTo: LOOK_FOR_SPLINTERS");
 
69
        "TARGET_LOST" = ("setStateTo: LOOK_FOR_SPLINTERS");
 
70
        UPDATE = ("pauseAI: 8.0", "sendScriptMessage: $scanForCascadeWeapon");
 
71
    };
 
72
 
 
73
    "LOOK_FOR_SPLINTERS" =
 
74
    {
 
75
        ENTER = (performIdle, checkForFullHold);
 
76
        /* Combat messages. See LOOK_FOR_ROCKS. */
 
77
        "CASCADE_WEAPON_FOUND" =
 
78
        (
 
79
            "sendScriptMessage: $saveAIState LOOK_FOR_SPLINTERS",
 
80
            "setStateTo: CASCADE_WEAPON_FOUND"
 
81
        );
 
82
        "HOSTILE_FIRE" = (setTargetToPrimaryAggressor, "sendScriptMessage: $performJaguarCompanyAttackTarget");
 
83
        "INCOMING_MISSILE" =
 
84
        (
 
85
            "sendScriptMessage: $saveAIState",
 
86
            "setStateTo: MISSILE_DETECTED",
 
87
            "randomPauseAI: 0.25 0.75"
 
88
        );
 
89
        /* Respond to an attack call by fleeing. */
 
90
        "JAGUAR_COMPANY_ATTACK_TARGET" = ("setStateTo: FLEE");
 
91
        "TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: COLLECT_STUFF");
 
92
        "NOTHING_FOUND" = ("setStateTo: LOOK_FOR_ROCKS");
 
93
        "HOLD_FULL" = ("setStateTo: GO_TO_STATION");
 
94
        "NO_CARGO_BAY" = ("setStateTo: GO_TO_STATION");
 
95
        UPDATE = ("pauseAI: 8.0", scanForLoot, "sendScriptMessage: $scanForCascadeWeapon");
 
96
    };
 
97
 
 
98
    "COLLECT_STUFF" =
 
99
    {
 
100
        ENTER = (performCollect);
 
101
        /* Combat messages. See LOOK_FOR_ROCKS. */
 
102
        "CASCADE_WEAPON_FOUND" =
 
103
        (
 
104
            "sendScriptMessage: $saveAIState LOOK_FOR_SPLINTERS",
 
105
            "setStateTo: CASCADE_WEAPON_FOUND"
 
106
        );
 
107
        "HOSTILE_FIRE" = (setTargetToPrimaryAggressor, "sendScriptMessage: $performJaguarCompanyAttackTarget");
 
108
        "INCOMING_MISSILE" =
 
109
        (
 
110
            "sendScriptMessage: $saveAIState",
 
111
            "setStateTo: MISSILE_DETECTED",
 
112
            "randomPauseAI: 0.25 0.75"
 
113
        );
 
114
        /* Respond to an attack call by fleeing. */
 
115
        "JAGUAR_COMPANY_ATTACK_TARGET" = ("setStateTo: FLEE");
 
116
        FRUSTRATED = ("setStateTo: LOOK_FOR_SPLINTERS");
 
117
        "CARGO_SCOOPED" = ("setStateTo: LOOK_FOR_SPLINTERS");
 
118
        "HOLD_FULL" = ("setStateTo: GO_TO_STATION");
 
119
        "TARGET_LOST" = ("setStateTo: LOOK_FOR_SPLINTERS");
 
120
        "COLLISION" = ("setStateTo: LOOK_FOR_SPLINTERS");
 
121
        UPDATE = ("pauseAI: 8.0", "sendScriptMessage: $scanForCascadeWeapon");
 
122
    };
 
123
 
 
124
    "GO_TO_STATION" =
 
125
    {
 
126
        /* Search for the base and get it's co-ordinates. */
 
127
        ENTER = ("sendScriptMessage: $setCoordsToJaguarCompanyBase");
 
128
        /* Combat messages. See LOOK_FOR_ROCKS. */
 
129
        "CASCADE_WEAPON_FOUND" = ("sendScriptMessage: $saveAIState", "setStateTo: CASCADE_WEAPON_FOUND");
 
130
        "HOSTILE_FIRE" = (setTargetToPrimaryAggressor, "sendScriptMessage: $performJaguarCompanyAttackTarget");
 
131
        "INCOMING_MISSILE" =
 
132
        (
 
133
            "sendScriptMessage: $saveAIState",
 
134
            "setStateTo: MISSILE_DETECTED",
 
135
            "randomPauseAI: 0.25 0.75"
 
136
        );
 
137
        /* Respond to an attack call by fleeing. */
 
138
        "JAGUAR_COMPANY_ATTACK_TARGET" = ("setStateTo: FLEE");
 
139
        /* Co-ordinates set to the base so let's set a course to it. */
 
140
        "JAGUAR_COMPANY_BASE_FOUND" =
 
141
        (
 
142
            setDestinationFromCoordinates,
 
143
            "setDesiredRangeTo: 5000.0",
 
144
            checkCourseToDestination
 
145
        );
 
146
        /* Base has gone.
 
147
         * Probably blown up by a pirate or thargoid. Hyperspace out to another system.
 
148
         */
 
149
        "JAGUAR_COMPANY_BASE_NOT_FOUND" = ("addFuel: 7", performHyperSpaceExitWithoutReplacing);
 
150
        /* Course is OK. */
 
151
        "COURSE_OK" = (setSpeedToCruiseSpeed, performFlyToRangeFromDestination);
 
152
        /* Something in the way. */
 
153
        "WAYPOINT_SET" = ("setAITo: jaguar_company_waypointAI.plist");
 
154
        /* Start docking procedures. */
 
155
        "DESIRED_RANGE_ACHIEVED" = (setTargetToNearestStation, "setAITo: jaguar_company_dockingAI.plist");
 
156
        /* Wandered into a wormhole whilst in waypoint AI. */
 
157
        WORMHOLE = ("setStateTo: GLOBAL");
 
158
        /* Search for the base and get it's co-ordinates. Also check for cascade weapons. */
 
159
        UPDATE =
 
160
        (
 
161
            "pauseAI: 8.0",
 
162
            "sendScriptMessage: $setCoordsToJaguarCompanyBase",
 
163
            "sendScriptMessage: $scanForCascadeWeapon"
 
164
        );
 
165
    };
 
166
 
 
167
    FLEE =
 
168
    {
 
169
        ENTER = ("setDesiredRangeTo: 25600", performFlee);
 
170
        /* Combat messages. See LOOK_FOR_ROCKS. */
 
171
        "CASCADE_WEAPON_FOUND" =
 
172
        (
 
173
            "sendScriptMessage: $saveAIState LOOK_FOR_SPLINTERS",
 
174
            "setStateTo: CASCADE_WEAPON_FOUND"
 
175
        );
 
176
        "HOSTILE_FIRE" = (setTargetToPrimaryAggressor, "sendScriptMessage: $performJaguarCompanyAttackTarget");
 
177
        "INCOMING_MISSILE" =
 
178
        (
 
179
            "sendScriptMessage: $saveAIState LOOK_FOR_SPLINTERS",
 
180
            "setStateTo: MISSILE_DETECTED",
 
181
            "randomPauseAI: 0.25 0.75"
 
182
        );
 
183
        /* Reached safety. */
 
184
        "REACHED_SAFETY" = ("setSpeedTo: 0.0", performIdle);
 
185
        "ENERGY_FULL" = (performIdle, "setStateTo: LOOK_FOR_SPLINTERS");
 
186
        "TARGET_LOST" = (performIdle, "setStateTo: LOOK_FOR_SPLINTERS");
 
187
    };
 
188
 
 
189
    /* Either fight or flee from the missile. */
 
190
    "FLEE_FOR_MISSILE" =
 
191
    {
 
192
        /* Check for cascade weapons whilst fleeing to a range of 10km from the missile. */
 
193
        ENTER = ("sendScriptMessage: $scanForCascadeWeapon", "setDesiredRangeTo: 10000.0", performFlee);
 
194
        /* Combat messages. See LOOK_FOR_ROCKS. */
 
195
        "CASCADE_WEAPON_FOUND" = ("setStateTo: CASCADE_WEAPON_FOUND");
 
196
        "HOSTILE_FIRE" = (setTargetToPrimaryAggressor, "sendScriptMessage: $performJaguarCompanyAttackTarget");
 
197
        /* Break off flee to deal with incoming missile. */
 
198
        "INCOMING_MISSILE" = ("setStateTo: MISSILE_DETECTED", "randomPauseAI: 0.25 0.75");
 
199
        /* Current target was either destroyed or disappeared off the scanner. Recall the last state. */
 
200
        "TARGET_DESTROYED" = ("sendScriptMessage: $recallAIState", "pauseAI: 2.0");
 
201
        "TARGET_LOST" = ("sendScriptMessage: $recallAIState", "pauseAI: 2.0");
 
202
        /* We have put some distance between us and the missile. Recall the last state. */
 
203
        "REACHED_SAFETY" = ("sendScriptMessage: $recallAIState", "pauseAI: 2.0");
 
204
        /* Fire the ECM every 10 seconds and check for cascade weapons. */
 
205
        UPDATE = ("pauseAI: 8.0", fightOrFleeMissile, "sendScriptMessage: $scanForCascadeWeapon");
 
206
    };
 
207
 
 
208
    /* Deal with incoming missile. */
 
209
    "MISSILE_DETECTED" =
 
210
    {
 
211
        /* Fire the ECM (if available) and flee from the missile. */
 
212
        UPDATE =
 
213
        (
 
214
            setTargetToPrimaryAggressor,
 
215
            fightOrFleeMissile,
 
216
            "sendScriptMessage: $performJaguarCompanyAttackTarget",
 
217
            "setStateTo: FLEE_FOR_MISSILE"
 
218
        );
 
219
    };
 
220
 
 
221
    /* Run away (anywhere). Target has already been set */
 
222
    "CASCADE_WEAPON_FOUND" =
 
223
    {
 
224
        ENTER = (setDestinationToTarget, "setDesiredRangeTo: 25600.0", performFlee, "pauseAI: 2.0");
 
225
        "CASCADE_WEAPON_FOUND" = ("setStateTo: CASCADE_WEAPON_FOUND");
 
226
        "TARGET_LOST" = ("sendScriptMessage: $recallAIState", "pauseAI: 2.0");
 
227
        "REACHED_SAFETY" = ("sendScriptMessage: $recallAIState", "pauseAI: 2.0");
 
228
        "DESIRED_RANGE_ACHIEVED" = ("sendScriptMessage: $recallAIState", "pauseAI: 2.0");
 
229
        UPDATE = ("pauseAI: 2.0", "sendScriptMessage: $scanForCascadeWeapon");
 
230
    };
 
231
}
 
 
b'\\ No newline at end of file'