📄 client.htm
字号:
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_watertype">watertype</a> == <a href="qc-defs.htm#CONTENT_WATER">CONTENT_WATER</a>)
<a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-defs.htm#CHAN_BODY">CHAN_BODY</a>, <b>"player/inh2o.wav"</b>, 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_watertype">watertype</a> == <a href="qc-defs.htm#CONTENT_SLIME">CONTENT_SLIME</a>)
<a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-defs.htm#CHAN_BODY">CHAN_BODY</a>, <b>"player/slimbrn2.wav"</b>, 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_flags">flags</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> + <a href="defs.htm#FL_INWATER">FL_INWATER</a>;
<a href="qc-glob.htm#self">self</a>.dmgtime = 0;
}
<b>if</b> (! (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> & <a href="defs.htm#FL_WATERJUMP">FL_WATERJUMP</a>) )
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_velocity">velocity</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_velocity">velocity</a> - 0.8*<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_waterlevel">waterlevel</a>*<a href="qc-glob.htm#frametime">frametime</a>*<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_velocity">velocity</a>;
};
<a href="qc-types.htm#void">void</a>() <b>CheckWaterJump</b><a name="CheckWaterJump">=</a>
{
<b>local</b> <a href="qc-types.htm#vector">vector</a> start, end;
<i>// check for a jump-out-of-water</i>
<a href="qc-built.htm#makevectors">makevectors</a> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_angles">angles</a>);
start = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin">origin</a>;
start_z = start_z + 8;
v_forward_z = 0;
<a href="qc-built.htm#normalize">normalize</a>(<a href="qc-built.htm#v_forward">v_forward</a>);
end = start + <a href="qc-built.htm#v_forward">v_forward</a>*24;
<a href="qc-built.htm#traceline">traceline</a> (start, end, <a href="defs.htm#TRUE">TRUE</a>, <a href="qc-glob.htm#self">self</a>);
<b>if</b> (<a href="qc-built.htm#trace_fraction">trace_fraction</a> < 1)
{ <i>// solid at waist</i>
start_z = start_z + <a href="qc-glob.htm#self">self</a>.maxs_z - 8;
end = start + <a href="qc-built.htm#v_forward">v_forward</a>*24;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_movedir">movedir</a> = <a href="qc-built.htm#trace_plane_normal">trace_plane_normal</a> * -50;
<a href="qc-built.htm#traceline">traceline</a> (start, end, <a href="defs.htm#TRUE">TRUE</a>, <a href="qc-glob.htm#self">self</a>);
<b>if</b> (<a href="qc-built.htm#trace_fraction">trace_fraction</a> == 1)
{ <i>// open at eye level</i>
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> | <a href="defs.htm#FL_WATERJUMP">FL_WATERJUMP</a>;
<a href="qc-glob.htm#self">self</a>.velocity_z = 225;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> - (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> & <a href="defs.htm#FL_JUMPRELEASED">FL_JUMPRELEASED</a>);
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_teleport_time">teleport_time</a> = <a href="qc-glob.htm#time">time</a> + 2; <i>// safety net</i>
<b>return</b>;
}
}
};
<i>/*
================
PlayerPreThink
Called every frame before physics are run
================
*/</i>
<a href="qc-types.htm#void">void</a>() <b><a href="qc-glob.htm#f_PlayerPreThink">PlayerPreThink</a></b><a name="PlayerPreThink">=</a>
{
<b>local</b> <a href="qc-types.htm#float">float</a> mspeed, aspeed;
<b>local</b> <a href="qc-types.htm#float">float</a> r;
<b>if</b> (<a href="client.htm#intermission_running">intermission_running</a>)
{
<a href="client.htm#IntermissionThink">IntermissionThink</a> (); <i>// otherwise a button could be missed between</i>
<b>return</b>; <i>// the think tics</i>
}
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_view_ofs">view_ofs</a> == '0 0 0')
<b>return</b>; <i>// intermission or finale</i>
<a href="qc-built.htm#makevectors">makevectors</a> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_v_angle">v_angle</a>); <i>// is this still used</i>
<a href="client.htm#CheckRules">CheckRules</a> ();
<a href="client.htm#WaterMove">WaterMove</a> ();
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_waterlevel">waterlevel</a> == 2)
<a href="client.htm#CheckWaterJump">CheckWaterJump</a> ();
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_deadflag">deadflag</a> >= <a href="qc-defs.htm#DEAD_DEAD">DEAD_DEAD</a>)
{
<a href="client.htm#PlayerDeathThink">PlayerDeathThink</a> ();
<b>return</b>;
}
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_deadflag">deadflag</a> == <a href="qc-defs.htm#DEAD_DYING">DEAD_DYING</a>)
<b>return</b>; <i>// dying, so do nothing</i>
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_button2">button2</a>)
{
<a href="client.htm#PlayerJump">PlayerJump</a> ();
}
<b>else</b>
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_flags">flags</a> | <a href="defs.htm#FL_JUMPRELEASED">FL_JUMPRELEASED</a>;
<i>// teleporters can force a non-moving pause time </i>
<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_pausetime">pausetime</a>)
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_velocity">velocity</a> = '0 0 0';
};
<i>/*
================
CheckPowerups
Check for turning off powerups
================
*/</i>
<a href="qc-types.htm#void">void</a>() <b>CheckPowerups</b><a name="CheckPowerups">=</a>
{
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_health">health</a> <= 0)
<b>return</b>;
<i>// invisibility</i>
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_invisible_finished">invisible_finished</a>)
{
<i>// sound and screen flash when items starts to run out</i>
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_invisible_sound">invisible_sound</a> < <a href="qc-glob.htm#time">time</a>)
{
<a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-defs.htm#CHAN_AUTO">CHAN_AUTO</a>, <b>"items/inv3.wav"</b>, 0.5, <a href="qc-defs.htm#ATTN_IDLE">ATTN_IDLE</a>);
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_invisible_sound">invisible_sound</a> = <a href="qc-glob.htm#time">time</a> + ((<a href="qc-built.htm#random">random</a>() * 3) + 1);
}
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_invisible_finished">invisible_finished</a> < <a href="qc-glob.htm#time">time</a> + 3)
{
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_invisible_time">invisible_time</a> == 1)
{
<a href="qc-built.htm#sprint">sprint</a> (<a href="qc-glob.htm#self">self</a>, <b>"Ring of Shadows magic is fading\n"</b>);
<a href="qc-built.htm#stuffcmd">stuffcmd</a> (<a href="qc-glob.htm#self">self</a>, <b>"bf\n"</b>);
<a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-defs.htm#CHAN_AUTO">CHAN_AUTO</a>, <b>"items/inv2.wav"</b>, 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_invisible_time">invisible_time</a> = <a href="qc-glob.htm#time">time</a> + 1;
}
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_invisible_time">invisible_time</a> < <a href="qc-glob.htm#time">time</a>)
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_invisible_time">invisible_time</a> = <a href="qc-glob.htm#time">time</a> + 1;
<a href="qc-built.htm#stuffcmd">stuffcmd</a> (<a href="qc-glob.htm#self">self</a>, <b>"bf\n"</b>);
}
}
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_invisible_finished">invisible_finished</a> < <a href="qc-glob.htm#time">time</a>)
{ <i>// just stopped</i>
<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_items">items</a> - <a href="qc-defs.htm#IT_INVISIBILITY">IT_INVISIBILITY</a>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_invisible_finished">invisible_finished</a> = 0;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_invisible_time">invisible_time</a> = 0;
}
<i>// use the eyes</i>
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_frame">frame</a> = 0;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_modelindex">modelindex</a> = modelindex_eyes;
}
<b>else</b>
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_modelindex">modelindex</a> = modelindex_player; <i>// don't use eyes</i>
<i>// invincibility</i>
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_invincible_finished">invincible_finished</a>)
{
<i>// sound and screen flash when items starts to run out</i>
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_invincible_finished">invincible_finished</a> < <a href="qc-glob.htm#time">time</a> + 3)
{
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_invincible_time">invincible_time</a> == 1)
{
<a href="qc-built.htm#sprint">sprint</a> (<a href="qc-glob.htm#self">self</a>, <b>"Protection is almost burned out\n"</b>);
<a href="qc-built.htm#stuffcmd">stuffcmd</a> (<a href="qc-glob.htm#self">self</a>, <b>"bf\n"</b>);
<a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-defs.htm#CHAN_AUTO">CHAN_AUTO</a>, <b>"items/protect2.wav"</b>, 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_invincible_time">invincible_time</a> = <a href="qc-glob.htm#time">time</a> + 1;
}
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_invincible_time">invincible_time</a> < <a href="qc-glob.htm#time">time</a>)
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_invincible_time">invincible_time</a> = <a href="qc-glob.htm#time">time</a> + 1;
<a href="qc-built.htm#stuffcmd">stuffcmd</a> (<a href="qc-glob.htm#self">self</a>, <b>"bf\n"</b>);
}
}
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_invincible_finished">invincible_finished</a> < <a href="qc-glob.htm#time">time</a>)
{ <i>// just stopped</i>
<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_items">items</a> - <a href="qc-defs.htm#IT_INVULNERABILITY">IT_INVULNERABILITY</a>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_invincible_time">invincible_time</a> = 0;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_invincible_finished">invincible_finished</a> = 0;
}
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_invincible_finished">invincible_finished</a> > <a href="qc-glob.htm#time">time</a>)
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_effects">effects</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_effects">effects</a> | <a href="qc-defs.htm#EF_DIMLIGHT">EF_DIMLIGHT</a>;
<b>else</b>
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_effects">effects</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_effects">effects</a> - (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_effects">effects</a> & <a href="qc-defs.htm#EF_DIMLIGHT">EF_DIMLIGHT</a>);
}
<i>// super damage</i>
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_super_damage_finished">super_damage_finished</a>)
{
<i>// sound and screen flash when items starts to run out</i>
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_super_damage_finished">super_damage_finished</a> < <a href="qc-glob.htm#time">time</a> + 3)
{
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_super_time">super_time</a> == 1)
{
<a href="qc-built.htm#sprint">sprint</a> (<a href="qc-glob.htm#self">self</a>, <b>"Quad Damage is wearing off\n"</b>);
<a href="qc-built.htm#stuffcmd">stuffcmd</a> (<a href="qc-glob.htm#self">self</a>, <b>"bf\n"</b>);
<a href="qc-built.htm#sound">sound</a> (<a href="qc-glob.htm#self">self</a>, <a href="qc-defs.htm#CHAN_AUTO">CHAN_AUTO</a>, <b>"items/damage2.wav"</b>, 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_super_time">super_time</a> = <a href="qc-glob.htm#time">time</a> + 1;
}
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_super_time">super_time</a> < <a href="qc-glob.htm#time">time</a>)
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_super_time">super_time</a> = <a href="qc-glob.htm#time">time</a> + 1;
<a href="qc-built.htm#stuffcmd">stuffcmd</a> (<a href="qc-glob.htm#self">self</a>, <b>"bf\n"</b>);
}
}
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_super_damage_finished">super_damage_finished</a> < <a href="qc-glob.htm#time">time</a>)
{ <i>// just stopped</i>
<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_items">items</a> - <a href="qc-defs.htm#IT_QUAD">IT_QUAD</a>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_super_damage_finished">super_damage_finished</a> = 0;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_super_time">super_time</a> = 0;
}
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_super_damage_finished">super_damage_finished</a> > <a href="qc-glob.htm#time">time</a>)
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_effects">effects</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_effects">effects</a> | <a href="qc-defs.htm#EF_DIMLIGHT">EF_DIMLIGHT</a>;
<b>else</b>
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_effects">effects</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_effects">effects</a> - (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_effects">effects</a> & <a href="qc-defs.htm#EF_DIMLIGHT">EF_DIMLIGHT</a>);
}
<i>// suit </i>
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_radsuit_finished">radsuit_finished</a>)
{
<a href="qc-glob.htm#
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -