X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fgamemode_nexball.qc;h=78d9d707689b5ce2332287daa108aa67e00fa0b2;hb=0e8bb460f7ee90a70701957fb94b9a7a443bf20e;hp=f5b92a4808f39528ac5e769beeff3b09c5069885;hpb=773883ab5d3e9d165fe2ee5784c96720e0cd392c;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/mutators/gamemode_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc index f5b92a480..78d9d7076 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qc +++ b/qcsrc/server/mutators/gamemode_nexball.qc @@ -124,7 +124,7 @@ void GiveBall(entity plyr, entity ball) ball.velocity = '0 0 0'; ball.movetype = MOVETYPE_NONE; - ball.touch = SUB_Null; + ball.touch = func_null; ball.effects |= EF_NOSHADOW; ball.scale = 1; // scale down. @@ -205,7 +205,8 @@ void ResetBall(void) { if(time == self.teamtime) bprint("The ", Team_ColoredFullName(self.team), " held the ball for too long.\n"); - self.touch = SUB_Null; + + self.touch = func_null; self.movetype = MOVETYPE_NOCLIP; self.velocity = '0 0 0'; // just in case? if(!self.cnt) @@ -247,7 +248,7 @@ void football_touch(void) self.nextthink = time + autocvar_g_nexball_delay_idle; return; } - if(other.classname != "player") + if not(IS_PLAYER(other)) return; if(other.health < 1) return; @@ -287,7 +288,7 @@ void basketball_touch(void) football_touch(); return; } - if(!self.cnt && other.classname == "player" && (other != self.nb_dropper || time > self.nb_droptime + autocvar_g_nexball_delay_collect)) + if(!self.cnt && IS_PLAYER(other) && (other != self.nb_dropper || time > self.nb_droptime + autocvar_g_nexball_delay_collect)) { if(other.health <= 0) return; @@ -326,7 +327,7 @@ void GoalTouch(void) else otherteam = 0; - if((isclient = ball.pusher.flags & FL_CLIENT)) + if((isclient = IS_CLIENT(ball.pusher))) pname = ball.pusher.netname; else pname = "Someone (?)"; @@ -387,7 +388,7 @@ void GoalTouch(void) ball.cnt = 1; ball.think = ResetBall; if(ball.classname == "nexball_basketball") - ball.touch = football_touch; // better than SUB_Null: football control until the ball gets reset + ball.touch = football_touch; // better than func_null: football control until the ball gets reset ball.nextthink = time + autocvar_g_nexball_delay_goal * (self.team != GOAL_OUT); } @@ -424,28 +425,28 @@ void nb_spawnteams(void) { switch(e.team) { - case FL_TEAM_1: + case NUM_TEAM_1: if(!t_r) { nb_spawnteam("Red", e.team-1) ; t_r = 1; } break; - case FL_TEAM_2: + case NUM_TEAM_2: if(!t_b) { nb_spawnteam("Blue", e.team-1) ; t_b = 1; } break; - case FL_TEAM_3: + case NUM_TEAM_3: if(!t_y) { nb_spawnteam("Yellow", e.team-1); t_y = 1; } break; - case FL_TEAM_4: + case NUM_TEAM_4: if(!t_p) { nb_spawnteam("Pink", e.team-1) ; @@ -478,7 +479,7 @@ void SpawnBall(void) // balls += 4; // using the remaining bits to count balls will leave more than the max edict count, so it's fine - if(!self.model) + if(self.model == "") { self.model = "models/nexball/ball.md3"; self.scale = 1.3; @@ -504,13 +505,13 @@ void SpawnBall(void) if(!autocvar_g_nexball_sound_bounce) self.noise = ""; - else if(!self.noise) + else if(self.noise == "") self.noise = "sound/nexball/bounce.wav"; //bounce sound placeholder (FIXME) - if(!self.noise1) + if(self.noise1 == "") self.noise1 = "sound/nexball/drop.wav"; //ball drop sound placeholder (FIXME) - if(!self.noise2) + if(self.noise2 == "") self.noise2 = "sound/nexball/steal.wav"; //stealing sound placeholder (FIXME) if(self.noise) precache_sound(self.noise); @@ -567,7 +568,7 @@ void SpawnGoal(void) } EXACTTRIGGER_INIT; self.classname = "nexball_goal"; - if(!self.noise) + if(self.noise == "") self.noise = "ctf/respawn.wav"; precache_sound(self.noise); self.touch = GoalTouch; @@ -575,29 +576,29 @@ void SpawnGoal(void) void spawnfunc_nexball_redgoal(void) { - self.team = FL_TEAM_1; + self.team = NUM_TEAM_1; SpawnGoal(); } void spawnfunc_nexball_bluegoal(void) { - self.team = FL_TEAM_2; + self.team = NUM_TEAM_2; SpawnGoal(); } void spawnfunc_nexball_yellowgoal(void) { - self.team = FL_TEAM_3; + self.team = NUM_TEAM_3; SpawnGoal(); } void spawnfunc_nexball_pinkgoal(void) { - self.team = FL_TEAM_4; + self.team = NUM_TEAM_4; SpawnGoal(); } void spawnfunc_nexball_fault(void) { self.team = GOAL_FAULT; - if(!self.noise) + if(self.noise == "") self.noise = "misc/typehit.wav"; SpawnGoal(); } @@ -605,7 +606,7 @@ void spawnfunc_nexball_fault(void) void spawnfunc_nexball_out(void) { self.team = GOAL_OUT; - if(!self.noise) + if(self.noise == "") self.noise = "misc/typehit.wav"; SpawnGoal(); } @@ -668,12 +669,12 @@ void W_Nexball_Touch(void) { entity ball, attacker; attacker = self.owner; - //self.think = SUB_Null; + //self.think = func_null; //self.enemy = world; PROJECTILE_TOUCH; if(attacker.team != other.team || autocvar_g_nexball_basketball_teamsteal) - if((ball = other.ballcarried) && (attacker.classname == "player")) + if((ball = other.ballcarried) && (IS_PLAYER(attacker))) { other.velocity = other.velocity + normalize(self.velocity) * other.damageforcescale * autocvar_g_balance_nexball_secondary_force; other.flags &~= FL_ONGROUND; @@ -773,14 +774,13 @@ void W_Nexball_Attack2(void) missile.flags = FL_PROJECTILE; } -var const float() nullfunc; float ball_customize() { if(!self.owner) { self.effects &~= EF_FLAME; self.scale = 1; - self.customizeentityforclient = nullfunc; + self.customizeentityforclient = func_null; return TRUE; } @@ -844,14 +844,8 @@ float w_nexball_weapon(float req) precache_sound("misc/typehit.wav"); } else if(req == WR_SETUP) - weapon_setup(WEP_PORTO); - else if(req == WR_SUICIDEMESSAGE) - { - w_deathtypestring = "is a weirdo"; - } - else if(req == WR_KILLMESSAGE) { - w_deathtypestring = "got killed by #'s black magic"; + weapon_setup(WEP_PORTO); } // No need to check WR_CHECKAMMO* or WR_AIM, it should always return TRUE return TRUE; @@ -906,7 +900,7 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink) //tracebox(self.origin + self.view_ofs, '-2 -2 -2', '2 2 2', self.origin + self.view_ofs + v_forward * autocvar_g_nexball_safepass_maxdist); crosshair_trace(self); if( trace_ent && - trace_ent.flags & FL_CLIENT && + IS_CLIENT(trace_ent) && trace_ent.deadflag == DEAD_NO && trace_ent.team == self.team && vlen(trace_ent.origin - self.origin) <= autocvar_g_nexball_safepass_maxdist ) @@ -980,5 +974,18 @@ MUTATOR_DEFINITION(gamemode_nexball) InitializeEntity(world, nb_delayedinit, INITPRIO_GAMETYPE); } + MUTATOR_ONROLLBACK_OR_REMOVE + { + // we actually cannot roll back nb_delayedinit here + // BUT: we don't need to! If this gets called, adding always + // succeeds. + } + + MUTATOR_ONREMOVE + { + print("This is a game type and it cannot be removed at runtime."); + return -1; + } + return 0; }