]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Game mode is semi-functional now!!!! Tons of fixes were done, but still lots of thing...
authorunknown <samual@xonotic.org>
Thu, 18 Nov 2010 04:36:59 +0000 (23:36 -0500)
committerunknown <samual@xonotic.org>
Thu, 18 Nov 2010 04:36:59 +0000 (23:36 -0500)
defaultXonotic.cfg
qcsrc/menu/xonotic/dialog_multiplayer_create.c
qcsrc/server/cl_client.qc
qcsrc/server/defs.qh
qcsrc/server/mutators/gamemode_keepaway.qc

index 0bfa32f777e95e32d51fb3184fd0560455369ba7..ac8ab046aef316738f4d73db6eb3f06dc36441f3 100644 (file)
@@ -1247,10 +1247,23 @@ seta g_keyhunt_teams_override 0
 set g_keyhunt_teams 0
 
 // keepaway
-set g_keepaway 0 "Keepaway: w00t"
-set g_keepawayball_respawntime 5
-set g_keepawayball_damageforcescale 1
-set g_keepawayball_trail_color "0.2 0.4 1"
+set g_keepaway 0 "game mode which focuses around a ball, look at g_keepaway_win_mode for further details"
+set g_keepaway_pointlimit      -1      "total amount of points you can get, -1 for unlimited"
+set g_keepaway_pointleadlimit  -1      "mercy rule, -1 for unlimited"
+set g_keepaway_powerup 0       "powerup while holding the ball"
+set g_keepaway_powerup_damage  1.5     "damage multiplier while having powerup"
+set g_keepaway_powerup_force   1.5     "force multiplier while having powerup"
+set g_keepaway_powerup_selfdamage      1       "self damage multiplier while having powerup"
+set g_keepaway_powerup_selfforce       1.5     "self force multiplier while having powerup"
+set g_keepaway_noncarrier_warn 0       "warn players when they kill without holding the ball"
+set g_keepaway_noncarrier_damage       0.5     "damage done to other players if both you and they don't have the ball"
+set g_keepaway_noncarrier_force        0.5     "force done to other players if both you and they don't have the ball"
+set g_keepaway_noncarrier_selfdamage   1       "self damage if you don't have the ball"
+set g_keepaway_noncarrier_selfforce    1       "self force if you don't have the ball"
+seta g_keepaway_win_mode       0       "win mode for keepaway: 0 = time, 1 = kills as carrier (KAC)"
+set g_keepawayball_trail_color 254     "particle trail color from player/ball"
+set g_keepawayball_damageforcescale    1       "I don't really know what this is for. :)"
+set g_keepawayball_respawntime 15      "if no one picks up the ball, how long to wait until the ball respawns"
 seta g_keepaway_teams_override 0
 set g_keepaway_teams 0
 
index 4fb8ac0ca5836e662ef911416e356e532c81c6cc..c47684bc66b6dc251204999feef7410b1bf1c727 100644 (file)
@@ -39,6 +39,8 @@ void XonoticServerCreateTab_fill(entity me)
                        if(e.checked) e0 = NULL;
                me.TD(me, 1, me.columns / n, e = makeXonoticGametypeButton(1, "g_arena", "Arena"));
                        if(e.checked) e0 = NULL;
+               me.TD(me, 1, me.columns / n, e = makeXonoticGametypeButton(1, "g_keepaway", "Keepaway"));
+                       if(e.checked) e0 = NULL;
                me.TD(me, 1, me.columns / n, e = makeXonoticGametypeButton(1, "g_race", "Race"));
                        if(e.checked) e0 = NULL;
                me.TD(me, 1, me.columns / n, e = makeXonoticGametypeButton(1, "g_cts", "Race CTS"));
index e3507d6413a8e54b4e57a4fd4fba36104916fa47..7e5ff5e8f8ad329286243807977e4404ecc4738b 100644 (file)
@@ -608,6 +608,8 @@ void PutObserverInServer (void)
        if(self.ballcarried)
                DropBall(self.ballcarried, self.origin + self.ballcarried.origin, self.velocity);
 
+       MUTATOR_CALLHOOK(MakePlayerObserver);
+
        WaypointSprite_PlayerDead();
 
        if not(g_ca)  // don't reset teams when moving a ca player to the spectators
@@ -714,7 +716,7 @@ void PutObserverInServer (void)
        else
                self.frags = FRAGS_SPECTATOR;
 
-       MUTATOR_CALLHOOK(MakePlayerObserver);
+       //MUTATOR_CALLHOOK(MakePlayerObserver);
 }
 
 float RestrictSkin(float s)
index bb278ce2bd1fe5fb3ecb47ace8294aa368d777fb..71546ee9f09a0753f3e17f8dbc6e5f7c0b137b1d 100644 (file)
@@ -558,6 +558,10 @@ void target_voicescript_clear(entity pl);
 .float metertime;
 float g_nexball_meter_period;
 
+// Keepaway
+
+.entity kaballcarried;
+
 void SUB_DontUseTargets();
 void SUB_UseTargets();
 
index 607705384b610f23850b5a0205043a2f29cd60cf..27fb396ad2c7f86867b94296796cfa6d53885740 100644 (file)
@@ -16,15 +16,15 @@ void ka_Initialize()
        e.nextthink = time;
 }
 
-void ka_SpawnBall()
+void ka_SpawnBall() // self = the ball
 {
        if(!g_keepaway) { 
                remove(self); 
                return; 
        }
        if (!self.model) {
-               self.model = "models/nexball/ball.md3"; 
-               self.scale = 1.3;
+               self.model = "models/orbs/orbblue.md3"; 
+               self.scale = 1;
        }
 
        precache_model(self.model);
@@ -43,7 +43,8 @@ void ka_SpawnBall()
        self.owner = world;
        
        // todo: Waypoints and radar
-       //WaypointSprite_AttachCarrier();
+       WaypointSprite_AttachCarrier("nb-ball", self);
+       //bprint("^4ka_SpawnBall was just called!\n");
 }
 
 void ka_RespawnBall()
