Tiberian Technologies Scripts Reference Revision: 9000
Loading...
Searching...
No Matches
gmplugin.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 TT_INCLUDE_GMPLUGIN_H
13#define TT_INCLUDE_GMPLUGIN_H
14#include "scripts.h"
15#include "engine.h"
16#define INTERFACE_VERSION 4.8f
17
18enum EventType {
19 EVENT_GLOBAL_INI = 0,
20 EVENT_MAP_INI,
21 EVENT_CHAT_HOOK,
22 EVENT_OBJECT_CREATE_HOOK,
23 EVENT_LOAD_LEVEL_HOOK,
24 EVENT_GAME_OVER_HOOK,
25 EVENT_PLAYER_JOIN_HOOK,
26 EVENT_PLAYER_LEAVE_HOOK,
27 EVENT_REFILL_HOOK,
28 EVENT_POWERUP_PURCHASE_HOOK,
29 EVENT_VEHICLE_PURCHASE_HOOK,
30 EVENT_CHARACTER_PURCHASE_HOOK,
31 EVENT_THINK_HOOK,
32 EVENT_RADIO_HOOK,
33 EVENT_STOCK_DAMAGE_HOOK,
34 EVENT_TT_DAMAGE_HOOK,
35 EVENT_PRE_LOAD_LEVEL_HOOK,
36 EVENT_DIALOG_HOOK,
37 EVENT_COUNT
38};
39
40class Plugin {
41public:
42 virtual ~Plugin() {};
43 virtual float Get_Version() {return INTERFACE_VERSION;} //returns the version of the SSGM interface this plugin is intended to work with
44 virtual void OnLoadGlobalINISettings(INIClass *SSGMIni) {}; //called when ssgm.ini is parsed to read global settings
45 virtual void OnFreeData() {}; //called when data allocated for global settings is freed (i.e. on shutdown and before global settings are re-loaded)
46 virtual void OnLoadMapINISettings(INIClass *SSGMIni) {}; //called when ssgm.ini is parsed to read per-map settings
47 virtual void OnFreeMapData() {}; //called when data allocated for per-map settings is freed (i.e. on shutdown and before per-map settings are re-loaded)
48 virtual bool OnChat(int PlayerID,TextMessageEnum Type,const wchar_t *Message,int recieverID) {return true;}; //called on chat message
49 virtual void OnObjectCreate(void *data,GameObject *obj) {}; //called on object create
50 virtual void OnLoadLevel() {}; //called on level load
51 virtual void OnGameOver() {}; //called on game over
52 virtual void OnPlayerJoin(int PlayerID,const char *PlayerName) {}; //called on player join
53 virtual void OnPlayerLeave(int PlayerID) {}; //called on player leave
54 virtual bool OnRefill(GameObject *purchaser) {return true;}; //called on refill
55 virtual PurchaseStatus OnPowerupPurchase(BaseControllerClass *base,GameObject *purchaser,unsigned int cost,unsigned int preset,const char *data) {return PurchaseStatus_Allow;}; //called on beacon purchase
56 virtual PurchaseStatus OnVehiclePurchase(BaseControllerClass *base,GameObject *purchaser,unsigned int cost,unsigned int preset,const char *data) {return PurchaseStatus_Allow;}; //called on vehicle purchase
57 virtual PurchaseStatus OnCharacterPurchase(BaseControllerClass *base,GameObject *purchaser,unsigned int cost,unsigned int preset,const char *data) {return PurchaseStatus_Allow;}; //called on character purchase
58 virtual void OnThink() {}; //called once per frame
59 virtual bool OnRadioCommand(int PlayerType, int PlayerID, int AnnouncementID, int IconID, AnnouncementEnum AnnouncementType) {return true;} //called on radio command
60 virtual bool OnStockDamage(PhysicalGameObj* damager, PhysicalGameObj* target, float damage, uint warheadId) { return true; } //called on damage from clients with version <4.0
61 virtual bool OnTtDamage(PhysicalGameObj* damager, PhysicalGameObj* target, const AmmoDefinitionClass* ammo, const char* bone) { return true; } //called on damage from clients with version >=4.0
62 virtual void OnPreLoadLevel() {}; //called on level load but before the client is sent any network updates
63 virtual void OnDialog(int PlayerID, int DialogID, int ControlID, DialogMessageType MessageType) {}; //called on a dialog notification from client
64};
65
66typedef Plugin *(*Plugin_Init_Type) ();
67typedef void (*Plugin_Shutdown_Type) ();
68
69#endif