X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fgamemode_nexball.qc;h=5831250d2d4b29cf144821413fc4028d7239483f;hb=2c0e35d3ee9fe6652c9c56f29dbbf546da0043b0;hp=62cfd01ad867250673f406bfc68ab7ea99841671;hpb=ad77b9efa833b1ef942252c7f86565c2c4cec52d;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/mutators/gamemode_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc index 62cfd01ad8..5831250d2d 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qc +++ b/qcsrc/server/mutators/gamemode_nexball.qc @@ -44,12 +44,12 @@ void ball_restart(void) void nexball_setstatus(void) { entity oldself; - self.items &~= IT_KEY1; + self.items &= ~IT_KEY1; if(self.ballcarried) { if(self.ballcarried.teamtime && (self.ballcarried.teamtime < time)) { - bprint("The ", ColoredTeamName(self.team), " held the ball for too long.\n"); + bprint("The ", Team_ColoredFullName(self.team), " held the ball for too long.\n"); oldself = self; self = self.ballcarried; DropBall(self, self.owner.origin, '0 0 0'); @@ -85,7 +85,7 @@ void DropOwner(void) DropBall(self, ownr.origin, ownr.velocity); makevectors(ownr.v_angle_y * '0 1 0'); ownr.velocity += ('0 0 0.75' - v_forward) * 1000; - ownr.flags &~= FL_ONGROUND; + ownr.flags &= ~FL_ONGROUND; } void GiveBall(entity plyr, entity ball) @@ -94,7 +94,7 @@ void GiveBall(entity plyr, entity ball) if((ownr = ball.owner)) { - ownr.effects &~= autocvar_g_nexball_basketball_effects_default; + ownr.effects &= ~autocvar_g_nexball_basketball_effects_default; ownr.ballcarried = world; if(ownr.metertime) { @@ -120,7 +120,7 @@ void GiveBall(entity plyr, entity ball) ball.nb_dropper = plyr; plyr.effects |= autocvar_g_nexball_basketball_effects_default; - ball.effects &~= autocvar_g_nexball_basketball_effects_default; + ball.effects &= ~autocvar_g_nexball_basketball_effects_default; ball.velocity = '0 0 0'; ball.movetype = MOVETYPE_NONE; @@ -139,9 +139,9 @@ void GiveBall(entity plyr, entity ball) ownr = self; self = plyr; - WEPSET_COPY_EE(self.weaponentity, self); + self.weaponentity.weapons = self.weapons; self.weaponentity.switchweapon = self.weapon; - WEPSET_COPY_EW(self, WEP_PORTO); + self.weapons = WEPSET_PORTO; weapon_action(WEP_PORTO, WR_RESETPLAYER); self.switchweapon = WEP_PORTO; W_SwitchWeapon(WEP_PORTO); @@ -151,13 +151,13 @@ void GiveBall(entity plyr, entity ball) void DropBall(entity ball, vector org, vector vel) { ball.effects |= autocvar_g_nexball_basketball_effects_default; - ball.effects &~= EF_NOSHADOW; - ball.owner.effects &~= autocvar_g_nexball_basketball_effects_default; + ball.effects &= ~EF_NOSHADOW; + ball.owner.effects &= ~autocvar_g_nexball_basketball_effects_default; setattachment(ball, world, ""); setorigin(ball, org); ball.movetype = MOVETYPE_BOUNCE; - ball.flags &~= FL_ONGROUND; + ball.flags &= ~FL_ONGROUND; ball.scale = ball_scale; ball.velocity = vel; ball.nb_droptime = time; @@ -182,7 +182,7 @@ void DropBall(entity ball, vector org, vector vel) void InitBall(void) { if(gameover) return; - self.flags &~= FL_ONGROUND; + self.flags &= ~FL_ONGROUND; self.movetype = MOVETYPE_BOUNCE; if(self.classname == "nexball_basketball") self.touch = basketball_touch; @@ -194,7 +194,7 @@ void InitBall(void) self.teamtime = 0; self.pusher = world; self.team = FALSE; - sound(self, CH_TRIGGER, self.noise1, VOL_BASE, ATTN_NORM); + sound(self, CH_TRIGGER, self.noise1, VOL_BASE, ATTEN_NORM); WaypointSprite_Ping(self.waypointsprite_attachedforcarrier); LogNB("init", world); } @@ -204,7 +204,8 @@ void ResetBall(void) if(self.cnt < 2) // step 1 { if(time == self.teamtime) - bprint("The ", ColoredTeamName(self.team), " held the ball for too long.\n"); + bprint("The ", Team_ColoredFullName(self.team), " held the ball for too long.\n"); + self.touch = func_null; self.movetype = MOVETYPE_NOCLIP; self.velocity = '0 0 0'; // just in case? @@ -240,14 +241,14 @@ void football_touch(void) { if(time > self.lastground + 0.1) { - sound(self, CH_TRIGGER, self.noise, VOL_BASE, ATTN_NORM); + sound(self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); self.lastground = time; } if(vlen(self.velocity) && !self.cnt) 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; @@ -296,7 +297,7 @@ void basketball_touch(void) } else if(other.solid == SOLID_BSP) { - sound(self, CH_TRIGGER, self.noise, VOL_BASE, ATTN_NORM); + sound(self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); if(vlen(self.velocity) && !self.cnt) self.nextthink = min(time + autocvar_g_nexball_delay_idle, self.teamtime); } @@ -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 (?)"; @@ -341,9 +342,9 @@ void GoalTouch(void) { LogNB("fault", ball.pusher); if(nb_teams == 2) - bprint(ColoredTeamName(otherteam), " gets a point due to ", pname, "^7's silliness.\n"); + bprint(Team_ColoredFullName(otherteam), " gets a point due to ", pname, "^7's silliness.\n"); else - bprint(ColoredTeamName(ball.team), " loses a point due to ", pname, "^7's silliness.\n"); + bprint(Team_ColoredFullName(ball.team), " loses a point due to ", pname, "^7's silliness.\n"); pscore = -1; } else if(self.team == GOAL_OUT) @@ -358,11 +359,11 @@ void GoalTouch(void) else //score { LogNB(strcat("goal:", ftos(self.team)), ball.pusher); - bprint("Goaaaaal! ", pname, "^7 scored a point for the ", ColoredTeamName(ball.team), ".\n"); + bprint("Goaaaaal! ", pname, "^7 scored a point for the ", Team_ColoredFullName(ball.team), ".\n"); pscore = 1; } - sound(ball, CH_TRIGGER, self.noise, VOL_BASE, ATTN_NONE); + sound(ball, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NONE); if(ball.team && pscore) { @@ -424,28 +425,28 @@ void nb_spawnteams(void) { switch(e.team) { - case COLOR_TEAM1: + case NUM_TEAM_1: if(!t_r) { nb_spawnteam("Red", e.team-1) ; t_r = 1; } break; - case COLOR_TEAM2: + case NUM_TEAM_2: if(!t_b) { nb_spawnteam("Blue", e.team-1) ; t_b = 1; } break; - case COLOR_TEAM3: + case NUM_TEAM_3: if(!t_y) { nb_spawnteam("Yellow", e.team-1); t_y = 1; } break; - case COLOR_TEAM4: + 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 = COLOR_TEAM1; + self.team = NUM_TEAM_1; SpawnGoal(); } void spawnfunc_nexball_bluegoal(void) { - self.team = COLOR_TEAM2; + self.team = NUM_TEAM_2; SpawnGoal(); } void spawnfunc_nexball_yellowgoal(void) { - self.team = COLOR_TEAM3; + self.team = NUM_TEAM_3; SpawnGoal(); } void spawnfunc_nexball_pinkgoal(void) { - self.team = COLOR_TEAM4; + 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(); } @@ -673,14 +674,14 @@ void W_Nexball_Touch(void) 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; + other.flags &= ~FL_ONGROUND; if(!attacker.ballcarried) { LogNB("stole", attacker); - sound(other, CH_TRIGGER, ball.noise2, VOL_BASE, ATTN_NORM); + sound(other, CH_TRIGGER, ball.noise2, VOL_BASE, ATTEN_NORM); if(attacker.team == other.team && time > attacker.teamkill_complain) { @@ -777,7 +778,7 @@ float ball_customize() { if(!self.owner) { - self.effects &~= EF_FLAME; + self.effects &= ~EF_FLAME; self.scale = 1; self.customizeentityforclient = func_null; return TRUE; @@ -789,11 +790,11 @@ float ball_customize() if(self.enemy) self.effects |= EF_FLAME; else - self.effects &~= EF_FLAME; + self.effects &= ~EF_FLAME; } else { - self.effects &~= EF_FLAME; + self.effects &= ~EF_FLAME; self.scale = 1; } @@ -843,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; @@ -905,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 ) @@ -922,30 +917,40 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink) } else { - if(!WEPSET_EMPTY_E(self.weaponentity)) + if(self.weaponentity.weapons) { - WEPSET_COPY_EE(self, self.weaponentity); + self.weapons = self.weaponentity.weapons; weapon_action(WEP_PORTO, WR_RESETPLAYER); self.switchweapon = self.weaponentity.switchweapon; W_SwitchWeapon(self.switchweapon); - WEPSET_CLEAR_E(self.weaponentity); + self.weaponentity.weapons = '0 0 0'; } } } + + nexball_setstatus(); + return FALSE; } MUTATOR_HOOKFUNCTION(nexball_PlayerSpawn) { - WEPSET_CLEAR_E(self.weaponentity); + self.weaponentity.weapons = '0 0 0'; if(nexball_mode & NBM_BASKETBALL) - WEPSET_OR_EW(self, WEP_PORTO); + self.weapons |= WEPSET_PORTO; else - WEPSET_CLEAR_E(self); + self.weapons = '0 0 0'; + + 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; } @@ -958,6 +963,7 @@ MUTATOR_DEFINITION(gamemode_nexball) 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(SetStartItems, nexball_SetStartItems, CBC_ORDER_ANY); MUTATOR_ONADD {