📄 doors.htm
字号:
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_velocity">velocity</a> = '0 0 0';
<i>// Make a sound, wait a little...</i>
<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_nextthink">nextthink</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_ltime">ltime</a> + 0.1;
temp = 1 - (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_spawnflags">spawnflags</a> & <a href="doors.htm#SECRET_1ST_LEFT">SECRET_1ST_LEFT</a>); <i>// 1 or -1</i>
<a href="qc-built.htm#makevectors">makevectors</a>(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_mangle">mangle</a>);
<b>if</b> (!<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_t_width">t_width</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#SECRET_1ST_DOWN">SECRET_1ST_DOWN</a>)
<a href="qc-glob.htm#self">self</a>. t_width = <a href="qc-built.htm#fabs">fabs</a>(<a href="qc-built.htm#v_up">v_up</a> * <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_size">size</a>);
<b>else</b>
<a href="qc-glob.htm#self">self</a>. t_width = <a href="qc-built.htm#fabs">fabs</a>(<a href="qc-built.htm#v_right">v_right</a> * <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_size">size</a>);
}
<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>. t_length = <a href="qc-built.htm#fabs">fabs</a>(<a href="qc-built.htm#v_forward">v_forward</a> * <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_size">size</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#SECRET_1ST_DOWN">SECRET_1ST_DOWN</a>)
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_dest1">dest1</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin">origin</a> - <a href="qc-built.htm#v_up">v_up</a> * <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_t_width">t_width</a>;
<b>else</b>
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_dest1">dest1</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin">origin</a> + <a href="qc-built.htm#v_right">v_right</a> * (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_t_width">t_width</a> * temp);
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_dest2">dest2</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_dest1">dest1</a> + <a href="qc-built.htm#v_forward">v_forward</a> * <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_t_length">t_length</a>;
<a href="subs.htm#SUB_CalcMove">SUB_CalcMove</a>(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_dest1">dest1</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_speed">speed</a>, <a href="doors.htm#fd_secret_move1">fd_secret_move1</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_noise2">noise2</a>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
};
<i>// Wait after first movement...</i>
<a href="qc-types.htm#void">void</a> () <b>fd_secret_move1</b><a name="fd_secret_move1">=</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.0;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_think">think</a> = <a href="doors.htm#fd_secret_move2">fd_secret_move2</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_noise3">noise3</a>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
};
<i>// Start moving sideways w/sound...</i>
<a href="qc-types.htm#void">void</a> () <b>fd_secret_move2</b><a name="fd_secret_move2">=</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_noise2">noise2</a>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
<a href="subs.htm#SUB_CalcMove">SUB_CalcMove</a>(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_dest2">dest2</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_speed">speed</a>, <a href="doors.htm#fd_secret_move3">fd_secret_move3</a>);
};
<i>// Wait here until time to go back...</i>
<a href="qc-types.htm#void">void</a> () <b>fd_secret_move3</b><a name="fd_secret_move3">=</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_noise3">noise3</a>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</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#SECRET_OPEN_ONCE">SECRET_OPEN_ONCE</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-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_think">think</a> = <a href="doors.htm#fd_secret_move4">fd_secret_move4</a>;
}
};
<i>// Move backward...</i>
<a href="qc-types.htm#void">void</a> () <b>fd_secret_move4</b><a name="fd_secret_move4">=</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_noise2">noise2</a>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
<a href="subs.htm#SUB_CalcMove">SUB_CalcMove</a>(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_dest1">dest1</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_speed">speed</a>, <a href="doors.htm#fd_secret_move5">fd_secret_move5</a>);
};
<i>// Wait 1 second...</i>
<a href="qc-types.htm#void">void</a> () <b>fd_secret_move5</b><a name="fd_secret_move5">=</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.0;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_think">think</a> = <a href="doors.htm#fd_secret_move6">fd_secret_move6</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_noise3">noise3</a>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
};
<a href="qc-types.htm#void">void</a> () <b>fd_secret_move6</b><a name="fd_secret_move6">=</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_noise2">noise2</a>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
<a href="subs.htm#SUB_CalcMove">SUB_CalcMove</a>(<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_oldorigin">oldorigin</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_speed">speed</a>, <a href="doors.htm#fd_secret_done">fd_secret_done</a>);
};
<a href="qc-types.htm#void">void</a> () <b>fd_secret_done</b><a name="fd_secret_done">=</a>
{
<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_spawnflags">spawnflags</a>&<a href="doors.htm#SECRET_YES_SHOOT">SECRET_YES_SHOOT</a>)
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_health">health</a> = 10000;
<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_pain">th_pain</a> = <a href="doors.htm#fd_secret_use">fd_secret_use</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_noise3">noise3</a>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
};
<a href="qc-types.htm#void">void</a> () <b>secret_blocked</b><a name="secret_blocked">=</a>
{
<b>if</b> (<a href="qc-glob.htm#time">time</a> < <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>);
};
<i>/*
================
secret_touch
Prints messages
================
*/</i>
<a href="qc-types.htm#void">void</a>() <b>secret_touch</b><a name="secret_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#self">self</a>.<a href="qc-enty.htm#dot_attack_finished">attack_finished</a> > <a href="qc-glob.htm#time">time</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> + 2;
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_message">message</a>)
{
<a href="qc-built.htm#centerprint">centerprint</a> (<a href="qc-glob.htm#other">other</a>, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_message">message</a>);
<a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#other">other</a>, <a href="qc-defs.htm#CHAN_BODY">CHAN_BODY</a>, <b>"misc/talk.wav"</b>, 1, <a href="qc-defs.htm#ATTN_NORM">ATTN_NORM</a>);
}
};
<i>/*QUAKED func_door_secret (0 .5 .8) ? open_once 1st_left 1st_down no_shoot always_shoot
Basic secret door. Slides back, then to the side. Angle determines direction.
wait = # of seconds before coming back
1st_left = 1st move is left of arrow
1st_down = 1st move is down from arrow
always_shoot = even if targeted, keep shootable
t_width = override WIDTH to move back (or height if going down)
t_length = override LENGTH to move sideways
"dmg" damage to inflict when blocked (2 default)
If a secret door has a targetname, it will only be opened by it's botton or trigger, not by damage.
"sounds"
1) medieval
2) metal
3) base
*/</i>
<a href="qc-types.htm#void">void</a> () <b>func_door_secret</b><a name="func_door_secret">=</a>
{
<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> = 3;
<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/latch2.wav"</b>);
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"doors/winch2.wav"</b>);
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"doors/drclos4.wav"</b>);
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise1">noise1</a> = <b>"doors/latch2.wav"</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise2">noise2</a> = <b>"doors/winch2.wav"</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise3">noise3</a> = <b>"doors/drclos4.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/airdoor1.wav"</b>);
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"doors/airdoor2.wav"</b>);
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise2">noise2</a> = <b>"doors/airdoor1.wav"</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise1">noise1</a> = <b>"doors/airdoor2.wav"</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise3">noise3</a> = <b>"doors/airdoor2.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/basesec1.wav"</b>);
<a href="qc-built.htm#precache_sound">precache_sound</a> (<b>"doors/basesec2.wav"</b>);
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise2">noise2</a> = <b>"doors/basesec1.wav"</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise1">noise1</a> = <b>"doors/basesec2.wav"</b>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise3">noise3</a> = <b>"doors/basesec2.wav"</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;
<i>// Magic formula...</i>
<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_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_classname">classname</a> = <b>"door"</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#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-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_touch">touch</a> = <a href="doors.htm#secret_touch">secret_touch</a>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_blocked">blocked</a> = <a href="doors.htm#secret_blocked">secret_blocked</a>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_speed">speed</a> = 50;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_use">use</a> = <a href="doors.htm#fd_secret_use">fd_secret_use</a>;
<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_spawnflags">spawnflags</a>&<a href="doors.htm#SECRET_YES_SHOOT">SECRET_YES_SHOOT</a>)
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_health">health</a> = 10000;
<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_pain">th_pain</a> = <a href="doors.htm#fd_secret_use">fd_secret_use</a>;
}
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_oldorigin">oldorigin</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_wait">wait</a>)
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_wait">wait</a> = 5; <i>// 5 seconds before closing</i>
};
</pre></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -