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

📄 plats.htm

📁 Quake 的 各 种 文 档 格 式 说 明
💻 HTM
📖 第 1 页 / 共 2 页
字号:
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_movetype">movetype</a> = <a href="qc-defs.htm#MOVETYPE_PUSH">MOVETYPE_PUSH</a>;
	<a href="qc-built.htm#setorigin">setorigin</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin">origin</a>);	
	<a href="qc-built.htm#setmodel">setmodel</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_model">model</a>);
	<a href="qc-built.htm#setsize">setsize</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_mins">mins</a> , <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_maxs">maxs</a>);

	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_blocked">blocked</a> = <a href="plats.htm#plat_crush">plat_crush</a>;
	<b>if</b> (!<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_speed">speed</a>)
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_speed">speed</a> = 150;

<i>// pos1 is the top position, pos2 is the bottom</i>
	<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_origin">origin</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_origin">origin</a>;
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_height">height</a>)
		<a href="qc-glob.htm#self">self</a>.pos2_z = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin_z">origin_z</a> - <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_height">height</a>;
	<b>else</b>
		<a href="qc-glob.htm#self">self</a>.pos2_z = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin_z">origin_z</a> - <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_size_z">size_z</a> + 8;

	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_use">use</a> = <a href="plats.htm#plat_trigger_use">plat_trigger_use</a>;

	<a href="plats.htm#plat_spawn_inside_trigger">plat_spawn_inside_trigger</a> ();	<i>// the "start moving" trigger	</i>

	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_targetname">targetname</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="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_use">use</a> = <a href="plats.htm#plat_use">plat_use</a>;
	}
	<b>else</b>
	{
		<a href="qc-built.htm#setorigin">setorigin</a> (<a href="qc-glob.htm#self">self</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_state">state</a> = <a href="defs.htm#STATE_BOTTOM">STATE_BOTTOM</a>;
	}
};

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

<a href="qc-types.htm#void">void</a>() <a href="plats.htm#train_next">train_next</a>;
<a href="qc-types.htm#void">void</a>() <a href="plats.htm#func_train_find">func_train_find</a>;

<a href="qc-types.htm#void">void</a>() <b>train_blocked</b><a name="train_blocked">=</a>
{
	<b>if</b> (<a href="qc-glob.htm#time">time</a> &lt; <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_attack_finished">attack_finished</a>)
		<b>return</b>;
	<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.5;
	<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-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_dmg">dmg</a>);
};
<a href="qc-types.htm#void">void</a>() <b>train_use</b><a name="train_use">=</a>
{
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_think">think</a> != <a href="plats.htm#func_train_find">func_train_find</a>)
		<b>return</b>;		<i>// already activated</i>
	<a href="plats.htm#train_next">train_next</a>();
};

<a href="qc-types.htm#void">void</a>() <b>train_wait</b><a name="train_wait">=</a>
{
	<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_wait">wait</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> + <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_wait">wait</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>);
	}
	<b>else</b>
		<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> + 0.1;
	
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_think">think</a> = <a href="plats.htm#train_next">train_next</a>;
};

