Tiberian Technologies Scripts Reference Revision: 9000
Loading...
Searching...
No Matches
engine_script.h
1/* Renegade Scripts.dll
2 Copyright 2013 Tiberian Technologies
3
4 This file is part of the Renegade scripts.dll
5 The Renegade scripts.dll is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free
7 Software Foundation; either version 2, or (at your option) any later
8 version. See the file COPYING for more details.
9 In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
10 Only the source code to the module(s) containing the licenced code has to be released.
11*/
12#ifndef SCRIPTS_INCLUDE__ENGINE_SCRIPT_H
13#define SCRIPTS_INCLUDE__ENGINE_SCRIPT_H
14#include "scripts.h"
15#include "engine_string.h"
16#include "SList.h"
17
18SCRIPTS_API void Remove_Script(GameObject *obj,const char *script); //removes all copies of <script> from an object
19SCRIPTS_API void Remove_All_Scripts(GameObject *obj); //removes all scripts from an object
20SCRIPTS_API void Attach_Script_Preset(const char *script,const char *params,const char *preset,int team); //attached <script> to all objects of <preset> in team <team>
21SCRIPTS_API void Attach_Script_Type(const char *script,const char *params,unsigned long type,int team); //attaches <script> to all objects of <type> in team <team>
22SCRIPTS_API void Remove_Script_Preset(const char *script,const char *preset,int team); //removes all copies of <script> from all objects of <preset> in team <team>
23SCRIPTS_API void Remove_Script_Type(const char *script,unsigned long type,int team); //removes all copies of <script> from all objects of <type> in team <team>
24SCRIPTS_API bool Is_Script_Attached(GameObject *obj,const char *script); //is the script attached
25SCRIPTS_API void Attach_Script_Once(GameObject *obj,const char *script,const char *params); //attach a script if its not already attached
26SCRIPTS_API void Attach_Script_Preset_Once(const char *script,const char *params,const char *preset,int team); //attach a script to all objects of preset if its not already attached
27SCRIPTS_API void Attach_Script_Type_Once(const char *script,const char *params,unsigned long type,int team); //attach a script to all objects of type if its not already attached
28SCRIPTS_API void Attach_Script_Building(const char *script,const char *params,int team); //attach a script to all buildings
29SCRIPTS_API void Attach_Script_Is_Preset(GameObject *obj,const char *preset,const char *script,const char *params,int team); //attach the script if object is of preset
30SCRIPTS_API void Attach_Script_Is_Type(GameObject *obj,unsigned long type,const char *script,const char *params,int team); //attach the script if object is of type
31SCRIPTS_API void Attach_Script_Player_Once(const char *script,const char *params,int team); //attach a script to all players if its not already attached
32SCRIPTS_API void Remove_Duplicate_Script(GameObject *obj, const char *script); //remove duplicate scripts from an object
33SCRIPTS_API void Attach_Script_All_Buildings_Team(int Team,const char *Script,const char *Params,bool Once); //attach a script to all buildings by team
34SCRIPTS_API void Attach_Script_All_Turrets_Team(int Team,const char *Script,const char *Params,bool Once); //attach a script to all static vehicles by team
35SCRIPTS_API GameObject *Find_Building_With_Script(int Team,int Type,const char *Script,GameObject *Caller); //Find a building of this type with this script attached to it
36SCRIPTS_API GameObject *Find_Object_With_Script(const char *script); //Find the first object with this script on it
37SCRIPTS_API GameObject *Find_Closest_Object_With_Script(const char *script, Vector3 pos); //Find the closest object to pos with this script on it
38SCRIPTS_API void Find_All_Objects_With_Script(const char *script, SList<GameObject>& objects); // Find all objects with this script on it
39
55SCRIPTS_API void Find_All_Objects_With_Script_By_Distance(const char *script, SList<GameObject>& objects, Vector3 position);
56SCRIPTS_API void Find_All_Vehicles_By_Distance(SList<GameObject>& objects, Vector3 position);
57
58SCRIPTS_API void Send_Custom_Event_To_Objects_With_Script( GameObject *sender, const char *script, int message, int param, float delay ); // Script to send a custom to all objects with a specific script
59SCRIPTS_API void Send_Custom_Event_To_Objects_With_Script_Ranged( GameObject *sender, const char *script, int message, int param, float delay, float range ); // Script to send a custom to all objects with a specific script in a specified range
60SCRIPTS_API ScriptImpClass* Find_Script_On_Object(GameObject* obj, const char *script); // Returns a pointer to the first instance of the named script on the given object, or NULL if not found
61SCRIPTS_API void Attach_Script_Occupants(GameObject *obj,const char *script,const char *params); //attaches a script to all occupants of a vehicle
62
79SCRIPTS_API void Attach_Script_V ( GameObject* pObj, const char* script, const char* params, ... );
80
98SCRIPTS_API void Attach_Script_V ( GameObject* pObj, const char* script, const char* params, va_list vargs );
99
116SCRIPTS_API void Attach_Script_Once_V ( GameObject* pObj, const char* script, const char* params, ... );
117
118class ScriptParameter : public NoEqualsClass<ScriptParameter>
119{
120public:
121 StringClass name;
122 StringClass value;
123 int type;
124};
125
126typedef enum
127{
128 PARAM_TYPE_INT = 0,
129 PARAM_TYPE_FLOAT,
130 PARAM_TYPE_STRING,
131 PARAM_TYPE_BOOL,
132 PARAM_TYPE_ID,
133 PARAM_TYPE_VECTOR3,
134 PARAM_TYPE_ENUM,
135 PARAM_TYPE_EMITTER,
136 PARAM_TYPE_WEAPON,
137 PARAM_TYPE_AMMO,
138 PARAM_TYPE_EXPLOSION,
139 PARAM_TYPE_ANIMATION,
140 PARAM_TYPE_GANG,
141 PARAM_TYPE_FILE,
142 PARAM_TYPE_SOUND,
143 PARAM_TYPE_COLOR,
144 PARAM_TYPE_COUNT
145} PARAM_TYPES;
146
147const char * const PARAM_TYPE_STRINGS[PARAM_TYPE_COUNT] =
148{
149 "int",
150 "float",
151 "string",
152 "bool",
153 "ID",
154 "vector3",
155 "enum",
156 "emitter",
157 "weapon",
158 "ammo",
159 "explosion",
160 "animation",
161 "gang",
162 "file",
163 "sound",
164 "color",
165};
166
167SCRIPTS_API void Get_Script_Parameters(const char *script, DynamicVectorClass<ScriptParameter> &parameters);
168
169#endif