]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/func/train.qc
Merge branch 'DefaultUser/gametype_votescreen' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / func / train.qc
index 1ec63780f12dfde25ffed5ba88c068d534dcc19f..dd9eaac860a5efe24dc0f7d09b71569b356f5fc2 100644 (file)
@@ -1,3 +1,4 @@
+#include "train.qh"
 .float train_wait_turning;
 void train_next(entity this);
 #ifdef SVQC
@@ -6,18 +7,18 @@ void train_use(entity this, entity actor, entity trigger);
 void train_wait(entity this)
 {
        SUB_UseTargets(this.enemy, NULL, NULL);
-       this.enemy = world;
+       this.enemy = NULL;
 
        // if turning is enabled, the train will turn toward the next point while waiting
        if(this.platmovetype_turn && !this.train_wait_turning)
        {
                entity targ, cp;
                vector ang;
-               targ = find(world, targetname, this.target);
+               targ = find(NULL, targetname, this.target);
                if((this.spawnflags & 1) && targ.curvetarget)
-                       cp = find(world, targetname, targ.curvetarget);
+                       cp = find(NULL, targetname, targ.curvetarget);
                else
-                       cp = world;
+                       cp = NULL;
 
                if(cp) // bezier curves movement
                        ang = cp.origin - (this.origin - this.view_ofs); // use the origin of the control point of the next path_corner
@@ -40,7 +41,7 @@ void train_wait(entity this)
 #endif
 
 #ifdef SVQC
-       entity tg = find(world, targetname, this.target);
+       entity tg = find(NULL, targetname, this.target);
        if(tg.spawnflags & 4)
        {
                this.use = train_use;
@@ -63,21 +64,21 @@ void train_wait(entity this)
 
 void train_next(entity this)
 {
-       entity targ, cp = world;
+       entity targ, cp = NULL;
        vector cp_org = '0 0 0';
 
-       targ = find(world, targetname, this.target);
+       targ = find(NULL, targetname, this.target);
        this.target = targ.target;
        if (this.spawnflags & 1)
        {
                if(targ.curvetarget)
                {
-                       cp = find(world, targetname, targ.curvetarget); // get its second target (the control point)
+                       cp = find(NULL, targetname, targ.curvetarget); // get its second target (the control point)
                        cp_org = cp.origin - this.view_ofs; // no control point found, assume a straight line to the destination
                }
        }
        if (this.target == "")
-               objerror("train_next: no next target");
+               objerror(this, "train_next: no next target");
        this.wait = targ.wait;
        if (!this.wait)
                this.wait = 0.1;
@@ -186,10 +187,10 @@ void train_use(entity this, entity actor, entity trigger)
 void func_train_find(entity this)
 {
        entity targ;
-       targ = find(world, targetname, this.target);
+       targ = find(NULL, targetname, this.target);
        this.target = targ.target;
        if (this.target == "")
-               objerror("func_train_find: no next target");
+               objerror(this, "func_train_find: no next target");
        SUB_SETORIGIN(this, targ.origin - this.view_ofs);
 
        if(!(this.spawnflags & 4))
@@ -215,7 +216,7 @@ spawnfunc(func_train)
                precache_sound(this.noise);
 
        if (this.target == "")
-               objerror("func_train without a target");
+               objerror(this, "func_train without a target");
        if (!this.speed)
                this.speed = 100;
 
@@ -237,7 +238,7 @@ spawnfunc(func_train)
        // wait for targets to spawn
        InitializeEntity(this, func_train_find, INITPRIO_FINDTARGET);
 
-       this.blocked = generic_plat_blocked;
+       setblocked(this, generic_plat_blocked);
        if(this.dmg && (this.message == ""))
                this.message = " was squished";
     if(this.dmg && (this.message2 == ""))
@@ -307,9 +308,10 @@ NET_HANDLE(ENT_CLIENT_TRAIN, bool isnew)
 
                this.classname = "func_train";
                this.solid = SOLID_BSP;
-               this.movetype = MOVETYPE_PUSH;
+               set_movetype(this, MOVETYPE_PUSH);
                this.drawmask = MASK_NORMAL;
                this.draw = train_draw;
+               if (isnew) IL_PUSH(g_drawables, this);
                this.entremove = trigger_remove_generic;
 
                if(set_platmovetype(this, this.platmovetype))
@@ -322,13 +324,9 @@ NET_HANDLE(ENT_CLIENT_TRAIN, bool isnew)
                //func_train_find();
 
                // but we will need these
-               //this.move_nextthink = this.move_ltime + 0.1;
-               //this.move_think = train_next;
                train_next(this);
 
-               this.move_movetype = MOVETYPE_PUSH;
-               this.move_origin = this.origin;
-               this.move_angles = this.angles;
+               set_movetype(this, MOVETYPE_PUSH);
                this.move_time = time;
        }