📄 doors.htm
字号:
}
} <b>while</b> (1 );
};
<i>/*QUAKED func_door (0 .5 .8) ? START_OPEN x DOOR_DONT_LINK GOLD_KEY SILVER_KEY TOGGLE
if two doors touch, they are assumed to be connected and operate as a unit.
TOGGLE causes the door to wait in both the start and end states for a trigger event.
START_OPEN causes the door to move to its destination when spawned, and operate in reverse. It is used to temporarily or permanently close off an area when triggered (not usefull for touch or takedamage doors).
Key doors are allways wait -1.
"message" is printed when the door is touched if it is a trigger door and it hasn't been fired yet
"angle" determines the opening direction
"targetname" if set, no touch field will be spawned and a remote button or trigger field activates the door.
"health" if set, door must be shot open
"speed" movement speed (100 default)
"wait" wait before returning (3 default, -1 = never return)
"lip" lip remaining at end of move (8 default)
"dmg" damage to inflict when blocked (2 default)
"sounds"
0) no sound
1) stone
2) base
3) stone chain
4) screechy metal
*/</i>
<a href="qc-types.htm#void">void</a>() <b>func_door</b><a name="func_door">=</a>
{
<b>if</b> (<a href="qc-glob.htm#world">world</a>.<a href="qc-enty.htm#dot_worldtype">worldtype</a> == 0)
{
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"doors/medtry.wav"</b>);
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"doors/meduse.wav"</b>);
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise3">noise3</a> = <b>"doors/medtry.wav"</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise4">noise4</a> = <b>"doors/meduse.wav"</b>;
}
<b>else</b> <b>if</b> (<a href="qc-glob.htm#world">world</a>.<a href="qc-enty.htm#dot_worldtype">worldtype</a> == 1)
{
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"doors/runetry.wav"</b>);
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"doors/runeuse.wav"</b>);
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise3">noise3</a> = <b>"doors/runetry.wav"</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise4">noise4</a> = <b>"doors/runeuse.wav"</b>;
}
<b>else</b> <b>if</b> (<a href="qc-glob.htm#world">world</a>.<a href="qc-enty.htm#dot_worldtype">worldtype</a> == 2)
{
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"doors/basetry.wav"</b>);
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"doors/baseuse.wav"</b>);
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise3">noise3</a> = <b>"doors/basetry.wav"</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise4">noise4</a> = <b>"doors/baseuse.wav"</b>;
}
<b>else</b>
{
<a href="qc-built.htm#dprint">dprint</a> (<b>"no worldtype set!\n"</b>);
}
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_sounds">sounds</a> == 0)
{
<a href="qc-built.htm#precache_sound">precache_sound</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-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise2">noise2</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-built.htm#precache_sound">precache_sound</a> (<b>"doors/drclos4.wav"</b>);
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"doors/doormv1.wav"</b>);
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise1">noise1</a> = <b>"doors/drclos4.wav"</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise2">noise2</a> = <b>"doors/doormv1.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>"doors/hydro1.wav"</b>);
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"doors/hydro2.wav"</b>);
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise2">noise2</a> = <b>"doors/hydro1.wav"</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise1">noise1</a> = <b>"doors/hydro2.wav"</b>;
}
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_sounds">sounds</a> == 3)
{
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"doors/stndr1.wav"</b>);
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"doors/stndr2.wav"</b>);
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise2">noise2</a> = <b>"doors/stndr1.wav"</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise1">noise1</a> = <b>"doors/stndr2.wav"</b>;
}
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_sounds">sounds</a> == 4)
{
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"doors/ddoor1.wav"</b>);
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"doors/ddoor2.wav"</b>);
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise1">noise1</a> = <b>"doors/ddoor2.wav"</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise2">noise2</a> = <b>"doors/ddoor1.wav"</b>;
}
<a href="subs.htm#SetMovedir">SetMovedir</a> ();
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_max_health">max_health</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_health">health</a>;
<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-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-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_classname">classname</a> = <b>"door"</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_blocked">blocked</a> = <a href="doors.htm#door_blocked">door_blocked</a>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_use">use</a> = <a href="doors.htm#door_use">door_use</a>;
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_spawnflags">spawnflags</a> & <a href="doors.htm#DOOR_SILVER_KEY">DOOR_SILVER_KEY</a>)
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a> = <a href="qc-defs.htm#IT_KEY1">IT_KEY1</a>;
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_spawnflags">spawnflags</a> & <a href="doors.htm#DOOR_GOLD_KEY">DOOR_GOLD_KEY</a>)
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_items">items</a> = <a href="qc-defs.htm#IT_KEY2">IT_KEY2</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_wait">wait</a>)
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_wait">wait</a> = 3;
<b>if</b> (!<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_lip">lip</a>)
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_lip">lip</a> = 8;
<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;
<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_pos1">pos1</a> + <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_movedir">movedir</a>*(<a href="qc-built.htm#fabs">fabs</a>(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_movedir">movedir</a>*<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_size">size</a>) - <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_lip">lip</a>);
<i>// DOOR_START_OPEN is to allow an entity to be lighted in the closed position</i>
<i>// but spawn in the open position</i>
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_spawnflags">spawnflags</a> & <a href="doors.htm#DOOR_START_OPEN">DOOR_START_OPEN</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_pos2">pos2</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_pos1">pos1</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_origin">origin</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>;
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_health">health</a>)
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_takedamage">takedamage</a> = <a href="qc-defs.htm#DAMAGE_YES">DAMAGE_YES</a>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_th_die">th_die</a> = <a href="doors.htm#door_killed">door_killed</a>;
}
<b>if</b> (<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_wait">wait</a> = -1;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_touch">touch</a> = <a href="doors.htm#door_touch">door_touch</a>;
<i>// LinkDoors can't be done until all of the doors have been spawned, so</i>
<i>// the sizes can be detected properly.</i>
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_think">think</a> = <a href="doors.htm#LinkDoors">LinkDoors</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> + 0.1;
};
<i>/*
=============================================================================
SECRET DOORS
=============================================================================
*/</i>
<a href="qc-types.htm#void">void</a>() <a href="doors.htm#fd_secret_move1">fd_secret_move1</a>;
<a href="qc-types.htm#void">void</a>() <a href="doors.htm#fd_secret_move2">fd_secret_move2</a>;
<a href="qc-types.htm#void">void</a>() <a href="doors.htm#fd_secret_move3">fd_secret_move3</a>;
<a href="qc-types.htm#void">void</a>() <a href="doors.htm#fd_secret_move4">fd_secret_move4</a>;
<a href="qc-types.htm#void">void</a>() <a href="doors.htm#fd_secret_move5">fd_secret_move5</a>;
<a href="qc-types.htm#void">void</a>() <a href="doors.htm#fd_secret_move6">fd_secret_move6</a>;
<a href="qc-types.htm#void">void</a>() <a href="doors.htm#fd_secret_done">fd_secret_done</a>;
<a href="qc-types.htm#float">float</a> <b><a name="SECRET_OPEN_ONCE">SECRET_OPEN_ONCE</a></b> = 1; <i>// stays open</i>
<a href="qc-types.htm#float">float</a> <b><a name="SECRET_1ST_LEFT">SECRET_1ST_LEFT</a></b> = 2; <i>// 1st move is left of arrow</i>
<a href="qc-types.htm#float">float</a> <b><a name="SECRET_1ST_DOWN">SECRET_1ST_DOWN</a></b> = 4; <i>// 1st move is down from arrow</i>
<a href="qc-types.htm#float">float</a> <b><a name="SECRET_NO_SHOOT">SECRET_NO_SHOOT</a></b> = 8; <i>// only opened by trigger</i>
<a href="qc-types.htm#float">float</a> <b><a name="SECRET_YES_SHOOT">SECRET_YES_SHOOT</a></b> = 16; <i>// shootable even if targeted</i>
<a href="qc-types.htm#void">void</a> () <b>fd_secret_use</b><a name="fd_secret_use">=</a>
{
<b>local</b> <a href="qc-types.htm#float">float</a> temp;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_health">health</a> = 10000;
<i>// exit if still moving around...</i>
<b>if</b> (<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_oldorigin">oldorigin</a>)
<b>return</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_message">message</a> = <a href="defs.htm#string_null">string_null</a>; <i>// no more message</i>
<a href="subs.htm#SUB_UseTargets">SUB_UseTargets</a>(); <i>// fire all targets / killtargets</i>
<b>if</b> (!(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_spawnflags">spawnflags</a> & <a href="doors.htm#SECRET_NO_SHOOT">SECRET_NO_SHOOT</a>))
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_th_pain">th_pain</a> = <a href="subs.htm#SUB_Null">SUB_Null</a>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_takedamage">takedamage</a> = <a href="qc-defs.htm#DAMAGE_NO">DAMAGE_NO</a>;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -