]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Finally a functioning HUD! Now all I need is a new keepawayball_carrying.tga image...
authorunknown <samual@xonotic.org>
Sun, 21 Nov 2010 20:42:05 +0000 (15:42 -0500)
committerunknown <samual@xonotic.org>
Sun, 21 Nov 2010 20:42:05 +0000 (15:42 -0500)
qcsrc/server/mutators/gamemode_keepaway.qc

index 8f200dcd6c2b6c15a8ce456c566170737068947b..e8ec55b1e3612a234a973d8318166a376f2f9fec 100644 (file)
@@ -2,7 +2,6 @@ void ka_SpawnBall(void);
 void ka_TouchEvent(void);
 void ka_RespawnBall(void);
 void ka_DropEvent(entity);
-void ka_UpdateState(entity);
 
 void ka_Initialize()
 {
@@ -46,11 +45,9 @@ void ka_SpawnBall() // self = the ball
        self.flags = FL_ITEM;
        //self.reset = ka_Reset;
        self.owner = world;
-       
-       //WaypointSprite_AttachCarrier("ka-ball", self);
+
        WaypointSprite_Spawn("ka-ball", 0, 0, self, '0 0 64', world, self.team, self, waypointsprite_attachedforcarrier, FALSE);
        WaypointSprite_UpdateTeamRadar(self.waypointsprite_attachedforcarrier, RADARICON_FLAGCARRIER, '0 1 1');
-       // wtf radar doesn't work when not in a team environment?
 }
 
 void ka_RespawnBall()
@@ -104,10 +101,7 @@ void ka_TouchEvent()
        other.effects |= 8;
        other.alpha = 0.6;
 
-       ka_UpdateState(other);
-
        bprint(other.netname, "^7 has picked up the ball!\n");
-       if(other.items & IT_KEY1) { bprint(other.netname, "^7 has the ball in their inventory.\n"); }
        WriteByte(MSG_BROADCAST, SVC_CENTERPRINT);
        WriteString(MSG_BROADCAST, strcat("\n\n", other.netname, "^7 has picked up the ball!\n"));
        sound(self.owner, CHAN_AUTO, "keepaway/pickedup.wav", VOL_BASE, ATTN_NONE);
@@ -144,10 +138,7 @@ void ka_DropEvent(entity plyr)
        ball.owner.kaballcarried = world;
        ball.owner = world;
        
-       ka_UpdateState(plyr);
-       
        bprint(plyr.netname, "^7 has dropped the ball!\n");
-       if(plyr.items & IT_KEY1) { bprint(plyr.netname, "^7 has the ball in their inventory.\n"); }
        WriteByte(MSG_BROADCAST, SVC_CENTERPRINT);
        WriteString(MSG_BROADCAST, strcat("\n\n", plyr.netname, "^7 has dropped the ball!\n"));
        sound(other, CHAN_AUTO, "keepaway/dropped.wav", VOL_BASE, ATTN_NONE);   
@@ -161,13 +152,6 @@ void ka_DropEvent(entity plyr)
        WaypointSprite_Kill(plyr.waypointsprite_attachedforcarrier);
 }
 
-void ka_UpdateState(entity plyr)
-{
-       if(plyr.kaballcarried) {
-               plyr.items |= IT_KEY1; 
-       }
-}
-
 MUTATOR_HOOKFUNCTION(ka_RemovePlayer)
 {
        if(self.kaballcarried) { ka_DropEvent(self); }
@@ -191,8 +175,6 @@ MUTATOR_HOOKFUNCTION(ka_Scoring)
                        PlayerScore_Add(frag_attacker, SP_KEEPAWAY_SCORE, 1);
        }
 
-       if(self.items & IT_KEY1) { bprint(self.netname, "^7 has the ball in their inventory.\n"); }
-
        if(self.kaballcarried) { ka_DropEvent(self); }
        return 1;
 }
@@ -205,19 +187,14 @@ MUTATOR_HOOKFUNCTION(ka_GiveFragsForKill)
 
 MUTATOR_HOOKFUNCTION(ka_PlayerPreThink)
 {
+       self.items &~= IT_KEY1;
+
        if(self.kaballcarried) {
                self.items |= IT_KEY1; 
        }
-       //if(self.items & IT_KEY1) { bprint(self.netname, "^7 has the ball in their inventory.\n"); }
        return 1;
 }
 
-//MUTATOR_HOOKFUNCTION(ka_SpectateCopy)
-//{
-//     self.items = other.items;
-//     return 1;
-//}
-
 MUTATOR_DEFINITION(gamemode_keepaway)
 {
        MUTATOR_HOOK(MakePlayerObserver, ka_RemovePlayer, CBC_ORDER_ANY);
@@ -225,7 +202,6 @@ MUTATOR_DEFINITION(gamemode_keepaway)
        MUTATOR_HOOK(PlayerDies, ka_Scoring, CBC_ORDER_ANY);
        MUTATOR_HOOK(GiveFragsForKill, ka_GiveFragsForKill, CBC_ORDER_FIRST);
        MUTATOR_HOOK(PlayerPreThink, ka_PlayerPreThink, CBC_ORDER_FIRST);
-       //MUTATOR_HOOK(SpectateCopy, ka_SpectateCopy, CBC_ORDER_ANY);
 
        MUTATOR_ONADD
        {