Half-Life: Add I/O ability to ITEM_LONGJUMP
This commit is contained in:
parent
a9853f79cf
commit
54f0c5d24c
2 changed files with 34 additions and 8 deletions
|
@ -25,13 +25,17 @@ and pressing jump.
|
|||
*/
|
||||
class item_longjump:CBaseTrigger
|
||||
{
|
||||
string m_strOnPlayerTouch;
|
||||
|
||||
void(void) item_longjump;
|
||||
|
||||
virtual void(void) touch;
|
||||
virtual void(void) Respawn;
|
||||
virtual void(string, string) SpawnKey;
|
||||
};
|
||||
|
||||
void item_longjump::touch(void)
|
||||
void
|
||||
item_longjump::touch(void)
|
||||
{
|
||||
if (other.classname != "player") {
|
||||
return;
|
||||
|
@ -47,7 +51,11 @@ void item_longjump::touch(void)
|
|||
sound(other, CHAN_VOICE, "fvox/powermove_on.wav", 1, ATTN_NORM);
|
||||
pl.g_items |= ITEM_LONGJUMP;
|
||||
|
||||
UseTargets(other, TRIG_TOGGLE, m_flDelay);
|
||||
if (!target) {
|
||||
UseOutput(other, m_strOnPlayerTouch);
|
||||
} else {
|
||||
UseTargets(other, TRIG_TOGGLE, m_flDelay);
|
||||
}
|
||||
|
||||
if (real_owner || cvar("sv_playerslots") == 1) {
|
||||
remove(self);
|
||||
|
@ -58,7 +66,8 @@ void item_longjump::touch(void)
|
|||
}
|
||||
}
|
||||
|
||||
void item_longjump::Respawn(void)
|
||||
void
|
||||
item_longjump::Respawn(void)
|
||||
{
|
||||
SetSolid(SOLID_TRIGGER);
|
||||
SetMovetype(MOVETYPE_TOSS);
|
||||
|
@ -73,7 +82,22 @@ void item_longjump::Respawn(void)
|
|||
Sound_Play(this, CHAN_ITEM, "item.respawn");
|
||||
}
|
||||
|
||||
void item_longjump::item_longjump(void)
|
||||
void
|
||||
item_longjump::SpawnKey(string strKey, string strValue)
|
||||
{
|
||||
switch (strKey) {
|
||||
case "OnPlayerTouch":
|
||||
strValue = strreplace(",", ",_", strValue);
|
||||
m_strOnPlayerTouch = strcat(m_strOnPlayerTouch, ",_", strValue);
|
||||
break;
|
||||
default:
|
||||
CBaseTrigger::SpawnKey(strKey, strValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
item_longjump::item_longjump(void)
|
||||
{
|
||||
model = "models/w_longjump.mdl";
|
||||
precache_sound("items/suitchargeok1.wav");
|
||||
|
|
|
@ -33,7 +33,8 @@ class item_suit:CBaseTrigger
|
|||
virtual void(string, string) SpawnKey;
|
||||
};
|
||||
|
||||
void item_suit::touch(void)
|
||||
void
|
||||
item_suit::touch(void)
|
||||
{
|
||||
if (other.classname != "player") {
|
||||
return;
|
||||
|
@ -52,7 +53,6 @@ void item_suit::touch(void)
|
|||
|
||||
if (!target) {
|
||||
UseOutput(other, m_strOnPlayerTouch);
|
||||
return;
|
||||
} else {
|
||||
UseTargets(other, TRIG_TOGGLE, m_flDelay);
|
||||
}
|
||||
|
@ -66,7 +66,8 @@ void item_suit::touch(void)
|
|||
}
|
||||
}
|
||||
|
||||
void item_suit::Respawn(void)
|
||||
void
|
||||
item_suit::Respawn(void)
|
||||
{
|
||||
SetSolid(SOLID_TRIGGER);
|
||||
SetMovetype(MOVETYPE_TOSS);
|
||||
|
@ -96,7 +97,8 @@ item_suit::SpawnKey(string strKey, string strValue)
|
|||
}
|
||||
}
|
||||
|
||||
void item_suit::item_suit(void)
|
||||
void
|
||||
item_suit::item_suit(void)
|
||||
{
|
||||
model = "models/w_suit.mdl";
|
||||
precache_sound("items/suitchargeok1.wav");
|
||||
|
|
Loading…
Reference in a new issue