<a href="qc-types.htm#void">void</a>() <b>train_next</b><a name="train_next">=</a>
{
	<b>local</b> <a href="qc-types.htm#entity">entity</a>	targ;

	targ = <a href="qc-built.htm#find">find</a> (<a href="qc-glob.htm#world">world</a>, targetname, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_target">target</a>);
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_target">target</a> = targ.<a href="qc-enty.htm#dot_target">target</a>;
	<b>if</b> (!<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_target">target</a>)
		<a href="qc-built.htm#objerror">objerror</a> (<b>"train_next: no next target"</b>);
	<b>if</b> (targ.<a href="qc-enty.htm#dot_wait">wait</a>)
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_wait">wait</a> = targ.<a href="qc-enty.htm#dot_wait">wait</a>;
	<b>else</b>
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_wait">wait</a> = 0;
	<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="subs.htm#SUB_CalcMove">SUB_CalcMove</a> (targ.<a href="qc-enty.htm#dot_origin">origin</a> - <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_mins">mins</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_speed">speed</a>, <a href="plats.htm#train_wait">train_wait</a>);
};

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

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

	targ = <a href="qc-built.htm#find">find</a> (<a href="qc-glob.htm#world">world</a>, targetname, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_target">target</a>);
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_target">target</a> = targ.<a href="qc-enty.htm#dot_target">target</a>;
	<a href="qc-built.htm#setorigin">setorigin</a> (<a href="qc-glob.htm#self">self</a>, targ.<a href="qc-enty.htm#dot_origin">origin</a> - <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_mins">mins</a>);
	<b>if</b> (!<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_targetname">targetname</a>)
	{	<i>// not triggered, so start immediately</i>
		<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> + 0.1;
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_think">think</a> = <a href="plats.htm#train_next">train_next</a>;
	}
};

<i>/*QUAKED func_train (0 .5 .8) ?
Trains are moving platforms that players can ride.
The targets origin specifies the min point of the train at each corner.
The train spawns at the first target it is pointing at.
If the train is the target of a button or trigger, it will not begin moving until activated.
speed	default 100
dmg		default	2
sounds
1) ratchet metal

*/</i>

<a href="qc-types.htm#void">void</a>() <b>func_train</b><a name="func_train">=</a>
{	
	<b>if</b> (!<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_speed">speed</a>)
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_speed">speed</a> = 100;
	<b>if</b> (!<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_target">target</a>)
		<a href="qc-built.htm#objerror">objerror</a> (<b>"func_train without a target"</b>);
	<b>if</b> (!<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_dmg">dmg</a>)
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_dmg">dmg</a> = 2;

	<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_noise">noise</a> = (<b>"misc/null.wav"</b>);
		<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"misc/null.wav"</b>);
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise1">noise1</a> = (<b>"misc/null.wav"</b>);
		<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"misc/null.wav"</b>);
	}

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

	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_cnt">cnt</a> = 1;
	<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>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_movetype">movetype</a> = <a href="qc-defs.htm#MOVETYPE_PUSH">MOVETYPE_PUSH</a>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_blocked">blocked</a> = <a href="plats.htm#train_blocked">train_blocked</a>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_use">use</a> = <a href="plats.htm#train_use">train_use</a>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_classname">classname</a> = <b>"train"</b>;

	<a href="qc-built.htm#setmodel">setmodel</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_model">model</a>);
	<a href="qc-built.htm#setsize">setsize</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_mins">mins</a> , <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_maxs">maxs</a>);
	<a href="qc-built.htm#setorigin">setorigin</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin">origin</a>);

<i>// start trains on the second frame, to make sure their targets have had</i>
<i>// a chance to spawn</i>
	<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> + 0.1;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_think">think</a> = <a href="plats.htm#func_train_find">func_train_find</a>;
};

<i>/*QUAKED misc_teleporttrain (0 .5 .8) (-8 -8 -8) (8 8 8)
This is used for the final bos
*/</i>

<a href="qc-types.htm#void">void</a>() <b>misc_teleporttrain</b><a name="misc_teleporttrain">=</a>
{	
	<b>if</b> (!<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_speed">speed</a>)
		<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_speed">speed</a> = 100;
	<b>if</b> (!<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_target">target</a>)
		<a href="qc-built.htm#objerror">objerror</a> (<b>"func_train without a target"</b>);

	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_cnt">cnt</a> = 1;
	<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_movetype">movetype</a> = <a href="qc-defs.htm#MOVETYPE_PUSH">MOVETYPE_PUSH</a>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_blocked">blocked</a> = <a href="plats.htm#train_blocked">train_blocked</a>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_use">use</a> = <a href="plats.htm#train_use">train_use</a>;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_avelocity">avelocity</a> = '100 200 300';

	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise">noise</a> = (<b>"misc/null.wav"</b>);
	<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"misc/null.wav"</b>);
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise1">noise1</a> = (<b>"misc/null.wav"</b>);
	<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"misc/null.wav"</b>);

	<a href="qc-built.htm#precache_model2">precache_model2</a> (<b>"progs/teleport.mdl"</b>);
	<a href="qc-built.htm#setmodel">setmodel</a> (<a href="qc-glob.htm#self">self</a>, <b>"progs/teleport.mdl"</b>);
	<a href="qc-built.htm#setsize">setsize</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_mins">mins</a> , <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_maxs">maxs</a>);
	<a href="qc-built.htm#setorigin">setorigin</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin">origin</a>);

<i>// start trains on the second frame, to make sure their targets have had</i>
<i>// a chance to spawn</i>
	<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> + 0.1;
	<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_think">think</a> = <a href="plats.htm#func_train_find">func_train_find</a>;
};


</pre></body></html>

⌨️ 快捷键说明

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