]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into bones_was_here/q3compat
authorbones_was_here <bones_was_here@yahoo.com.au>
Sun, 2 Aug 2020 06:02:52 +0000 (16:02 +1000)
committerbones_was_here <bones_was_here@yahoo.com.au>
Sun, 2 Aug 2020 06:02:52 +0000 (16:02 +1000)
1  2 
qcsrc/common/mapobjects/trigger/jumppads.qc
qcsrc/common/mapobjects/trigger/multi.qc
qcsrc/common/physics/player.qc
qcsrc/common/stats.qh
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/server/client.qc
qcsrc/server/compat/quake3.qc
qcsrc/server/g_world.qc
qcsrc/server/items/spawning.qc
xonotic-server.cfg

Simple merge
index a0bde6b925ef51333e85a9ac51d816c07aeaf31f,5bbc4dd26317ff9a663fee894fbeef2e5398dd67..e1aba4caa4f0620b2c0385e5f6f2172ec612d787
@@@ -3,7 -3,7 +3,8 @@@
  #ifdef SVQC
  #include <server/autocvars.qh>
  #include <server/client.qh>
 +#include <server/compat/quake3.qh>
+ #include <common/mapobjects/trigger/secret.qh>
  #endif
  
  // Full list of all stat constants, included in a single location for easy reference
Simple merge
Simple merge
Simple merge
index 0000000000000000000000000000000000000000,f1c8796c7211ece944ef334be60266c8a661e7b4..829e6914116ca4cd6aaa6f856ddb7b5529d42f9e
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,149 +1,148 @@@
 -// FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard
 -SPAWNFUNC_ITEM(item_armor1, ITEM_ArmorSmall)
+ #include "spawning.qh"
+ /// \file
+ /// \brief Source file that contains implementation of the functions related to
+ /// creation of game items.
+ /// \copyright GNU GPLv2 or any later version.
+ #include <server/mutators/_mod.qh>
+ #include <server/weapons/spawning.qh>
+ #include <common/weapons/all.qh>
+ #include <common/mapobjects/subs.qh>
+ .bool m_isloot; ///< Holds whether item is loot.
+ /// \brief Holds whether strength, shield or superweapon timers expire while
+ /// this item is on the ground.
+ .bool m_isexpiring;
+ entity Item_FindDefinition(string class_name)
+ {
+       FOREACH(Items, it.m_canonical_spawnfunc == class_name,
+       {
+               return it;
+       });
+       FOREACH(Weapons, it.m_canonical_spawnfunc == class_name,
+       {
+               return it.m_pickup;
+       });
+       return NULL;
+ }
+ bool Item_IsAllowed(string class_name)
+ {
+       entity definition = Item_FindDefinition(class_name);
+       if (definition == NULL)
+       {
+               return false;
+       }
+       return Item_IsDefinitionAllowed(definition);
+ }
+ bool Item_IsDefinitionAllowed(entity definition)
+ {
+       return !MUTATOR_CALLHOOK(FilterItemDefinition, definition);
+ }
+ entity Item_Create(string class_name, vector position, bool no_align)
+ {
+       entity item = spawn();
+       item.classname = class_name;
+       item.spawnfunc_checked = true;
+       setorigin(item, position);
+       item.noalign = no_align;
+       Item_Initialize(item, class_name);
+       if (wasfreed(item))
+       {
+               return NULL;
+       }
+       return item;
+ }
+ void Item_Initialize(entity item, string class_name)
+ {
+       FOREACH(Weapons, it.m_canonical_spawnfunc == class_name,
+       {
+               weapon_defaultspawnfunc(item, it);
+               return;
+       });
+       FOREACH(Items, it.m_canonical_spawnfunc == class_name,
+       {
+               StartItem(item, it);
+               return;
+       });
+       LOG_FATALF("Item_Initialize: Invalid classname: %s", class_name);
+ }
+ entity Item_CreateLoot(string class_name, vector position, vector vel,
+       float time_to_live)
+ {
+       entity item = spawn();
+       if (!Item_InitializeLoot(item, class_name, position, vel, time_to_live))
+       {
+               return NULL;
+       }
+       return item;
+ }
+ bool Item_InitializeLoot(entity item, string class_name, vector position,
+       vector vel, float time_to_live)
+ {
+       item.classname = class_name;
+       Item_SetLoot(item, true);
+       item.noalign = true;
+       setorigin(item, position);
+       item.pickup_anyway = true;
+       item.spawnfunc_checked = true;
+       Item_Initialize(item, class_name);
+       if (wasfreed(item))
+       {
+               return false;
+       }
+       item.gravity = 1;
+       item.velocity = vel;
+       SUB_SetFade(item, time + time_to_live, 1);
+       return true;
+ }
+ bool Item_IsLoot(entity item)
+ {
+       return item.m_isloot || item.classname == "droppedweapon";
+ }
+ void Item_SetLoot(entity item, bool loot)
+ {
+       item.m_isloot = loot;
+ }
+ bool Item_ShouldKeepPosition(entity item)
+ {
+       return item.noalign || (item.spawnflags & 1);
+ }
+ bool Item_IsExpiring(entity item)
+ {
+       return item.m_isexpiring;
+ }
+ void Item_SetExpiring(entity item, bool expiring)
+ {
+       item.m_isexpiring = expiring;
+ }
+ // Compatibility spawn functions
++SPAWNFUNC_ITEM_COND(item_armor1, cvar("sv_mapformat_is_quake3"), ITEM_ArmorSmall, ITEM_ArmorMedium)
+ SPAWNFUNC_ITEM(item_armor25, ITEM_ArmorMega)
+ SPAWNFUNC_ITEM(item_armor_large, ITEM_ArmorMega)
+ SPAWNFUNC_ITEM(item_health1, ITEM_HealthSmall)
+ SPAWNFUNC_ITEM(item_health25, ITEM_HealthMedium)
+ SPAWNFUNC_ITEM(item_health_large, ITEM_HealthBig)
+ SPAWNFUNC_ITEM(item_health100, ITEM_HealthMega)
+ SPAWNFUNC_ITEM(item_quad, ITEM_Strength)
Simple merge