From ec9c61b50671bede8fb5fba2c6c217d7bb49aedc Mon Sep 17 00:00:00 2001 From: TimePath Date: Sat, 26 Sep 2015 15:55:57 +1000 Subject: [PATCH] Split port-o-launch and nexball ball stealer --- defaultXonotic.cfg | 1 - qcsrc/client/view.qc | 3 +- qcsrc/common/monsters/monster/mage.qc | 4 +- qcsrc/common/turrets/unit/plasma_dual.qc | 4 +- qcsrc/common/vehicles/unit/racer.qc | 4 +- qcsrc/common/weapons/all.inc | 2 + qcsrc/common/weapons/all.qh | 3 +- qcsrc/common/weapons/weapon/porto.qc | 7 ---- qcsrc/server/autocvars.qh | 14 ------- qcsrc/server/mutators/gamemode_nexball.qc | 40 ++++++++++++------- .../mutators/gamemode_nexball_weapon.qc | 11 +++++ weapons.cfg | 28 ------------- 12 files changed, 46 insertions(+), 75 deletions(-) create mode 100644 qcsrc/server/mutators/gamemode_nexball_weapon.qc delete mode 100644 weapons.cfg diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 338808f3d..c51dfc1a2 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -640,7 +640,6 @@ alias weapon_group_7 "impulse 7" alias weapon_group_8 "impulse 8" alias weapon_group_9 "impulse 9" alias weapon_group_0 "impulse 14" // cycles the superweapons -exec weapons.cfg // score log set sv_logscores_console 0 "print scores to server console" diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 80d1fe1df..d4eb7ba22 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -321,6 +321,7 @@ float TrueAimCheck() { case WEP_TUBA.m_id: // no aim case WEP_PORTO.m_id: // shoots from eye + case WEP_NEXBALL.m_id: // shoots from eye case WEP_HOOK.m_id: // no trueaim case WEP_MORTAR.m_id: // toss curve return SHOTTYPE_HITWORLD; @@ -440,7 +441,7 @@ bool WantEventchase() return true; if(MUTATOR_CALLHOOK(WantEventchase, self)) return true; - if(autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(WepSet_GetFromStat() & WepSet_FromWeapon(WEP_PORTO.m_id))) + if(autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(WepSet_GetFromStat() & WepSet_FromWeapon(WEP_NEXBALL.m_id))) return true; if(autocvar_cl_eventchase_death && (getstati(STAT_HEALTH) <= 0)) { diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index a3114812b..949e6ad3c 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -23,9 +23,7 @@ CLASS(MageSpike, PortoLaunch) /* refname */ ATTRIB(MageSpike, netname, string, "magespike"); /* wepname */ ATTRIB(MageSpike, message, string, _("Mage spike")); ENDCLASS(MageSpike) -REGISTER_WEAPON(MAGE_SPIKE, NEW(MageSpike)) { - localcmd(sprintf("alias weapon_%s \"impulse %d\"\n", this.netname, 230 + this.m_id - 1)); -} +REGISTER_WEAPON(MAGE_SPIKE, NEW(MageSpike)); #ifdef SVQC diff --git a/qcsrc/common/turrets/unit/plasma_dual.qc b/qcsrc/common/turrets/unit/plasma_dual.qc index 7f761bad1..1744f54f5 100644 --- a/qcsrc/common/turrets/unit/plasma_dual.qc +++ b/qcsrc/common/turrets/unit/plasma_dual.qc @@ -19,9 +19,7 @@ CLASS(PlasmaDualAttack, PortoLaunch) /* refname */ ATTRIB(PlasmaDualAttack, netname, string, "plasmadual"); /* wepname */ ATTRIB(PlasmaDualAttack, message, string, _("Dual plasma")); ENDCLASS(PlasmaDualAttack) -REGISTER_WEAPON(PLASMA_DUAL, NEW(PlasmaDualAttack)) { - localcmd(sprintf("alias weapon_%s \"impulse %d\"\n", this.netname, 230 + this.m_id - 1)); -} +REGISTER_WEAPON(PLASMA_DUAL, NEW(PlasmaDualAttack)); #ifdef SVQC diff --git a/qcsrc/common/vehicles/unit/racer.qc b/qcsrc/common/vehicles/unit/racer.qc index 4f8325517..be146dfc2 100644 --- a/qcsrc/common/vehicles/unit/racer.qc +++ b/qcsrc/common/vehicles/unit/racer.qc @@ -29,9 +29,7 @@ CLASS(RacerAttack, PortoLaunch) /* refname */ ATTRIB(RacerAttack, netname, string, "racercannon"); /* wepname */ ATTRIB(RacerAttack, message, string, _("Racer cannon")); ENDCLASS(RacerAttack) -REGISTER_WEAPON(RACER, NEW(RacerAttack)) { - localcmd(sprintf("alias weapon_%s \"impulse %d\"\n", this.netname, 230 + this.m_id - 1)); -} +REGISTER_WEAPON(RACER, NEW(RacerAttack)); #endif diff --git a/qcsrc/common/weapons/all.inc b/qcsrc/common/weapons/all.inc index fc89a0cd2..3257215a9 100644 --- a/qcsrc/common/weapons/all.inc +++ b/qcsrc/common/weapons/all.inc @@ -27,3 +27,5 @@ #include "weapon/arc.qc" #include "weapon/hmg.qc" #include "weapon/rpc.qc" + +#include "../../server/mutators/gamemode_nexball_weapon.qc" diff --git a/qcsrc/common/weapons/all.qh b/qcsrc/common/weapons/all.qh index c2ed2af7b..1b7cc7272 100644 --- a/qcsrc/common/weapons/all.qh +++ b/qcsrc/common/weapons/all.qh @@ -193,7 +193,7 @@ CLASS(Weapon, Object) /** A: WEPSET_id : WEPSET_... */ ATTRIB(Weapon, weapons, WepSet, '0 0 0'); /** M: function : w_... */ - ATTRIB(Weapon, weapon_func, bool(entity thiswep, int req), w_new); + METHOD(Weapon, weapon_func, bool(entity this, int req)) { return w_new(this, req); } /** M: ammotype : main ammo field */ ATTRIB(Weapon, ammo_field, .int, ammo_none); /** M: impulse : weapon impulse */ @@ -284,6 +284,7 @@ entity dummy_weapon_info; WEPSET_ALL |= (WEPSET_##id = WepSet_FromWeapon(this.m_id)); \ if ((this.spawnflags) & WEP_FLAG_SUPERWEAPON) WEPSET_SUPERWEAPONS |= WEPSET_##id; \ register_weapon(this, this.m_id, WEPSET_##id); \ + localcmd(sprintf("alias weapon_%s \"impulse %d\"\n", this.netname, 230 + this.m_id - 1)); \ } \ REGISTER_INIT(WEP, id) diff --git a/qcsrc/common/weapons/weapon/porto.qc b/qcsrc/common/weapons/weapon/porto.qc index bdd5bb59f..765f2606b 100644 --- a/qcsrc/common/weapons/weapon/porto.qc +++ b/qcsrc/common/weapons/weapon/porto.qc @@ -284,13 +284,6 @@ void W_Porto_Attack(float type) MUTATOR_CALLHOOK(EditProjectile, self, gren); } -bool w_nexball_weapon(int req); // WEAPONTODO - -METHOD(PortoLaunch, weapon_func, bool(entity this, int req)) { - if(g_nexball) { return w_nexball_weapon(req); } - return super.weapon_func(this, req); -} - METHOD(PortoLaunch, wr_aim, bool(entity thiswep)) { SELFPARAM(); diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index fcf209fac..83677a24c 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -416,22 +416,8 @@ float autocvar_g_multijump_speed; float autocvar_g_multijump_maxspeed; float autocvar_g_multijump_dodging = 1; string autocvar_g_mutatormsg; -float autocvar_g_nexball_basketball_bouncefactor; -float autocvar_g_nexball_basketball_bouncestop; -float autocvar_g_nexball_basketball_carrier_highspeed; -bool autocvar_g_nexball_basketball_meter; -float autocvar_g_nexball_basketball_meter_maxpower; -float autocvar_g_nexball_basketball_meter_minpower; -float autocvar_g_nexball_delay_collect; -float autocvar_g_nexball_delay_goal; -float autocvar_g_nexball_delay_start; -float autocvar_g_nexball_football_bouncefactor; -float autocvar_g_nexball_football_bouncestop; int autocvar_g_nexball_goalleadlimit; #define autocvar_g_nexball_goallimit cvar("g_nexball_goallimit") -bool autocvar_g_nexball_radar_showallplayers; -bool autocvar_g_nexball_sound_bounce; -int autocvar_g_nexball_trail_color; //float autocvar_g_nick_flood_penalty; int autocvar_g_nick_flood_penalty_red; int autocvar_g_nick_flood_penalty_yellow; diff --git a/qcsrc/server/mutators/gamemode_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc index c3f00d61b..8bf3b8424 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qc +++ b/qcsrc/server/mutators/gamemode_nexball.qc @@ -3,6 +3,21 @@ #include "gamemode.qh" +float autocvar_g_nexball_basketball_bouncefactor; +float autocvar_g_nexball_basketball_bouncestop; +float autocvar_g_nexball_basketball_carrier_highspeed; +bool autocvar_g_nexball_basketball_meter; +float autocvar_g_nexball_basketball_meter_maxpower; +float autocvar_g_nexball_basketball_meter_minpower; +float autocvar_g_nexball_delay_collect; +float autocvar_g_nexball_delay_goal; +float autocvar_g_nexball_delay_start; +float autocvar_g_nexball_football_bouncefactor; +float autocvar_g_nexball_football_bouncestop; +bool autocvar_g_nexball_radar_showallplayers; +bool autocvar_g_nexball_sound_bounce; +int autocvar_g_nexball_trail_color; + float autocvar_g_nexball_safepass_turnrate; float autocvar_g_nexball_safepass_maxdist; float autocvar_g_nexball_safepass_holdtime; @@ -153,11 +168,11 @@ void GiveBall(entity plyr, entity ball) plyr.weaponentity.weapons = plyr.weapons; plyr.weaponentity.switchweapon = plyr.weapon; - plyr.weapons = WEPSET_PORTO; + plyr.weapons = WEPSET_NEXBALL; setself(plyr); - WEP_ACTION(WEP_PORTO, WR_RESETPLAYER); - plyr.switchweapon = WEP_PORTO.m_id; - W_SwitchWeapon(WEP_PORTO.m_id); + WEP_ACTION(WEP_NEXBALL, WR_RESETPLAYER); + plyr.switchweapon = WEP_NEXBALL.m_id; + W_SwitchWeapon(WEP_NEXBALL.m_id); setself(this); } @@ -826,6 +841,11 @@ float ball_customize() return true; } +float w_nexball_weapon(float req); +METHOD(BallStealer, weapon_func, bool(entity this, int req)) { + return w_nexball_weapon(req); +} + float w_nexball_weapon(float req) {SELFPARAM(); if(req == WR_THINK) @@ -929,7 +949,7 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink) if(self.weaponentity.weapons) { self.weapons = self.weaponentity.weapons; - WEP_ACTION(WEP_PORTO, WR_RESETPLAYER); + WEP_ACTION(WEP_NEXBALL, WR_RESETPLAYER); self.switchweapon = self.weaponentity.switchweapon; W_SwitchWeapon(self.switchweapon); @@ -949,7 +969,7 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerSpawn) self.weaponentity.weapons = '0 0 0'; if(nexball_mode & NBM_BASKETBALL) - self.weapons |= WEPSET_PORTO; + self.weapons |= WEPSET_NEXBALL; else self.weapons = '0 0 0'; @@ -966,13 +986,6 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerPhysics) return false; } -MUTATOR_HOOKFUNCTION(nexball_SetStartItems) -{ - start_items |= IT_UNLIMITED_SUPERWEAPONS; // FIXME BAD BAD BAD BAD HACK, NEXBALL SHOULDN'T ABUSE PORTO'S WEAPON SLOT - - return false; -} - MUTATOR_HOOKFUNCTION(nexball_ForbidThrowing) {SELFPARAM(); if(self.weapon == WEP_MORTAR.m_id) @@ -998,7 +1011,6 @@ MUTATOR_DEFINITION(gamemode_nexball) MUTATOR_HOOK(PlayerSpawn, nexball_PlayerSpawn, CBC_ORDER_ANY); MUTATOR_HOOK(PlayerPreThink, nexball_PlayerPreThink, CBC_ORDER_ANY); MUTATOR_HOOK(PlayerPhysics, nexball_PlayerPhysics, CBC_ORDER_ANY); - MUTATOR_HOOK(SetStartItems, nexball_SetStartItems, CBC_ORDER_ANY); MUTATOR_HOOK(ForbidThrowCurrentWeapon, nexball_ForbidThrowing, CBC_ORDER_ANY); MUTATOR_HOOK(FilterItem, nexball_FilterItem, CBC_ORDER_ANY); diff --git a/qcsrc/server/mutators/gamemode_nexball_weapon.qc b/qcsrc/server/mutators/gamemode_nexball_weapon.qc new file mode 100644 index 000000000..a8822f897 --- /dev/null +++ b/qcsrc/server/mutators/gamemode_nexball_weapon.qc @@ -0,0 +1,11 @@ +#ifndef IMPLEMENTATION + +CLASS(BallStealer, PortoLaunch) +/* flags */ ATTRIB(BallStealer, spawnflags, int, WEP_TYPE_OTHER); +/* impulse */ ATTRIB(BallStealer, impulse, int, 2); +/* refname */ ATTRIB(BallStealer, netname, string, "ballstealer"); +/* wepname */ ATTRIB(BallStealer, message, string, _("Ball Stealer")); +ENDCLASS(BallStealer) +REGISTER_WEAPON(NEXBALL, NEW(BallStealer)); + +#endif diff --git a/weapons.cfg b/weapons.cfg deleted file mode 100644 index eb768df23..000000000 --- a/weapons.cfg +++ /dev/null @@ -1,28 +0,0 @@ -alias weapon_blaster "impulse 230" -alias weapon_shotgun "impulse 231" -alias weapon_machinegun "impulse 232" -alias weapon_mortar "impulse 233" -alias weapon_minelayer "impulse 234" -alias weapon_electro "impulse 235" -alias weapon_crylink "impulse 236" -alias weapon_vortex "impulse 237" -alias weapon_hagar "impulse 238" -alias weapon_devastator "impulse 239" -alias weapon_porto "impulse 240" -alias weapon_vaporizer "impulse 241" -alias weapon_hook "impulse 242" -alias weapon_hlac "impulse 243" -alias weapon_tuba "impulse 244" -alias weapon_rifle "impulse 245" -alias weapon_fireball "impulse 246" -alias weapon_seeker "impulse 247" -alias weapon_shockwave "impulse 248" -alias weapon_arc "impulse 249" - -// Backwards compatibility with 0.7.0 -alias weapon_laser "weapon_blaster" -alias weapon_uzi "weapon_machinegun" -alias weapon_grenadelauncher "weapon_mortar" -alias weapon_nex "weapon_vortex" -alias weapon_rocketlauncher "weapon_devastator" -alias weapon_minstanex "weapon_vaporizer" -- 2.39.2