📄 weapons.htm
字号:
<a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-defs.htm#CHAN_WEAPON">CHAN_WEAPON</a>, <b>"weapons/spike2.wav"</b>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_finished">attack_finished</a> = <a href="qc-glob.htm#time">time</a> + 0.2;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_currentammo">currentammo</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_nails">ammo_nails</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_nails">ammo_nails</a> - 2;
dir = <a href="qc-built.htm#aim">aim</a> (<a href="qc-glob.htm#self">self</a>, 1000);
<a href="weapons.htm#launch_spike">launch_spike</a> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin">origin</a> + '0 0 16', dir);
<a href="defs.htm#newmis">newmis</a>.<a href="qc-enty.htm#dot_touch">touch</a> = <a href="weapons.htm#superspike_touch">superspike_touch</a>;
<a href="qc-built.htm#setmodel">setmodel</a> (<a href="defs.htm#newmis">newmis</a>, <b>"progs/s_spike.mdl"</b>);
<a href="qc-built.htm#setsize">setsize</a> (<a href="defs.htm#newmis">newmis</a>, <a href="defs.htm#VEC_ORIGIN">VEC_ORIGIN</a>, <a href="defs.htm#VEC_ORIGIN">VEC_ORIGIN</a>);
<a href="qc-glob.htm#self">self</a>.punchangle_x = -2;
};
<a href="qc-types.htm#void">void</a>(<a href="qc-types.htm#float">float</a> ox) <b>W_FireSpikes</b><a name="W_FireSpikes">=</a>
{
<b>local</b> <a href="qc-types.htm#vector">vector</a> dir;
<b>local</b> <a href="qc-types.htm#entity">entity</a> old;
<a href="qc-built.htm#makevectors">makevectors</a> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_v_angle">v_angle</a>);
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_nails">ammo_nails</a> >= 2 && <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == <a href="qc-defs.htm#IT_SUPER_NAILGUN">IT_SUPER_NAILGUN</a>)
{
<a href="weapons.htm#W_FireSuperSpikes">W_FireSuperSpikes</a> ();
<b>return</b>;
}
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_nails">ammo_nails</a> < 1)
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> = <a href="weapons.htm#W_BestWeapon">W_BestWeapon</a> ();
<a href="weapons.htm#W_SetCurrentAmmo">W_SetCurrentAmmo</a> ();
<b>return</b>;
}
<a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-defs.htm#CHAN_WEAPON">CHAN_WEAPON</a>, <b>"weapons/rocket1i.wav"</b>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_finished">attack_finished</a> = <a href="qc-glob.htm#time">time</a> + 0.2;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_currentammo">currentammo</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_nails">ammo_nails</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_nails">ammo_nails</a> - 1;
dir = <a href="qc-built.htm#aim">aim</a> (<a href="qc-glob.htm#self">self</a>, 1000);
<a href="weapons.htm#launch_spike">launch_spike</a> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin">origin</a> + '0 0 16' + <a href="qc-built.htm#v_right">v_right</a>*ox, dir);
<a href="qc-glob.htm#self">self</a>.punchangle_x = -2;
};
.<a href="qc-types.htm#dot_float">float</a> hit_z;
<a href="qc-types.htm#void">void</a>() <b>spike_touch</b><a name="spike_touch">=</a>
{
<b>local</b> <a href="qc-types.htm#float">float</a> rand;
<b>if</b> (<a href="qc-glob.htm#other">other</a> == <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_owner">owner</a>)
<b>return</b>;
<b>if</b> (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_solid">solid</a> == <a href="qc-defs.htm#SOLID_TRIGGER">SOLID_TRIGGER</a>)
<b>return</b>; <i>// trigger field, do nothing</i>
<b>if</b> (<a href="qc-built.htm#pointcontents">pointcontents</a>(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin">origin</a>) == <a href="qc-defs.htm#CONTENT_SKY">CONTENT_SKY</a>)
{
<a href="qc-built.htm#remove">remove</a>(<a href="qc-glob.htm#self">self</a>);
<b>return</b>;
}
<i>// hit something that bleeds</i>
<b>if</b> (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_takedamage">takedamage</a>)
{
<a href="weapons.htm#spawn_touchblood">spawn_touchblood</a> (9);
<a href="combat.htm#T_Damage">T_Damage</a> (<a href="qc-glob.htm#other">other</a>, <a href="qc-glob.htm#self">self</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_owner">owner</a>, 9);
}
<b>else</b>
{
<a href="qc-netf.htm#WriteByte">WriteByte</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, <a href="qc-net.htm#SVC_TEMPENTITY">SVC_TEMPENTITY</a>);
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_classname">classname</a> == <b>"wizspike"</b>)
<a href="qc-netf.htm#WriteByte">WriteByte</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, <a href="defs.htm#TE_WIZSPIKE">TE_WIZSPIKE</a>);
<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_classname">classname</a> == <b>"knightspike"</b>)
<a href="qc-netf.htm#WriteByte">WriteByte</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, <a href="defs.htm#TE_KNIGHTSPIKE">TE_KNIGHTSPIKE</a>);
<b>else</b>
<a href="qc-netf.htm#WriteByte">WriteByte</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, <a href="defs.htm#TE_SPIKE">TE_SPIKE</a>);
<a href="qc-netf.htm#WriteCoord">WriteCoord</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin_x">origin_x</a>);
<a href="qc-netf.htm#WriteCoord">WriteCoord</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin_y">origin_y</a>);
<a href="qc-netf.htm#WriteCoord">WriteCoord</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin_z">origin_z</a>);
}
<a href="qc-built.htm#remove">remove</a>(<a href="qc-glob.htm#self">self</a>);
};
<a href="qc-types.htm#void">void</a>() <b>superspike_touch</b><a name="superspike_touch">=</a>
{
<b>local</b> <a href="qc-types.htm#float">float</a> rand;
<b>if</b> (<a href="qc-glob.htm#other">other</a> == <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_owner">owner</a>)
<b>return</b>;
<b>if</b> (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_solid">solid</a> == <a href="qc-defs.htm#SOLID_TRIGGER">SOLID_TRIGGER</a>)
<b>return</b>; <i>// trigger field, do nothing</i>
<b>if</b> (<a href="qc-built.htm#pointcontents">pointcontents</a>(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin">origin</a>) == <a href="qc-defs.htm#CONTENT_SKY">CONTENT_SKY</a>)
{
<a href="qc-built.htm#remove">remove</a>(<a href="qc-glob.htm#self">self</a>);
<b>return</b>;
}
<i>// hit something that bleeds</i>
<b>if</b> (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_takedamage">takedamage</a>)
{
<a href="weapons.htm#spawn_touchblood">spawn_touchblood</a> (18);
<a href="combat.htm#T_Damage">T_Damage</a> (<a href="qc-glob.htm#other">other</a>, <a href="qc-glob.htm#self">self</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_owner">owner</a>, 18);
}
<b>else</b>
{
<a href="qc-netf.htm#WriteByte">WriteByte</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, <a href="qc-net.htm#SVC_TEMPENTITY">SVC_TEMPENTITY</a>);
<a href="qc-netf.htm#WriteByte">WriteByte</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, <a href="defs.htm#TE_SUPERSPIKE">TE_SUPERSPIKE</a>);
<a href="qc-netf.htm#WriteCoord">WriteCoord</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin_x">origin_x</a>);
<a href="qc-netf.htm#WriteCoord">WriteCoord</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin_y">origin_y</a>);
<a href="qc-netf.htm#WriteCoord">WriteCoord</a> (<a href="qc-net.htm#MSG_BROADCAST">MSG_BROADCAST</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin_z">origin_z</a>);
}
<a href="qc-built.htm#remove">remove</a>(<a href="qc-glob.htm#self">self</a>);
};
<i>/*
===============================================================================
PLAYER WEAPON USE
===============================================================================
*/</i>
<a href="qc-types.htm#void">void</a>() <b>W_SetCurrentAmmo</b><a name="W_SetCurrentAmmo">=</a>
{
<a href="player.htm#player_run">player_run</a> (); <i>// get out of any weapon firing states</i>
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a> - ( <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a> & (<a href="qc-defs.htm#IT_SHELLS">IT_SHELLS</a> | <a href="qc-defs.htm#IT_NAILS">IT_NAILS</a> | <a href="qc-defs.htm#IT_ROCKETS">IT_ROCKETS</a> | <a href="qc-defs.htm#IT_CELLS">IT_CELLS</a>) );
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == <a href="qc-defs.htm#IT_AXE">IT_AXE</a>)
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_currentammo">currentammo</a> = 0;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weaponmodel">weaponmodel</a> = <b>"progs/v_axe.mdl"</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weaponframe">weaponframe</a> = 0;
}
<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == <a href="qc-defs.htm#IT_SHOTGUN">IT_SHOTGUN</a>)
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_currentammo">currentammo</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_shells">ammo_shells</a>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weaponmodel">weaponmodel</a> = <b>"progs/v_shot.mdl"</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weaponframe">weaponframe</a> = 0;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a> | <a href="qc-defs.htm#IT_SHELLS">IT_SHELLS</a>;
}
<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == <a href="qc-defs.htm#IT_SUPER_SHOTGUN">IT_SUPER_SHOTGUN</a>)
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_currentammo">currentammo</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_shells">ammo_shells</a>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weaponmodel">weaponmodel</a> = <b>"progs/v_shot2.mdl"</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weaponframe">weaponframe</a> = 0;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a> | <a href="qc-defs.htm#IT_SHELLS">IT_SHELLS</a>;
}
<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == <a href="qc-defs.htm#IT_NAILGUN">IT_NAILGUN</a>)
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_currentammo">currentammo</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_nails">ammo_nails</a>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weaponmodel">weaponmodel</a> = <b>"progs/v_nail.mdl"</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weaponframe">weaponframe</a> = 0;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a> | <a href="qc-defs.htm#IT_NAILS">IT_NAILS</a>;
}
<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == <a href="qc-defs.htm#IT_SUPER_NAILGUN">IT_SUPER_NAILGUN</a>)
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_currentammo">currentammo</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_nails">ammo_nails</a>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weaponmodel">weaponmodel</a> = <b>"progs/v_nail2.mdl"</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weaponframe">weaponframe</a> = 0;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a> | <a href="qc-defs.htm#IT_NAILS">IT_NAILS</a>;
}
<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == <a href="qc-defs.htm#IT_GRENADE_LAUNCHER">IT_GRENADE_LAUNCHER</a>)
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_currentammo">currentammo</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_rockets">ammo_rockets</a>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weaponmodel">weaponmodel</a> = <b>"progs/v_rock.mdl"</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weaponframe">weaponframe</a> = 0;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a> | <a href="qc-defs.htm#IT_ROCKETS">IT_ROCKETS</a>;
}
<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == <a href="qc-defs.htm#IT_ROCKET_LAUNCHER">IT_ROCKET_LAUNCHER</a>)
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_currentammo">currentammo</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_rockets">ammo_rockets</a>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weaponmodel">weaponmodel</a> = <b>"progs/v_rock2.mdl"</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weaponframe">weaponframe</a> = 0;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a> | <a href="qc-defs.htm#IT_ROCKETS">IT_ROCKETS</a>;
}
<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == <a href="qc-defs.htm#IT_LIGHTNING">IT_LIGHTNING</a>)
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_currentammo">currentammo</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_cells">ammo_cells</a>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weaponmodel">weaponmodel</a> = <b>"progs/v_light.mdl"</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weaponframe">weaponframe</a> = 0;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a> | <a href="qc-defs.htm#IT_CELLS">IT_CELLS</a>;
}
<b>else</b>
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_currentammo">currentammo</a> = 0;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weaponmodel">weaponmodel</a> = <b>""</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weaponframe">weaponframe</a> = 0;
}
};
<a href="qc-types.htm#float">float</a>() <b>W_BestWeapon</b><a name="W_BestWeapon">=</a>
{
<b>local</b> <a href="qc-types.htm#float">float</a> it;
it = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a>;
<b>if</b>(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_cells">ammo_cells</a> >= 1 && (it & <a href="qc-defs.htm#IT_LIGHTNING">IT_LIGHTNING</a>) )
return IT_LIGHTNING;
<b>else</b> <b>if</b>(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_nails">ammo_nails</a> >= 2 && (it & <a href="qc-defs.htm#IT_SUPER_NAILGUN">IT_SUPER_NAILGUN</a>) )
return IT_SUPER_NAILGUN;
<b>else</b> <b>if</b>(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_shells">ammo_shells</a> >= 2 && (it & <a href="qc-defs.htm#IT_SUPER_SHOTGUN">IT_SUPER_SHOTGUN</a>) )
return IT_SUPER_SHOTGUN;
<b>else</b> <b>if</b>(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_nails">ammo_nails</a> >= 1 && (it & <a href="qc-defs.htm#IT_NAILGUN">IT_NAILGUN</a>) )
return IT_NAILGUN;
<b>else</b> <b>if</b>(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ammo_shells">ammo_shells</a> >= 1 && (it & <a href="qc-defs.htm#IT_SHOTGUN">IT_SHOTGUN</a>) )
return IT_SHOTGUN;
<i>/*
if(self.ammo_rockets >= 1 && (it & IT_ROCKET_LAUNCHER) )
return IT_ROCKET_LAUNCHER;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -