X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fturrets%2Fturret.qh;h=a66952833a10fe877c7ba2a806cc474da50be5ba;hb=b9671f63469586007314131f3f53728795c035cd;hp=e31d93fd2cbeace6c404fd91f840752f5f80d988;hpb=129cf6ae83fa24855423c8edec3ad2cb072cb4cd;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/turrets/turret.qh b/qcsrc/common/turrets/turret.qh index e31d93fd2..a66952833 100644 --- a/qcsrc/common/turrets/turret.qh +++ b/qcsrc/common/turrets/turret.qh @@ -1,16 +1,61 @@ #ifndef TURRET_H #define TURRET_H -// turret requests -const int TR_SETUP = 1; // (BOTH) setup turret data -const int TR_THINK = 2; // (SERVER) logic to run every frame -const int TR_DEATH = 3; // (SERVER) called when turret dies -const int TR_PRECACHE = 4; // (BOTH) precaches models/sounds used by this turret -const int TR_ATTACK = 5; // (SERVER) called when turret attacks -const int TR_CONFIG = 6; // (ALL) +#include -// functions: -entity get_turretinfo(int id); +CLASS(Turret, Object) + ATTRIB(Turret, m_id, int, 0) + + /** short name */ + ATTRIB(Turret, netname, string, string_null) + /** human readable name */ + ATTRIB(Turret, turret_name, string, _("Turret")) + /** currently a copy of the model */ + ATTRIB(Turret, mdl, string, string_null) + /** full name of model */ + ATTRIB(Turret, model, string, string_null) + /** full name of tur_head model */ + ATTRIB(Turret, head_model, string, string_null) + + ATTRIB(Turret, spawnflags, int, 0) + /** turret hitbox size */ + ATTRIB(Turret, mins, vector, '-0 -0 -0') + /** turret hitbox size */ + ATTRIB(Turret, maxs, vector, '0 0 0') + + METHOD(Turret, display, void(Turret this, void(string name, string icon) returns)) { + returns(this.turret_name, string_null); + } + /** (BOTH) setup turret data */ + METHOD(Turret, tr_setup, void(Turret this, entity it)) { + + } + /** (SERVER) logic to run every frame */ + METHOD(Turret, tr_think, void(Turret this, entity it)) { + + } + /** (SERVER) called when turret dies */ + METHOD(Turret, tr_death, void(Turret this, entity it)) { + + } + /** (BOTH) precaches models/sounds used by this turret */ + METHOD(Turret, tr_precache, void(Turret this)) { + + } + ATTRIB(Turret, m_weapon, Weapon, WEP_Null) +#ifdef SVQC + /** (SERVER) called when turret attacks */ + METHOD(Turret, tr_attack, void(Turret this, entity it)) { + Weapon w = this.m_weapon; + .entity weaponentity = weaponentities[0]; + w.wr_think(w, it, weaponentity, 1); + } +#endif + /** (ALL) */ + METHOD(Turret, tr_config, void(Turret this)) { + // TODO + } +ENDCLASS(Turret) // fields: .entity tur_head; @@ -132,42 +177,4 @@ const int TNSF_ANIM = 128; const int TNSF_FULL_UPDATE = 16777215; - -// other useful macros -#define TUR_ACTION(turrettype,mrequest) (get_turretinfo(turrettype)).turret_func(mrequest) -#define TUR_NAME(turrettype) (get_turretinfo(turrettype)).turret_name - -float t_null(float dummy) { return 0; } - -CLASS(Turret, Object) - ATTRIB(Turret, m_id, int, 0) - - ATTRIB(Turret, turretid, int, 0) - /** short name */ - ATTRIB(Turret, netname, string, string_null) - /** human readable name */ - ATTRIB(Turret, turret_name, string, string_null) - /** t_... */ - ATTRIB(Turret, turret_func, float(float), t_null) - /** currently a copy of the model */ - ATTRIB(Turret, mdl, string, string_null) - /** full name of model */ - ATTRIB(Turret, model, string, string_null) - /** full name of tur_head model */ - ATTRIB(Turret, head_model, string, string_null) - /** TODO: deprecate! */ - ATTRIB(Turret, cvar_basename, string, string_null) - - ATTRIB(Turret, spawnflags, int, 0) - /** turret hitbox size */ - ATTRIB(Turret, mins, vector, '-0 -0 -0') - /** turret hitbox size */ - ATTRIB(Turret, maxs, vector, '0 0 0') - - METHOD(Turret, display, void(entity this, void(string name, string icon) returns)) { - returns(this.turret_name, string_null); - } - -ENDCLASS(Turret) - #endif