From: LegendaryGuard Date: Tue, 5 Jul 2022 20:16:14 +0000 (+0200) Subject: Complete vehicle and turret spawn implementation, vehicles in non-teamplay gamemodes... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=427711aa7f69dbb664a451e3c026fd498916b373;p=xonotic%2Fxonotic-data.pk3dir.git Complete vehicle and turret spawn implementation, vehicles in non-teamplay gamemodes detect the entered intruder, plus now vehicles can be spawned at the same time after starting the game. cl_pokenade_type can be used writing vehicle / turret names to summon according to player's wish --- diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 61449fcb71..5380b21df3 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -771,7 +771,7 @@ void nade_emerald_randomweapons(entity e, vector org) RandomSelection_Init(); FOREACH(Weapons, it != WEP_Null && (!((it.spawnflags & WEP_FLAG_HIDDEN) || (it.spawnflags & WEP_FLAG_MUTATORBLOCKED)) || autocvar_g_nades_emerald_randomweapons_includespecial), { - if((it.spawnflags & WEP_FLAG_HIDDEN) && (it.spawnflags & WEP_FLAG_MUTATORBLOCKED)) + if((it.spawnflags & WEP_FLAG_HIDDEN) && (it.spawnflags & WEP_FLAG_MUTATORBLOCKED)) // && (it.spawnflags & WEP_TYPE_OTHER)) continue; float chancewep = 1; if(it.spawnflags & WEP_FLAG_SPECIALATTACK) //LegendGuard fixes the strange part of the code @@ -1000,12 +1000,9 @@ void nade_emerald_boom(entity this) if(!autocvar_g_vehicles) return; - // looks like a bad practice - time = 0.7; - e = spawnvehicle( e, - "random", + this.pokenade_type, VEH_Null, this.realowner, this.realowner, @@ -1028,7 +1025,7 @@ void nade_emerald_boom(entity this) e = spawnturret( e, - "random", //this.tandemnade_type, + this.pokenade_type, TUR_Null, this.realowner, this.realowner, diff --git a/qcsrc/common/notifications/all.inc b/qcsrc/common/notifications/all.inc index 87398b11d2..92c466f29b 100644 --- a/qcsrc/common/notifications/all.inc +++ b/qcsrc/common/notifications/all.inc @@ -773,6 +773,7 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input != MSG_CENTER_NOTIF(VEHICLE_ENTER_GUNNER, N_ENABLE, 0, 0, "pass_key", CPID_VEHICLES, "0 0", _("^BGPress ^F2%s^BG to enter the vehicle gunner"), "") MSG_CENTER_NOTIF(VEHICLE_ENTER_STEAL, N_ENABLE, 0, 0, "pass_key", CPID_VEHICLES, "0 0", _("^BGPress ^F2%s^BG to steal this vehicle"), "") MSG_CENTER_NOTIF(VEHICLE_STEAL, N_ENABLE, 0, 0, "", CPID_VEHICLES_OTHER, "0 0", _("^F2The enemy is stealing one of your vehicles!\n^F4Stop them!"), "") + MSG_CENTER_NOTIF(VEHICLE_STEAL_OWNER, N_ENABLE, 1, 0, "s1", CPID_VEHICLES_OTHER, "4 0", _("^F2Intruder detected, %s vehicle is being stolen,\n disabling shields!"), "") MSG_CENTER_NOTIF(VEHICLE_STEAL_SELF, N_ENABLE, 0, 0, "", CPID_VEHICLES_OTHER, "4 0", _("^F2Intruder detected, disabling shields!"), "") MSG_CENTER_NOTIF(WEAPON_MINELAYER_LIMIT, N_ENABLE, 0, 1, "f1", CPID_Null, "0 0", _("^BGYou cannot place more than ^F2%s^BG mines at a time"), "") diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index 88804768b1..8177f1734f 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -1509,8 +1509,8 @@ entity spawnturret (entity e, string turret, Turret tur, entity spawnedby, entit turret_initialize(e, tur); tmp_turcount++; - - //LOG_INFOF("^1tur.netname^3: %s", tur.netname); + + // LOG_INFOF("^1tur.netname^3: %s", tur.netname); if (optional) e.tur_head.effects = (EF_DIMLIGHT | EF_FULLBRIGHT); diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 8a02b47f4d..ba0a5088a8 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -978,6 +978,17 @@ void vehicles_enter(entity pl, entity veh) if(veh.owner) return; // got here and didn't enter the gunner, return + if(!teamplay) + if(!veh.realowner) + if(veh.realowner != pl && autocvar_g_vehicles_steal) + { + Send_Notification(NOTIF_ONE, pl, MSG_CENTER, CENTER_VEHICLE_STEAL_OWNER, veh.realowner.netname); + + veh.vehicle_shield = 0; + veh.old_vehicle_flags = veh.vehicle_flags; // make a backup just so we're not permanently crippling this vehicle + veh.vehicle_flags &= ~VHF_SHIELDREGEN; + } + if(teamplay) if(veh.team) if(DIFF_TEAM(pl, veh)) @@ -1295,8 +1306,10 @@ bool vehicle_initialize(entity this, Vehicle info, bool nodrop) if(this.active == ACTIVE_NOT) this.nextthink = 0; // wait until activated - else if(autocvar_g_vehicles_delayspawn) + else if(autocvar_g_vehicles_delayspawn && !this.summoned) this.nextthink = time + this.respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter); + else if(this.summoned) + this.nextthink = time; else this.nextthink = time + game_starttime; @@ -1324,7 +1337,7 @@ entity spawnvehicle (entity e, string vehicle, Vehicle veh, entity spawnedby, en e.optional_setup = optional; e.no_respawn_option = no_respwn; - e.cannot_respawn = false; + e.summoned = true; setorigin(e, orig); bool allow_any = boolean(vehicle == "anyrandom"); @@ -1365,6 +1378,8 @@ entity spawnvehicle (entity e, string vehicle, Vehicle veh, entity spawnedby, en } e.realowner = spawnedby; + e.colormod = spawnedby.colormod; + e.colormap = spawnedby.colormap; if(IS_PLAYER(spawnedby)) { @@ -1384,5 +1399,7 @@ entity spawnvehicle (entity e, string vehicle, Vehicle veh, entity spawnedby, en tmp_vehcount++; + // LOG_INFOF("^4veh.netname^3: %s", veh.netname); + return e; } diff --git a/qcsrc/common/vehicles/sv_vehicles.qh b/qcsrc/common/vehicles/sv_vehicles.qh index a7d9bf1c46..708244d5d5 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qh +++ b/qcsrc/common/vehicles/sv_vehicles.qh @@ -87,6 +87,7 @@ const int MAX_AXH = 4; .bool optional_setup; .bool no_respawn_option; .bool cannot_respawn; +.bool summoned; // vehicle functions .void(int _spawnflag) vehicle_spawn; /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns