]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Random items: finished base code.
authorLyberta <lyberta@lyberta.net>
Fri, 29 Sep 2017 20:55:34 +0000 (23:55 +0300)
committerLyberta <lyberta@lyberta.net>
Fri, 29 Sep 2017 20:55:34 +0000 (23:55 +0300)
mutators.cfg
qcsrc/common/mutators/mutator/overkill/sv_overkill.qc
qcsrc/common/t_items.qc

index a8b611aaa80bb081489b1ae04a0b9e482d70bbcf..c70c2d0b4beea0c4079b2425ea4ff360786bed41 100644 (file)
@@ -490,6 +490,8 @@ set g_random_items_replace_item_shells 1 "Whether to randomly replace shells."
 set g_random_items_replace_item_bullets 1 "Whether to randomly replace bullets."
 set g_random_items_replace_item_rockets 1 "Whether to randomly replace rockets."
 set g_random_items_replace_item_cells 1 "Whether to randomly replace cells."
+set g_random_items_replace_item_plasma 1 "Whether to randomly replace plasma."
+set g_random_items_replace_item_fuel 1 "Whether to randomly replace fuel."
 set g_random_items_replace_weapon_blaster 1 "Whether to randomly replace blaster."
 set g_random_items_replace_weapon_shotgun 1 "Whether to randomly replace shotgun."
 set g_random_items_replace_weapon_machinegun 1 "Whether to randomly replace machinegun."
@@ -512,45 +514,96 @@ set g_random_items_replace_weapon_seeker 1 "Whether to randomly replace TAG seek
 set g_random_items_replace_weapon_vaporizer 1 "Whether to randomly replace vaporizer."
 set g_random_items_replace_item_strength 1 "Whether to randomly replace strength."
 set g_random_items_replace_item_shield 1 "Whether to randomly replace shield."
