⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 items.htm

📁 Quake 的 各 种 文 档 格 式 说 明
💻 HTM
📖 第 1 页 / 共 5 页
字号:
	{
		<b>if</b> (leave &amp;&amp; (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_items">items</a> &amp; <a href="qc-defs.htm#IT_GRENADE_LAUNCHER">IT_GRENADE_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_GRENADE_LAUNCHER">IT_GRENADE_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_lightning"</b>)
	{
		<b>if</b> (leave &amp;&amp; (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_items">items</a> &amp; <a href="qc-defs.htm#IT_LIGHTNING">IT_LIGHTNING</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_LIGHTNING">IT_LIGHTNING</a>;
		<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_cells">ammo_cells</a> = <a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_cells">ammo_cells</a> + 15;
	}
	<b>else</b>
		<a href="qc-built.htm#objerror">objerror</a> (<b>"weapon_touch: unknown classname"</b>);

	<a href="qc-built.htm#sprint">sprint</a> (<a href="qc-glob.htm#other">other</a>, <b>"You got the "</b>);
	<a href="qc-built.htm#sprint">sprint</a> (<a href="qc-glob.htm#other">other</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_netname">netname</a>);
	<a href="qc-built.htm#sprint">sprint</a> (<a href="qc-glob.htm#other">other</a>, <b>"\n"</b>);
<i>// weapon 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>"weapons/pkup.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="items.htm#bound_other_ammo">bound_other_ammo</a> ();

<i>// change to the weapon</i>
	old = <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> | new;
	
	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>;

	<b>if</b> (!<a href="qc-glob.htm#deathmatch">deathmatch</a>)
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> = new;
	<b>else</b>
		<a href="items.htm#Deathmatch_Weapon">Deathmatch_Weapon</a> (old, new);

	<a href="weapons.htm#W_SetCurrentAmmo">W_SetCurrentAmmo</a>();

	<a href="qc-glob.htm#self">self</a> = stemp;

	<b>if</b> (leave)
		<b>return</b>;

<i>// remove it in single player, or setup for respawning in deathmatch</i>
	<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>;
	<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>;
	<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> + 30;
	<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="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 weapon_supershotgun (0 .5 .8) (-16 -16 0) (16 16 32)
*/</i>


<a href="qc-types.htm#void">void</a>() <b>weapon_supershotgun</b><a name="weapon_supershotgun">=</a>
{
	<a href="qc-built.htm#precache_model">precache_model</a> (<b>"progs/g_shot.mdl"</b>);
	<a href="qc-built.htm#setmodel">setmodel</a> (<a href="qc-glob.htm#self">self</a>, <b>"progs/g_shot.mdl"</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_netname">netname</a> = <b>"Double-barrelled Shotgun"</b>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_touch">touch</a> = <a href="items.htm#weapon_touch">weapon_touch</a>;
	<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 weapon_nailgun (0 .5 .8) (-16 -16 0) (16 16 32)
*/</i>


<a href="qc-types.htm#void">void</a>() <b>weapon_nailgun</b><a name="weapon_nailgun">=</a>
{
	<a href="qc-built.htm#precache_model">precache_model</a> (<b>"progs/g_nail.mdl"</b>);
	<a href="qc-built.htm#setmodel">setmodel</a> (<a href="qc-glob.htm#self">self</a>, <b>"progs/g_nail.mdl"</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_netname">netname</a> = <b>"nailgun"</b>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_touch">touch</a> = <a href="items.htm#weapon_touch">weapon_touch</a>;
	<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 weapon_supernailgun (0 .5 .8) (-16 -16 0) (16 16 32)
*/</i>


<a href="qc-types.htm#void">void</a>() <b>weapon_supernailgun</b><a name="weapon_supernailgun">=</a>
{
	<a href="qc-built.htm#precache_model">precache_model</a> (<b>"progs/g_nail2.mdl"</b>);
	<a href="qc-built.htm#setmodel">setmodel</a> (<a href="qc-glob.htm#self">self</a>, <b>"progs/g_nail2.mdl"</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_netname">netname</a> = <b>"Super Nailgun"</b>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_touch">touch</a> = <a href="items.htm#weapon_touch">weapon_touch</a>;
	<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 weapon_grenadelauncher (0 .5 .8) (-16 -16 0) (16 16 32)
*/</i>


<a href="qc-types.htm#void">void</a>() <b>weapon_grenadelauncher</b><a name="weapon_grenadelauncher">=</a>
{
	<a href="qc-built.htm#precache_model">precache_model</a> (<b>"progs/g_rock.mdl"</b>);
	<a href="qc-built.htm#setmodel">setmodel</a> (<a href="qc-glob.htm#self">self</a>, <b>"progs/g_rock.mdl"</b>);
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> = 3;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_netname">netname</a> = <b>"Grenade Launcher"</b>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_touch">touch</a> = <a href="items.htm#weapon_touch">weapon_touch</a>;
	<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 weapon_rocketlauncher (0 .5 .8) (-16 -16 0) (16 16 32)
*/</i>


<a href="qc-types.htm#void">void</a>() <b>weapon_rocketlauncher</b><a name="weapon_rocketlauncher">=</a>
{
	<a href="qc-built.htm#precache_model">precache_model</a> (<b>"progs/g_rock2.mdl"</b>);
	<a href="qc-built.htm#setmodel">setmodel</a> (<a href="qc-glob.htm#self">self</a>, <b>"progs/g_rock2.mdl"</b>);
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> = 3;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_netname">netname</a> = <b>"Rocket Launcher"</b>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_touch">touch</a> = <a href="items.htm#weapon_touch">weapon_touch</a>;
	<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 weapon_lightning (0 .5 .8) (-16 -16 0) (16 16 32)
*/</i>


<a href="qc-types.htm#void">void</a>() <b>weapon_lightning</b><a name="weapon_lightning">=</a>
{
	<a href="qc-built.htm#precache_model">precache_model</a> (<b>"progs/g_light.mdl"</b>);
	<a href="qc-built.htm#setmodel">setmodel</a> (<a href="qc-glob.htm#self">self</a>, <b>"progs/g_light.mdl"</b>);
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> = 3;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_netname">netname</a> = <b>"Thunderbolt"</b>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_touch">touch</a> = <a href="items.htm#weapon_touch">weapon_touch</a>;
	<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>/*
===============================================================================

AMMO

===============================================================================
*/</i>


<a href="qc-types.htm#void">void</a>() <b>ammo_touch</b><a name="ammo_touch">=</a>
{
<b>local</b> <a href="qc-types.htm#entity">entity</a>	stemp;
<b>local</b> <a href="qc-types.htm#float">float</a>		best;

	<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#other">other</a>.<a href="qc-enty.htm#dot_health">health</a> &lt;= 0)
		<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;


<i>// shotgun</i>
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == 1)
	{
		<b>if</b> (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_shells">ammo_shells</a> &gt;= 100)
			<b>return</b>;
		<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> + <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_aflag">aflag</a>;
	}

<i>// spikes</i>
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == 2)
	{
		<b>if</b> (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_nails">ammo_nails</a> &gt;= 200)
			<b>return</b>;
		<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> + <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_aflag">aflag</a>;
	}

<i>//	rockets</i>
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == 3)
	{
		<b>if</b> (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_rockets">ammo_rockets</a> &gt;= 100)
			<b>return</b>;
		<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> + <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_aflag">aflag</a>;
	}

<i>//	cells</i>
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == 4)
	{
		<b>if</b> (<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_cells">ammo_cells</a> &gt;= 200)
			<b>return</b>;
		<a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_ammo_cells">ammo_cells</a> = <a href="qc-glob.htm#other">other</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_aflag">aflag</a>;
	}

	<a href="items.htm#bound_other_ammo">bound_other_ammo</a> ();
	
	<a href="qc-built.htm#sprint">sprint</a> (<a href="qc-glob.htm#other">other</a>, <b>"You got the "</b>);
	<a href="qc-built.htm#sprint">sprint</a> (<a href="qc-glob.htm#other">other</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_netname">netname</a>);
	<a href="qc-built.htm#sprint">sprint</a> (<a href="qc-glob.htm#other">other</a>, <b>"\n"</b>);
<i>// ammo 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>"weapons/lock4.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>);

<i>// change to a better weapon if appropriate</i>

	<b>if</b> ( <a href="qc-glob.htm#other">other</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == best )
	{
		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>;
		<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> ();
		<a href="qc-glob.htm#self">self</a> = stemp;
	}

<i>// if changed current ammo, update it</i>
	stemp = <a href="qc-glob.htm#self">self</a>;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -