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

📄 plats.htm

📁 Quake 的 各 种 文 档 格 式 说 明
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<html><head><title>plats.qc</title></head><body bgcolor="#C0F0D0">
<base target=examine>
<pre>


<a href="qc-types.htm#void">void</a>() <a href="plats.htm#plat_center_touch">plat_center_touch</a>;
<a href="qc-types.htm#void">void</a>() <a href="plats.htm#plat_outside_touch">plat_outside_touch</a>;
<a href="qc-types.htm#void">void</a>() <a href="plats.htm#plat_trigger_use">plat_trigger_use</a>;
<a href="qc-types.htm#void">void</a>() <a href="plats.htm#plat_go_up">plat_go_up</a>;
<a href="qc-types.htm#void">void</a>() <a href="plats.htm#plat_go_down">plat_go_down</a>;
<a href="qc-types.htm#void">void</a>() <a href="plats.htm#plat_crush">plat_crush</a>;
<a href="qc-types.htm#float">float</a> <b><a name="PLAT_LOW_TRIGGER">PLAT_LOW_TRIGGER</a></b> = 1;

<a href="qc-types.htm#void">void</a>() <b>plat_spawn_inside_trigger</b><a name="plat_spawn_inside_trigger">=</a>
{
	<b>local</b> <a href="qc-types.htm#entity">entity</a>	trigger;
	<b>local</b> <a href="qc-types.htm#vector">vector</a>	tmin, tmax;

<i>//</i>
<i>// middle trigger</i>
<i>//	</i>
	trigger = <a href="qc-built.htm#spawn">spawn</a>();
	trigger.<a href="qc-enty.htm#dot_touch">touch</a> = <a href="plats.htm#plat_center_touch">plat_center_touch</a>;
	trigger.<a href="qc-enty.htm#dot_movetype">movetype</a> = <a href="qc-defs.htm#MOVETYPE_NONE">MOVETYPE_NONE</a>;
	trigger.<a href="qc-enty.htm#dot_solid">solid</a> = <a href="qc-defs.htm#SOLID_TRIGGER">SOLID_TRIGGER</a>;
	trigger.<a href="qc-enty.htm#dot_enemy">enemy</a> = <a href="qc-glob.htm#self">self</a>;
	
	tmin = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_mins">mins</a> + '25 25 0';
	tmax = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_maxs">maxs</a> - '25 25 -8';
	tmin_z = tmax_z - (<a href="qc-glob.htm#self">self</a>.pos1_z - <a href="qc-glob.htm#self">self</a>.pos2_z + 8);
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_spawnflags">spawnflags</a> &amp; <a href="plats.htm#PLAT_LOW_TRIGGER">PLAT_LOW_TRIGGER</a>)
		tmax_z = tmin_z + 8;
	
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_size_x">size_x</a> &lt;= 50)
	{
		tmin_x = (<a href="qc-glob.htm#self">self</a>.mins_x + <a href="qc-glob.htm#self">self</a>.maxs_x) / 2;
		tmax_x = tmin_x + 1;
	}
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_size_y">size_y</a> &lt;= 50)
	{
		tmin_y = (<a href="qc-glob.htm#self">self</a>.mins_y + <a href="qc-glob.htm#self">self</a>.maxs_y) / 2;
		tmax_y = tmin_y + 1;
	}
	
	<a href="qc-built.htm#setsize">setsize</a> (trigger, tmin, tmax);
};

<a href="qc-types.htm#void">void</a>() <b>plat_hit_top</b><a name="plat_hit_top">=</a>
{
	<a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-defs.htm#CHAN_VOICE">CHAN_VOICE</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise1">noise1</a>, 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_state">state</a> = <a href="defs.htm#STATE_TOP">STATE_TOP</a>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_think">think</a> = <a href="plats.htm#plat_go_down">plat_go_down</a>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_nextthink">nextthink</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ltime">ltime</a> + 3;
};

<a href="qc-types.htm#void">void</a>() <b>plat_hit_bottom</b><a name="plat_hit_bottom">=</a>
{
	<a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-defs.htm#CHAN_VOICE">CHAN_VOICE</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise1">noise1</a>, 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_state">state</a> = <a href="defs.htm#STATE_BOTTOM">STATE_BOTTOM</a>;
};

<a href="qc-types.htm#void">void</a>() <b>plat_go_down</b><a name="plat_go_down">=</a>
{
	<a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-defs.htm#CHAN_VOICE">CHAN_VOICE</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise">noise</a>, 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_state">state</a> = <a href="defs.htm#STATE_DOWN">STATE_DOWN</a>;
	<a href="subs.htm#SUB_CalcMove">SUB_CalcMove</a> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_pos2">pos2</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_speed">speed</a>, <a href="plats.htm#plat_hit_bottom">plat_hit_bottom</a>);
};

<a href="qc-types.htm#void">void</a>() <b>plat_go_up</b><a name="plat_go_up">=</a>
{
	<a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-defs.htm#CHAN_VOICE">CHAN_VOICE</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise">noise</a>, 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_state">state</a> = <a href="defs.htm#STATE_UP">STATE_UP</a>;
	<a href="subs.htm#SUB_CalcMove">SUB_CalcMove</a> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_pos1">pos1</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_speed">speed</a>, <a href="plats.htm#plat_hit_top">plat_hit_top</a>);
};

<a href="qc-types.htm#void">void</a>() <b>plat_center_touch</b><a name="plat_center_touch">=</a>
{
	<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>;

	<a href="qc-glob.htm#self">self</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_enemy">enemy</a>;
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_state">state</a> == <a href="defs.htm#STATE_BOTTOM">STATE_BOTTOM</a>)
		<a href="plats.htm#plat_go_up">plat_go_up</a> ();
	<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_state">state</a> == <a href="defs.htm#STATE_TOP">STATE_TOP</a>)
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_nextthink">nextthink</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ltime">ltime</a> + 1;	<i>// delay going down</i>
};

<a href="qc-types.htm#void">void</a>() <b>plat_outside_touch</b><a name="plat_outside_touch">=</a>
{
	<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>//dprint ("plat_outside_touch\n");</i>
	<a href="qc-glob.htm#self">self</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_enemy">enemy</a>;
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_state">state</a> == <a href="defs.htm#STATE_TOP">STATE_TOP</a>)
		<a href="plats.htm#plat_go_down">plat_go_down</a> ();
};

<a href="qc-types.htm#void">void</a>() <b>plat_trigger_use</b><a name="plat_trigger_use">=</a>
{
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_think">think</a>)
		<b>return</b>;		<i>// allready activated</i>
	<a href="plats.htm#plat_go_down">plat_go_down</a>();
};


<a href="qc-types.htm#void">void</a>() <b>plat_crush</b><a name="plat_crush">=</a>
{
<i>//dprint ("plat_crush\n");</i>

	<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>, 1);
	
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_state">state</a> == <a href="defs.htm#STATE_UP">STATE_UP</a>)
		<a href="plats.htm#plat_go_down">plat_go_down</a> ();
	<b>else</b> <b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_state">state</a> == <a href="defs.htm#STATE_DOWN">STATE_DOWN</a>)
		<a href="plats.htm#plat_go_up">plat_go_up</a> ();
	<b>else</b>
		<a href="qc-built.htm#objerror">objerror</a> (<b>"plat_crush: bad self.state\n"</b>);
};

<a href="qc-types.htm#void">void</a>() <b>plat_use</b><a name="plat_use">=</a>
{
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_use">use</a> = <a href="subs.htm#SUB_Null">SUB_Null</a>;
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_state">state</a> != <a href="defs.htm#STATE_UP">STATE_UP</a>)
		<a href="qc-built.htm#objerror">objerror</a> (<b>"plat_use: not in up state"</b>);
	<a href="plats.htm#plat_go_down">plat_go_down</a>();
};


<i>/*QUAKED func_plat (0 .5 .8) ? PLAT_LOW_TRIGGER
speed	default 150

Plats are always drawn in the extended position, so they will light correctly.

If the plat is the target of another trigger or button, it will start out disabled in the extended position until it is trigger, when it will lower and become a normal plat.

If the "height" key is set, that will determine the amount the plat moves, instead of being implicitly determined by the model's height.
Set "sounds" to one of the following:
1) base fast
2) chain slow
*/</i>



<a href="qc-types.htm#void">void</a>() <b>func_plat</b><a name="func_plat">=</a>

{
<b>local</b> <a href="qc-types.htm#entity">entity</a> t;

	<b>if</b> (!<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_t_length">t_length</a>)
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_t_length">t_length</a> = 80;
	<b>if</b> (!<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_t_width">t_width</a>)
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_t_width">t_width</a> = 10;

	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_sounds">sounds</a> == 0)
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_sounds">sounds</a> = 2;
<i>// FIX THIS TO LOAD A GENERIC PLAT SOUND</i>

	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_sounds">sounds</a> == 1)
	{
		<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"plats/plat1.wav"</b>);
		<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"plats/plat2.wav"</b>);
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise">noise</a> = <b>"plats/plat1.wav"</b>;
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise1">noise1</a> = <b>"plats/plat2.wav"</b>;
	}

	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_sounds">sounds</a> == 2)
	{
		<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"plats/medplat1.wav"</b>);
		<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"plats/medplat2.wav"</b>);
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise">noise</a> = <b>"plats/medplat1.wav"</b>;
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise1">noise1</a> = <b>"plats/medplat2.wav"</b>;
	}


	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_mangle">mangle</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_angles">angles</a>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_angles">angles</a> = '0 0 0';

	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_classname">classname</a> = <b>"plat"</b>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_solid">solid</a> = <a href="qc-defs.htm#SOLID_BSP">SOLID_BSP</a>;

⌨️ 快捷键说明

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