check_unacceptable_compiler_bugs();
#ifdef WATERMARK
- print(sprintf(_("^4CSQC Build information: %s\n"), WATERMARK()));
+ print(sprintf(_("^4CSQC Build information: ^1%s\n"), WATERMARK()));
#endif
float i;
registercmd("hud_save");
//registercmd("menu_action");
- registercmd("+button3");
- registercmd("-button3");
- registercmd("+button4");
- registercmd("-button4");
registercmd("+showscores");registercmd("-showscores");
registercmd("+showaccuracy");registercmd("-showaccuracy");
GibSplash_Precache();
Casings_Precache();
DamageInfo_Precache();
+ turrets_precache();
if(autocvar_cl_announcer != cl_announcer_prev) {
Announcer_Precache();
if(cl_announcer_prev)
minimapname = strzone(minimapname);
WarpZone_Init();
+
hud_configure_prev = -1;
+ tab_panel = -1;
}
// CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)
if(camera_active)
cvar_set("chase_active",ftos(chase_active_backup));
+ // unset the event chasecam's chase_active
+ if(autocvar_chase_active < 0)
+ cvar_set("chase_active", "0");
+
if not(isdemo())
{
if not(calledhooks & HOOK_START)
else
HUD_Panel_ExportCfg(argv(1));
return true;
- } else if(strCmd == "+button4") { // zoom
- // return false, because the message shall be sent to the server anyway (for demos/speccing)
- if(ignore_plus_zoom)
- {
- --ignore_plus_zoom;
- return false;
- }
- button_zoom = 1;
- return true;
- } else if(strCmd == "-button4") { // zoom
- if(ignore_minus_zoom)
- {
- --ignore_minus_zoom;
- return false;
- }
- button_zoom = 0;
- return true;
- } else if(strCmd == "+button3") { // secondary
- button_attack2 = 1;
- return false;
- } else if(strCmd == "-button3") { // secondary
- button_attack2 = 0;
- return false;
} else if(strCmd == "+showscores") {
scoreboard_showscores = true;
return true;
vote_prev = 0;
cvar_set("cl_allow_uid2name", "1");
vote_change = -9999;
+ uid2name_dialog = 0;
}
else
{
vote_prev = 0;
cvar_set("cl_allow_uid2name", "0");
vote_change = -9999;
+ uid2name_dialog = 0;
}
else
{
// --------------------------------------------------------------------------
// BEGIN OPTIONAL CSQC FUNCTIONS
+ void Ent_RemoveEntCS()
+ {
+ entcs_receiver[self.sv_entnum] = world;
+ }
void Ent_ReadEntCS()
{
+ float sf;
InterpolateOrigin_Undo();
self.classname = "entcs_receiver";
- self.sv_entnum = ReadByte() - 1;
- self.origin_x = ReadShort();
- self.origin_y = ReadShort();
- self.origin_z = ReadShort();
- self.angles_y = ReadByte() * 360.0 / 256;
- self.origin_z = self.angles_x = self.angles_z = 0;
+ sf = ReadByte();
+
+ if(sf & 1)
+ self.sv_entnum = ReadByte();
+ if(sf & 2)
+ {
+ self.origin_x = ReadShort();
+ self.origin_y = ReadShort();
+ self.origin_z = ReadShort();
+ }
+ if(sf & 4)
+ {
+ self.angles_y = ReadByte() * 360.0 / 256;
+ self.angles_x = self.angles_z = 0;
+ }
+ if(sf & 8)
+ self.healthvalue = ReadByte() * 10;
+ if(sf & 16)
+ self.armorvalue = ReadByte() * 10;
+
+ entcs_receiver[self.sv_entnum] = self;
+ self.entremove = Ent_RemoveEntCS;
InterpolateOrigin_Note();
}
#ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
if(!isNew && n != self.sv_entnum)
{
- print(_("A CSQC entity changed its owner!\n"));
+ //print(_("A CSQC entity changed its owner!\n"));
+ print(sprintf(_("A CSQC entity changed its owner! (edict: %d, classname: %s)\n"), num_for_edict(self), self.classname));
isNew = true;
Ent_Remove();
self.enttype = ENT_CLIENT_SCORES;
HUD_UpdateTeamPos(o);
}
- void Net_Reset()
- {
- }
-
void Ent_ClientData()
{
float f;
race_laptime = 0;
race_checkpointtime = 0;
}
+ if (autocvar_hud_panel_healtharmor_progressbar_gfx)
+ {
+ if ( (spectatee_status == -1 && newspectatee_status > 0) //before observing, now spectating
+ || (spectatee_status > 0 && newspectatee_status > 0 && spectatee_status != newspectatee_status) //changed spectated player
+ )
+ prev_p_health = -1;
+ else if(spectatee_status && !newspectatee_status) //before observing/spectating, now playing
+ prev_health = -1;
+ }
spectatee_status = newspectatee_status;
}
nags = ReadByte();
+ if(!(nags & 4))
+ {
+ if(vote_called_vote)
+ strunzone(vote_called_vote);
+ vote_called_vote = string_null;
+ }
+
if(nags & 128)
{
if(vote_called_vote)
if(self.enttype)
if(t != self.enttype)
{
- print(_("A CSQC entity changed its type!\n"));
+ //print(_("A CSQC entity changed its type!\n"));
+ print(sprintf(_("A CSQC entity changed its type! (edict: %d, classname: %s)\n"), num_for_edict(self), self.classname));
Ent_Remove();
bIsNewEntity = 1;
}
case ENT_CLIENT_TUBANOTE: Ent_TubaNote(bIsNewEntity); break;
case ENT_CLIENT_WARPZONE: WarpZone_Read(bIsNewEntity); break;
case ENT_CLIENT_WARPZONE_CAMERA: WarpZone_Camera_Read(bIsNewEntity); break;
+ case ENT_CLIENT_WARPZONE_TELEPORTED: WarpZone_Teleported_Read(bIsNewEntity); break;
case ENT_CLIENT_TRIGGER_MUSIC: Ent_ReadTriggerMusic(); break;
case ENT_CLIENT_HOOK: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_HOOK); break;
case ENT_CLIENT_LGBEAM: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_LGBEAM); break;
case ENT_CLIENT_GAUNTLET: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_GAUNTLET); break;
case ENT_CLIENT_ACCURACY: Ent_ReadAccuracy(); break;
+ case ENT_CLIENT_TURRET: ent_turret(); break;
default:
- error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), self.enttype));
+ //error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), self.enttype));
+ error(sprintf(_("Unknown entity type in CSQC_Ent_Update (enttype: %d, edict: %d, classname: %s)\n"), self.enttype, num_for_edict(self), self.classname));
break;
}
void Gamemode_Init()
{
- if(gametype == GAME_ONSLAUGHT) {
- print(strcat("Using ", minimapname, " as minimap.\n"));
- precache_pic("gfx/ons-cp-neutral.tga");
- precache_pic("gfx/ons-cp-red.tga");
- precache_pic("gfx/ons-cp-blue.tga");
- precache_pic("gfx/ons-frame.tga");
- precache_pic("gfx/ons-frame-team.tga");
- }
-
if not(isdemo())
{
localcmd("\n_cl_hook_gamestart ", GametypeNameFromType(gametype), "\n");
g_balance_electro_secondary_bouncestop = ReadCoord();
nex_scope = !ReadByte();
- sniperrifle_scope = !ReadByte();
+ rifle_scope = !ReadByte();
serverflags = ReadByte();
minelayer_maxmines = ReadByte();
+ hagar_maxrockets = ReadByte();
+
g_trueaim_minrange = ReadCoord();
if(!postinit)
string keys;
float n, j, k, l;
- if (!hud_showbinds)
+ if (!autocvar_hud_showbinds)
return text;
keys = db_get(binddb, command);
keys = strcat(keys, ", ", keynumtostring(k));
++l;
- if (hud_showbinds_limit > 0 && hud_showbinds_limit >= l) break;
+ if (autocvar_hud_showbinds_limit > 0 && autocvar_hud_showbinds_limit >= l) break;
}
}
}
if ("" == keys) {
- if (hud_showbinds > 1)
+ if (autocvar_hud_showbinds > 1)
return sprintf(_("%s (not bound)"), text);
else
return text;
}
- else if (hud_showbinds > 1)
+ else if (autocvar_hud_showbinds > 1)
return sprintf(_("%s (%s)"), text, keys);
else
return keys;
prandom.qh
bgmscript.qh
noise.qh
-
+ teamplay.qh
+tturrets.qh
+../server/tturrets/include/turrets_early.qh
main.qh
sortlist.qc
ctf.qc
teamradar.qc
+ hud_config.qc
hud.qc
scoreboard.qc
mapvoting.qc
target_music.qc
//vehicles/spiderbot.qc
-
+ shownames.qh
+ shownames.qc
Main.qc
View.qc
interpolate.qc
../warpzonelib/mathlib.qc
../warpzonelib/common.qc
../warpzonelib/client.qc
+tturrets.qc
../common/if-this-file-errors-scroll-up-and-fix-the-warnings.fteqccfail
--- /dev/null
- remove(self.tur_head);
+void turrets_precache()
+{
+ precache_model ("models/turrets/ewheel-base2.md3");
+ precache_model ("models/turrets/ewheel-gun1.md3");
+ precache_model ("models/turrets/base.md3");
+ precache_model ("models/turrets/flac.md3");
+ precache_model ("models/turrets/reactor.md3");
+ precache_model ("models/turrets/hellion.md3");
+ precache_model ("models/turrets/hk.md3");
+ precache_model ("models/turrets/machinegun.md3");
+ precache_model ("models/turrets/mlrs.md3");
+ precache_model ("models/turrets/phaser.md3");
+ precache_model ("models/turrets/phaser_beam.md3");
+ precache_model ("models/turrets/plasma.md3");
+ precache_model ("models/turrets/plasmad.md3");
+ precache_model ("models/turrets/tesla_head.md3");
+ precache_model ("models/turrets/tesla_base.md3");
+ precache_model ("models/turrets/walker_head_minigun.md3");
+ precache_model ("models/turrets/walker_body.md3");
+ precache_model ("models/turrets/walker_props.md3");
+ precache_model ("models/turrets/walker_spawn.md3");
+ precache_model ("models/turrets/rocket.md3");
+
+ precache_sound ("turrets/phaser.wav");
+ precache_sound ("weapons/rocket_impact.wav");
+ precache_sound ("weapons/uzi_fire.wav");
+}
+
+//.entity tur_base;
+void turret_remove()
+{
++ entity th;
+ dprint("Removing turret type ", ftos(self.turret_type), "\n");
- if(sf & TNSF_FAR)
- {
- self.tur_head.move_angles_x = ReadShort();
- self.tur_head.move_angles_y = ReadShort();
- }
- else
- {
- self.tur_head.move_angles_x = ReadAngle();
- self.tur_head.move_angles_y = ReadAngle();
- }
++ th = self.tur_head;
+ self.tur_head = world;
++ remove(th);
+}
+
+void turret_changeteam()
+{
+ self.colormod = '0 0 0';
+ switch(self.team)
+ {
+ case COLOR_TEAM1: // Red
+ self.colormod = '2 0.5 0.5';
+ break;
+
+ case COLOR_TEAM2: // Blue
+ self.colormod = '0.5 0.5 2';
+ break;
+
+ case COLOR_TEAM3: // Yellow
+ self.colormod = '1.4 1.4 0.6';
+ break;
+
+ case COLOR_TEAM4: // Pink
+ self.colormod = '1.4 0.6 1.4';
+ break;
+ }
+
+ self.tur_head.colormod = self.colormod;
+}
+
+void turret_head_draw()
+{
+ float dt;
+ dt = time - self.move_time;
+ self.move_time = time;
+ if(dt <= 0)
+ return;
+
+ self.angles += dt * self.move_avelocity;
+ self.drawmask = MASK_NORMAL;
+}
+
+void turret_draw()
+{
+ //float dt;
+
+ if (self.health < 127)
+ if(random() < 0.25)
+ te_spark(self.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
+
+ self.drawmask = MASK_NORMAL;
+}
+
+//void(entity e, entity tagentity, string tagname) setattachment = #443;
+void turret_construct()
+{
+ string sbase, shead;
+ vector _min, _max;
+
+ if(self.tur_head == world)
+ self.tur_head = spawn();
+
+ sbase = "models/turrets/base.md3";
+ _min = '-32 -32 0';
+ _max = '32 32 64';
+
+ switch(self.turret_type)
+ {
+ case TID_EWHEEL:
+ sbase = "models/turrets/ewheel-base2.md3";
+ shead = "models/turrets/ewheel-gun1.md3";
+ break;
+ case TID_FLAC:
+ shead = "models/turrets/flac.md3";
+ break;
+ case TID_FUSION:
+ shead = "models/turrets/reactor.md3";
+ _min = '-34 -34 0';
+ _max = '34 34 90';
+ break;
+ case TID_HELLION:
+ shead = "models/turrets/hellion.md3";
+ break;
+ case TID_HK:
+ shead = "models/turrets/hk.md3";
+ break;
+ case TID_MACHINEGUN:
+ shead = "models/turrets/machinegun.md3";
+ break;
+ case TID_MLRS:
+ shead = "models/turrets/mlrs.md3";
+ break;
+ case TID_PHASER:
+ shead = "models/turrets/phaser.md3";
+ break;
+ case TID_PLASMA:
+ shead = "models/turrets/plasma.md3";
+ break;
+ case TID_PLASMA_DUAL:
+ shead = "models/turrets/plasmad.md3";
+ break;
+ case TID_TESLA:
+ sbase = "models/turrets/tesla_base.md3";
+ shead = "models/turrets/tesla_head.md3";
+ _min = '-60 -60 0';
+ _max ='60 60 128';
+ break;
+ case TID_WALKER:
+ sbase = "models/turrets/walker_body.md3";
+ shead = "models/turrets/walker_head_minigun.md3";
+ _min = '-70 -70 0';
+ _max = '70 70 95';
+ break;
+ }
+
+ setorigin(self, self.origin);
+
+ self.tur_head.classname = "turret_head";
+ self.tur_head.owner = self;
+
+ setmodel(self, sbase);
+ setmodel(self.tur_head, shead);
+
+ self.tur_head.move_movetype = MOVETYPE_NOCLIP;
+ self.move_movetype = MOVETYPE_NOCLIP;
+
+ setsize(self, _min, _max);
+ setsize(self.tur_head, '0 0 0', '0 0 0');
+
+ setorigin(self.tur_head, gettaginfo(self, gettagindex(self, "tag_head")));
+ self.health = 255;
+ self.solid = SOLID_BBOX;
+ self.tur_head.solid = SOLID_NOT;
+ self.movetype = MOVETYPE_NOCLIP;
+ self.tur_head.movetype = MOVETYPE_NOCLIP;
+ self.draw = turret_draw;
+ self.tur_head.draw = turret_head_draw;
+ self.entremove = turret_remove;
+}
+
+void ent_turret()
+{
+ float sf;
+ sf = ReadByte();
+
+ if(sf & TNSF_SETUP)
+ {
+ self.turret_type = ReadByte();
+ dprint("Constructing turret type ", ftos(self.turret_type), "\n");
+
+ self.origin_x = ReadCoord();
+ self.origin_y = ReadCoord();
+ self.origin_z = ReadCoord();
+
+ self.angles_x = ReadAngle();
+ self.angles_y = ReadAngle();
+
+ turret_construct();
+ }
+
+ if(sf & TNSF_ANG)
+ {
- if(sf & TNSF_FAR)
- {
- self.tur_head.move_avelocity_x = ReadShort();
- self.tur_head.move_avelocity_y = ReadShort();
- }
- else
- {
- self.tur_head.move_avelocity_x = ReadAngle();
- self.tur_head.move_avelocity_y = ReadAngle();
- }
++ self.tur_head.move_angles_x = ReadShort();
++ self.tur_head.move_angles_y = ReadShort();
+ self.tur_head.angles = self.angles + self.tur_head.move_angles;
+ }
+
+ if(sf & TNSF_AVEL)
+ {
- }
++ self.tur_head.move_avelocity_x = ReadShort();
++ self.tur_head.move_avelocity_y = ReadShort();
+ }
+
+ if(sf & TNSF_STATUS)
+ {
+ float _team;
+ _team = ReadByte();
+ _team -= 1; // /&)=(%&#)&%)/#&)=½!!!½!!". thanks.
+ self.health = ReadByte();
+ if(_team != self.team)
+ {
+ self.team = _team;
+ turret_changeteam();
+ }
+ }
++}
// Comment out below to skip turrets
#define TTURRETS_ENABLED
+//#define TTURRETS_CSQC
#ifdef TTURRETS_ENABLED
-
-#message "with tZork turrets"
+#ifdef SVQC
+//#message "with tZork turrets"
float turret_count;
.vector tur_shotdir_updated;
void turrets_precash();
-
-
+#endif // SVQC
+
+// common
+.float turret_type;
+float TID_EWHEEL = 1;
+float TID_FLAC = 2;
+float TID_FUSION = 3;
+float TID_HELLION = 4;
+float TID_HK = 5;
+float TID_MACHINEGUN = 6;
+float TID_MLRS = 7;
+float TID_PHASER = 8;
+float TID_PLASMA = 9;
+float TID_PLASMA_DUAL = 10;
+float TID_TESLA = 11;
+float TID_WALKER = 12;
+float TID_LAST = 12;
+
+float TNSF_UPDATE = 2;
+float TNSF_STATUS = 4;
+float TNSF_SETUP = 8;
+float TNSF_ANG = 16;
+float TNSF_AVEL = 32;
- float TNSF_FAR = 64;
+float TNSF_FULL_UPDATE = 16777215;
#endif // TTURRETS_ENABLED
self.ammo = self.ammo_max;
self.nextthink = time + self.ticrate;
- self.think = turret_think;
+
+ if(self.SendEntity)
+ {
+ self.SendFlags = TNSF_FULL_UPDATE;
+ self.think = turret_link; // CSQC?
+ }
+
+ else
+ self.think = turret_think; // Or not?
if (self.turret_respawnhook)
self.turret_respawnhook();
if not (self.tur_active)
return;
- if (teams_matter)
+ if (teamplay)
if (self.team == attacker.team)
{
// This does not happen anymore. Re-enable if you fix that.
{
self.tur_head.angles_x = self.tur_head.angles_x + (-0.5 + random()) * damage;
self.tur_head.angles_y = self.tur_head.angles_y + (-0.5 + random()) * damage;
+
+ if(self.SendEntity)
+ self.SendFlags |= TNSF_ANG;
+
}
if (self.turrcaps_flags & TFL_TURRCAPS_MOVE)
self.nextthink = time;
self.think = turret_stdproc_die;
}
+
+ // CSQC
+ if(self.SendEntity)
+ self.SendFlags |= TNSF_STATUS;
+
}
#define cvar_base "g_turrets_unit_"
-/*
-float turret_customizeentityforclient()
-{
-}
-
-float Turret_SendEntity(entity to, float sf)
+float turret_send(entity to, float sf)
{
- float dist;
- dist = vlen(self.origin - to.origin);
- if(dist > 1024) // When far away, write angles/avelocity as short insted of angle.
- sf |= TNSF_FAR;
-
-
WriteByte(MSG_ENTITY, ENT_CLIENT_TURRET);
- WriteCoord(MSG_ENTITY, self.tur_head.angles_x);
- WriteCoord(MSG_ENTITY, self.tur_head.angles_y);
- WriteByte(MSG_ENTITY, self.tur_head.frame);
-
- //WriteCoord(MSG_ENTITY, self.tur_head.angles_z);
-
+
+ WriteByte(MSG_ENTITY, sf);
+ if(sf & TNSF_SETUP)
+ {
+ WriteByte(MSG_ENTITY, self.turret_type);
+
+ WriteCoord(MSG_ENTITY, self.origin_x);
+ WriteCoord(MSG_ENTITY, self.origin_y);
+ WriteCoord(MSG_ENTITY, self.origin_z);
+
+ WriteAngle(MSG_ENTITY, self.angles_x);
+ WriteAngle(MSG_ENTITY, self.angles_y);
+ }
+
+ if(sf & TNSF_ANG)
+ {
- if(sf & TNSF_FAR)
- {
- WriteShort(MSG_ENTITY, rint(self.tur_head.angles_x));
- WriteShort(MSG_ENTITY, rint(self.tur_head.angles_y));
- }
- else
- {
- WriteAngle(MSG_ENTITY, self.tur_head.angles_x);
- WriteAngle(MSG_ENTITY, self.tur_head.angles_y);
- }
++ WriteShort(MSG_ENTITY, rint(self.tur_head.angles_x));
++ WriteShort(MSG_ENTITY, rint(self.tur_head.angles_y));
+ }
+
+ if(sf & TNSF_AVEL)
+ {
- if(sf & TNSF_FAR)
- {
- WriteShort(MSG_ENTITY, rint(self.tur_head.avelocity_x));
- WriteShort(MSG_ENTITY, rint(self.tur_head.avelocity_y));
- }
- else
- {
- WriteAngle(MSG_ENTITY, self.tur_head.avelocity_x);
- WriteAngle(MSG_ENTITY, self.tur_head.avelocity_y);
- }
++ WriteShort(MSG_ENTITY, rint(self.tur_head.avelocity_x));
++ WriteShort(MSG_ENTITY, rint(self.tur_head.avelocity_y));
+ }
+
+ if(sf & TNSF_STATUS)
+ {
+ WriteByte(MSG_ENTITY, self.team);
+ WriteByte(MSG_ENTITY, rint((self.health / self.tur_health) * 255)); // Send health as 0-255 insted of real value, where 255 = 100%
+ }
+
return TRUE;
}
-*/
void load_unit_settings(entity ent, string unitname, float is_reload)
{
self.tur_dist_impact_to_aimpos = 0;
else
self.tur_dist_impact_to_aimpos = vlen(trace_endpos - self.tur_aimpos);
-
-
}
else
tracebox(self.tur_shotorg, '-1 -1 -1','1 1 1', self.tur_shotorg + (self.tur_shotdir_updated * self.tur_dist_aimpos),MOVE_NORMAL,self);
** Handles head rotation according to
** the units .track_type and .track_flags
**/
+.float turret_framecounter;
void turret_stdproc_track()
{
vector target_angle; // This is where we want to aim
vector move_angle; // This is where we can aim
float f_tmp;
-
+ vector v1, v2;
+ v1 = self.tur_head.angles;
+ v2 = self.tur_head.avelocity;
+
if (self.track_flags == TFL_TRACK_NO)
return;
if(self.tur_head.angles_y < -self.aim_maxrot)
self.tur_head.angles_y = self.aim_maxrot;
}
-
+
+ // CSQC
+ if(self.SendEntity)
+ self.SendFlags = TNSF_ANG;
+
return;
case TFL_TRACKTYPE_FLUIDINERTIA:
{
self.tur_head.avelocity_x = 0;
self.tur_head.angles_x = self.aim_maxpitch;
+
+ if(self.SendEntity)
+ self.SendFlags |= TNSF_ANG;
}
if((self.tur_head.angles_x + self.tur_head.avelocity_x * self.ticrate) < -self.aim_maxpitch)
{
self.tur_head.avelocity_x = 0;
self.tur_head.angles_x = -self.aim_maxpitch;
+
+ if(self.SendEntity)
+ self.SendFlags |= TNSF_ANG;
}
}
{
self.tur_head.avelocity_y = 0;
self.tur_head.angles_y = self.aim_maxrot;
+
+ if(self.SendEntity)
+ self.SendFlags |= TNSF_ANG;
}
if((self.tur_head.angles_y + self.tur_head.avelocity_y * self.ticrate) < -self.aim_maxrot)
{
self.tur_head.avelocity_y = 0;
self.tur_head.angles_y = -self.aim_maxrot;
+
+ if(self.SendEntity)
+ self.SendFlags |= TNSF_ANG;
}
}
+
+ if(self.SendEntity)
+ {
+ self.SendFlags |= TNSF_AVEL;
+
+ // Push a angle update every 10'th frame
+ self.turret_framecounter += 1;
+ if(self.turret_framecounter >= 10)
+ {
+ self.SendFlags |= TNSF_ANG;
+ self.turret_framecounter = 0;
+ }
+ }
}
entity e;
self.nextthink = time + self.ticrate;
-
+ //self.SendFlags = TNSF_UPDATE | TNSF_STATUS | TNSF_ANG | TNSF_AVEL;
+
// ONS uses somewhat backwards linking.
- if (teams_matter)
+ if (teamplay)
{
if not (g_onslaught)
if (self.target)
if not (self.spawnflags & TSF_NO_AMMO_REGEN)
if (self.ammo < self.ammo_max)
self.ammo = min(self.ammo + self.ammo_recharge, self.ammo_max);
-
- if (self.health < (self.tur_health * 0.5))
- if(random() < 0.25)
- te_spark(self.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
// Inactive turrets needs to run the think loop,
// So they can handle animation and wake up if need be.
void turret_link()
{
- //Net_LinkEntity(self, FALSE, 0, Turret_SendEntity);
+ Net_LinkEntity(self, TRUE, 0, turret_send);
self.think = turret_think;
self.nextthink = time;
++ self.tur_head.effects = EF_NODRAW;
}
void turrets_manager_think()
* (unless you have a very good reason not to)
* if the return value is 0, the turret should be removed.
*/
-float turret_stdproc_init (string cvar_base_name, float csqc_shared, string base, string head)
+float turret_stdproc_init (string cvar_base_name, float csqc_shared, string base, string head, float _turret_type)
{
entity e, ee;
// Are turrets allowed?
if (autocvar_g_turrets == 0)
return 0;
-
-
+
+ if(_turret_type < 1 || _turret_type > TID_LAST)
+ {
+ dprint("Invalid / Unkown turret type\"", ftos(_turret_type), "\", aborting!\n");
+ return 0;
+ }
+ self.turret_type = _turret_type;
+
e = find(world, classname, "turret_manager");
if not (e)
{
e.think = turrets_manager_think;
e.nextthink = time + 2;
}
-
+#ifndef TTURRETS_CSQC
+ csqc_shared = 0;
+#endif
+ /*
if(csqc_shared)
{
dprint("WARNING: turret requested csqc_shared but this is not implemented. Expect strange things to happen.\n");
csqc_shared = 0;
}
-
+ */
+
if not (self.spawnflags & TSF_SUSPENDED)
droptofloor_builtin();
// Terrainbase spawnflag. This puts a enlongated model
// under the turret, so it looks ok on uneaven surfaces.
+ /* TODO: Handle this with CSQC
if (self.spawnflags & TSF_TERRAINBASE)
{
entity tb;
setorigin(tb,self.origin);
tb.solid = SOLID_BBOX;
}
+ */
self.cvar_basename = cvar_base_name;
- load_unit_settings(self,self.cvar_basename, 0);
+ load_unit_settings(self, self.cvar_basename, 0);
// Handle turret teams.
if (autocvar_g_assault != 0)
if not (self.team)
self.team = 14; // Assume turrets are on the defending side if not explicitly set otehrwize
}
- else if not (teams_matter)
+ else if not (teamplay)
self.team = MAX_SHOT_DISTANCE; // Group all turrets into the same team, so they dont kill eachother.
else if(g_onslaught && self.targetname)
{
self.use = turret_stdproc_use;
self.bot_attack = TRUE;
- // Initiate the main AI loop
- if(csqc_shared)
- self.think = turret_link;
- else
- self.think = turret_think;
-
++turret_count;
self.nextthink = time + 1;
self.nextthink += turret_count * sys_frametime;
activator = ee;
self.use();
}
-
+
+ Net_LinkEntity(self, TRUE, 0, turret_send);
turret_stdproc_respawn();
+
+ // Initiate the main AI loop
+ /*self.nextthink = time;
+ if(csqc_shared)
+ self.think = turret_link;
+ else
+ self.think = turret_think;
+ */
return 1;
}