X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fgamemode_nexball.qc;h=92e707b061948c84ca2598c90bde7f42bfde3732;hb=971eb36c4ccfde80cd46767b0c20e2d97350821e;hp=014d37ec20169fd6497b6f3b50764b51deb1d91c;hpb=7b15197339e0263e56a6684f8a1b3890ba6d367b;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/mutators/gamemode_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc index 014d37ec2..92e707b06 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qc +++ b/qcsrc/server/mutators/gamemode_nexball.qc @@ -8,9 +8,9 @@ vector autocvar_g_nexball_viewmodel_offset; void basketball_touch(); void football_touch(); void ResetBall(); -#define NBM_NONE 0 -#define NBM_FOOTBALL 2 -#define NBM_BASKETBALL 4 +const float NBM_NONE = 0; +const float NBM_FOOTBALL = 2; +const float NBM_BASKETBALL = 4; float nexball_mode; float OtherTeam(float t) //works only if there are two teams on the map! @@ -22,6 +22,17 @@ float OtherTeam(float t) //works only if there are two teams on the map! return e.team; } +const float ST_NEXBALL_GOALS = 1; +const float SP_NEXBALL_GOALS = 4; +const float SP_NEXBALL_FAULTS = 5; +void nb_ScoreRules(float teams) +{ + ScoreRules_basics(teams, 0, 0, TRUE); + ScoreInfo_SetLabel_TeamScore( ST_NEXBALL_GOALS, "goals", SFL_SORT_PRIO_PRIMARY); + ScoreInfo_SetLabel_PlayerScore( SP_NEXBALL_GOALS, "goals", SFL_SORT_PRIO_PRIMARY); + ScoreInfo_SetLabel_PlayerScore(SP_NEXBALL_FAULTS, "faults", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER); + ScoreRules_basics_end(); +} void LogNB(string mode, entity actor) { @@ -142,7 +153,7 @@ void GiveBall(entity plyr, entity ball) self.weaponentity.weapons = self.weapons; self.weaponentity.switchweapon = self.weapon; self.weapons = WEPSET_PORTO; - weapon_action(WEP_PORTO, WR_RESETPLAYER); + WEP_ACTION(WEP_PORTO, WR_RESETPLAYER); self.switchweapon = WEP_PORTO; W_SwitchWeapon(WEP_PORTO); self = ownr; @@ -288,7 +299,7 @@ void basketball_touch(void) football_touch(); return; } - if(!self.cnt && IS_PLAYER(other) && (other != self.nb_dropper || time > self.nb_droptime + autocvar_g_nexball_delay_collect)) + if(!self.cnt && IS_PLAYER(other) && !other.frozen && !other.deadflag && (other != self.nb_dropper || time > self.nb_droptime + autocvar_g_nexball_delay_collect)) { if(other.health <= 0) return; @@ -457,16 +468,6 @@ void nb_spawnteams(void) } } -// scoreboard setup -void nb_ScoreRules(float teams) -{ - ScoreRules_basics(teams, 0, 0, TRUE); - ScoreInfo_SetLabel_TeamScore( ST_NEXBALL_GOALS, "goals", SFL_SORT_PRIO_PRIMARY); - ScoreInfo_SetLabel_PlayerScore( SP_NEXBALL_GOALS, "goals", SFL_SORT_PRIO_PRIMARY); - ScoreInfo_SetLabel_PlayerScore(SP_NEXBALL_FAULTS, "faults", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER); - ScoreRules_basics_end(); -} - void nb_delayedinit(void) { if(find(world, classname, "nexball_team") == world) @@ -694,7 +695,7 @@ void W_Nexball_Touch(void) PROJECTILE_TOUCH; if(attacker.team != other.team || autocvar_g_nexball_basketball_teamsteal) - if((ball = other.ballcarried) && !other.deadflag && (IS_PLAYER(attacker))) + if((ball = other.ballcarried) && !other.frozen && !other.deadflag && (IS_PLAYER(attacker))) { other.velocity = other.velocity + normalize(self.velocity) * other.damageforcescale * autocvar_g_balance_nexball_secondary_force; other.flags &= ~FL_ONGROUND; @@ -740,7 +741,7 @@ void W_Nexball_Attack(float t) mi = autocvar_g_nexball_basketball_meter_minpower; ma = max(mi, autocvar_g_nexball_basketball_meter_maxpower); // avoid confusion //One triangle wave period with 1 as max - mul = 2 * mod(t, g_nexball_meter_period) / g_nexball_meter_period; + mul = 2 * (t % g_nexball_meter_period) / g_nexball_meter_period; if(mul > 1) mul = 2 - mul; mul = mi + (ma - mi) * mul; // range from the minimal power to the maximal power @@ -784,7 +785,7 @@ void W_Nexball_Attack2(void) setsize(missile, '0 0 0', '0 0 0'); setorigin(missile, w_shotorg); - W_SetupProjectileVelocity(missile, autocvar_g_balance_nexball_secondary_speed, 0); + W_SetupProjVelocity_Basic(missile, autocvar_g_balance_nexball_secondary_speed, 0); missile.angles = vectoangles(missile.velocity); missile.touch = W_Nexball_Touch; missile.think = SUB_Remove; @@ -855,7 +856,7 @@ float w_nexball_weapon(float req) weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready); } } - else if(req == WR_PRECACHE) + else if(req == WR_INIT) { precache_model("models/weapons/g_porto.md3"); precache_model("models/weapons/v_porto.md3"); @@ -867,7 +868,7 @@ float w_nexball_weapon(float req) } else if(req == WR_SETUP) { - weapon_setup(WEP_PORTO); + //weapon_setup(WEP_PORTO); } // No need to check WR_CHECKAMMO* or WR_AIM, it should always return TRUE return TRUE; @@ -930,7 +931,7 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink) if(self.weaponentity.weapons) { self.weapons = self.weaponentity.weapons; - weapon_action(WEP_PORTO, WR_RESETPLAYER); + WEP_ACTION(WEP_PORTO, WR_RESETPLAYER); self.switchweapon = self.weaponentity.switchweapon; W_SwitchWeapon(self.switchweapon); @@ -976,7 +977,7 @@ MUTATOR_HOOKFUNCTION(nexball_SetStartItems) MUTATOR_HOOKFUNCTION(nexball_ForbidThrowing) { - if(self.weapon == WEP_GRENADE_LAUNCHER) + if(self.weapon == WEP_MORTAR) return TRUE; return FALSE; @@ -985,7 +986,7 @@ MUTATOR_HOOKFUNCTION(nexball_ForbidThrowing) MUTATOR_HOOKFUNCTION(nexball_FilterItem) { if(self.classname == "droppedweapon") - if(self.weapon == WEP_GRENADE_LAUNCHER) + if(self.weapon == WEP_MORTAR) return TRUE; return FALSE; @@ -1011,8 +1012,6 @@ MUTATOR_DEFINITION(gamemode_nexball) g_nexball_meter_period = rint(g_nexball_meter_period * 32) / 32; //Round to 1/32ths to send as a byte multiplied by 32 addstat(STAT_NB_METERSTART, AS_FLOAT, metertime); - w_porto(WR_PRECACHE); // abuse - // General settings /* CVTOV(g_nexball_football_boost_forward); //100