19 newmine.owner = this.
owner;
24 setorigin(newmine, this.
origin);
25 setmodel(newmine, MDL_MINELAYER_MINE);
26 setsize(newmine,
'-4 -4 -4',
'4 4 4');
34 newmine.event_damage = this.event_damage;
36 newmine.damagedbycontents =
true;
46 newmine.nextthink =
time;
47 newmine.cnt = this.
cnt;
48 newmine.flags = this.
flags;
70 RadiusDamage(
this, this.
realowner,
WEP_CVAR(WEP_MINE_LAYER, damage),
WEP_CVAR(WEP_MINE_LAYER, edgedamage),
WEP_CVAR(WEP_MINE_LAYER,
radius),
NULL,
NULL,
WEP_CVAR(WEP_MINE_LAYER, force), this.
projectiledeathtype, this.
weaponentity_fld, directhitentity);
73 Weapon thiswep = WEP_MINE_LAYER;
74 if(this.
realowner.(weaponentity).m_weapon == thiswep)
80 own.cnt = thiswep.
m_id;
105 Weapon thiswep = WEP_MINE_LAYER;
106 if(this.
realowner.(weaponentity).m_weapon == thiswep)
112 own.cnt = thiswep.
m_id;
170 IL_EACH(
g_mines, it.realowner == e && it.weaponentity_fld == weaponentity,
197 if(
WEP_CVAR(WEP_MINE_LAYER, lifetime_countdown) > 0)
212 float time_core =
WEP_CVAR(WEP_MINE_LAYER, proximity_time_core);
213 float time_edge =
WEP_CVAR(WEP_MINE_LAYER, proximity_time_edge);
214 float proxrad =
WEP_CVAR(WEP_MINE_LAYER, proximity_radius);
224 float new_mine_time =
time + time_core;
225 if(time_edge != time_core)
226 new_mine_time += (time_edge - time_core) *
vlen(head.WarpZone_findradius_dist) / proxrad;
242 if(this.
realowner.(weaponentity).m_weapon == WEP_MINE_LAYER)
283 float is_from_enemy = (inflictor.realowner != this.
realowner);
301 if(minecount >=
WEP_CVAR(WEP_MINE_LAYER, limit))
312 W_SetupShot_ProjectileSize(actor, weaponentity,
'-4 -4 -4',
'4 4 4',
false, 5, SND_MINE_FIRE,
CH_WEAPON_A,
WEP_CVAR(WEP_MINE_LAYER, damage), thiswep.
m_id);
316 mine.weaponentity_fld = weaponentity;
318 mine.owner = mine.realowner = actor;
319 if(
WEP_CVAR(WEP_MINE_LAYER, detonatedelay) >= 0)
320 mine.spawnshieldtime =
time +
WEP_CVAR(WEP_MINE_LAYER, detonatedelay);
322 mine.spawnshieldtime = -1;
323 mine.classname =
"mine";
324 mine.bot_dodge =
true;
325 mine.bot_dodgerating =
WEP_CVAR(WEP_MINE_LAYER, damage) * 2;
331 mine.damagedbycontents =
true;
336 mine.projectiledeathtype = thiswep.
m_id;
337 mine.weaponentity_fld = weaponentity;
338 setsize(mine,
'-4 -4 -4',
'4 4 4');
346 mine.nextthink =
time;
353 if(mine.cnt > 0) { mine.cnt +=
time; }
364 bool minfound =
false;
366 IL_EACH(
g_mines, it.realowner ==
this && it.weaponentity_fld == weaponentity,
370 if(!it.minelayer_detonate)
372 it.minelayer_detonate = true;
386 if(minecount >=
WEP_CVAR(WEP_MINE_LAYER, limit))
393 float edgedamage, coredamage, edgeradius, recipricoledgeradius;
394 float selfdamage, teamdamage, enemydamage;
395 edgedamage =
WEP_CVAR(WEP_MINE_LAYER, edgedamage);
396 coredamage =
WEP_CVAR(WEP_MINE_LAYER, damage);
398 recipricoledgeradius = 1 / edgeradius;
406 IL_EACH(g_bot_targets, it.bot_attack,
408 float d = vlen(it.origin + (it.mins + it.maxs) * 0.5 - mine.origin);
409 d = bound(0, edgedamage + (coredamage - edgedamage) * sqrt(1 - d * recipricoledgeradius), 10000);
412 selfdamage = selfdamage + d;
413 else if(SAME_TEAM(it, actor))
414 teamdamage = teamdamage + d;
415 else if(bot_shouldattack(actor, it))
416 enemydamage = enemydamage + d;
420 float desirabledamage;
421 desirabledamage = enemydamage;
425 desirabledamage = desirabledamage - teamdamage;
433 IL_EACH(g_bot_targets, it.bot_attack,
435 if((v_forward * normalize(mine.origin - it.origin) < 0.1)
436 && desirabledamage > 0.1 * coredamage
437 ) PHYS_INPUT_BUTTON_ATCK2(actor) = true;
444 if((v_forward * normalize(it.origin - actor.enemy.origin) < 0.1)
445 && IS_PLAYER(actor.enemy)
446 && (desirabledamage >= 0.1 * coredamage)
449 float distance = bound(300, vlen(actor.origin - actor.enemy.origin), 30000);
450 if(random() / distance * 300 > frametime * bound(0, (10 - skill) * 0.2, 1))
451 PHYS_INPUT_BUTTON_ATCK2(actor) = true;
458 if(desirabledamage >= 0.75 * coredamage)
472 if(autocvar_g_balance_minelayer_reload_ammo && actor.(weaponentity).clip_load <
WEP_CVAR(WEP_MINE_LAYER,
ammo))
479 thiswep.wr_reload(thiswep, actor, weaponentity);
534 return WEAPON_MINELAYER_SUICIDE;
539 return WEAPON_MINELAYER_MURDER;
564 PAR(_(
"The %s places mines on the ground when fired, which detonate and damage enemies if stepped on. "
565 "Only a couple mines can be placed at any time, and after several seconds they will self-detonate."),
COLORED_NAME(
this));
566 PAR(_(
"The secondary fire instantaneously detonates any mines fired by the primary fire, first waiting until you're far enough away."));
567 PAR(_(
"It consumes %s ammo for each mine laid."),
COLORED_NAME(ITEM_Rockets));
568 PAR(_(
"The mines are not launched very far before they hit the ground, so the %s isn't very effective at medium to long ranges. "
569 "It is often used to protect important areas of the map such as the flag in %s, control points in %s, or checkpoints in %s."),
COLORED_NAME(
this),
COLORED_NAME(MAPINFO_TYPE_CTF),
COLORED_NAME(MAPINFO_TYPE_ONSLAUGHT),
COLORED_NAME(MAPINFO_TYPE_ASSAULT));
bool bot_aim(entity this,.entity weaponentity, float shotspeed, float shotspeedupward, float maxshottime, float applygravity, bool shot_accurate)
IntrusiveList g_bot_dodge
#define MUTATOR_CALLHOOK(id,...)
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
void TakeResource(entity receiver, Resource res_type, float amount)
Takes an entity some resource.
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
virtual void wr_checkammo1()
(SERVER) checks ammo for weapon primary
#define colormapPaletteColor(c, isPants)
#define COLORED_NAME(this)
const int IT_UNLIMITED_AMMO
#define setmodel(this, m)
bool IsFlying(entity this)
#define PHYS_INPUT_BUTTON_ATCK(s)
#define PHYS_INPUT_BUTTON_ATCK2(s)
void SetMovetypeFollow(entity ent, entity e)
void UnsetMovetypeFollow(entity ent)
int LostMovetypeFollow(entity ent)
vector trace_plane_normal
void CSQCProjectile(entity e, float clientanimate, int type, float docull)
float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype,.entity weaponentity, entity directhitentity)
IntrusiveList g_damagedbycontents
float autocvar_g_balance_selfdamagepercent
#define pointparticles(effect, org, vel, howmany)
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
#define IL_EACH(this, cond, body)
entity WarpZone_FindRadius(vector org, float rad, bool needlineofsight)
entity WarpZone_RefSys_SpawnSameRefSys(entity me)
void W_MineLayer_ProximityExplode(entity this)
void W_MineLayer_Explode_think(entity this)
void W_MineLayer_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
int W_MineLayer_Count(entity e,.entity weaponentity)
void W_MineLayer_Explode(entity this, entity directhitentity)
void W_MineLayer_Stick(entity this, entity to)
void W_MineLayer_Think(entity this)
bool W_MineLayer_PlacedMines(entity this,.entity weaponentity, bool detonate)
void W_MineLayer_Attack(Weapon thiswep, entity actor,.entity weaponentity)
void W_MineLayer_Touch(entity this, entity toucher)
void W_MineLayer_DoRemoteExplode(entity this)
void W_MineLayer_RemoteExplode(entity this)
void set_movetype(entity this, int mt)
const int MOVETYPE_FOLLOW
#define UNSET_ONGROUND(s)
const int MOVETYPE_BOUNCE
void Send_Notification(NOTIF broadcast, entity client, MSG net_type, Notification net_name,...count)
entity Notification
always last
#define METHOD(cname, name, prototype)
const int PROJECTILE_MINE
float health
Legacy fields for the resources. To be removed.
#define w_getbestweapon(ent, wepent)
#define IS_INDEPENDENT_PLAYER(e)
float W_CheckProjectileDamage(entity inflictor, entity projowner, int deathtype, float exception)
void W_PrepareExplosionByDamage(entity this, entity attacker, void(entity this) explode)
#define PROJECTILE_TOUCH(e, t)
IntrusiveList g_projectiles
#define PROJECTILE_MAKETRIGGER(e)
#define sound(e, c, s, v, a)
void play2(entity e, string filename)
float spamsound(entity e, int chan, Sound samp, float vol, float _atten)
use this one if you might be causing spam (e.g.
bool StatusEffects_active(StatusEffect this, entity actor)
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
#define W_SetupShot_ProjectileSize(ent, wepent, mi, ma, antilag, recoil, snd, chan, maxdamage, deathtype)
#define W_SetupProjVelocity_Basic(ent, pspeed, pspread)
string W_Guide_Keybinds(Weapon wep)
void W_MuzzleFlash(Weapon thiswep, entity actor,.entity weaponentity, vector shotorg, vector shotdir)
string W_Guide_DPS_onlyOne_unnamed(string name)
#define WEP_CVAR(wep, name)
const int MAX_WEAPONSLOTS
entity weaponentities[MAX_WEAPONSLOTS]
void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use,.entity weaponentity)
void W_Reload(entity actor,.entity weaponentity, float sent_ammo_min, Sound sent_sound)
void weapon_thinkf(entity actor,.entity weaponentity, WFRAME fr, float t, void(Weapon thiswep, entity actor,.entity weaponentity, int fire) func)
bool weapon_prepareattack(Weapon thiswep, entity actor,.entity weaponentity, bool secondary, float attacktime)
void w_ready(Weapon thiswep, entity actor,.entity weaponentity, int fire)
#define ATTACK_FINISHED(ent, w)
float weapon_load[REGISTRY_MAX(Weapons)]