]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/miscfunctions.qc
Merge branch 'master' into mirceakitsune/sandbox
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / miscfunctions.qc
index 8b9cfec127f529c968982e103878561476487f6e..87fa4d6274298deefed6d38e18e7d87fa3ef8aca 100644 (file)
@@ -8,6 +8,21 @@ void crosshair_trace(entity pl)
 {
        traceline_antilag(pl, pl.cursor_trace_start, pl.cursor_trace_start + normalize(pl.cursor_trace_endpos - pl.cursor_trace_start) * MAX_SHOT_DISTANCE, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
 }
+void crosshair_trace_plusvisibletriggers(entity pl)
+{
+       entity first;
+       entity e;
+       first = findchainfloat(solid, SOLID_TRIGGER);
+
+       for (e = first; e; e = e.chain)
+               if (e.model != "")
+                       e.solid = SOLID_BSP;
+
+       crosshair_trace(pl);
+
+       for (e = first; e; e = e.chain)
+               e.solid = SOLID_TRIGGER;
+}
 void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
 void WarpZone_crosshair_trace(entity pl)
 {
@@ -1086,6 +1101,8 @@ void readlevelcvars(void)
                MUTATOR_ADD(mutator_rocketflying);
        if(cvar("g_vampire"))
                MUTATOR_ADD(mutator_vampire);
+       if(cvar("g_sandbox"))
+               MUTATOR_ADD(sandbox);
 
        if(cvar("sv_allow_fullbright"))
                serverflags |= SERVERFLAG_ALLOW_FULLBRIGHT;
@@ -1266,12 +1283,12 @@ float sound_allowed(float dest, entity e)
 }
 
 #ifdef COMPAT_XON010_CHANNELS
-void(entity e, float chan, string samp, float vol, float atten) sound_builtin = #8;
+void(entity e, float chan, string samp, float vol, float atten) builtin_sound = #8;
 void sound(entity e, float chan, string samp, float vol, float atten)
 {
     if (!sound_allowed(MSG_BROADCAST, e))
         return;
-    sound_builtin(e, chan, samp, vol, atten);
+    builtin_sound(e, chan, samp, vol, atten);
 }
 #else
 #undef sound
@@ -1696,7 +1713,7 @@ void make_safe_for_remove(entity e)
 void objerror(string s)
 {
     make_safe_for_remove(self);
-    objerror_builtin(s);
+    builtin_objerror(s);
 }
 
 .float remove_except_protected_forbidden;
@@ -1704,20 +1721,20 @@ void remove_except_protected(entity e)
 {
        if(e.remove_except_protected_forbidden)
                error("not allowed to remove this at this point");
-       remove_builtin(e);
+       builtin_remove(e);
 }
 
 void remove_unsafely(entity e)
 {
     if(e.classname == "spike")
         error("Removing spikes is forbidden (crylink bug), please report");
-    remove_builtin(e);
+    builtin_remove(e);
 }
 
 void remove_safely(entity e)
 {
     make_safe_for_remove(e);
-    remove_builtin(e);
+    builtin_remove(e);
 }
 
 void InitializeEntity(entity e, void(void) func, float order)
@@ -1778,7 +1795,7 @@ void InitializeEntitiesRun()
         {
             entity e_old;
             e_old = self.enemy;
-            remove_builtin(self);
+            builtin_remove(self);
             self = e_old;
         }
         //dprint("Delayed initialization: ", self.classname, "\n");
@@ -1875,7 +1892,7 @@ void adaptor_think2use_hittype_splash() // for timed projectile detonation
 // deferred dropping
 void DropToFloor_Handler()
 {
-    droptofloor_builtin();
+    builtin_droptofloor();
     self.dropped_origin = self.origin;
 }
 
@@ -2037,7 +2054,19 @@ void print_to(entity e, string s)
 
 string uid2name(string myuid) {
        string s;
-       s = db_get(ServerProgsDB, strcat("uid2name", myuid));
+       s = db_get(ServerProgsDB, strcat("/uid2name/", myuid));
+
+       // FIXME remove this later after 0.6 release
+       // convert old style broken records to correct style
+       if(s == "")
+       {
+               s = db_get(ServerProgsDB, strcat("uid2name", myuid));
+               if(s != "")
+               {
+                       db_put(ServerProgsDB, strcat("/uid2name/", myuid), s);
+                       db_put(ServerProgsDB, strcat("uid2name", myuid), "");
+               }
+       }
        
        if(s == "")
                s = "^1Unregistered Player";
@@ -3023,14 +3052,14 @@ float ExponentialFalloff(float mindist, float maxdist, float halflifedist, float
 
 
 #ifdef RELEASE
-#define cvar_string_normal cvar_string_builtin
-#define cvar_normal cvar_builtin
+#define cvar_string_normal builtin_cvar_string
+#define cvar_normal builtin_cvar
 #else
 string cvar_string_normal(string n)
 {
        if not(cvar_type(n) & 1)
                backtrace(strcat("Attempt to access undefined cvar: ", n));
-       return cvar_string_builtin(n);
+       return builtin_cvar_string(n);
 }
 
 float cvar_normal(string n)
@@ -3038,7 +3067,7 @@ float cvar_normal(string n)
        return stof(cvar_string_normal(n));
 }
 #endif
-#define cvar_set_normal cvar_set_builtin
+#define cvar_set_normal builtin_cvar_set
 
 void defer_think()
 {