]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
div said this might work as a mutator, so add a new mutator and a hook and prepare...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 4 Apr 2012 12:52:42 +0000 (15:52 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 4 Apr 2012 12:52:42 +0000 (15:52 +0300)
defaultXonotic.cfg
qcsrc/server/autocvars.qh
qcsrc/server/cl_weapons.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/base.qh
qcsrc/server/mutators/mutator_physical_weapons.qc [new file with mode: 0644]
qcsrc/server/mutators/mutators.qh
qcsrc/server/progs.src
qcsrc/server/t_items.qc

index f32a19948412380c5136cd9f7f2a1100eeb89917..6be29e7401d23455022c5d7e14553b878104b527 100644 (file)
@@ -1387,8 +1387,8 @@ alias sethostname "set menu_use_default_hostname 0; hostname $*"
 
 set sv_foginterval 1 "force enable fog in regular intervals"
 
-set physics_ode_droppedweapon 1 "use ODE physics instead of simple physics for dropped weapons, requires physics_ode to be enabled"
-set physics_ode_droppedweapon_damageforcescale 3 "how affected physical weapons are by damage"
+set g_ode_weapons 1 "use ODE physics instead of simple physics for dropped weapons, requires physics_ode to be enabled"
+set g_ode_weapons_damageforcescale 3 "how affected physical weapons are by damage"
 
 // Audio track names (for old-style "cd loop NUMBER" usage)
 set _cdtrack_first "1"
index 9ff8b038f476f8ffdb87e2eda9b62292ef19b17d..e4c99f9ffa29a34fd05f6e034a2124d3c98acfea 100644 (file)
@@ -1216,5 +1216,5 @@ float autocvar_g_sandbox_object_material_velocity_min;
 float autocvar_g_sandbox_object_material_velocity_factor;
 float autocvar_g_max_info_autoscreenshot;
 float autocvar_physics_ode;
-float autocvar_physics_ode_droppedweapon;
-float autocvar_physics_ode_droppedweapon_damageforcescale;
+float autocvar_g_ode_weapons;
+float autocvar_g_ode_weapons_damageforcescale;
index dcd9d16f15434b56bf9a5a31217c233d708af8f2..ffb18ae211b52e8469463a751aba3cdf609f142d 100644 (file)
@@ -311,7 +311,7 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
                wep.pickup_anyway = TRUE; // these are ALWAYS pickable
 
                // make the dropped weapon physical
-               if(autocvar_physics_ode && autocvar_physics_ode_droppedweapon)
+               /*if(autocvar_physics_ode && autocvar_physics_ode_droppedweapon)
                {
                        entity wep2;
                        wep2 = spawn();
@@ -333,7 +333,7 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
                        wep.effects |= EF_NOMODELFLAGS; // disable the spinning
                        wep.movetype = MOVETYPE_FOLLOW;
                        wep.aiment = wep2;
-               }
+               }*/
 
                return s;
        }
index 1359c056692298f68ce457d95d13537e1398a9b8..6598468f4b680a88f0273cfe0ae5165ff2de48e1 100644 (file)
@@ -1078,6 +1078,8 @@ void readlevelcvars(void)
                MUTATOR_ADD(mutator_vampire);
        if(cvar("g_spawn_near_teammate"))
                MUTATOR_ADD(mutator_spawn_near_teammate);
+       if(cvar("g_ode_weapons"))
+               MUTATOR_ADD(mutator_physical_weapons);
 
        // is this a mutator? is this a mode?
        if(cvar("g_sandbox"))
index 137eebadb87edc1e56719e1e4be70dc6ce93fad0..ff5de6cfa4086ccca2460827d7c34427f8b93d2a 100644 (file)
@@ -205,3 +205,9 @@ MUTATOR_HOOKABLE(SV_StartFrame);
 MUTATOR_HOOKABLE(SetModname);
        // OUT
        string modname; // name of the mutator/mod if it warrants showing as such in the server browser
+       
+MUTATOR_HOOKABLE(Item_Spawn);
+       // called for each item being spawned on a map, including dropped weapons
+       // return 1 to remove an item
+       // INPUT
+       entity self; // the item
diff --git a/qcsrc/server/mutators/mutator_physical_weapons.qc b/qcsrc/server/mutators/mutator_physical_weapons.qc
new file mode 100644 (file)
index 0000000..a950177
--- /dev/null
@@ -0,0 +1,13 @@
+MUTATOR_HOOKFUNCTION(item_spawning)
+{
+       dprint("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+
+       return 0;
+}
+
+MUTATOR_DEFINITION(mutator_physical_weapons)
+{
+       MUTATOR_HOOK(Item_Spawn, item_spawning, CBC_ORDER_ANY);
+
+       return 0;
+}
index bc3c3fbd4446a5283d841a5a24ee1c6b3893981b..072e652fff72bb88ec7f516291ba16031c30ac61 100644 (file)
@@ -10,5 +10,6 @@ MUTATOR_DECLARATION(mutator_rocketflying);
 MUTATOR_DECLARATION(mutator_vampire);
 MUTATOR_DECLARATION(mutator_spawn_near_teammate);
 MUTATOR_DECLARATION(mutator_spawn_near_teammate);
+MUTATOR_DECLARATION(mutator_physical_weapons);
 
 MUTATOR_DECLARATION(sandbox);
index 0dbe5378186ab296c6cff094d0dfce718d9dfdd4..92f9fa6a21a4896c7a7dd468eb5544c47b230243 100644 (file)
@@ -215,6 +215,7 @@ mutators/mutator_dodging.qc
 mutators/mutator_rocketflying.qc
 mutators/mutator_vampire.qc
 mutators/mutator_spawn_near_teammate.qc
+mutators/mutator_physical_weapons.qc
 mutators/sandbox.qc
 
 ../warpzonelib/anglestransform.qc
index 5b9a2e5f99b9bc5e1c20d4bbbbbaa8414ffa58f9..1870dddf00c6be94c9db164f57efb93d998def12 100644 (file)
@@ -751,6 +751,13 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
        self.weapons = weaponid;
        self.flags = FL_ITEM | itemflags;
 
+       if(MUTATOR_CALLHOOK(Item_Spawn))
+       {
+               startitem_failed = TRUE;
+               remove(self);
+               return;
+       }
+
        // is it a dropped weapon?
        if (self.classname == "droppedweapon")
        {