From 22d0177a510b7d6124a925e0a41c47f2340ff17f Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 6 Feb 2015 11:00:48 +1100 Subject: [PATCH] and now for something completely different --- qcsrc/common/buffs.qh | 4 +- qcsrc/common/deathtypes.qh | 1 + qcsrc/common/notifications.qh | 5 +- qcsrc/server/mutators/mutator_buffs.qc | 92 ++++++++++++++++++++++++++ qcsrc/server/mutators/mutator_buffs.qh | 8 +++ 5 files changed, 108 insertions(+), 2 deletions(-) diff --git a/qcsrc/common/buffs.qh b/qcsrc/common/buffs.qh index 5fb644bde..634860f2b 100644 --- a/qcsrc/common/buffs.qh +++ b/qcsrc/common/buffs.qh @@ -53,6 +53,7 @@ REGISTER_BUFF(_("Vengeance"),vengeance,VENGEANCE,15,'0.55 0.5 1'); REGISTER_BUFF(_("Jump"),jump,JUMP,10,'0.7 0.2 1'); REGISTER_BUFF(_("Flight"),flight,FLIGHT,11,'1 0.2 0.5'); REGISTER_BUFF(_("Invisible"),invisible,INVISIBLE,12,'0.9 0.9 0.9'); +REGISTER_BUFF(_("Blessed"),blessed,BLESSED,14,'0.9 0.3 0'); #undef REGISTER_BUFF #ifdef SVQC @@ -80,10 +81,11 @@ BUFF_SPAWNFUNCS(vengeance, BUFF_VENGEANCE) BUFF_SPAWNFUNCS(jump, BUFF_JUMP) BUFF_SPAWNFUNCS(flight, BUFF_FLIGHT) BUFF_SPAWNFUNCS(invisible, BUFF_INVISIBLE) +BUFF_SPAWNFUNCS(blessed, BUFF_BLESSED) BUFF_SPAWNFUNCS(random, 0) BUFF_SPAWNFUNC_Q3TA_COMPAT(doubler, BUFF_MEDIC) -BUFF_SPAWNFUNC_Q3TA_COMPAT(resistance, BUFF_RESISTANCE) +BUFF_SPAWNFUNC_Q3TA_COMPAT(resistance, BUFF_RESISTANCE) BUFF_SPAWNFUNC_Q3TA_COMPAT(scout, BUFF_SPEED) BUFF_SPAWNFUNC_Q3TA_COMPAT(ammoregen, BUFF_AMMO) diff --git a/qcsrc/common/deathtypes.qh b/qcsrc/common/deathtypes.qh index b63dcc907..4b45a2384 100644 --- a/qcsrc/common/deathtypes.qh +++ b/qcsrc/common/deathtypes.qh @@ -26,6 +26,7 @@ int DEATH_VHLAST; DEATHTYPE(DEATH_DROWN, DEATH_SELF_DROWN, DEATH_MURDER_DROWN, NORMAL_POS) \ DEATHTYPE(DEATH_FALL, DEATH_SELF_FALL, DEATH_MURDER_FALL, NORMAL_POS) \ DEATHTYPE(DEATH_FIRE, DEATH_SELF_FIRE, DEATH_MURDER_FIRE, NORMAL_POS) \ + DEATHTYPE(DEATH_FOOT, DEATH_SELF_FOOT, NO_MSG, NORMAL_POS) \ DEATHTYPE(DEATH_GENERIC, DEATH_SELF_GENERIC, NO_MSG, NORMAL_POS) \ DEATHTYPE(DEATH_HURTTRIGGER, DEATH_SELF_VOID, DEATH_MURDER_VOID, NORMAL_POS) \ DEATHTYPE(DEATH_KILL, DEATH_SELF_SUICIDE, NO_MSG, NORMAL_POS) \ diff --git a/qcsrc/common/notifications.qh b/qcsrc/common/notifications.qh index 8a4865c3a..e8f5c675a 100644 --- a/qcsrc/common/notifications.qh +++ b/qcsrc/common/notifications.qh @@ -423,7 +423,8 @@ void Send_Notification_WOCOVA( MSG_INFO_NOTIF(1, INFO_DEATH_SELF_DROWN, 2, 1, "s1 s2loc spree_lost", "s1", "notify_water", _("^BG%s^K1 couldn't catch their breath%s%s"), _("^BG%s^K1 was in the water for too long%s%s")) \ MSG_INFO_NOTIF(1, INFO_DEATH_SELF_FALL, 2, 1, "s1 s2loc spree_lost", "s1", "notify_fall", _("^BG%s^K1 hit the ground with a crunch%s%s"), _("^BG%s^K1 hit the ground with a bit too much force%s%s")) \ MSG_INFO_NOTIF(1, INFO_DEATH_SELF_FIRE, 2, 1, "s1 s2loc spree_lost", "s1", "notify_death", _("^BG%s^K1 became a bit too crispy%s%s"), _("^BG%s^K1 felt a little hot%s%s")) \ - MSG_INFO_NOTIF(1, INFO_DEATH_SELF_GENERIC, 2, 1, "s1 s2loc spree_lost", "s1", "notify_selfkill", _("^BG%s^K1 died%s%s"), "") \ + MSG_INFO_NOTIF(1, INFO_DEATH_SELF_FOOT, 2, 1, "s1 s2loc spree_lost", "s1", "notify_parrot", _("^BG%s^K1 is a dead parrot!%s%s"),"") \ + MSG_INFO_NOTIF(1, INFO_DEATH_SELF_GENERIC, 2, 1, "s1 s2loc spree_lost", "s1", "notify_death", _("^BG%s^K1 died%s%s"), "") \ MSG_INFO_NOTIF(1, INFO_DEATH_SELF_LAVA, 2, 1, "s1 s2loc spree_lost", "s1", "notify_lava", _("^BG%s^K1 turned into hot slag%s%s"), _("^BG%s^K1 found a hot place%s%s")) \ MSG_INFO_NOTIF(1, INFO_DEATH_SELF_MON_AFRIT, 2, 1, "s1 s2loc spree_lost", "s1", "notify_death", _("^BG%s^K1 was turned to ash by an Afrit%s%s"), "") \ MSG_INFO_NOTIF(1, INFO_DEATH_SELF_MON_CREEPER, 2, 1, "s1 s2loc spree_lost", "s1", "notify_death", _("^BG%s^K1 was blown up by Creeper%s%s"), "") \ @@ -700,6 +701,7 @@ void Send_Notification_WOCOVA( MSG_CENTER_NOTIF(1, CENTER_DEATH_SELF_DROWN, 0, 0, "", NO_CPID, "0 0", _("^K1You couldn't catch your breath!"), "") \ MSG_CENTER_NOTIF(1, CENTER_DEATH_SELF_FALL, 0, 0, "", NO_CPID, "0 0", _("^K1You hit the ground with a crunch!"), "") \ MSG_CENTER_NOTIF(1, CENTER_DEATH_SELF_FIRE, 0, 0, "", NO_CPID, "0 0", _("^K1You got a little bit too crispy!"), _("^K1You felt a little too hot!")) \ + MSG_CENTER_NOTIF(1, CENTER_DEATH_SELF_FOOT, 0, 0, "", NO_CPID, "0 0", _("^K1This is an ex-parrot!"), "") \ MSG_CENTER_NOTIF(1, CENTER_DEATH_SELF_GENERIC, 0, 0, "", NO_CPID, "0 0", _("^K1You killed your own dumb self!"), _("^K1You need to be more careful!")) \ MSG_CENTER_NOTIF(1, CENTER_DEATH_SELF_LAVA, 0, 0, "", NO_CPID, "0 0", _("^K1You couldn't stand the heat!"), "") \ MSG_CENTER_NOTIF(1, CENTER_DEATH_SELF_MONSTER, 0, 0, "", NO_CPID, "0 0", _("^K1You were killed by a monster!"), _("^K1You need to watch out for monsters!")) \ @@ -907,6 +909,7 @@ void Send_Notification_WOCOVA( MSG_MULTI_NOTIF(1, DEATH_SELF_DROWN, NO_MSG, INFO_DEATH_SELF_DROWN, CENTER_DEATH_SELF_DROWN) \ MSG_MULTI_NOTIF(1, DEATH_SELF_FALL, NO_MSG, INFO_DEATH_SELF_FALL, CENTER_DEATH_SELF_FALL) \ MSG_MULTI_NOTIF(1, DEATH_SELF_FIRE, NO_MSG, INFO_DEATH_SELF_FIRE, CENTER_DEATH_SELF_FIRE) \ + MSG_MULTI_NOTIF(1, DEATH_SELF_FOOT, NO_MSG, INFO_DEATH_SELF_FOOT, CENTER_DEATH_SELF_FOOT) \ MSG_MULTI_NOTIF(1, DEATH_SELF_GENERIC, NO_MSG, INFO_DEATH_SELF_GENERIC, CENTER_DEATH_SELF_GENERIC) \ MSG_MULTI_NOTIF(1, DEATH_SELF_LAVA, NO_MSG, INFO_DEATH_SELF_LAVA, CENTER_DEATH_SELF_LAVA) \ MSG_MULTI_NOTIF(1, DEATH_SELF_MON_AFRIT, NO_MSG, INFO_DEATH_SELF_MON_AFRIT, CENTER_DEATH_SELF_MONSTER) \ diff --git a/qcsrc/server/mutators/mutator_buffs.qc b/qcsrc/server/mutators/mutator_buffs.qc index 93f022d3b..c5fcefd9e 100644 --- a/qcsrc/server/mutators/mutator_buffs.qc +++ b/qcsrc/server/mutators/mutator_buffs.qc @@ -373,6 +373,81 @@ void buff_SpawnReplacement(entity ent, entity old) buff_Init(ent); } +#ifdef MONTY +void buff_Blessed_Foot_Touch() +{ + if(other.iscreature && other.takedamage && other.health > 0) + { + int mydamage = 9999; + if(other == self.realowner) + mydamage = 5; // but spammed + Damage (other, self, world, mydamage, DEATH_FOOT, other.origin, '0 0 0'); + } +} + +void buff_Blessed_Foot_Think() +{ + self.nextthink = time; + if(self.buff_blessed_time) + if(time >= self.buff_blessed_time) + { + remove(self); + return; + } + if(self.origin_z <= self.buff_blessed_bottom_z) + { + if(!self.buff_blessed_soundplayed) + { + self.buff_blessed_time = time + 1; + self.velocity = '0 0 0'; + setorigin(self, self.buff_blessed_bottom); + //sound(self, CH_TRIGGER_SINGLE, "monty/foot.wav", VOL_BASE, ATTEN_MAX); + sound(self, CH_TRIGGER_SINGLE, "monty/foot.wav", VOL_BASEVOICE, ATTEN_MIN); + self.buff_blessed_soundplayed = true; + } + } + else + { + self.velocity = '0 0 -1500'; + //setorigin(self, self.origin - '0 0 10'); + } +} + +void buff_Blessed_SpawnFoot(entity player) +{ + makevectors(player.angles); + vector org = player.origin + (v_forward * 220) + ('0 0 1' * 32); + vector bottom; + vector top; + entity foot = spawn(); + + foot.realowner = player; // don't set owner, as we want this to crush owner + foot.classname = "montyfoot"; + foot.solid = SOLID_TRIGGER; + foot.touch = buff_Blessed_Foot_Touch; + foot.think = buff_Blessed_Foot_Think; + foot.nextthink = time; + foot.movetype = MOVETYPE_NOCLIP; + foot.scale = 6; + + setmodel(foot, "models/monty/foot.iqm"); + setsize(foot, '-150 -150 0', '150 150 250'); + + //tracebox(org, foot.mins, foot.maxs, org + '0 0 800', MOVE_NORMAL, foot); + top = org + '0 0 800'; + foot.dphitcontentsmask = DPCONTENTS_SOLID; + tracebox(org, foot.mins, foot.maxs, org - '0 0 2000', MOVE_WORLDONLY, foot); + foot.dphitcontentsmask = DPCONTENTS_LAVA; + bottom = trace_endpos; + + foot.buff_blessed_bottom = bottom; + foot.buff_blessed_top = top; + setorigin(foot, top); + + sound(player, CH_TRIGGER_SINGLE, "monty/ni.wav", VOL_BASEVOICE, ATTEN_NORM); +} +#endif + // mutator hooks MUTATOR_HOOKFUNCTION(buffs_PlayerDamage_SplitHealthArmor) { @@ -629,6 +704,20 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerThink) } } +#ifdef MONTY + if(!self.crouch) + self.buff_blessed_crouch_held = false; + + if(self.buffs & BUFF_BLESSED) + if(time >= self.buff_blessed_time) + if(self.crouch && !self.buff_blessed_crouch_held) + { + buff_Blessed_SpawnFoot(self); + self.buff_blessed_time = time + 0.5; + self.buff_blessed_crouch_held = true; + } +#endif + if((self.buffs & BUFF_INVISIBLE) && (self.oldbuffs & BUFF_INVISIBLE)) if(self.alpha != autocvar_g_buffs_invisible_alpha) self.alpha = autocvar_g_buffs_invisible_alpha; @@ -785,12 +874,15 @@ void buffs_DelayedInit() void buffs_Initialize() { + precache_model("models/monty/foot.iqm"); precache_model("models/relics/relic.md3"); precache_sound("misc/strength_respawn.wav"); precache_sound("misc/shield_respawn.wav"); precache_sound("relics/relic_effect.wav"); precache_sound(W_Sound("rocket_impact")); precache_sound("keepaway/respawn.wav"); + precache_sound("monty/foot.wav"); + precache_sound("monty/ni.wav"); addstat(STAT_BUFFS, AS_INT, buffs); diff --git a/qcsrc/server/mutators/mutator_buffs.qh b/qcsrc/server/mutators/mutator_buffs.qh index 2d72e5b66..33d5b40d0 100644 --- a/qcsrc/server/mutators/mutator_buffs.qh +++ b/qcsrc/server/mutators/mutator_buffs.qh @@ -12,6 +12,14 @@ // disability .float buff_disability_time; .float buff_disability_effect_time; +#ifdef MONTY +// blessed +.float buff_blessed_time; // a little delay to prevent super spam +.vector buff_blessed_bottom; +.vector buff_blessed_top; +.bool buff_blessed_soundplayed; +.bool buff_blessed_crouch_held; +#endif // buff definitions .float buff_active; -- 2.39.2