X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fassault.qc;h=425bbf77933892791bf46b5c96219b50daec758e;hb=5e42a6f54307afc1263845f546bfe74a6dfa100b;hp=0d7da73572a3083af09aff6a296b55afbe4fabf2;hpb=cbd704027b098da73f32298f43a1ecbc95e485d2;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/assault.qc b/qcsrc/server/assault.qc index 0d7da7357..425bbf779 100644 --- a/qcsrc/server/assault.qc +++ b/qcsrc/server/assault.qc @@ -30,9 +30,6 @@ void assault_objective_reset() { } void assault_objective_use() { - if(other.classname == "info_player_deathmatch") // a spawn, a spawn - return; - // activate objective self.health = 100; //print("^2Activated objective ", self.targetname, "=", etos(self), "\n"); @@ -50,6 +47,13 @@ void assault_objective_use() { self = oldself; } +vector target_objective_spawn_evalfunc(entity player, entity spot, vector current) +{ + if(self.health < 0 || self.health >= ASSAULT_VALUE_INACTIVE) + return '-1 0 0'; + return current; +} + void spawnfunc_target_objective() { if(!g_assault) { @@ -60,6 +64,7 @@ void spawnfunc_target_objective() { self.use = assault_objective_use; assault_objective_reset(); self.reset = assault_objective_reset; + self.spawn_evalfunc = target_objective_spawn_evalfunc; } @@ -71,7 +76,11 @@ void assault_objective_decrease_use() { } if(other.assault_sprite) + { WaypointSprite_Disown(other.assault_sprite, waypointsprite_deadlifetime); + if(other.classname == "func_assault_destructible") + other.sprite = world; + } else return; // already activated! cannot activate again! @@ -102,7 +111,7 @@ void assault_objective_decrease_use() { centerprint(player, s); } } - + oldactivator = activator; activator = oldself; SUB_UseTargets(); @@ -114,7 +123,7 @@ void assault_objective_decrease_use() { void assault_setenemytoobjective() { - local entity objective; + entity objective; for(objective = world; (objective = find(objective, targetname, self.target)); ) { if(objective.classname == "target_objective") { if(self.enemy == world) @@ -148,18 +157,26 @@ void target_objective_decrease_activate() for(ent = world; (ent = find(ent, target, self.targetname)); ) { if(ent.assault_sprite != world) + { WaypointSprite_Disown(ent.assault_sprite, waypointsprite_deadlifetime); + if(ent.classname == "func_assault_destructible") + ent.sprite = world; + } - spr = WaypointSprite_SpawnFixed("", 0.5 * (ent.absmin + ent.absmax), ent, assault_sprite); + spr = WaypointSprite_SpawnFixed("", 0.5 * (ent.absmin + ent.absmax), ent, assault_sprite, RADARICON_OBJECTIVE, '1 0.5 0'); spr.assault_decreaser = self; spr.waypointsprite_visible_for_player = assault_decreaser_sprite_visible; spr.classname = "sprite_waypoint"; WaypointSprite_UpdateRule(spr, assault_attacker_team, SPRITERULE_TEAMPLAY); if(ent.classname == "func_assault_destructible") + { WaypointSprite_UpdateSprites(spr, "as-defend", "as-destroy", "as-destroy"); + WaypointSprite_UpdateMaxHealth(spr, ent.max_health); + WaypointSprite_UpdateHealth(spr, ent.health); + ent.sprite = spr; + } else WaypointSprite_UpdateSprites(spr, "as-defend", "as-push", "as-push"); - WaypointSprite_UpdateTeamRadar(spr, RADARICON_OBJECTIVE, '1 0.5 0'); } } @@ -198,6 +215,7 @@ void spawnfunc_func_assault_destructible() { return; } self.spawnflags = 3; + self.classname = "func_assault_destructible"; if(assault_attacker_team == COLOR_TEAM1) { self.team = COLOR_TEAM2; } else { @@ -262,7 +280,7 @@ void assault_roundstart_use() { activator = self; SUB_UseTargets(); - + #ifdef TTURRETS_ENABLED entity ent, oldself; @@ -304,9 +322,31 @@ void spawnfunc_target_assault_roundstart() { // trigger new round // reset objectives, toggle spawnpoints, reset triggers, ... -void assault_new_round() { +void vehicles_clearrturn(); +void vehicles_spawn(); +void assault_new_round() +{ + entity oldself; //bprint("ASSAULT: new round\n"); + oldself = self; + // Eject players from vehicles + FOR_EACH_PLAYER(self) + { + if(self.vehicle) + vehicles_exit(VHEF_RELESE); + } + + self = findchainflags(vehicle_flags, VHF_ISVEHICLE); + while(self) + { + vehicles_clearrturn(); + vehicles_spawn(); + self = self.chain; + } + + self = oldself; + // up round counter self.winning = self.winning + 1; @@ -318,7 +358,7 @@ void assault_new_round() { } - local entity ent; + entity ent; for(ent = world; (ent = nextent(ent)); ) { if(clienttype(ent) == CLIENTTYPE_NOTACLIENT)