-set g_random_map_health_probability 1 "Probability of random health items spawning in the map."
-set g_random_map_armor_probability 1 "Probability of random armor items spawning in the map."
-set g_random_map_ammo_probability 1 "Probability of random ammo items spawning in the map."
-set g_random_map_weapon_probability 1 "Probability of random weapons spawning in the map."
-set g_random_map_powerup_probability 0.25 "Probability of random powerups spawning in the map."
-set g_random_map_health_small_probability 10 "Probability of random small health spawning in the map."
-set g_random_map_health_medium_probability 4 "Probability of random medium health spawning in the map."
-set g_random_map_health_big_probability 2 "Probability of random big health spawning in the map."
-set g_random_map_health_mega_probability 1 "Probability of random mega health spawning in the map."
-set g_random_map_armor_small_probability 10 "Probability of random small armor spawning in the map."
-set g_random_map_armor_medium_probability 4 "Probability of random medium armor spawning in the map."
-set g_random_map_armor_big_probability 2 "Probability of random big armor spawning in the map."
-set g_random_map_armor_mega_probability 1 "Probability of random mega armor spawning in the map."
-set g_random_map_ammo_shells_probability 1 "Probability of random shells spawning in the map."
-set g_random_map_ammo_bullets_probability 1 "Probability of random bullets spawning in the map."
-set g_random_map_ammo_rockets_probability 1 "Probability of random rockets spawning in the map."
-set g_random_map_ammo_cells_probability 1 "Probability of random cells spawning in the map."
-set g_random_map_weapon_blaster_probability 0 "Probability of random blaster spawning in the map."
-set g_random_map_weapon_shotgun_probability 0 "Probability of random shotgun spawning in the map."
-set g_random_map_weapon_machinegun_probability 1 "Probability of random machinegun spawning in the map."
-set g_random_map_weapon_mortar_probability 1 "Probability of random mortar spawning in the map."
-set g_random_map_weapon_electro_probability 1 "Probability of random electro spawning in the map."
-set g_random_map_weapon_crylink_probability 1 "Probability of random crylink spawning in the map."
-set g_random_map_weapon_vortex_probability 1 "Probability of random vortex spawning in the map."
-set g_random_map_weapon_hagar_probability 1 "Probability of random hagar spawning in the map."
-set g_random_map_weapon_devastator_probability 1 "Probability of random devastator spawning in the map."
-set g_random_map_weapon_shockwave_probability 0 "Probability of random shockwave spawning in the map."
-set g_random_map_weapon_arc_probability 0 "Probability of random arc spawning in the map."
-set g_random_map_weapon_hook_probability 0 "Probability of random hook spawning in the map."
-set g_random_map_weapon_tuba_probability 0 "Probability of random tuba spawning in the map."
-set g_random_map_weapon_porto_probability 0 "Probability of random port-o-launch spawning in the map."
-set g_random_map_weapon_fireball_probability 0 "Probability of random fireball spawning in the map."
-set g_random_map_weapon_minelayer_probability 0 "Probability of random mine layer spawning in the map."
-set g_random_map_weapon_hlac_probability 0 "Probability of random HLAC spawning in the map."
-set g_random_map_weapon_rifle_probability 0 "Probability of random rifle spawning in the map."
-set g_random_map_weapon_seeker_probability 0 "Probability of random TAG seeker spawning in the map."
-set g_random_map_weapon_vaporizer_probability 0 "Probability of random vaporizer spawning in the map."
-set g_random_map_strength_probability 1 "Probability of random strength spawning in the map."
-set g_random_map_shield_probability 1 "Probability of random shield spawning in the map."
+set g_random_items_replace_item_fuel_regen 1 "Whether to randomly replace fuel regeneration."
+set g_random_items_replace_item_jetpack 1 "Whether to randomly replace jetpack."
+set g_random_items_health_probability 1 "Probability of random health items spawning in the map."
+set g_random_items_armor_probability 1 "Probability of random armor items spawning in the map."
+set g_random_items_resource_probability 1 "Probability of random ammo items spawning in the map."
+set g_random_items_weapon_probability 1 "Probability of random weapons spawning in the map."
+set g_random_items_powerup_probability 0.2 "Probability of random powerups spawning in the map."
+set g_random_items_health_small_probability 10 "Probability of random small health spawning in the map."
+set g_random_items_health_medium_probability 4 "Probability of random medium health spawning in the map."
+set g_random_items_health_big_probability 2 "Probability of random big health spawning in the map."
+set g_random_items_health_mega_probability 1 "Probability of random mega health spawning in the map."
+set g_random_items_armor_small_probability 10 "Probability of random small armor spawning in the map."
+set g_random_items_armor_medium_probability 4 "Probability of random medium armor spawning in the map."
+set g_random_items_armor_big_probability 2 "Probability of random big armor spawning in the map."
+set g_random_items_armor_mega_probability 1 "Probability of random mega armor spawning in the map."
+set g_random_items_resource_shells_probability 1 "Probability of random shells spawning in the map."
+set g_random_items_resource_bullets_probability 1 "Probability of random bullets spawning in the map."
+set g_random_items_resource_rockets_probability 1 "Probability of random rockets spawning in the map."
+set g_random_items_resource_cells_probability 1 "Probability of random cells spawning in the map."
+set g_random_items_resource_plasma_probability 0 "Probability of random plasma spawning in the map."
+set g_random_items_resource_fuel_probability 0 "Probability of random fuel spawning in the map."
+set g_random_items_weapon_blaster_probability 0 "Probability of random blaster spawning in the map."
+set g_random_items_weapon_shotgun_probability 0 "Probability of random shotgun spawning in the map."
+set g_random_items_weapon_machinegun_probability 1 "Probability of random machinegun spawning in the map."
+set g_random_items_weapon_mortar_probability 1 "Probability of random mortar spawning in the map."
+set g_random_items_weapon_electro_probability 1 "Probability of random electro spawning in the map."
+set g_random_items_weapon_crylink_probability 1 "Probability of random crylink spawning in the map."
+set g_random_items_weapon_vortex_probability 1 "Probability of random vortex spawning in the map."
+set g_random_items_weapon_hagar_probability 1 "Probability of random hagar spawning in the map."
+set g_random_items_weapon_devastator_probability 1 "Probability of random devastator spawning in the map."
+set g_random_items_weapon_shockwave_probability 0 "Probability of random shockwave spawning in the map."
+set g_random_items_weapon_arc_probability 0 "Probability of random arc spawning in the map."
+set g_random_items_weapon_hook_probability 0 "Probability of random hook spawning in the map."
+set g_random_items_weapon_tuba_probability 0 "Probability of random tuba spawning in the map."
+set g_random_items_weapon_porto_probability 0 "Probability of random port-o-launch spawning in the map."
+set g_random_items_weapon_fireball_probability 0 "Probability of random fireball spawning in the map."
+set g_random_items_weapon_minelayer_probability 0 "Probability of random mine layer spawning in the map."
+set g_random_items_weapon_hlac_probability 0 "Probability of random HLAC spawning in the map."
+set g_random_items_weapon_rifle_probability 0 "Probability of random rifle spawning in the map."
+set g_random_items_weapon_seeker_probability 0 "Probability of random TAG seeker spawning in the map."
+set g_random_items_weapon_vaporizer_probability 0 "Probability of random vaporizer spawning in the map."
+set g_random_items_strength_probability 1 "Probability of random strength spawning in the map."
+set g_random_items_shield_probability 1 "Probability of random shield spawning in the map."
+set g_random_items_fuel_regen_probability 0 "Probability of random fuel regeneration spawning in the map."
+set g_random_items_jetpack_probability 0 "Probability of random jetpack spawning in the map."
+set g_random_loot 0 "Whether to enable random loot."
 set g_random_loot_min 0 "Minimum amount of loot items."
 set g_random_loot_max 4 "Minimum amount of loot items."
 set g_random_loot_time 10 "Amount of time the loot will stay."
