}
// recursive predraw call to fix issues with forcemodels and LOD if bone indexes mismatch
- if(this.tag_entity.classname == "csqcmodel")
+ if(this.tag_entity.classname == "ENT_CLIENT_MODEL")
{
CSQCModel_Hook_PreDraw(this.tag_entity, (this.tag_entity.isplayermodel & ISPLAYER_CLIENT));
}
InterpolateOrigin_Undo(this);
this.iflags = IFLAG_VELOCITY | IFLAG_ORIGIN;
- this.classname = "radarlink";
if (isnew) IL_PUSH(g_radarlinks, this);
if(sendflags & 1)
if (!(this.count & 0x80))
InterpolateOrigin_Note(this);
- this.classname = "csqcprojectile";
this.draw = Projectile_Draw;
if (isnew) IL_PUSH(g_drawables, this);
this.entremove = Ent_RemoveProjectile;
ang_z = ReadByte() * 360 / 256;
return = true;
- Casing casing = RubbleNew("casing");
+ Casing casing = RubbleNew(new(casing));
casing.silent = (_state & 0x80);
casing.state = (_state & 0x7F);
casing.origin = org;
entity gib;
// TODO remove some gibs according to cl_nogibs
- gib = RubbleNew("gib");
+ gib = RubbleNew(new(gib));
set_movetype(gib, MOVETYPE_BOUNCE);
gib.gravity = 1;
gib.solid = SOLID_CORPSE;
}
}
-entity RubbleNew(string cname)
+entity RubbleNew(entity e)
{
- // spawn a new entity and return it
- entity e = spawn();
- e.classname = cname;
e.creationtime = time;
IL_PUSH(g_rubble, e);
return e;
{
if (!this)
// initial = temp
- e = new_pure(entcs_receiver);
+ e = new_pure(ENT_CLIENT_ENTCS);
else
// initial = linked
e = this;
if (isnew)
{
make_pure(this);
- this.classname = "entcs_receiver";
this.entremove = Ent_RemoveEntCS;
}
return ReadEntcs(this);
{
if (!g_assault) { delete(this); return; }
- this.classname = "target_objective";
IL_PUSH(g_assault_objectives, this);
this.use = assault_objective_use;
this.reset = assault_objective_reset;
{
if (!g_assault) { delete(this); return; }
- this.classname = "target_objective_decrease";
IL_PUSH(g_assault_objectivedecreasers, this);
if(!this.dmg)
if (!g_assault) { delete(this); return; }
this.spawnflags = 3;
- this.classname = "func_assault_destructible";
this.event_heal = destructible_heal;
IL_PUSH(g_assault_destructibles, this);
{
if (!g_assault) { delete(this); return; }
- this.classname = "func_assault_wall";
this.mdl = this.model;
_setmodel(this, this.mdl);
this.solid = SOLID_BSP;
if (!g_assault) { delete(this); return; }
this.winning = 0; // round not yet won by attackers
- this.classname = "target_assault_roundend";
this.use = target_assault_roundend_use;
this.cnt = 0; // first round
this.reset = target_assault_roundend_reset;
if (!g_assault) { delete(this); return; }
assault_attacker_team = NUM_TEAM_1;
- this.classname = "target_assault_roundstart";
this.use = assault_roundstart_use;
this.reset2 = assault_roundstart_use_this;
InitializeEntity(this, assault_roundstart_use_this, INITPRIO_FINDTARGET);
{
if(!g_ctf) { delete(this); return; }
- this.classname = "ctf_team";
this.team = this.cnt + 1;
}
precache_sound(this.noise);
if (this.noise1 != "")
precache_sound(this.noise1);
- this.classname = "dom_team";
_setmodel(this, this.model); // precision not needed
this.mdl = this.model;
this.dmg = this.modelindex;
void dom_spawnpoint(vector org)
{
entity e = spawn();
- e.classname = "dom_controlpoint";
setthink(e, spawnfunc_dom_controlpoint);
e.nextthink = time;
setorigin(e, org);
{
if(!g_invasion) { delete(this); return; }
- this.classname = "invasion_spawnpoint";
IL_PUSH(g_invasion_spawns, this);
}
kh_Key_Remove(this);
}
-const string STR_ITEM_KH_KEY = "item_kh_key";
void kh_Key_Spawn(entity initial_owner, float _angle, float i) // runs every time a new flag is created, ie after all the keys have been collected
{
- entity key = spawn();
+ entity key = new(item_kh_key);
key.count = i;
- key.classname = STR_ITEM_KH_KEY;
settouch(key, kh_Key_Touch);
setthink(key, kh_Key_Think);
key.nextthink = time;
kh_teams = BITS(bound(2, kh_teams, 4));
// make a KH entity for controlling the game
- kh_controller = spawn();
+ kh_controller = new(kh_controller);
setthink(kh_controller, kh_Controller_Think);
kh_Controller_SetThink(0, kh_WaitForPlayers);
spawnfunc(nexball_basketball)
{
nexball_mode |= NBM_BASKETBALL;
- this.classname = "nexball_basketball";
if (!(balls & BALL_BASKET))
{
/*
spawnfunc(nexball_football)
{
nexball_mode |= NBM_FOOTBALL;
- this.classname = "nexball_football";
this.solid = SOLID_TRIGGER;
balls |= BALL_FOOT;
this.pushable = autocvar_g_nexball_football_jumppad;
if(this.icon_realmodel == NULL)
{
- this.icon_realmodel = spawn();
+ this.icon_realmodel = new(cpicon_model);
setmodel(this.icon_realmodel, MDL_Null);
setorigin(this.icon_realmodel, this.origin);
setsize(this.icon_realmodel, CPICON_MIN, CPICON_MAX);
ons_worldgeneratorlist = gen;
gen.netname = sprintf("%s generator", Team_ColoredFullName(teamnum));
- gen.classname = "onslaught_generator";
gen.solid = SOLID_BBOX;
gen.team_saved = teamnum;
IL_PUSH(g_saved_team, gen);
{
if(!g_tdm || !this.cnt) { delete(this); return; }
- this.classname = "tdm_team";
this.team = this.cnt + 1;
}
//
void LaunchDebris (entity this, string debrisname, vector force)
{
- entity dbr = spawn();
+ entity dbr = new(debris);
vector org = this.absmin
+ '1 0 0' * random() * (this.absmax.x - this.absmin.x)
+ '0 1 0' * random() * (this.absmax.y - this.absmin.y)
#ifdef SVQC
if (!((toucher.iscreature || (toucher.flags & FL_PROJECTILE)) && !IS_DEAD(toucher)))
#elif defined(CSQC)
- if(!((IS_CLIENT(toucher) || toucher.classname == "csqcprojectile") && !IS_DEAD(toucher)))
+ if(!((IS_CLIENT(toucher) || toucher.classname == "ENT_CLIENT_PROJECTILE") && !IS_DEAD(toucher)))
#endif
return;
*/
spawnfunc(item_key1)
{
- this.classname = "item_key";
this.itemkeys = ITEM_KEY_BIT(1);
spawnfunc_item_key(this);
}
*/
spawnfunc(item_key2)
{
- this.classname = "item_key";
this.itemkeys = ITEM_KEY_BIT(0);
spawnfunc_item_key(this);
}
spawnfunc(info_teleport_destination)
{
- this.classname = "info_teleport_destination";
-
this.mangle = this.angles;
this.angles = '0 0 0';
void plat_spawn_inside_trigger(entity this)
{
- entity trigger;
vector tmin, tmax;
- trigger = spawn();
+ entity trigger = spawn();
settouch(trigger, plat_center_touch);
set_movetype(trigger, MOVETYPE_NONE);
trigger.solid = SOLID_TRIGGER;
spawnfunc(target_location)
{
- this.classname = "target_location";
// location name in netname
// eventually support: count, teamgame selectors, line of sight?
spawnfunc(info_location)
{
- this.classname = "target_location";
this.message = this.netname;
-
- target_push_init(this);
-
- IL_PUSH(g_locations, this);
+ spawnfunc_target_location(this);
}
#endif
else
return;
}
- toucher.trigger_gravity_check = spawn();
+ toucher.trigger_gravity_check = new(trigger_gravity_checker);
toucher.trigger_gravity_check.enemy = this;
toucher.trigger_gravity_check.owner = toucher;
toucher.trigger_gravity_check.gravity = toucher.gravity;
trigger_common_read(this, true);
return = true;
- this.classname = "trigger_impulse";
this.solid = SOLID_TRIGGER;
this.entremove = trigger_remove_generic;
this.move_time = time;
NET_HANDLE(ENT_CLIENT_TRIGGER_PUSH, bool isnew)
{
- this.classname = "jumppad";
- int mytm = ReadByte();
- if(mytm)
- {
- this.team = mytm - 1;
- }
+ int mytm = ReadByte(); if(mytm) { this.team = mytm - 1; }
this.spawnflags = ReadInt24_t();
this.active = ReadByte();
this.height = ReadCoord();
NET_HANDLE(ENT_CLIENT_TARGET_PUSH, bool isnew)
{
- this.classname = "push_target";
this.cnt = ReadByte();
this.targetname = strzone(ReadString());
this.origin = ReadVector();
return = true;
- this.classname = "trigger_keylock";
this.entremove = trigger_remove_generic;
}
#endif
spawnfunc(target_viewlocation_start)
{
- this.classname = "target_viewlocation_start";
this.cnt = 1;
viewloc_link(this);
}
spawnfunc(target_viewlocation_end)
{
- this.classname = "target_viewlocation_end";
this.cnt = 2;
viewloc_link(this);
}
setthink(this, trigger_viewloc_updatelink);
this.nextthink = time + 1; // we need to delay this or else
- this.classname = "trigger_viewlocation";
this.drawmask = MASK_NORMAL; // not so concerned, but better keep it alive
}
}
// Minigame menu options: create entry
-entity HUD_MinigameMenu_SpawnEntry(string s, vector offset, vector fontsize, vector color,void(entity, entity, entity) click)
+entity HUD_MinigameMenu_SpawnEntry(entity entry, string s, vector offset, vector fontsize, vector color,void(entity, entity, entity) click)
{
- entity entry = spawn();
entry.message = s;
entry.origin = offset;
entry.size = fontsize;
{
vector item_fontsize = hud_fontsize*1.25;
vector item_offset = '1 0 0' * item_fontsize_x;
- entity item = HUD_MinigameMenu_SpawnEntry(
+ entity item = HUD_MinigameMenu_SpawnEntry(new(hud_minigamemenu_subentry),
s,item_offset,item_fontsize,'0.8 0.8 0.8', click );
item.owner = parent;
return item;
HUD_MinigameMenu_EraseEntry(e);
break;
}
- entity currb = HUD_MinigameMenu_SpawnEntry(
+ entity currb = HUD_MinigameMenu_SpawnEntry(new(hud_minigamemenu_current),
_("Current Game"), '0 0 0', hud_fontsize*1.5,'0.7 0.84 1', HUD_MinigameMenu_ClickCurrentGame );
- currb.classname = "hud_minigamemenu_current";
currb.model = strzone(minigame_texture(strcat(active_minigame.descriptor.netname,"/icon")));
HUD_MinigameMenu_InsertEntry(currb,HUD_MinigameMenu_last_entry);
HUD_MinigameMenu_Click(currb);
for ( e = HUD_MinigameMenu_last_entry; e != NULL; e = e.list_prev )
if ( e.classname == "hud_minigamemenu_exit" )
return;
- entity exit = HUD_MinigameMenu_SpawnEntry(
+ entity exit = HUD_MinigameMenu_SpawnEntry(new(hud_minigamemenu_exit),
_("Exit Menu"),'0 0 0',hud_fontsize*1.5,'0.7 0.84 1', HUD_MinigameMenu_Close);
- exit.classname = "hud_minigamemenu_exit";
HUD_MinigameMenu_InsertEntry ( exit, HUD_MinigameMenu_last_entry );
}
}
{
if ( !mv_active && !HUD_MinigameMenu_IsOpened() )
{
- HUD_MinigameMenu_InsertEntry( HUD_MinigameMenu_SpawnEntry(
+ HUD_MinigameMenu_InsertEntry( HUD_MinigameMenu_SpawnEntry(new(hud_minigamemenu_entry),
_("Create"), '0 0 0', hud_fontsize*1.5,'0.7 0.84 1', HUD_MinigameMenu_ClickCreate),
HUD_MinigameMenu_last_entry );
- HUD_MinigameMenu_InsertEntry ( HUD_MinigameMenu_SpawnEntry(
+ HUD_MinigameMenu_InsertEntry ( HUD_MinigameMenu_SpawnEntry(new(hud_minigamemenu_entry),
_("Join"),'0 0 0',hud_fontsize*1.5,'0.7 0.84 1', HUD_MinigameMenu_ClickJoin),
HUD_MinigameMenu_last_entry );
HUD_MinigameMenu_CurrentButton();
}
else
{
- entity piece = msle_spawn(minigame,"minigame_board_piece");
+ entity piece = msle_spawn(minigame,new(minigame_board_piece));
piece.team = 1;
piece.netname = strzone(pos);
piece.bd_tiletype = thetile;
}
else
{
- entity e = msle_spawn(minigame,"minigame_board_piece");
+ entity e = msle_spawn(minigame,new(minigame_board_piece));
e.netname = tilename;
e.team = 1;
e.bd_dir = dir;
if ( c4_valid_tile(pos) )
if ( !c4_find_piece(minigame,pos) )
{
- entity piece = msle_spawn(minigame,"minigame_board_piece");
+ entity piece = msle_spawn(minigame,new(minigame_board_piece));
piece.team = player.team;
piece.netname = strzone(pos);
minigame_server_sendflags(piece,MINIG_SF_ALL);
entity e;
for ( int i = 0; i < 7; i++ )
{
- e = msle_spawn(minigame,"minigame_board_piece");
+ e = msle_spawn(minigame,new(minigame_board_piece));
e.team = 1;
e.minigame_flags = NMM_PIECE_HOME;
- e = msle_spawn(minigame,"minigame_board_piece");
+ e = msle_spawn(minigame,new(minigame_board_piece));
e.team = 2;
e.minigame_flags = NMM_PIECE_HOME;
}
entity pong_ai_spawn(entity paddle)
{
- entity ai = msle_spawn(paddle.owner,"pong_ai");
+ entity ai = msle_spawn(paddle.owner,new(pong_ai));
ai.minigame_players = ai;
ai.team = paddle.team;
setthink(ai, pong_ai_think);
// if real_player is NULL, the paddle is controlled by AI
entity pong_paddle_spawn(entity minigame, int pl_team, entity real_player)
{
- entity paddle = msle_spawn(minigame,"pong_paddle");
+ entity paddle = msle_spawn(minigame,new(pong_paddle));
paddle.pong_length = autocvar_sv_minigames_pong_paddle_size;
paddle.origin = pong_team_to_paddlepos(pl_team);
setthink(paddle, pong_paddle_think);
entity ball;
for ( int j = 0; j < autocvar_sv_minigames_pong_ball_number; j++ )
{
- ball = msle_spawn(minigame,"pong_ball");
+ ball = msle_spawn(minigame,new(pong_ball));
ball.pong_length = autocvar_sv_minigames_pong_ball_radius;
ball.m_mins = vec2(-ball.pong_length, -ball.pong_length);
ball.m_maxs = vec2(ball.pong_length, ball.pong_length);
delete(existing);
}
- entity piece = msle_spawn(minigame,"minigame_board_piece");
+ entity piece = msle_spawn(minigame,new(minigame_board_piece));
piece.cnt = 1;
piece.team = player.team; // temporary
piece.netname = strzone(pos);
if(t1_true || t2_true)
{
- entity piece = msle_spawn(minigame,"minigame_board_piece");
+ entity piece = msle_spawn(minigame,new(minigame_board_piece));
piece.team = ((t1_true) ? 1 : 2);
piece.netname = strzone(minigame_tile_buildname(i,t));
minigame_server_sendflags(piece,MINIG_SF_ALL);
continue;
if(i == floor(PS_NUM_CNT * 0.5) && t == floor(PS_LET_CNT * 0.5))
continue; // middle piece is empty
- entity piece = msle_spawn(minigame,"minigame_board_piece");
+ entity piece = msle_spawn(minigame,new(minigame_board_piece));
piece.team = 1; // init default team?
piece.netname = strzone(minigame_tile_buildname(t,i));
minigame_server_sendflags(piece,MINIG_SF_ALL);
if ( ttt_valid_tile(pos) )
if ( !ttt_find_piece(minigame,pos) )
{
- entity piece = msle_spawn(minigame,"minigame_board_piece");
+ entity piece = msle_spawn(minigame,new(minigame_board_piece));
piece.team = player.team;
piece.netname = strzone(pos);
minigame_server_sendflags(piece,MINIG_SF_ALL);
// Spawn linked entity on the server or local entity on the client
// This entity will be removed automatically when the minigame ends
-entity msle_spawn(entity minigame_session, string class_name)
+entity msle_spawn(entity minigame_session, entity e)
{
- entity e = spawn();
- e.classname = class_name;
e.owner = minigame_session;
e.minigame_autoclean = 1;
#ifdef SVQC
// Spawn linked entity on the server or local entity on the client
// This entity will be removed automatically when the minigame ends
-entity msle_spawn(entity minigame_session, string class_name);
+entity msle_spawn(entity minigame_session, entity e);
#include "minigame/all.qh"
{
makevectors(this.angles);
- entity missile = spawn();
+ entity missile = new(M_Mage_Attack_Spike);
missile.owner = missile.realowner = this;
setthink(missile, M_Mage_Attack_Spike_Think);
missile.ltime = time + 7;
actor.anim_finished = time + 1.2;
}
- entity missile = spawn();
+ entity missile = new(WyvernAttack);
missile.owner = missile.realowner = actor;
missile.solid = SOLID_TRIGGER;
set_movetype(missile, MOVETYPE_FLYMISSILE);
void Monster_Delay(entity this, int repeat_count, float defer_amnt, void(entity) func)
{
// deferred attacking, checks if monster is still alive and target is still valid before attacking
- entity e = spawn();
+ entity e = new(Monster_Delay);
setthink(e, Monster_Delay_Action);
e.nextthink = time + defer_amnt;
void buffs_BuffModel_Spawn(entity player)
{
- player.buff_model = spawn();
+ player.buff_model = new(buff_model);
setmodel(player.buff_model, MDL_BUFF);
setsize(player.buff_model, '0 0 -40', '0 0 40');
setattachment(player.buff_model, player, "");
if(frag_attacker != frag_target)
if(!ITEM_DAMAGE_NEEDKILL(frag_deathtype))
{
- entity dmgent = spawn();
+ entity dmgent = new(dmgent);
dmgent.dmg = frag_damage * autocvar_g_buffs_vengeance_damage_multiplier;
dmgent.enemy = frag_attacker;
void nade_napalm_boom(entity this)
{
- entity fountain;
- int c;
- for (c = 0; c < autocvar_g_nades_napalm_ball_count; c++)
+ for (int c = 0; c < autocvar_g_nades_napalm_ball_count; c++)
nade_napalm_ball(this);
-
- fountain = spawn();
+ entity fountain = new(nade_napalm_fountain);
fountain.owner = this.owner;
fountain.realowner = this.realowner;
fountain.origin = this.origin;
void nade_ice_boom(entity this)
{
- entity fountain;
- fountain = spawn();
+ entity fountain = new(nade_ice_fountain);
fountain.owner = this.owner;
fountain.realowner = this.realowner;
fountain.origin = this.origin;
void nade_spawn_boom(entity this)
{
- entity spawnloc = spawn();
+ entity spawnloc = new(nade_spawn_loc);
setorigin(spawnloc, this.origin);
setsize(spawnloc, this.realowner.mins, this.realowner.maxs);
set_movetype(spawnloc, MOVETYPE_NONE);
// NOTE: this function merely places an orb
// you must add a custom touch function to the returned entity if desired
// also set .colormod if you wish to have it colorized
- entity orb = spawn(); // Net_LinkEntity sets the classname (TODO)
+ entity orb = new(nades_spawn_orb);
orb.owner = own;
orb.realowner = realown;
setorigin(orb, org);
// The actual item can't be physical and trigger at the same time, so make it invisible and use a second entity for physics.
// Ugly hack, but unless SOLID_TRIGGER is gotten to work with MOVETYPE_PHYSICS in the engine it can't be fixed.
- entity wep;
- wep = spawn();
+ entity wep = spawn();
_setmodel(wep, item.model);
setsize(wep, item.mins, item.maxs);
setorigin(wep, item.origin);
player.superspec_flags = SSF_VERBOSE;
player.superspec_itemfilter = "";
- entity _hello = spawn();
+ entity _hello = new(superspec_delayed_hello);
_hello.enemy = player;
setthink(_hello, superspec_hello);
_hello.nextthink = time + 5;
#define IS_CLIENT(s) (((s).isplayermodel & ISPLAYER_CLIENT) || (s) == csqcplayer)
#define IS_PLAYER(s) ((s).isplayermodel & ISPLAYER_PLAYER)
#define IS_NOT_A_CLIENT(s) (!(s).isplayermodel && (s) != csqcplayer)
- #define IS_DEAD(s) (((s).classname == "csqcmodel") ? (s).csqcmodel_isdead : (GetResource((s), RES_HEALTH) <= 0))
+ #define IS_DEAD(s) (((s).classname == "ENT_CLIENT_MODEL") ? (s).csqcmodel_isdead : (GetResource((s), RES_HEALTH) <= 0))
//float player_multijump;
//float player_jumpheight;
// Compat.
spawnfunc(walker_checkpoint)
{
- this.classname = "turret_checkpoint";
spawnfunc_turret_checkpoint(this);
}
actor.shot_speed = 1;
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
}
- entity beam = spawn();
+ entity beam = new(PhaserTurret_beam);
beam.ticrate = 0.1; //autocvar_sys_ticrate;
setmodel(beam, MDL_TUR_PHASER_BEAM);
beam.effects = EF_LOWPRECISION;
*/
void paint_target(entity onwho, float f_size, vector v_color, float f_time)
{
- entity e;
-
- e = spawn();
- setmodel(e, MDL_TUR_C512); // precision set above
+ entity e = spawn();
+ setmodel(e, MDL_TUR_C512);
e.scale = (f_size/512);
//setsize(e, '0 0 0', '0 0 0');
//setattachment(e,onwho,"");
void paint_target2(entity onwho, float f_size, vector v_color, float f_time)
{
- entity e;
-
- e = spawn();
- setmodel(e, MDL_TUR_C512); // precision set above
+ entity e = spawn();
+ setmodel(e, MDL_TUR_C512);
e.scale = (f_size/512);
setsize(e, '0 0 0', '0 0 0');
void paint_target3(vector where, float f_size, vector v_color, float f_time)
{
- entity e;
- e = spawn();
- setmodel(e, MDL_TUR_C512); // precision set above
+ entity e = spawn();
+ setmodel(e, MDL_TUR_C512);
e.scale = (f_size/512);
setsize(e, '0 0 0', '0 0 0');
setorigin(e, where + '0 0 1');
if(axh != NULL && !wasfreed(axh)) // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
delete(axh);
- axh = spawn();
+ axh = new(AuxiliaryXhair);
axh.draw2d = func_null;
axh.drawmask = MASK_NORMAL;
axh.axh_drawflag = DRAWFLAG_NORMAL;
int _deahtype, float _projtype, float _health,
bool _cull, bool _clianim, entity _owner)
{
- TC(Sound, _mzlsound);
- entity proj;
-
- proj = spawn();
+ TC(Sound, _mzlsound);
+ entity proj = new(vehicles_projectile);
PROJECTILE_MAKETRIGGER(proj);
setorigin(proj, _org);
entity vehicle_tossgib(entity this, entity _template, vector _vel, string _tag, bool _burn, bool _explode, float _maxtime, vector _rot)
{
- entity _gib = spawn();
+ entity _gib = new(vehicle_gib);
_setmodel(_gib, _template.model);
vector org = gettaginfo(this, gettagindex(this, _tag));
setorigin(_gib, org);
_slot.vehicle_enter = _enterfunc;
STAT(HUD, _slot) = _hud;
_slot.vehicle_flags = VHF_PLAYERSLOT;
- _slot.vehicle_viewport = spawn();
- _slot.vehicle_hudmodel = spawn();
+ _slot.vehicle_viewport = new(vehicle_viewport);
+ _slot.vehicle_hudmodel = new(vehicle_hudmodel);
_slot.vehicle_hudmodel.viewmodelforclient = _slot;
_slot.vehicle_viewport.effects = (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NOGUNBOB | EF_NOSHADOW | EF_LOWPRECISION | EF_SELECTABLE | EF_TELEPORT_BIT);
{
if (wasfreed(this.vehicle_shieldent) || this.vehicle_shieldent == NULL)
{
- this.vehicle_shieldent = spawn();
+ this.vehicle_shieldent = new(vehicle_shieldent);
this.vehicle_shieldent.effects = EF_LOWPRECISION;
setmodel(this.vehicle_shieldent, MDL_VEH_SHIELD);
if(!instance.gun1)
{
// for some reason, autosizing of the shield entity refuses to work for this one so set it up in advance.
- instance.vehicle_shieldent = spawn();
+ instance.vehicle_shieldent = new(vehicle_shieldent);
instance.vehicle_shieldent.effects = EF_LOWPRECISION;
setmodel(instance.vehicle_shieldent, MDL_VEH_BUMBLEBEE_SHIELD);
setattachment(instance.vehicle_shieldent, instance, "");
// Raygun beam
if(instance.gun3.enemy == NULL)
{
- instance.gun3.enemy = spawn();
+ instance.gun3.enemy = new(bumble_raygun);
Net_LinkEntity(instance.gun3.enemy, true, 0, bumble_raygun_send);
instance.gun3.enemy.SendFlags = BRG_SETUP;
instance.gun3.enemy.cnt = autocvar_g_vehicle_bumblebee_raygun;
if(!dropmark)
{
- dropmark = spawn();
+ dropmark = new(raptor_dropmark);
dropmark.owner = player;
dropmark.gravity = 1;
dropmark.dphitcontentsmask = DPCONTENTS_SOLID;
vector forward, right, up;
MAKE_VECTORS(player.v_angle, forward, right, up);
for(int i = 0; i < 3; ++i) {
- entity _flare = spawn();
+ entity _flare = new(RaptorFlare_flare);
setmodel(_flare, MDL_VEH_RAPTOR_FLARE);
_flare.effects = EF_LOWPRECISION | EF_FLAME;
_flare.scale = 0.5;
for(i = 0; i < autocvar_g_vehicle_raptor_bomblets; ++i)
{
- bomblet = spawn();
+ bomblet = new(raptor_bomb_bomblet);
setorigin(bomblet, this.origin);
set_movetype(bomblet, MOVETYPE_TOSS);
void raptor_bombdrop(entity this)
{
- entity bomb_1, bomb_2;
-
- bomb_1 = spawn();
- bomb_2 = spawn();
+ entity bomb_1 = new(bombmount_left);
+ entity bomb_2 = new(bombmount_right);
vector org = gettaginfo(this, gettagindex(this, "bombmount_left"));
setorigin(bomb_1, org);
void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
{
- entity sfrag = spawn();
+ entity sfrag = new(RaptorCBShellfrag);
setmodel(sfrag, MDL_VEH_RAPTOR_CB_FRAGMENT);
setorigin(sfrag, _org);
return;
}
- entity h = spawn(), g1 = spawn(), g2 = spawn(), b = spawn();
+ entity h = new(spiderbot_top), g1 = new(spiderbot_gun), g2 = new(spiderbot_gun), b = new(spiderbot_body);
setmodel(b, MDL_VEH_SPIDERBOT_BODY);
setmodel(h, MDL_VEH_SPIDERBOT_TOP);
if(!instance.gun1)
{
instance.vehicles_impulse = spiderbot_impulse;
- instance.gun1 = spawn();
- instance.gun2 = spawn();
+ instance.gun1 = new(spiderbot_gun);
+ instance.gun2 = new(spiderbot_gun);
setmodel(instance.gun1, MDL_VEH_SPIDERBOT_GUN);
setmodel(instance.gun2, MDL_VEH_SPIDERBOT_GUN);
setattachment(instance.gun1, instance.tur_head, "tag_hardpoint01");
this.move_time = time;
loopsound(this, CH_SHOTS_SINGLE, SND_ARC_LOOP, VOL_BASE, ATTEN_NORM);
- flash = spawn();
+ flash = new(arc_flash);
flash.owner = this;
flash.effects = EF_ADDITIVE | EF_FULLBRIGHT;
//flash.drawmask = MASK_NORMAL;
void Net_ReadShockwaveParticle()
{
- entity shockwave;
- shockwave = spawn();
+ entity shockwave = new(shockwave_cone);
shockwave.draw = Draw_Shockwave;
IL_PUSH(g_drawables, shockwave);
NET_HANDLE(ENT_CLIENT_WEPENT, bool isnew)
{
- if (isnew)
- this.classname = "wepent_receiver";
return ReadWepent(this);
}
this.isplayermodel = BITSET(this.isplayermodel, ISPLAYER_LOCAL, islocalplayer);
this.isplayermodel = BITSET(this.isplayermodel, ISPLAYER_PLAYER, (psf & ISPLAYER_PLAYER));
- this.classname = "csqcmodel";
this.iflags |= IFLAG_ORIGIN; // interpolate origin too
this.iflags |= IFLAG_ANGLES; // interpolate angles too
this.iflags |= IFLAG_VELOCITY | IFLAG_AUTOVELOCITY; // let's calculate velocity automatically
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
{
- if (e.classname == "") e.classname = "net_linked";
+ if (e.classname == "")
+ {
+ LOG_WARN("Net_LinkEntity called on an entity without a classname, assigning default");
+ e.classname = "net_linked";
+ }
if (e.model == "" || e.modelindex == 0)
{
if (!this.sourceLoc) { \
this.sourceLoc = __FILE__":"STR(__LINE__); \
} \
+ this.classname = #id; \
if (!this.spawnfunc_checked) { \
_checkWhitelisted(this, #id); \
this.spawnfunc_checked = true; \
}
entity WarpZone_RefSys_SpawnSameRefSys(entity me)
{
- entity e;
- e = spawn();
+ entity e = spawn();
WarpZone_RefSys_Copy(e, me);
return e;
}
bool navigation_checkladders(entity e, vector org, vector m1, vector m2, vector end, vector end2, int movemode)
{
- IL_EACH(g_ladders, it.classname == "func_ladder",
+ IL_EACH(g_ladders, true,
{
if(it.bot_pickup)
if(boxesoverlap(org + m1 + '-1 -1 -1', org + m2 + '1 1 1', it.absmin, it.absmax))
{
float starttime = max(time, clientkilltime);
- this.killindicator = spawn();
+ this.killindicator = new(killindicator);
this.killindicator.owner = this;
this.killindicator.scale = 0.5;
setattachment(this.killindicator, this, "");
IL_EACH(g_clones, it.enemy == this && !(it.effects & CSQCMODEL_EF_RESPAWNGHOST) && !it.killindicator,
{
- it.killindicator = spawn();
+ it.killindicator = new(killindicator);
it.killindicator.owner = it;
it.killindicator.scale = 0.5;
setattachment(it.killindicator, it, "");
void ClientKill_Silent(entity this, float _delay)
{
- this.killindicator = spawn();
+ this.killindicator = new(killindicator);
this.killindicator.owner = this;
setthink(this.killindicator, KillIndicator_Think);
this.killindicator.nextthink = time + (this.lip) * 0.05;
timeout_time = autocvar_sv_timeout_length;
timeout_leadtime = autocvar_sv_timeout_leadtime;
- timeout_handler = spawn();
+ timeout_handler = new(timeout_handler);
setthink(timeout_handler, timeout_handler_think);
timeout_handler.nextthink = time; // always let the entity think asap
void MapVote_Spawn()
{
- Net_LinkEntity(mapvote_ent = spawn(), false, 0, MapVote_SendEntity);
+ Net_LinkEntity(mapvote_ent = new(mapvote_ent), false, 0, MapVote_SendEntity);
}
void MapVote_TouchMask()
spawnfunc(info_player_deathmatch)
{
- this.classname = "info_player_deathmatch";
IL_PUSH(g_spawnpoints, this);
relocate_spawnpoint(this);
}
vector beampos = start + dir * bound(0, (it.origin - start) * dir, length);
if(!pseudoprojectile)
- pseudoprojectile = spawn(); // we need this so the sound uses the "entchannel4" volume
+ pseudoprojectile = new(pseudoprojectile); // we need this so the sound uses the "entchannel4" volume
msg_entity = it;
// we want this to be very loud when close but fall off quickly -> using max base volume and high attenuation
delete_fn = remove_unsafely;
- entity e = spawn();
+ entity e = new(GotoFirstMap);
setthink(e, GotoFirstMap);
e.nextthink = time; // this is usually 1 at this point
start_ammo_plasma = 0;
if (random_start_ammo == NULL)
{
- random_start_ammo = spawn();
+ random_start_ammo = new(random_start_ammo);
}
start_health = cvar("g_balance_health_start");
start_armorvalue = cvar("g_balance_armor_start");