X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fgamemode_nexball.qc;h=392caa037d82b048dd1402109da7b0185697abb3;hb=939f709e0b7aef15091c56a824f12732262c00f0;hp=2d2c857e90dbff166c673e53f05488bb6970e878;hpb=0ab7132eba1a94b5ec19efe5a3f5f63071ed80ff;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/mutators/gamemode_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc index 2d2c857e9..392caa037 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qc +++ b/qcsrc/server/mutators/gamemode_nexball.qc @@ -22,6 +22,17 @@ float OtherTeam(float t) //works only if there are two teams on the map! return e.team; } +#define ST_NEXBALL_GOALS 1 +#define SP_NEXBALL_GOALS 4 +#define 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; @@ -461,7 +472,7 @@ void nb_delayedinit(void) { if(find(world, classname, "nexball_team") == world) nb_spawnteams(); - ScoreRules_nexball(nb_teams); + nb_ScoreRules(nb_teams); } @@ -471,11 +482,7 @@ void nb_delayedinit(void) void SpawnBall(void) { - if(!g_nexball) - { - remove(self); - return; - } + if(!g_nexball) { remove(self); return; } // balls += 4; // using the remaining bits to count balls will leave more than the max edict count, so it's fine @@ -559,14 +566,28 @@ void spawnfunc_nexball_football(void) SpawnBall(); } +float nb_Goal_Customize() +{ + entity e, wp_owner; + e = WaypointSprite_getviewentity(other); + wp_owner = self.owner; + if(SAME_TEAM(e, wp_owner)) { return FALSE; } + + return TRUE; +} + void SpawnGoal(void) { - if(!g_nexball) + if(!g_nexball) { remove(self); return; } + + EXACTTRIGGER_INIT; + + if(self.team != GOAL_OUT && Team_TeamToNumber(self.team) != -1) { - remove(self); - return; + WaypointSprite_SpawnFixed("goal", (self.absmin + self.absmax) * 0.5, self, sprite, RADARICON_NONE, ((self.team) ? Team_ColorRGB(self.team) : '1 0.5 0')); + self.sprite.customizeentityforclient = nb_Goal_Customize; } - EXACTTRIGGER_INIT; + self.classname = "nexball_goal"; if(self.noise == "") self.noise = "ctf/respawn.wav"; @@ -674,7 +695,7 @@ void W_Nexball_Touch(void) PROJECTILE_TOUCH; if(attacker.team != other.team || autocvar_g_nexball_basketball_teamsteal) - if((ball = other.ballcarried) && (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; @@ -683,7 +704,7 @@ void W_Nexball_Touch(void) LogNB("stole", attacker); sound(other, CH_TRIGGER, ball.noise2, VOL_BASE, ATTEN_NORM); - if(attacker.team == other.team && time > attacker.teamkill_complain) + if(SAME_TEAM(attacker, other) && time > attacker.teamkill_complain) { attacker.teamkill_complain = time + 5; attacker.teamkill_soundtime = time + 0.4; @@ -760,11 +781,11 @@ void W_Nexball_Attack2(void) missile.movetype = MOVETYPE_FLY; PROJECTILE_MAKETRIGGER(missile); - setmodel(missile, "models/elaser.mdl"); // precision set below + //setmodel(missile, "models/elaser.mdl"); // precision set below 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; @@ -772,6 +793,8 @@ void W_Nexball_Attack2(void) missile.effects = EF_BRIGHTFIELD | EF_LOWPRECISION; missile.flags = FL_PROJECTILE; + + CSQCProjectile(missile, TRUE, PROJECTILE_ELECTRO, TRUE); } float ball_customize() @@ -833,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"); @@ -845,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; @@ -859,18 +882,6 @@ MUTATOR_HOOKFUNCTION(nexball_BallDrop) return 0; } -MUTATOR_HOOKFUNCTION(nexball_BuildMutatorsString) -{ - ret_string = strcat(ret_string, ":NB"); - return 0; -} - -MUTATOR_HOOKFUNCTION(nexball_BuildMutatorsPrettyString) -{ - ret_string = strcat(ret_string, ", NexBall"); - return 0; -} - MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink) { makevectors(self.v_angle); @@ -920,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); @@ -947,6 +958,16 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerSpawn) return FALSE; } +MUTATOR_HOOKFUNCTION(nexball_PlayerPhysics) +{ + if(self.ballcarried) + { + self.stat_sv_airspeedlimit_nonqw *= autocvar_g_nexball_basketball_carrier_highspeed; + self.stat_sv_maxspeed *= autocvar_g_nexball_basketball_carrier_highspeed; + } + 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 @@ -954,16 +975,34 @@ MUTATOR_HOOKFUNCTION(nexball_SetStartItems) return FALSE; } +MUTATOR_HOOKFUNCTION(nexball_ForbidThrowing) +{ + if(self.weapon == WEP_MORTAR) + return TRUE; + + return FALSE; +} + +MUTATOR_HOOKFUNCTION(nexball_FilterItem) +{ + if(self.classname == "droppedweapon") + if(self.weapon == WEP_MORTAR) + return TRUE; + + return FALSE; +} + MUTATOR_DEFINITION(gamemode_nexball) { MUTATOR_HOOK(PlayerDies, nexball_BallDrop, CBC_ORDER_ANY); MUTATOR_HOOK(MakePlayerObserver, nexball_BallDrop, CBC_ORDER_ANY); MUTATOR_HOOK(ClientDisconnect, nexball_BallDrop, CBC_ORDER_ANY); - MUTATOR_HOOK(BuildMutatorsPrettyString, nexball_BuildMutatorsPrettyString, CBC_ORDER_ANY); - MUTATOR_HOOK(BuildMutatorsString, nexball_BuildMutatorsString, CBC_ORDER_ANY); 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); MUTATOR_ONADD {