Oolite
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@class OOScript;
30
39
50
51@interface PlayerEntity (Scripting)
52
53- (void)checkScript;
54
55- (void)setScriptTarget:(ShipEntity*)ship;
57
58- (void)runScriptActions:(NSArray*)sanitizedActions withContextName:(NSString*)contextName forTarget:(ShipEntity*)target;
59- (void)runUnsanitizedScriptActions:(NSArray*)unsanitizedActions allowingAIMethods:(BOOL)allowAIMethods withContextName:(NSString*)contextName forTarget:(ShipEntity*)target;
60
61// Test (sanitized) legacy script conditions array.
62- (BOOL)scriptTestConditions:(NSArray*)array;
63
64- (NSDictionary*)missionVariables;
65
66- (NSString*)missionVariableForKey:(NSString*)key;
67- (void)setMissionVariable:(NSString*)value forKey:(NSString*)key;
68
69- (NSMutableDictionary*)localVariablesForMission:(NSString*)missionKey;
70- (NSString*)localVariableForKey:(NSString*)variableName andMission:(NSString*)missionKey;
71- (void)setLocalVariable:(NSString*)value forKey:(NSString*)variableName andMission:(NSString*)missionKey;
72
73/*-----------------------------------------------------*/
74
75- (NSString*)mission_string;
76- (NSString*)status_string;
77- (NSString*)gui_screen_string;
78- (NSNumber*)galaxy_number;
79- (NSNumber*)planet_number;
80- (NSNumber*)score_number;
81- (NSNumber*)credits_number;
82- (NSNumber*)scriptTimer_number;
83- (NSNumber*)shipsFound_number;
84
85- (NSNumber*)d100_number;
86- (NSNumber*)pseudoFixedD100_number;
87- (NSNumber*)d256_number;
88- (NSNumber*)pseudoFixedD256_number;
89
90- (NSNumber*)clock_number; // returns the game time in seconds
91- (NSNumber*)clock_secs_number; // returns the game time in seconds
92- (NSNumber*)clock_mins_number; // returns the game time in minutes
93- (NSNumber*)clock_hours_number; // returns the game time in hours
94- (NSNumber*)clock_days_number; // returns the game time in days
95
96- (NSNumber*)fuelLevel_number; // returns the fuel level in LY
97
98- (NSString*)dockedAtMainStation_bool;
99- (NSString*)foundEquipment_bool;
100
101- (NSString*)sunWillGoNova_bool; // returns whether the sun is going to go nova
102- (NSString*)sunGoneNova_bool; // returns whether the sun has gone nova
103
104- (NSString*)missionChoice_string; // returns nil or the key for the chosen option
105- (NSString*)missionKeyPress_string;
106
107- (NSNumber*)dockedTechLevel_number;
108- (NSString*)dockedStationName_string; // returns 'NONE' if the player isn't docked, [station name] if it is, 'UNKNOWN' otherwise
109
110- (NSNumber*)systemGovernment_number;
111- (NSString*)systemGovernment_string;
112- (NSNumber*)systemEconomy_number;
113- (NSString*)systemEconomy_string;
114- (NSNumber*)systemTechLevel_number;
115- (NSNumber*)systemPopulation_number;
116- (NSNumber*)systemProductivity_number;
117
118- (NSString*)commanderName_string;
119- (NSString*)commanderRank_string;
120- (NSString*)commanderShip_string;
122- (NSString*)commanderLegalStatus_string;
123- (NSNumber*)commanderLegalStatus_number;
124
125/*-----------------------------------------------------*/
126
127- (NSArray*)missionsList;
128
129- (void)setMissionDescription:(NSString*)textKey;
131- (void)setMissionInstructions:(NSString*)text forMission:(NSString*)key;
132- (void)setMissionInstructionsList:(NSArray*)list forMission:(NSString*)key;
133- (void)setMissionDescription:(NSString*)textKey forMission:(NSString*)key;
134- (void)clearMissionDescriptionForMission:(NSString*)key;
135
136- (void)commsMessage:(NSString*)valueString;
137- (void)commsMessageByUnpiloted:(NSString*)valueString; // Enabled 02-May-2008 - Nikos. Same as commsMessage, but
138 // can be used by scripts to have unpiloted ships sending
139 // commsMessages, if we want to.
140
141- (void)consoleMessage3s:(NSString*)valueString;
142- (void)consoleMessage6s:(NSString*)valueString;
143
144- (void)setLegalStatus:(NSString*)valueString;
145- (void)awardCredits:(NSString*)valueString;
146- (void)awardShipKills:(NSString*)valueString;
147- (void)awardEquipment:(NSString*)equipString; // eg. EQ_NAVAL_ENERGY_UNIT
148- (void)removeEquipment:(NSString*)equipString; // eg. EQ_NAVAL_ENERGY_UNIT
149
150- (void)setPlanetinfo:(NSString*)key_valueString; // uses key=value format
151- (void)setSpecificPlanetInfo:(NSString*)key_valueString; // uses galaxy#=planet#=key=value
152
153- (void)awardCargo:(NSString*)amount_typeString;
154- (void)removeAllCargo;
155- (void)removeAllCargo:(BOOL)forceRemoval;
156
157- (void)useSpecialCargo:(NSString*)descriptionString;
158
159- (void)testForEquipment:(NSString*)equipString; // eg. EQ_NAVAL_ENERGY_UNIT
160
161- (void)awardFuel:(NSString*)valueString; // add to fuel up to 7.0 LY
162
163- (void)messageShipAIs:(NSString*)roles_message;
164- (void)ejectItem:(NSString*)item_key;
165- (void)addShips:(NSString*)roles_number;
166- (void)addSystemShips:(NSString*)roles_number_position;
167- (void)addShipsAt:(NSString*)roles_number_system_x_y_z;
168- (void)addShipsAtPrecisely:(NSString*)roles_number_system_x_y_z;
169- (void)addShipsWithinRadius:(NSString*)roles_number_system_x_y_z_r;
170- (void)spawnShip:(NSString*)ship_key;
171- (void)set:(NSString*)missionvariable_value;
172- (void)reset:(NSString*)missionvariable;
173/*
174 set:missionvariable_value
175 add:missionvariable_value
176 subtract:missionvariable_value
177
178 the value may be a string constant or one of the above calls
179 ending in _bool, _number, or _string
180
181 egs.
182 set: mission_my_mission_status MISSION_START
183 set: mission_my_mission_value 12.345
184 set: mission_my_mission_clock clock_number
185 add: mission_my_mission_clock 86400
186 subtract: mission_my_mission_clock d100_number
187*/
188
189- (void)increment:(NSString*)missionVariableString;
190- (void)decrement:(NSString*)missionVariableString;
191
192- (void)add:(NSString*)missionVariableString_value;
193- (void)subtract:(NSString*)missionVariableString_value;
194
195- (void)checkForShips:(NSString*)roleString;
196- (void)resetScriptTimer;
197- (void)addMissionText:(NSString*)textKey;
198- (void)addLiteralMissionText:(NSString*)text;
199
200- (void)setMissionChoiceByTextEntry:(BOOL)enable;
201- (void)setMissionChoices:(NSString*)choicesKey; // choicesKey is a key for a dictionary of
202 // choices/choice phrases in missiontext.plist and also..
203- (void)setMissionChoicesDictionary:(NSDictionary*)choicesDict;
204- (void)resetMissionChoice; // resets MissionChoice to nil
205
206- (void)clearMissionScreen;
207
208- (void)addMissionDestination:(NSString*)destinations; // mark a system on the star charts
209- (void)removeMissionDestination:(NSString*)destinations; // stop a system being marked on star charts
210
211- (void)showShipModel:(NSString*)shipKey;
212- (void)setMissionMusic:(NSString*)value;
213
214- (NSString*)missionTitle;
215- (void)setMissionTitle:(NSString*)value;
216
217- (void)setFuelLeak:(NSString*)value;
218- (NSNumber*)fuelLeakRate_number;
219- (void)setSunNovaIn:(NSString*)time_value;
220- (void)launchFromStation;
221- (void)blowUpStation;
222- (void)sendAllShipsAway;
223
224- (OOPlanetEntity*)addPlanet:(NSString*)planetKey;
225- (OOPlanetEntity*)addMoon:(NSString*)moonKey;
226
227- (void)debugOn;
228- (void)debugOff;
229- (void)debugMessage:(NSString*)args;
230
231- (NSString*)replaceVariablesInString:(NSString*)args;
232
233- (void)playSound:(NSString*)soundName;
234
235- (BOOL)addEqScriptForKey:(NSString*)eq_key;
236- (void)removeEqScriptForKey:(NSString*)eq_key;
237- (NSUInteger)eqScriptIndexForKey:(NSString*)eq_key;
238
241
242- (void)setGalacticHyperspaceBehaviourTo:(NSString*)galacticHyperspaceBehaviourString;
243- (void)setGalacticHyperspaceFixedCoordsTo:(NSString*)galacticHyperspaceFixedCoordsString;
244
245/*-----------------------------------------------------*/
246
248- (void)setMissionScreenID:(NSString*)msid;
249- (NSString*)missionScreenID;
252- (void)setGuiToMissionScreenWithCallback:(BOOL)callback;
253- (void)doMissionCallback;
255- (void)setBackgroundFromDescriptionsKey:(NSString*)d_key;
256- (void)addScene:(NSArray*)items atOffset:(Vector)off;
257- (BOOL)processSceneDictionary:(NSDictionary*)couplet atOffset:(Vector)off;
258- (BOOL)processSceneString:(NSString*)item atOffset:(Vector)off;
259
260@end
261
#define CONST_FUNC
NSString * OOComparisonTypeToString(OOComparisonType type) CONST_FUNC