📄 items.htm
字号:
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_nextthink">nextthink</a> = <a href="qc-glob.htm#time">time</a> + 20;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_think">think</a> = <a href="items.htm#SUB_regen">SUB_regen</a>;
}
};
<i>/*
===============================================================================
ARMOR
===============================================================================
*/</i>
<a href="qc-types.htm#void">void</a>() <a href="items.htm#armor_touch">armor_touch</a>;
<a href="qc-types.htm#void">void</a>() <b>armor_touch</b><a name="armor_touch">=</a>
{
<b>local</b> <a href="qc-types.htm#float">float</a> type, value, bit;
<b>if</b> (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_health">health</a> <= 0)
<b>return</b>;
<b>if</b> (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_classname">classname</a> != <b>"player"</b>)
<b>return</b>;
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_classname">classname</a> == <b>"item_armor1"</b>)
{
type = 0.3;
value = 100;
bit = <a href="qc-defs.htm#IT_ARMOR1">IT_ARMOR1</a>;
}
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_classname">classname</a> == <b>"item_armor2"</b>)
{
type = 0.6;
value = 150;
bit = <a href="qc-defs.htm#IT_ARMOR2">IT_ARMOR2</a>;
}
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_classname">classname</a> == <b>"item_armorInv"</b>)
{
type = 0.8;
value = 200;
bit = <a href="qc-defs.htm#IT_ARMOR3">IT_ARMOR3</a>;
}
<b>if</b> (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_armortype">armortype</a>*<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_armorvalue">armorvalue</a> >= type*value)
<b>return</b>;
<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_armortype">armortype</a> = type;
<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_armorvalue">armorvalue</a> = value;
<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_items">items</a> = <a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_items">items</a> - (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_items">items</a> & (<a href="qc-defs.htm#IT_ARMOR1">IT_ARMOR1</a> | <a href="qc-defs.htm#IT_ARMOR2">IT_ARMOR2</a> | <a href="qc-defs.htm#IT_ARMOR3">IT_ARMOR3</a>)) + bit;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_solid">solid</a> = <a href="qc-defs.htm#SOLID_NOT">SOLID_NOT</a>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_model">model</a> = <a href="defs.htm#string_null">string_null</a>;
<b>if</b> (<a href="qc-glob.htm#deathmatch">deathmatch</a> == 1)
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_nextthink">nextthink</a> = <a href="qc-glob.htm#time">time</a> + 20;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_think">think</a> = <a href="items.htm#SUB_regen">SUB_regen</a>;
<a href="qc-built.htm#sprint">sprint</a>(<a href="qc-glob.htm#other">other</a>, <b>"You got armor\n"</b>);
<i>// armor touch sound</i>
<a href="qc-built.htm#sound">sound</a>(<a href="qc-glob.htm#other">other</a>, <a href="qc-defs.htm#CHAN_ITEM">CHAN_ITEM</a>, <b>"items/armor1.wav"</b>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
<a href="qc-built.htm#stuffcmd">stuffcmd</a> (<a href="qc-glob.htm#other">other</a>, <b>"bf\n"</b>);
<a href="defs.htm#activator">activator</a> = <a href="qc-glob.htm#other">other</a>;
<a href="subs.htm#SUB_UseTargets">SUB_UseTargets</a>(); <i>// fire all targets / killtargets</i>
};
<i>/*QUAKED item_armor1 (0 .5 .8) (-16 -16 0) (16 16 32)
*/</i>
<a href="qc-types.htm#void">void</a>() <b>item_armor1</b><a name="item_armor1">=</a>
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_touch">touch</a> = <a href="items.htm#armor_touch">armor_touch</a>;
<a href="qc-built.htm#precache_model">precache_model</a> (<b>"progs/armor.mdl"</b>);
<a href="qc-built.htm#setmodel">setmodel</a> (<a href="qc-glob.htm#self">self</a>, <b>"progs/armor.mdl"</b>);
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_skin">skin</a> = 0;
<a href="qc-built.htm#setsize">setsize</a> (<a href="qc-glob.htm#self">self</a>, '-16 -16 0', '16 16 56');
<a href="items.htm#StartItem">StartItem</a> ();
};
<i>/*QUAKED item_armor2 (0 .5 .8) (-16 -16 0) (16 16 32)
*/</i>
<a href="qc-types.htm#void">void</a>() <b>item_armor2</b><a name="item_armor2">=</a>
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_touch">touch</a> = <a href="items.htm#armor_touch">armor_touch</a>;
<a href="qc-built.htm#precache_model">precache_model</a> (<b>"progs/armor.mdl"</b>);
<a href="qc-built.htm#setmodel">setmodel</a> (<a href="qc-glob.htm#self">self</a>, <b>"progs/armor.mdl"</b>);
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_skin">skin</a> = 1;
<a href="qc-built.htm#setsize">setsize</a> (<a href="qc-glob.htm#self">self</a>, '-16 -16 0', '16 16 56');
<a href="items.htm#StartItem">StartItem</a> ();
};
<i>/*QUAKED item_armorInv (0 .5 .8) (-16 -16 0) (16 16 32)
*/</i>
<a href="qc-types.htm#void">void</a>() <b>item_armorInv</b><a name="item_armorInv">=</a>
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_touch">touch</a> = <a href="items.htm#armor_touch">armor_touch</a>;
<a href="qc-built.htm#precache_model">precache_model</a> (<b>"progs/armor.mdl"</b>);
<a href="qc-built.htm#setmodel">setmodel</a> (<a href="qc-glob.htm#self">self</a>, <b>"progs/armor.mdl"</b>);
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_skin">skin</a> = 2;
<a href="qc-built.htm#setsize">setsize</a> (<a href="qc-glob.htm#self">self</a>, '-16 -16 0', '16 16 56');
<a href="items.htm#StartItem">StartItem</a> ();
};
<i>/*
===============================================================================
WEAPONS
===============================================================================
*/</i>
<a href="qc-types.htm#void">void</a>() <b>bound_other_ammo</b><a name="bound_other_ammo">=</a>
{
<b>if</b> (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_shells">ammo_shells</a> > 100)
<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_shells">ammo_shells</a> = 100;
<b>if</b> (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_nails">ammo_nails</a> > 200)
<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_nails">ammo_nails</a> = 200;
<b>if</b> (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_rockets">ammo_rockets</a> > 100)
<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_rockets">ammo_rockets</a> = 100;
<b>if</b> (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_cells">ammo_cells</a> > 100)
<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_cells">ammo_cells</a> = 100;
};
<a href="qc-types.htm#float">float</a>(<a href="qc-types.htm#float">float</a> w) <b>RankForWeapon</b><a name="RankForWeapon">=</a>
{
<b>if</b> (w == <a href="qc-defs.htm#IT_LIGHTNING">IT_LIGHTNING</a>)
return 1;
<b>if</b> (w == <a href="qc-defs.htm#IT_ROCKET_LAUNCHER">IT_ROCKET_LAUNCHER</a>)
return 2;
<b>if</b> (w == <a href="qc-defs.htm#IT_SUPER_NAILGUN">IT_SUPER_NAILGUN</a>)
return 3;
<b>if</b> (w == <a href="qc-defs.htm#IT_GRENADE_LAUNCHER">IT_GRENADE_LAUNCHER</a>)
return 4;
<b>if</b> (w == <a href="qc-defs.htm#IT_SUPER_SHOTGUN">IT_SUPER_SHOTGUN</a>)
return 5;
<b>if</b> (w == <a href="qc-defs.htm#IT_NAILGUN">IT_NAILGUN</a>)
return 6;
return 7;
};
<i>/*
=============
Deathmatch_Weapon
Deathmatch weapon change rules for picking up a weapon
.float ammo_shells, ammo_nails, ammo_rockets, ammo_cells;
=============
*/</i>
<a href="qc-types.htm#void">void</a>(<a href="qc-types.htm#float">float</a> old, <a href="qc-types.htm#float">float</a> new) <b>Deathmatch_Weapon</b><a name="Deathmatch_Weapon">=</a>
{
<b>local</b> <a href="qc-types.htm#float">float</a> or, nr;
<i>// change self.weapon if desired</i>
or = <a href="items.htm#RankForWeapon">RankForWeapon</a> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a>);
nr = <a href="items.htm#RankForWeapon">RankForWeapon</a> (new);
<b>if</b> ( nr < or )
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> = new;
};
<i>/*
=============
weapon_touch
=============
*/</i>
<a href="qc-types.htm#float">float</a>() <a href="weapons.htm#W_BestWeapon">W_BestWeapon</a>;
<a href="qc-types.htm#void">void</a>() <b>weapon_touch</b><a name="weapon_touch">=</a>
{
<b>local</b> <a href="qc-types.htm#float">float</a> hadammo, best, new, old;
<b>local</b> <a href="qc-types.htm#entity">entity</a> stemp;
<b>local</b> <a href="qc-types.htm#float">float</a> leave;
<b>if</b> (!(<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_flags">flags</a> & <a href="defs.htm#FL_CLIENT">FL_CLIENT</a>))
<b>return</b>;
<i>// if the player was using his best weapon, change up to the new one if better </i>
stemp = <a href="qc-glob.htm#self">self</a>;
<a href="qc-glob.htm#self">self</a> = <a href="qc-glob.htm#other">other</a>;
best = <a href="weapons.htm#W_BestWeapon">W_BestWeapon</a>();
<a href="qc-glob.htm#self">self</a> = stemp;
<b>if</b> (<a href="qc-glob.htm#deathmatch">deathmatch</a> == 2 || <a href="qc-glob.htm#coop">coop</a>)
leave = 1;
<b>else</b>
leave = 0;
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_classname">classname</a> == <b>"weapon_nailgun"</b>)
{
<b>if</b> (leave && (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_items">items</a> & <a href="qc-defs.htm#IT_NAILGUN">IT_NAILGUN</a>) )
<b>return</b>;
hadammo = <a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_nails">ammo_nails</a>;
new = <a href="qc-defs.htm#IT_NAILGUN">IT_NAILGUN</a>;
<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_nails">ammo_nails</a> = <a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_nails">ammo_nails</a> + 30;
}
<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_classname">classname</a> == <b>"weapon_supernailgun"</b>)
{
<b>if</b> (leave && (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_items">items</a> & <a href="qc-defs.htm#IT_SUPER_NAILGUN">IT_SUPER_NAILGUN</a>) )
<b>return</b>;
hadammo = <a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_rockets">ammo_rockets</a>;
new = <a href="qc-defs.htm#IT_SUPER_NAILGUN">IT_SUPER_NAILGUN</a>;
<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_nails">ammo_nails</a> = <a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_nails">ammo_nails</a> + 30;
}
<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_classname">classname</a> == <b>"weapon_supershotgun"</b>)
{
<b>if</b> (leave && (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_items">items</a> & <a href="qc-defs.htm#IT_SUPER_SHOTGUN">IT_SUPER_SHOTGUN</a>) )
<b>return</b>;
hadammo = <a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_rockets">ammo_rockets</a>;
new = <a href="qc-defs.htm#IT_SUPER_SHOTGUN">IT_SUPER_SHOTGUN</a>;
<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_shells">ammo_shells</a> = <a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_shells">ammo_shells</a> + 5;
}
<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_classname">classname</a> == <b>"weapon_rocketlauncher"</b>)
{
<b>if</b> (leave && (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_items">items</a> & <a href="qc-defs.htm#IT_ROCKET_LAUNCHER">IT_ROCKET_LAUNCHER</a>) )
<b>return</b>;
hadammo = <a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_rockets">ammo_rockets</a>;
new = <a href="qc-defs.htm#IT_ROCKET_LAUNCHER">IT_ROCKET_LAUNCHER</a>;
<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_rockets">ammo_rockets</a> = <a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_rockets">ammo_rockets</a> + 5;
}
<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_classname">classname</a> == <b>"weapon_grenadelauncher"</b>)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -