Oolite 1.91.0.7644-241112-7f5034b
Loading...
Searching...
No Matches
OOScript.h
Go to the documentation of this file.
1/*
2
3OOScript.h
4
5Abstract base class for scripts.
6Currently, Oolite supports two types of script: the original property list
7scripts and JavaScript scripts. OOS, a format that translated into plist
8scripts, was supported until 1.69.1, but never used. OOScript unifies the
9interfaces to the script types and abstracts loading. Additionally, it falls
10back to a more "primitive" script if loading of one type fails; specifically,
11the order of precedence is:
12 script.js (JavaScript)
13// script.oos (OOS)
14 script.plist (property list)
15
16Oolite
17Copyright (C) 2004-2013 Giles C Williams and contributors
18
19This program is free software; you can redistribute it and/or
20modify it under the terms of the GNU General Public License
21as published by the Free Software Foundation; either version 2
22of the License, or (at your option) any later version.
23
24This program is distributed in the hope that it will be useful,
25but WITHOUT ANY WARRANTY; without even the implied warranty of
26MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27GNU General Public License for more details.
28
29You should have received a copy of the GNU General Public License
30along with this program; if not, write to the Free Software
31Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
32MA 02110-1301, USA.
33
34*/
35
36#import <Foundation/Foundation.h>
37
38@class Entity;
39
40
41@interface OOScript: NSObject
42
43/* Looks for path/world-scripts.plist, path/script.js, then path/script.plist.
44 May return zero or more scripts.
45*/
46+ (NSArray *)worldScriptsAtPath:(NSString *)path;
47
48// Load named scripts from Scripts folders.
49+ (NSArray *)scriptsFromFileNamed:(NSString *)fileName;
50+ (NSArray *)scriptsFromList:(NSArray *)fileNames;
51
52+ (NSArray *)scriptsFromFileAtPath:(NSString *)filePath;
53
54// Load a single JavaScript script.
55+ (id)jsScriptFromFileNamed:(NSString *)fileName properties:(NSDictionary *)properties;
56// As above, but load from the "AIs" directory
57+ (id)jsAIScriptFromFileNamed:(NSString *)fileName properties:(NSDictionary *)properties;
58
59- (NSString *)name;
60- (NSString *)scriptDescription;
61- (NSString *)version;
62- (NSString *)displayName; // "name version" if version is defined, otherwise just "name".
63
64- (BOOL) requiresTickle;
65- (void)runWithTarget:(Entity *)target;
66
67@end
NSString * name()
Definition OOScript.m:256
NSString * version()
Definition OOScript.m:270
BOOL requiresTickle()
Definition OOScript.m:288
NSString * scriptDescription()
Definition OOScript.m:263
NSString * displayName()
Definition OOScript.m:277