@@ -65,6 +66,7 @@ void ka_RespawnBall()
                self.think = ka_RespawnBall;
                self.nextthink = time;
        }
+       //bprint("^4ka_RespawnBall was just called!\n");
 }
 
 void ka_TouchEvent(entity plyr)
@@ -75,17 +77,19 @@ void ka_TouchEvent(entity plyr)
                self.nextthink = time;
                return;
        }
-       if (!plyr) 
+       if(!plyr) 
                return;
-       if (!self) 
+       if(!self) 
                return;
-       if ((other.classname != "player" || other.health < 1) && (time > self.ctf_droptime + cvar("g_keepawayball_respawntime")))
+       if(other.classname != "player" || other.health < 1)
                return;
-       if (self.wait > time)
+       if(self.wait > time)
                return;
+       //if(time > self.ctf_droptime + cvar("g_keepawayball_respawntime"))
+       //      return;
 
        self.owner = other;
-       other.ballcarried = self;
+       other.kaballcarried = self;
        setattachment(self, other, "");
        setorigin(self, BALL_ATTACHORG);
        
@@ -114,37 +118,38 @@ void ka_TouchEvent(entity plyr)
 
 MUTATOR_HOOKFUNCTION(ka_RemovePlayer)
 {
-       entity ball;
-       ball = self.ballcarried;
-
-       setattachment(ball, world, "");
-       ball.movetype = MOVETYPE_BOUNCE;
-       ball.solid = SOLID_TRIGGER;
-       ball.wait = time + 1;
-       ball.ctf_droptime = time;
-       ball.think = ka_SpawnBall;
-       ball.nextthink = time + cvar("g_keepawayball_respawntime");
-       ball.touch = ka_TouchEvent;
-       self.effects = EF_LOWPRECISION;
-       self.alpha = 1.0;
-       ball.alpha = 1.0;
-       setorigin(ball, self.origin + '0 0 10');
-       ball.velocity = '0 0 200' + '0 100 0'*crandom() + '100 0 0'*crandom();
+       if(self.kaballcarried) {
+               entity ball;
+               ball = self.kaballcarried;
+
+               setattachment(ball, world, "");
+               ball.movetype = MOVETYPE_BOUNCE;
+               ball.solid = SOLID_TRIGGER;
+               ball.wait = time + 1;
+               ball.ctf_droptime = time;
+               ball.think = ka_SpawnBall;
+               ball.nextthink = time + cvar("g_keepawayball_respawntime");
+               ball.touch = ka_TouchEvent;
+               self.effects = EF_LOWPRECISION;
+               self.alpha = 1.0;
+               ball.alpha = 1.0;
+               setorigin(ball, self.origin + '0 0 10'); // FIX ME: If a player becomes spectator, the hook function is given AFTER this happens, which means the origin given is after they already moved to another position, not where they died!
+               ball.velocity = '0 0 200' + '0 100 0'*crandom() + '100 0 0'*crandom();
        
-       bprint(self.netname, "^7 has dropped the ball!\n");
-       WriteByte(MSG_BROADCAST, SVC_CENTERPRINT);
-       WriteString(MSG_BROADCAST, strcat("\n\n", self.netname, "^7 has dropped the ball!\n"));
-       sound(other, CHAN_AUTO, "keepaway/dropped.wav", VOL_BASE, ATTN_NORM);   
-       
-       PlayerScore_Add(self, SP_KEEPAWAY_DROPS, 1);
-       
-       // todo
-       //WaypointSprite_AttachCarrier("ka-ball", ball);
-       //WaypointSprite_Kill(plyr.waypointsprite_attachedforcarrier);
-       
-       ball.owner.ballcarried = world;
-       ball.owner = world;
-
+               bprint(self.netname, "^7 has dropped the ball!\n");
+               WriteByte(MSG_BROADCAST, SVC_CENTERPRINT);
+               WriteString(MSG_BROADCAST, strcat("\n\n", self.netname, "^7 has dropped the ball!\n"));
+               sound(other, CHAN_AUTO, "keepaway/dropped.wav", VOL_BASE, ATTN_NORM);   
+               
+               PlayerScore_Add(self, SP_KEEPAWAY_DROPS, 1);
+               
+               // todo
+               WaypointSprite_AttachCarrier("nb-ball", ball);
+               WaypointSprite_Kill(self.waypointsprite_attachedforcarrier);
+               
+               ball.owner.kaballcarried = world;
+               ball.owner = world;
+       }
        return 1;
 }
 
@@ -263,7 +268,7 @@ MUTATOR_DEFINITION(gamemode_keepaway)
 {
        MUTATOR_HOOK(MakePlayerObserver, ka_RemovePlayer, CBC_ORDER_ANY);
        MUTATOR_HOOK(ClientDisconnect, ka_RemovePlayer, CBC_ORDER_ANY);
-       //MUTATOR_HOOK(PlayerDies, ka_PlayerDies, CBC_ORDER_ANY);
+       MUTATOR_HOOK(PlayerDies, ka_RemovePlayer, CBC_ORDER_ANY);
        //MUTATOR_HOOK(PlayerSpawn, ka_PlayerSpawn, CBC_ORDER_ANY);
        //MUTATOR_HOOK(GiveFragsForKill, ka_GiveFragsForKill, CBC_ORDER_FIRST);
        //MUTATOR_HOOK(PlayerPreThink, ka_PlayerPreThink, CBC_ORDER_FIRST);