+set g_random_loot_spread 200 "How far can loot be thrown."
+set g_random_loot_health_probability 1 "Probability of random health items spawning as loot."
+set g_random_loot_armor_probability 1 "Probability of random armor items spawning as loot."
+set g_random_loot_resource_probability 1 "Probability of random ammo items spawning as loot."
+set g_random_loot_weapon_probability 1 "Probability of random weapons spawning as loot."
+set g_random_loot_powerup_probability 0.2 "Probability of random powerups spawning as loot."
+set g_random_loot_health_small_probability 4 "Probability of random small health spawning as loot."
+set g_random_loot_health_medium_probability 3 "Probability of random medium health spawning as loot."
+set g_random_loot_health_big_probability 2 "Probability of random big health spawning as loot."
+set g_random_loot_health_mega_probability 1 "Probability of random mega health spawning as loot."
+set g_random_loot_armor_small_probability 4 "Probability of random small armor spawning as loot."
+set g_random_loot_armor_medium_probability 3 "Probability of random medium armor spawning as loot."
+set g_random_loot_armor_big_probability 2 "Probability of random big armor spawning as loot."
+set g_random_loot_armor_mega_probability 1 "Probability of random mega armor spawning as loot."
+set g_random_loot_resource_shells_probability 1 "Probability of random shells spawning as loot."
+set g_random_loot_resource_bullets_probability 1 "Probability of random bullets spawning as loot."
+set g_random_loot_resource_rockets_probability 1 "Probability of random rockets spawning as loot."
+set g_random_loot_resource_cells_probability 1 "Probability of random cells spawning as loot."
+set g_random_loot_resource_plasma_probability 0 "Probability of random plasma spawning as loot."
+set g_random_loot_resource_fuel_probability 0 "Probability of random fuel spawning as loot."
+set g_random_loot_weapon_blaster_probability 0 "Probability of random blaster spawning as loot."
+set g_random_loot_weapon_shotgun_probability 0 "Probability of random shotgun spawning as loot."
+set g_random_loot_weapon_machinegun_probability 1 "Probability of random machinegun spawning as loot."
+set g_random_loot_weapon_mortar_probability 1 "Probability of random mortar spawning as loot."
+set g_random_loot_weapon_electro_probability 1 "Probability of random electro spawning as loot."
+set g_random_loot_weapon_crylink_probability 1 "Probability of random crylink spawning as loot."
+set g_random_loot_weapon_vortex_probability 1 "Probability of random vortex spawning as loot."
+set g_random_loot_weapon_hagar_probability 1 "Probability of random hagar spawning as loot."
+set g_random_loot_weapon_devastator_probability 1 "Probability of random devastator spawning as loot."
+set g_random_loot_weapon_shockwave_probability 0 "Probability of random shockwave spawning as loot."
+set g_random_loot_weapon_arc_probability 0 "Probability of random arc spawning as loot."
+set g_random_loot_weapon_hook_probability 0 "Probability of random hook spawning as loot."
+set g_random_loot_weapon_tuba_probability 0 "Probability of random tuba spawning as loot."
+set g_random_loot_weapon_porto_probability 0 "Probability of random port-o-launch spawning as loot."
+set g_random_loot_weapon_fireball_probability 0 "Probability of random fireball spawning as loot."
+set g_random_loot_weapon_minelayer_probability 0 "Probability of random mine layer spawning as loot."
+set g_random_loot_weapon_hlac_probability 0 "Probability of random HLAC spawning as loot."
+set g_random_loot_weapon_rifle_probability 0 "Probability of random rifle spawning as loot."
+set g_random_loot_weapon_seeker_probability 0 "Probability of random TAG seeker spawning as loot."
+set g_random_loot_weapon_vaporizer_probability 0 "Probability of random vaporizer spawning as loot."
+set g_random_loot_strength_probability 1 "Probability of random strength spawning as loot."
+set g_random_loot_shield_probability 1 "Probability of random shield spawning as loot."
+set g_random_loot_fuel_regen_probability 0 "Probability of random fuel regeneration spawning as loot."
+set g_random_loot_jetpack_probability 0 "Probability of random jetpack spawning as loot."
index b47e587511643e3076e172835052c16787d3079d..ea541ce440750283b4325eacdaedf3386a70ae74 100644 (file)
@@ -61,20 +61,10 @@ MUTATOR_HOOKFUNCTION(ok, Damage_Calculate, CBC_ORDER_LAST)
 
 void ok_DropItem(entity this, entity targ)
 {
-       entity e = new(droppedweapon); // hax
+       entity e = spawn();
        e.ok_item = true;
-       e.noalign = true;
-       e.pickup_anyway = true;
-       e.spawnfunc_checked = true;
-       spawnfunc_item_armor_small(e);
-       if (!wasfreed(e)) { // might have been blocked by a mutator
-        set_movetype(e, MOVETYPE_TOSS);
-        e.gravity = 1;
-        e.reset = SUB_Remove;
-        setorigin(e, this.origin + '0 0 32');
-        e.velocity = '0 0 200' + normalize(targ.origin - this.origin) * 500;
-        SUB_SetFade(e, time + 5, 1);
-       }
+       Item_InitializeLoot(e, "item_armor_small", this.origin + '0 0 32',
+               '0 0 200' + normalize(targ.origin - this.origin) * 500, 5);
 }
 
 MUTATOR_HOOKFUNCTION(ok, PlayerDies)
