case ENT_CLIENT_AUXILIARYXHAIR: Net_AuXair2(bIsNewEntity); break;
case ENT_CLIENT_TURRET: ent_turret(); break;
case ENT_CLIENT_MONSTER: ent_monster(); break;
- case ENT_CLIENT_GENERATOR: ent_td_generator(); break;
+ case ENT_CLIENT_GENERATOR: ent_generator(); break;
case ENT_CLIENT_MODEL: CSQCModel_Read(bIsNewEntity); break;
case ENT_CLIENT_ITEM: ItemRead(bIsNewEntity); break;
case ENT_CLIENT_BUMBLE_RAYGUN: bumble_raygun_read(bIsNewEntity); break;
self.health = _tmp;
}
}
-
-void td_generator_precache()
-{
- precache_model("models/onslaught/generator.md3");
- precache_model("models/onslaught/generator_dead.md3");
- precache_sound("onslaught/generator_underattack.wav");
-}
-
-void td_generator_die()
-{
- setmodel(self, "models/onslaught/generator_dead.md3");
- pointparticles(particleeffectnum("explosion_medium"), self.origin, '0 0 0', 1);
-}
-
-void td_generator_draw() { } // TODO
-
-void td_generator_construct()
-{
- self.netname = "Generator";
-
- setorigin(self, self.origin);
- setmodel(self, "models/onslaught/generator.md3");
- setsize(self, GENERATOR_MIN, GENERATOR_MAX);
-
- self.move_movetype = MOVETYPE_NOCLIP;
- self.health = 255;
- self.solid = SOLID_BBOX;
- self.movetype = MOVETYPE_NOCLIP;
- self.move_origin = self.origin;
- self.move_time = time;
- self.drawmask = MASK_NORMAL;
- self.alpha = 1;
- self.draw = td_generator_draw;
-}
-
-void ent_td_generator()
-{
- float sf;
- sf = ReadByte();
-
- if(sf & MSF_SETUP)
- {
- self.origin_x = ReadCoord();
- self.origin_y = ReadCoord();
- self.origin_z = ReadCoord();
- setorigin(self, self.origin);
-
- td_generator_precache();
- td_generator_construct();
- self.colormap = 1024;
- self.glowmod = '1 1 0';
- }
-
- if(sf & MSF_STATUS)
- {
- float _tmp = ReadByte();
-
- if(_tmp == 0 && self.health != 0)
- td_generator_die();
-
- self.health = _tmp;
- }
-}
-
void ent_monster();
void Monsters_Precache();
-void ent_td_generator();
monsters.qh
../server/monsters/lib/monsters_early.qh
../server/movelib.qc
+../server/generator.qh
main.qh
vehicles/vehicles.qh
../common/csqcmodel_settings.qh
../warpzonelib/client.qc
tturrets.qc
+../server/generator.qc
+
../server/monsters/monsters.qh
monsters.qc
--- /dev/null
+#ifdef CSQC
+void generator_precache()
+{
+ precache_model("models/onslaught/generator.md3");
+ precache_model("models/onslaught/generator_dead.md3");
+ precache_sound("onslaught/generator_underattack.wav");
+}
+
+void generator_die()
+{
+ setmodel(self, "models/onslaught/generator_dead.md3");
+}
+
+void generator_draw() { } // TODO
+
+void generator_construct()
+{
+ self.netname = "Generator";
+
+ setorigin(self, self.origin);
+ setmodel(self, "models/onslaught/generator.md3");
+ setsize(self, GENERATOR_MIN, GENERATOR_MAX);
+
+ self.move_movetype = MOVETYPE_NOCLIP;
+ self.health = 255;
+ self.solid = SOLID_BBOX;
+ self.movetype = MOVETYPE_NOCLIP;
+ self.move_origin = self.origin;
+ self.move_time = time;
+ self.drawmask = MASK_NORMAL;
+ self.alpha = 1;
+ self.draw = generator_draw;
+}
+
+.vector glowmod;
+void generator_changeteam()
+{
+ switch(self.team - 1)
+ {
+ case NUM_TEAM_1: // Red
+ {
+ self.glowmod = '2 0 0';
+ self.teamradar_color = '1 0 0';
+ break;
+ }
+ case NUM_TEAM_2: // Blue
+ {
+ self.glowmod = '0 0 2';
+ self.teamradar_color = '0 0 1';
+ break;
+ }
+ case NUM_TEAM_3: // Yellow
+ {
+ self.glowmod = '1 1 0';
+ self.teamradar_color = '1 1 0';
+ break;
+ }
+ case NUM_TEAM_4: // Pink
+ {
+ self.glowmod = '1 0 1';
+ self.teamradar_color = '1 0 1';
+ break;
+ }
+ }
+
+ if(self.team)
+ self.colormap = 1024 + (self.team - 1) * 17;
+}
+
+void ent_generator()
+{
+ float sf;
+ sf = ReadByte();
+
+ if(sf & GSF_SETUP)
+ {
+ self.origin_x = ReadCoord();
+ self.origin_y = ReadCoord();
+ self.origin_z = ReadCoord();
+ setorigin(self, self.origin);
+
+ generator_precache();
+ generator_construct();
+ self.colormap = 1024;
+ self.glowmod = '1 1 0';
+ }
+
+ if(sf & GSF_STATUS)
+ {
+ float _tmp;
+ _tmp = ReadByte();
+ if(_tmp != self.team)
+ {
+ self.team = _tmp;
+ generator_changeteam();
+ }
+
+ _tmp = ReadByte();
+
+ if(_tmp == 0 && self.health != 0)
+ generator_die();
+
+ self.health = _tmp;
+ }
+}
+#endif // CSQC
+
+#ifdef SVQC
+float generator_send(entity to, float sf)
+{
+ WriteByte(MSG_ENTITY, ENT_CLIENT_GENERATOR);
+ WriteByte(MSG_ENTITY, sf);
+ if(sf & GSF_SETUP)
+ {
+ WriteCoord(MSG_ENTITY, self.origin_x);
+ WriteCoord(MSG_ENTITY, self.origin_y);
+ WriteCoord(MSG_ENTITY, self.origin_z);
+ }
+
+ if(sf & GSF_STATUS)
+ {
+ WriteByte(MSG_ENTITY, self.team);
+
+ if(self.health <= 0)
+ WriteByte(MSG_ENTITY, 0);
+ else
+ WriteByte(MSG_ENTITY, ceil((self.health / self.max_health) * 255));
+ }
+
+ return TRUE;
+}
+
+void generator_link(void() spawnproc)
+{
+ Net_LinkEntity(self, TRUE, 0, generator_send);
+ self.think = spawnproc;
+ self.nextthink = time;
+}
+#endif // SVQC
--- /dev/null
+#define GENERATOR_MIN '-52 -52 -14'
+#define GENERATOR_MAX '52 52 75'
+
+float GSF_STATUS = 4;
+float GSF_SETUP = 8;
+
+#ifdef CSQC
+void ent_generator();
+#endif
\ No newline at end of file
float MSF_FULL_UPDATE = 16777215;
-#define GENERATOR_MIN '-52 -52 -14'
-#define GENERATOR_MAX '52 52 75'
-
#endif // CSQC/SVQC
\ No newline at end of file
if(random() < damage/200+0.2)
if(random() < 0.5)
ons_throwgib(hitloc + '0 0 20', randomvec()*360, "models/onslaught/gen_gib1.md3", 5, FALSE);
+
+ self.SendFlags |= GSF_STATUS;
}
// update links after a delay
{
onslaught_updatelinks();
// now begin normal thinking
- self.think = onslaught_generator_think;
- self.nextthink = time;
+ generator_link(onslaught_generator_think);
+
+ self.SendFlags = GSF_SETUP;
}
string onslaught_generator_waypointsprite_for_team(entity e, float t)
self.movetype = MOVETYPE_NONE;
self.lasthealth = self.max_health = self.health = autocvar_g_onslaught_gen_health;
setmodel(self, "models/onslaught/generator.md3");
- setsize(self, '-52 -52 -14', '52 52 75');
+ setsize(self, GENERATOR_MIN, GENERATOR_MAX);
setorigin(self, self.origin);
self.takedamage = DAMAGE_AIM;
self.bot_attack = TRUE;
gendestroyed = TRUE;
+ pointparticles(particleeffectnum("explosion_medium"), self.origin, '0 0 0', 1);
+
Send_Notification(NOTIF_ALL, world, MSG_MULTI, MULTI_TD_GENDESTROYED);
self.solid = SOLID_NOT;
self.SendFlags |= MSF_STATUS;
}
-float td_generator_send(entity to, float sf)
-{
- WriteByte(MSG_ENTITY, ENT_CLIENT_GENERATOR);
- WriteByte(MSG_ENTITY, sf);
- if(sf & MSF_SETUP)
- {
- WriteCoord(MSG_ENTITY, self.origin_x);
- WriteCoord(MSG_ENTITY, self.origin_y);
- WriteCoord(MSG_ENTITY, self.origin_z);
- }
-
- if(sf & MSF_STATUS)
- {
- if(self.health <= 0)
- WriteByte(MSG_ENTITY, 0);
- else
- WriteByte(MSG_ENTITY, ceil((self.health / self.max_health) * 255));
- }
-
- return TRUE;
-}
-
void td_generator_think()
{
self.think = td_generator_think;
void td_generator_setup()
{
-
self.think = td_generator_think;
self.nextthink = time + 0.1;
WaypointSprite_UpdateHealth(self.sprite, self.health);
}
-void td_generator_link()
-{
- Net_LinkEntity(self, TRUE, 0, td_generator_send);
- self.think = td_generator_setup;
- self.nextthink = time;
-}
-
void spawnfunc_td_generator()
{
if not(g_td) { remove(self); return; }
droptofloor();
- td_generator_link();
+ generator_link(td_generator_setup);
}
entity PickGenerator()
monsters/lib/monsters_early.qh
+generator.qh
+
campaign.qh
../common/campaign_common.qh
../common/mapinfo.qh
portals.qc
+generator.qc
+
target_spawn.qc
func_breakable.qc
target_music.qc