📄 player.htm
字号:
<a href="qc-types.htm#void">void</a>() <b>player_axpain1</b><a name="player_axpain1">=</a> [ $axpain1, player_axpain2 ] {<a href="player.htm#PainSound">PainSound</a>();<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weaponframe">weaponframe</a>=0;};
<a href="qc-types.htm#void">void</a>() <b>player_axpain2</b><a name="player_axpain2">=</a> [ $axpain2, player_axpain3 ] {};
<a href="qc-types.htm#void">void</a>() <b>player_axpain3</b><a name="player_axpain3">=</a> [ $axpain3, player_axpain4 ] {};
<a href="qc-types.htm#void">void</a>() <b>player_axpain4</b><a name="player_axpain4">=</a> [ $axpain4, player_axpain5 ] {};
<a href="qc-types.htm#void">void</a>() <b>player_axpain5</b><a name="player_axpain5">=</a> [ $axpain5, player_axpain6 ] {};
<a href="qc-types.htm#void">void</a>() <b>player_axpain6</b><a name="player_axpain6">=</a> [ $axpain6, <a href="player.htm#player_run">player_run</a> ] {};
<a href="qc-types.htm#void">void</a>() <b>player_pain</b><a name="player_pain">=</a>
{
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weaponframe">weaponframe</a>)
<b>return</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>)
<b>return</b>; <i>// eyes don't have pain frames</i>
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_weapon">weapon</a> == <a href="qc-defs.htm#IT_AXE">IT_AXE</a>)
<a href="player.htm#player_axpain1">player_axpain1</a> ();
<b>else</b>
<a href="player.htm#player_pain1">player_pain1</a> ();
};
<a href="qc-types.htm#void">void</a>() <a href="player.htm#player_diea1">player_diea1</a>;
<a href="qc-types.htm#void">void</a>() <a href="player.htm#player_dieb1">player_dieb1</a>;
<a href="qc-types.htm#void">void</a>() <a href="player.htm#player_diec1">player_diec1</a>;
<a href="qc-types.htm#void">void</a>() <a href="player.htm#player_died1">player_died1</a>;
<a href="qc-types.htm#void">void</a>() <a href="player.htm#player_diee1">player_diee1</a>;
<a href="qc-types.htm#void">void</a>() <a href="player.htm#player_die_ax1">player_die_ax1</a>;
<a href="qc-types.htm#void">void</a>() <b>DeathBubblesSpawn</b><a name="DeathBubblesSpawn">=</a>
{
<b>local</b> <a href="qc-types.htm#entity">entity</a> bubble;
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_owner">owner</a>.<a href="qc-enty.htm#dot_waterlevel">waterlevel</a> != 3)
<b>return</b>;
bubble = <a href="qc-built.htm#spawn">spawn</a>();
<a href="qc-built.htm#setmodel">setmodel</a> (bubble, <b>"progs/s_bubble.spr"</b>);
<a href="qc-built.htm#setorigin">setorigin</a> (bubble, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_owner">owner</a>.<a href="qc-enty.htm#dot_origin">origin</a> + '0 0 24');
bubble.<a href="qc-enty.htm#dot_movetype">movetype</a> = <a href="qc-defs.htm#MOVETYPE_NOCLIP">MOVETYPE_NOCLIP</a>;
bubble.<a href="qc-enty.htm#dot_solid">solid</a> = <a href="qc-defs.htm#SOLID_NOT">SOLID_NOT</a>;
bubble.<a href="qc-enty.htm#dot_velocity">velocity</a> = '0 0 15';
bubble.<a href="qc-enty.htm#dot_nextthink">nextthink</a> = <a href="qc-glob.htm#time">time</a> + 0.5;
bubble.<a href="qc-enty.htm#dot_think">think</a> = <a href="misc.htm#bubble_bob">bubble_bob</a>;
bubble.<a href="qc-enty.htm#dot_classname">classname</a> = <b>"bubble"</b>;
bubble.<a href="qc-enty.htm#dot_frame">frame</a> = 0;
bubble.<a href="qc-enty.htm#dot_cnt">cnt</a> = 0;
<a href="qc-built.htm#setsize">setsize</a> (bubble, '-8 -8 -8', '8 8 8');
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_nextthink">nextthink</a> = <a href="qc-glob.htm#time">time</a> + 0.1;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_think">think</a> = <a href="player.htm#DeathBubblesSpawn">DeathBubblesSpawn</a>;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_air_finished">air_finished</a> = <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_air_finished">air_finished</a> + 1;
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_air_finished">air_finished</a> >= <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_bubble_count">bubble_count</a>)
<a href="qc-built.htm#remove">remove</a>(<a href="qc-glob.htm#self">self</a>);
};
<a href="qc-types.htm#void">void</a>(<a href="qc-types.htm#float">float</a> num_bubbles) <b>DeathBubbles</b><a name="DeathBubbles">=</a>
{
<b>local</b> <a href="qc-types.htm#entity">entity</a> bubble_spawner;
bubble_spawner = <a href="qc-built.htm#spawn">spawn</a>();
<a href="qc-built.htm#setorigin">setorigin</a> (bubble_spawner, <a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_origin">origin</a>);
bubble_spawner.<a href="qc-enty.htm#dot_movetype">movetype</a> = <a href="qc-defs.htm#MOVETYPE_NONE">MOVETYPE_NONE</a>;
bubble_spawner.<a href="qc-enty.htm#dot_solid">solid</a> = <a href="qc-defs.htm#SOLID_NOT">SOLID_NOT</a>;
bubble_spawner.<a href="qc-enty.htm#dot_nextthink">nextthink</a> = <a href="qc-glob.htm#time">time</a> + 0.1;
bubble_spawner.<a href="qc-enty.htm#dot_think">think</a> = <a href="player.htm#DeathBubblesSpawn">DeathBubblesSpawn</a>;
bubble_spawner.<a href="qc-enty.htm#dot_air_finished">air_finished</a> = 0;
bubble_spawner.<a href="qc-enty.htm#dot_owner">owner</a> = <a href="qc-glob.htm#self">self</a>;
bubble_spawner.<a href="qc-enty.htm#dot_bubble_count">bubble_count</a> = num_bubbles;
<b>return</b>;
};
<a href="qc-types.htm#void">void</a>() <b>DeathSound</b><a name="DeathSound">=</a>
{
<b>local</b> <a href="qc-types.htm#float">float</a> rs;
<i>// water death sounds</i>
<b>if</b> (<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_waterlevel">waterlevel</a> == 3)
{
<a href="player.htm#DeathBubbles">DeathBubbles</a>(20);
<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>, <b>"player/h2odeath.wav"</b>, 1, <a href="qc-defs.htm#ATTN_NONE">ATTN_NONE</a>);
<b>return</b>;
}
rs = <a href="qc-built.htm#rint">rint</a> ((<a href="qc-built.htm#random">random</a>() * 4) + 1);
<b>if</b> (rs == 1)
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise">noise</a> = <b>"player/death1.wav"</b>;
<b>if</b> (rs == 2)
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise">noise</a> = <b>"player/death2.wav"</b>;
<b>if</b> (rs == 3)
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise">noise</a> = <b>"player/death3.wav"</b>;
<b>if</b> (rs == 4)
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise">noise</a> = <b>"player/death4.wav"</b>;
<b>if</b> (rs == 5)
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_noise">noise</a> = <b>"player/death5.wav"</b>;
<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_NONE">ATTN_NONE</a>);
<b>return</b>;
};
<a href="qc-types.htm#void">void</a>() <b>PlayerDead</b><a name="PlayerDead">=</a>
{
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_nextthink">nextthink</a> = -1;
<i>// allow respawn after a certain time</i>
<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="qc-types.htm#vector">vector</a>(<a href="qc-types.htm#float">float</a> dm) <b>VelocityForDamage</b><a name="VelocityForDamage">=</a>
{
<b>local</b> <a href="qc-types.htm#vector">vector</a> v;
v_x = 100 * <a href="weapons.htm#crandom">crandom</a>();
v_y = 100 * <a href="weapons.htm#crandom">crandom</a>();
v_z = 200 + 100 * <a href="qc-built.htm#random">random</a>();
<b>if</b> (dm > -50)
{
<i>// dprint ("level 1\n");</i>
v = v * 0.7;
}
<b>else</b> <b>if</b> (dm > -200)
{
<i>// dprint ("level 3\n");</i>
v = v * 2;
}
<b>else</b>
v = v * 10;
return v;
};
<a href="qc-types.htm#void">void</a>(<a href="qc-types.htm#string">string</a> gibname, <a href="qc-types.htm#float">float</a> dm) <b>ThrowGib</b><a name="ThrowGib">=</a>
{
<b>local</b> <a href="qc-types.htm#entity">entity</a> new;
new = <a href="qc-built.htm#spawn">spawn</a>();
new.<a href="qc-enty.htm#dot_origin">origin</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> (new, gibname);
<a href="qc-built.htm#setsize">setsize</a> (new, '0 0 0', '0 0 0');
new.<a href="qc-enty.htm#dot_velocity">velocity</a> = <a href="player.htm#VelocityForDamage">VelocityForDamage</a> (dm);
new.<a href="qc-enty.htm#dot_movetype">movetype</a> = <a href="qc-defs.htm#MOVETYPE_BOUNCE">MOVETYPE_BOUNCE</a>;
new.<a href="qc-enty.htm#dot_solid">solid</a> = <a href="qc-defs.htm#SOLID_NOT">SOLID_NOT</a>;
new.avelocity_x = <a href="qc-built.htm#random">random</a>()*600;
new.avelocity_y = <a href="qc-built.htm#random">random</a>()*600;
new.avelocity_z = <a href="qc-built.htm#random">random</a>()*600;
new.<a href="qc-enty.htm#dot_think">think</a> = <a href="subs.htm#SUB_Remove">SUB_Remove</a>;
new.<a href="qc-enty.htm#dot_ltime">ltime</a> = <a href="qc-glob.htm#time">time</a>;
new.<a href="qc-enty.htm#dot_nextthink">nextthink</a> = <a href="qc-glob.htm#time">time</a> + 10 + <a href="qc-built.htm#random">random</a>()*10;
new.<a href="qc-enty.htm#dot_frame">frame</a> = 0;
new.<a href="qc-enty.htm#dot_flags">flags</a> = 0;
};
<a href="qc-types.htm#void">void</a>(<a href="qc-types.htm#string">string</a> gibname, <a href="qc-types.htm#float">float</a> dm) <b>ThrowHead</b><a name="ThrowHead">=</a>
{
<a href="qc-built.htm#setmodel">setmodel</a> (<a href="qc-glob.htm#self">self</a>, gibname);
<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_nextthink">nextthink</a> = -1;
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_movetype">movetype</a> = <a href="qc-defs.htm#MOVETYPE_BOUNCE">MOVETYPE_BOUNCE</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>;
<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_view_ofs">view_ofs</a> = '0 0 8';
<a href="qc-built.htm#setsize">setsize</a> (<a href="qc-glob.htm#self">self</a>, '-16 -16 0', '16 16 56');
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_velocity">velocity</a> = <a href="player.htm#VelocityForDamage">VelocityForDamage</a> (dm);
<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_origin_z">origin_z</a> - 24;
<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_ONGROUND">FL_ONGROUND</a>);
<a href="qc-glob.htm#self">self</a>.<a href="qc-enty.htm#dot_avelocity">avelocity</a> = <a href="weapons.htm#crandom">crandom</a>() * '0 600 0';
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -