]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/miscfunctions.qc
Write some actual content for common.qc and common.qh
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / miscfunctions.qc
index 4e43f17fdae175842b88c3ba33d120b783339d10..c76ddb38a55dd868bf6d9864e1847783395c5066 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,12 @@ void readlevelcvars(void)
                MUTATOR_ADD(mutator_rocketflying);
        if(cvar("g_vampire"))
                MUTATOR_ADD(mutator_vampire);
+       if(cvar("g_spawn_near_teammate"))
+               MUTATOR_ADD(mutator_spawn_near_teammate);
+
+       // is this a mutator? is this a mode?
+       if(cvar("g_sandbox"))
+               MUTATOR_ADD(sandbox);
 
        if(cvar("sv_allow_fullbright"))
                serverflags |= SERVERFLAG_ALLOW_FULLBRIGHT;
@@ -1266,12 +1287,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 +1717,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 +1725,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 +1799,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 +1896,7 @@ void adaptor_think2use_hittype_splash() // for timed projectile detonation
 // deferred dropping
 void DropToFloor_Handler()
 {
-    droptofloor_builtin();
+    builtin_droptofloor();
     self.dropped_origin = self.origin;
 }
 
@@ -2027,14 +2048,6 @@ void URI_Get_Callback(float id, float status, string data)
     }
 }
 
-void print_to(entity e, string s)
-{
-    if (e)
-        sprint(e, strcat(s, "\n"));
-    else
-        print(s, "\n");
-}
-
 string uid2name(string myuid) {
        string s;
        s = db_get(ServerProgsDB, strcat("/uid2name/", myuid));
@@ -3035,14 +3048,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)
@@ -3050,7 +3063,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()
 {
@@ -3135,29 +3148,3 @@ float isPushable(entity e)
                return TRUE;
        return FALSE;
 }
-
-// used by gamecommand/clientcommand/votecommand/bancommand system
-float GetFilteredNumber(string input)
-{
-       entity tmp_player, selection;
-       float output, matches;
-       
-       // check and see if we can get a number from input like "#3" or "3" 
-       if(substring(input, 0, 1) == "#")
-               output = stof(substring(input, 1, -1));
-       else
-               output = stof(input);
-               
-       // if we can't, check and see if we can match the input to the netname of any player in the game
-       if not(output) 
-       {
-               FOR_EACH_CLIENT(tmp_player)
-                       if (strdecolorize(tmp_player.netname) == strdecolorize(input))
-                               selection = tmp_player;
-
-               if (selection) { output = num_for_edict(selection); }
-       }
-               
-       print(strcat("input: ", input, ", output: ", ftos(output), ",\n"));
-       return output;
-}
\ No newline at end of file