minigame_server_sendflags(minigame,MINIG_SF_UPDATE);
}
+void snake_move_head(entity minigame);
+void snake_head_think()
+{
+ entity minigame = self.owner;
+
+ if(minigame.minigame_flags & SNAKE_TURN_MOVE)
+ snake_move_head(minigame);
+
+ self.nextthink = time + minigame.snake_delay;
+}
+
void snake_setup_pieces(entity minigame)
{
int targnum = bound(1, floor(random() * SNAKE_NUM_CNT), SNAKE_NUM_CNT - 1);
piece.team = 1; // init default team?
piece.netname = strzone(minigame_tile_buildname(targlet,targnum));
piece.cnt = 1;
+ piece.think = snake_head_think;
+ piece.nextthink = time + 0.1;
minigame_server_sendflags(piece,MINIG_SF_ALL);
minigame.snake_head = piece;
// Team 1 by default
return 1;
}
- case "frame":
- {
- if(minigame.minigame_flags & SNAKE_TURN_MOVE)
- if(time >= minigame.snake_nextmove)
- {
- snake_move_head(minigame);
- minigame.snake_nextmove = time + minigame.snake_delay;
- }
- return false;
- }
case "cmd":
{
switch(argv(0))
return mgteam;
}
-void minigame_frame()
-{
- entity minig = self;
-
- minig.minigame_event(minig,"frame");
- minig.nextthink = time + 0.1;
-}
-
entity start_minigame(entity player, string minigame )
{
if ( !autocvar_sv_minigames || !IS_REAL_CLIENT(player) )
minig.classname = "minigame";
minig.netname = strzone(strcat(e.netname,"_",ftos(num_for_edict(minig))));
minig.descriptor = e;
- minig.think = minigame_frame;
- minig.nextthink = time;
minig.minigame_event = e.minigame_event;
minig.minigame_event(minig,"start");
GameLogEcho(strcat(":minigame:start:",minig.netname));