]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Complete vehicle and turret spawn implementation, vehicles in non-teamplay gamemodes...
authorLegendaryGuard <rootuser999@gmail.com>
Tue, 5 Jul 2022 20:16:14 +0000 (22:16 +0200)
committerLegendaryGuard <rootuser999@gmail.com>
Tue, 5 Jul 2022 20:16:14 +0000 (22:16 +0200)
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/notifications/all.inc
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/sv_vehicles.qh

index 61449fcb712d6de3746fc800bd11c9ffb96d3a14..5380b21df34466fd5b14ee52992afe70c7d27dda 100644 (file)
@@ -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, 
index 87398b11d222367c1aeafa752eecab84b02e3f0d..92c466f29b2e86c1c21045dc37ede6ab4082327f 100644 (file)
@@ -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"), "")
index 88804768b14ffb3673b6cb65bd4fc79a596cb07e..8177f1734f619adec9ec0da3dbbf326588537d24 100644 (file)
@@ -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);
index 8a02b47f4de8aab09174baaa499b9a4416d31a3c..ba0a5088a88c7abbe2a1bff97ab85f97be81a5f0 100644 (file)
@@ -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;
 }
index a7d9bf1c469d3fba5c8f248c1e96fb4b8cc31270..708244d5d5b9b2e0302ba38d05792b6717d994e3 100644 (file)
@@ -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