]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/miscfunctions.qc
Merge branch 'master' into TimePath/physics
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / miscfunctions.qc
index e4d9156f6653308dbf8df3ab9d45bad3323951a6..212e8cffb6dd60de37196936df8722dc9682668c 100644 (file)
@@ -33,20 +33,25 @@ 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));
 }
+.bool ctrace_solidchanged;
 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;
+       FOREACH_ENTITY_FLOAT(solid, SOLID_TRIGGER,
+       {
+               if(it.model != "")
+               {
+                       it.solid = SOLID_BSP;
+                       it.ctrace_solidchanged = true;
+               }
+       });
 
        crosshair_trace(pl);
 
-       for (e = first; e; e = e.chain)
-               e.solid = SOLID_TRIGGER;
+       FOREACH_ENTITY_FLOAT(ctrace_solidchanged, true,
+       {
+               it.solid = SOLID_TRIGGER;
+               it.ctrace_solidchanged = false;
+       });
 }
 void WarpZone_crosshair_trace(entity pl)
 {
@@ -881,7 +886,7 @@ void InitializeEntitiesRun()
 {
     entity startoflist = initialize_entity_first;
     initialize_entity_first = NULL;
-    remove = remove_except_protected;
+    delete_fn = remove_except_protected;
     for (entity e = startoflist; e; e = e.initialize_entity_next)
     {
                e.remove_except_protected_forbidden = 1;
@@ -912,7 +917,7 @@ void InitializeEntitiesRun()
         }
         e = next;
     }
-    remove = remove_unsafely;
+    delete_fn = remove_unsafely;
 }
 
 .float(entity) isEliminated;
@@ -1318,7 +1323,7 @@ void detach_sameorigin(entity e)
 
 void follow_sameorigin(entity e, entity to)
 {
-    e.movetype = MOVETYPE_FOLLOW; // make the hole follow
+    set_movetype(e, MOVETYPE_FOLLOW); // make the hole follow
     e.aiment = to; // make the hole follow bmodel
     e.punchangle = to.angles; // the original angles of bmodel
     e.view_ofs = e.origin - to.origin; // relative origin
@@ -1327,7 +1332,7 @@ void follow_sameorigin(entity e, entity to)
 
 void unfollow_sameorigin(entity e)
 {
-    e.movetype = MOVETYPE_NONE;
+    set_movetype(e, MOVETYPE_NONE);
 }
 
 entity gettaginfo_relative_ent;
@@ -1349,7 +1354,7 @@ vector gettaginfo_relative(entity e, float tag)
 void SetMovetypeFollow(entity ent, entity e)
 {
        // FIXME this may not be warpzone aware
-       ent.movetype = MOVETYPE_FOLLOW; // make the hole follow
+       set_movetype(ent, MOVETYPE_FOLLOW); // make the hole follow
        ent.solid = SOLID_NOT; // MOVETYPE_FOLLOW is always non-solid - this means this cannot be teleported by warpzones any more! Instead, we must notice when our owner gets teleported.
        ent.aiment = e; // make the hole follow bmodel
        ent.punchangle = e.angles; // the original angles of bmodel
@@ -1360,14 +1365,14 @@ void SetMovetypeFollow(entity ent, entity e)
 }
 void UnsetMovetypeFollow(entity ent)
 {
-       ent.movetype = MOVETYPE_FLY;
+       set_movetype(ent, MOVETYPE_FLY);
        PROJECTILE_MAKETRIGGER(ent);
        ent.aiment = NULL;
 }
 float LostMovetypeFollow(entity ent)
 {
 /*
-       if(ent.movetype != MOVETYPE_FOLLOW)
+       if(ent.move_movetype != MOVETYPE_FOLLOW)
                if(ent.aiment)
                        error("???");
 */