Oolite 1.91.0.7604-240417-a536cbe
Loading...
Searching...
No Matches
PlayerEntityLegacyScriptEngine.h
Go to the documentation of this file.
1/*
2
3PlayerEntityLegacyScriptEngine.h
4
5Various utility methods used for scripting.
6
7Oolite
8Copyright (C) 2004-2013 Giles C Williams and contributors
9
10This program is free software; you can redistribute it and/or
11modify it under the terms of the GNU General Public License
12as published by the Free Software Foundation; either version 2
13of the License, or (at your option) any later version.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23MA 02110-1301, USA.
24
25*/
26
27#import "PlayerEntity.h"
28
29
30@class OOScript;
31
32
42
43
55
56
57@interface PlayerEntity (Scripting)
58
59- (void) checkScript;
60
61- (void) setScriptTarget:(ShipEntity *)ship;
63
64- (void) runScriptActions:(NSArray *)sanitizedActions withContextName:(NSString *)contextName forTarget:(ShipEntity *)target;
65- (void) runUnsanitizedScriptActions:(NSArray *)unsanitizedActions allowingAIMethods:(BOOL)allowAIMethods withContextName:(NSString *)contextName forTarget:(ShipEntity *)target;
66
67// Test (sanitized) legacy script conditions array.
68- (BOOL) scriptTestConditions:(NSArray *)array;
69
70- (NSDictionary*) missionVariables;
71
72- (NSString *)missionVariableForKey:(NSString *)key;
73- (void)setMissionVariable:(NSString *)value forKey:(NSString *)key;
74
75- (NSMutableDictionary *)localVariablesForMission:(NSString *)missionKey;
76- (NSString *)localVariableForKey:(NSString *)variableName andMission:(NSString *)missionKey;
77- (void)setLocalVariable:(NSString *)value forKey:(NSString *)variableName andMission:(NSString *)missionKey;
78
79/*-----------------------------------------------------*/
80
81- (NSString *) mission_string;
82- (NSString *) status_string;
83- (NSString *) gui_screen_string;
84- (NSNumber *) galaxy_number;
85- (NSNumber *) planet_number;
86- (NSNumber *) score_number;
87- (NSNumber *) credits_number;
88- (NSNumber *) scriptTimer_number;
89- (NSNumber *) shipsFound_number;
90
91- (NSNumber *) d100_number;
92- (NSNumber *) pseudoFixedD100_number;
93- (NSNumber *) d256_number;
94- (NSNumber *) pseudoFixedD256_number;
95
96- (NSNumber *) clock_number; // returns the game time in seconds
97- (NSNumber *) clock_secs_number; // returns the game time in seconds
98- (NSNumber *) clock_mins_number; // returns the game time in minutes
99- (NSNumber *) clock_hours_number; // returns the game time in hours
100- (NSNumber *) clock_days_number; // returns the game time in days
101
102- (NSNumber *) fuelLevel_number; // returns the fuel level in LY
103
104- (NSString *) dockedAtMainStation_bool;
105- (NSString *) foundEquipment_bool;
106
107- (NSString *) sunWillGoNova_bool; // returns whether the sun is going to go nova
108- (NSString *) sunGoneNova_bool; // returns whether the sun has gone nova
109
110- (NSString *) missionChoice_string; // returns nil or the key for the chosen option
111- (NSString *) missionKeyPress_string;
112
113- (NSNumber *) dockedTechLevel_number;
114- (NSString *) dockedStationName_string; // returns 'NONE' if the player isn't docked, [station name] if it is, 'UNKNOWN' otherwise
115
116- (NSNumber *) systemGovernment_number;
117- (NSString *) systemGovernment_string;
118- (NSNumber *) systemEconomy_number;
119- (NSString *) systemEconomy_string;
120- (NSNumber *) systemTechLevel_number;
121- (NSNumber *) systemPopulation_number;
122- (NSNumber *) systemProductivity_number;
123
124- (NSString *) commanderName_string;
125- (NSString *) commanderRank_string;
126- (NSString *) commanderShip_string;
128- (NSString *) commanderLegalStatus_string;
129- (NSNumber *) commanderLegalStatus_number;
130
131/*-----------------------------------------------------*/
132
133- (NSArray *) missionsList;
134
135- (void) setMissionDescription:(NSString *)textKey;
137- (void) setMissionInstructions:(NSString *)text forMission:(NSString *)key;
138- (void) setMissionInstructionsList:(NSArray *)list forMission:(NSString *)key;
139- (void) setMissionDescription:(NSString *)textKey forMission:(NSString *)key;
140- (void) clearMissionDescriptionForMission:(NSString *)key;
141
142- (void) commsMessage:(NSString *)valueString;
143- (void) commsMessageByUnpiloted:(NSString *)valueString; // Enabled 02-May-2008 - Nikos. Same as commsMessage, but
144 // can be used by scripts to have unpiloted ships sending
145 // commsMessages, if we want to.
146
147- (void) consoleMessage3s:(NSString *)valueString;
148- (void) consoleMessage6s:(NSString *)valueString;
149
150- (void) setLegalStatus:(NSString *)valueString;
151- (void) awardCredits:(NSString *)valueString;
152- (void) awardShipKills:(NSString *)valueString;
153- (void) awardEquipment:(NSString *)equipString; //eg. EQ_NAVAL_ENERGY_UNIT
154- (void) removeEquipment:(NSString *)equipString; //eg. EQ_NAVAL_ENERGY_UNIT
155
156- (void) setPlanetinfo:(NSString *)key_valueString; // uses key=value format
157- (void) setSpecificPlanetInfo:(NSString *)key_valueString; // uses galaxy#=planet#=key=value
158
159- (void) awardCargo:(NSString *)amount_typeString;
160- (void) removeAllCargo;
161- (void) removeAllCargo:(BOOL)forceRemoval;
162
163- (void) useSpecialCargo:(NSString *)descriptionString;
164
165- (void) testForEquipment:(NSString *)equipString; //eg. EQ_NAVAL_ENERGY_UNIT
166
167- (void) awardFuel:(NSString *)valueString; // add to fuel up to 7.0 LY
168
169- (void) messageShipAIs:(NSString *)roles_message;
170- (void) ejectItem:(NSString *)item_key;
171- (void) addShips:(NSString *)roles_number;
172- (void) addSystemShips:(NSString *)roles_number_position;
173- (void) addShipsAt:(NSString *)roles_number_system_x_y_z;
174- (void) addShipsAtPrecisely:(NSString *)roles_number_system_x_y_z;
175- (void) addShipsWithinRadius:(NSString *)roles_number_system_x_y_z_r;
176- (void) spawnShip:(NSString *)ship_key;
177- (void) set:(NSString *)missionvariable_value;
178- (void) reset:(NSString *)missionvariable;
179/*
180 set:missionvariable_value
181 add:missionvariable_value
182 subtract:missionvariable_value
183
184 the value may be a string constant or one of the above calls
185 ending in _bool, _number, or _string
186
187 egs.
188 set: mission_my_mission_status MISSION_START
189 set: mission_my_mission_value 12.345
190 set: mission_my_mission_clock clock_number
191 add: mission_my_mission_clock 86400
192 subtract: mission_my_mission_clock d100_number
193*/
194
195- (void) increment:(NSString *)missionVariableString;
196- (void) decrement:(NSString *)missionVariableString;
197
198- (void) add:(NSString *)missionVariableString_value;
199- (void) subtract:(NSString *)missionVariableString_value;
200
201- (void) checkForShips: (NSString *)roleString;
202- (void) resetScriptTimer;
203- (void) addMissionText: (NSString *)textKey;
204- (void) addLiteralMissionText: (NSString *)text;
205
206- (void) setMissionChoiceByTextEntry:(BOOL)enable;
207- (void) setMissionChoices:(NSString *)choicesKey; // choicesKey is a key for a dictionary of
208 // choices/choice phrases in missiontext.plist and also..
209- (void) setMissionChoicesDictionary:(NSDictionary *)choicesDict;
210- (void) resetMissionChoice; // resets MissionChoice to nil
211
212- (void) clearMissionScreen;
213
214- (void) addMissionDestination:(NSString *)destinations; // mark a system on the star charts
215- (void) removeMissionDestination:(NSString *)destinations; // stop a system being marked on star charts
216
217- (void) showShipModel:(NSString *)shipKey;
218- (void) setMissionMusic:(NSString *)value;
219
220- (NSString *)missionTitle;
221- (void) setMissionTitle:(NSString *)value;
222
223- (void) setFuelLeak: (NSString *)value;
224- (NSNumber *)fuelLeakRate_number;
225- (void) setSunNovaIn: (NSString *)time_value;
226- (void) launchFromStation;
227- (void) blowUpStation;
228- (void) sendAllShipsAway;
229
230- (OOPlanetEntity *) addPlanet: (NSString *)planetKey;
231- (OOPlanetEntity *) addMoon: (NSString *)moonKey;
232
233- (void) debugOn;
234- (void) debugOff;
235- (void) debugMessage:(NSString *)args;
236
237- (NSString*) replaceVariablesInString:(NSString*) args;
238
239- (void) playSound:(NSString *) soundName;
240
241- (BOOL) addEqScriptForKey:(NSString *)eq_key;
242- (void) removeEqScriptForKey:(NSString *)eq_key;
243- (NSUInteger) eqScriptIndexForKey:(NSString *)eq_key;
244
245- (void) targetNearestHostile;
247
248- (void) setGalacticHyperspaceBehaviourTo:(NSString *) galacticHyperspaceBehaviourString;
249- (void) setGalacticHyperspaceFixedCoordsTo:(NSString *) galacticHyperspaceFixedCoordsString;
250
251/*-----------------------------------------------------*/
252
253- (void) clearMissionScreenID;
254- (void) setMissionScreenID:(NSString *)msid;
255- (NSString *) missionScreenID;
256- (void) setGuiToMissionScreen;
258- (void) setGuiToMissionScreenWithCallback:(BOOL) callback;
259- (void) doMissionCallback;
261- (void) setBackgroundFromDescriptionsKey:(NSString*) d_key;
262- (void) addScene:(NSArray *) items atOffset:(Vector) off;
263- (BOOL) processSceneDictionary:(NSDictionary *) couplet atOffset:(Vector) off;
264- (BOOL) processSceneString:(NSString*) item atOffset:(Vector) off;
265
266@end
267
#define CONST_FUNC
NSString * OOComparisonTypeToString(OOComparisonType type) CONST_FUNC