index 0d9418ede903a642bd6a04c19770549b549a1d11..7d16e6c69ee6234a4bb8e5366b8018f5948c480a 100644 (file)
@@ -879,7 +879,6 @@ LABEL(skip)
 
 void Item_Touch(entity this, entity toucher)
 {
-
        // remove the item if it's currnetly in a NODROP brush or hits a NOIMPACT surface (such as sky)
        if (Item_IsLoot(this))
        {
@@ -906,14 +905,17 @@ void Item_Touch(entity this, entity toucher)
 
        toucher = M_ARGV(1, entity);
 
-       if (Item_IsLoot(this))
+       // TODO: Proper way to handle expiring and not expiring loot.
+       // Expiring loot will have strength "ticking" will it's dropped.
+       // Not expiring will not tick.
+       // OTOH, do we really need expiring loot?
+       if (this.classname == "droppedweapon")
        {
                this.strength_finished = max(0, this.strength_finished - time);
                this.invincible_finished = max(0, this.invincible_finished - time);
                this.superweapons_finished = max(0, this.superweapons_finished - time);
        }
-       entity it = this.itemdef;
-       bool gave = ITEM_HANDLE(Pickup, it, this, toucher);
+       bool gave = ITEM_HANDLE(Pickup, this.itemdef, this, toucher);
        if (!gave)
        {
                if (Item_IsLoot(this))
@@ -1221,7 +1223,6 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
        if (Item_IsLoot(this))
        {
                this.reset = SUB_Remove;
-               // it's a dropped weapon
                set_movetype(this, MOVETYPE_TOSS);
 
                // Savage: remove thrown items after a certain period of time ("garbage collection")
@@ -1231,7 +1232,11 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
                this.takedamage = DAMAGE_YES;
                this.event_damage = Item_Damage;
 
-               if(this.strength_finished || this.invincible_finished || this.superweapons_finished)
+               // TODO: Proper way to handle expiring and not expiring loot.
+               // Expiring loot will have strength "ticking" will it's dropped.
+               // Not expiring will not tick.
+               // OTOH, do we really need expiring loot?
+               if (this.strength_finished || this.invincible_finished || this.superweapons_finished)
                {
                        // if item is worthless after a timer, have it expire then
                        this.nextthink = max(this.strength_finished, this.invincible_finished, this.superweapons_finished);