]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix bad LOS origin (made ehweel and walker turrets idle in place insted of attacking)
authorJakob MG <jakob_mg@hotmail.com>
Thu, 25 Mar 2010 14:56:01 +0000 (15:56 +0100)
committerJakob MG <jakob_mg@hotmail.com>
Thu, 25 Mar 2010 14:56:01 +0000 (15:56 +0100)
qcsrc/server/tturrets/include/turrets_early.qh
qcsrc/server/tturrets/system/system_main.qc
qcsrc/server/tturrets/units/unit_ewheel.qc
qcsrc/server/tturrets/units/unit_walker.qc

index 25cba992c0e9e70217ca529d00400515b8d222bb..fa07f867fcded1d6c28b131ecb2d59c0ea088d12 100644 (file)
@@ -28,6 +28,7 @@ vector real_origin(entity ent);
 .string cvar_basename;
 
 //.float spawnflags
+#define TSF_SUSPENDED     1
 /// Spawn a pillar model under the turret to make it look ok on uneven ground surfaces
 #define TSF_TERRAINBASE   2
 /// Disable builtin ammo regeneration
index 6ee08493c95eee1e2669e6a8b648aa322eca1662..afddaef0d319bba83bbb419519bbdc8edc9f5329 100644 (file)
@@ -567,7 +567,8 @@ float turret_validate_target(entity e_turret,entity e_target,float validate_flag
     if (validate_flags & TFL_TARGETSELECT_LOS)
     {
         v_tmp = real_origin(e_target) + ((e_target.mins + e_target.maxs) * 0.5);
-        traceline(e_turret.tur_shotorg,v_tmp,0,e_turret);
+
+        traceline(e_turret.tur_shotorg, v_tmp, 0, e_turret);
 
         if (e_turret.aim_firetolerance_dist < vlen(v_tmp - trace_endpos))
             return -19;
@@ -926,8 +927,8 @@ float turret_stdproc_init (string cvar_base_name, float csqc_shared, string base
         v = gettaginfo(e,gettagindex(e,"tag_fire"));
         if(v == '0 0 0')
         {
-            objerror("^1ERROR: Engine is borken! Turrets will NOT work. force g_turrets to 0 to run maps with turrets anyway.");
-            crash();
+            //objerror("^1ERROR: Engine is borken! Turrets will NOT work. force g_turrets to 0 to run maps with turrets anyway.");
+            //crash();
         }
         setmodel(e,"");
 
@@ -942,6 +943,9 @@ float turret_stdproc_init (string cvar_base_name, float csqc_shared, string base
         csqc_shared = 0;
     }
 
+    if not (self.spawnflags & TSF_SUSPENDED)
+        droptofloor_builtin();
+
     // Terrainbase spawnflag. This puts a enlongated model
     // under the turret, so it looks ok on uneaven surfaces.
     if (self.spawnflags & TSF_TERRAINBASE)
index 3f7acdac95941704784826b51b367eb18b7c94df..3d84386a4932599be18198ffaa7b29bef633541b 100644 (file)
@@ -171,6 +171,13 @@ void ewheel_postthink()
     float vz;
     vector wish_angle,real_angle;
 
+    /*
+    if(self.enemy)
+        dprint("enemy!\n");
+    else
+        dprint("nothign =(!\n");
+    */
+
     vz = self.velocity_z;
 
     self.angles_x = anglemods(self.angles_x);
@@ -190,7 +197,8 @@ void ewheel_postthink()
     self.angles_y = (self.angles_y + real_angle_y);
 
     // Simulate banking
-    self.angles_z = bound(-45,real_angle_y * -2.5,45);
+    self.angles_z -= self.angles_z * frametime * 2;
+    self.angles_z = bound(-45,self.angles_z  + ((real_angle_y * -25) * frametime),45);
 
     if(self.enemy)
         ewheel_move_enemy();
@@ -207,7 +215,10 @@ void ewheel_respawnhook()
 {
     entity e;
 
-    setorigin(self,self.pos1);
+    self.velocity = '0 0 0';
+    self.enemy = world;
+
+    setorigin(self, self.pos1);
 
     if (self.target != "")
     {
@@ -230,23 +241,14 @@ void ewheel_respawnhook()
 
 void ewheel_diehook()
 {
-    turret_trowgib2(self.origin,self.velocity + '0 0 400', '-0.6 -0.2 -02', self, 3 + time + random() * 2);
-
     self.velocity = '0 0 0';
 
+    turret_trowgib2(self.origin, self.velocity + '0 0 400', '-0.6 -0.2 -02', self, 3 + time + random() * 2);
+
     if (self.pathcurrent)
         pathlib_deletepath(self.pathcurrent.owner);
 
     self.pathcurrent = world;
-
-    /*
-    if (self.damage_flags & TFL_DMG_DEATH_NORESPAWN)
-    {
-        verbstack_flush(self.verbs_move);
-        remove(self.verbs_move);
-    }
-    */
-
 }
 
 void turret_ewheel_dinit()
@@ -291,12 +293,11 @@ void turret_ewheel_dinit()
     self.solid      = SOLID_SLIDEBOX;
     self.takedamage = DAMAGE_AIM;
 
-    setsize(self,'-32 -32 0', '32 32 48');
+    setsize(self, '-32 -32 0', '32 32 48');
+    self.idle_aim = '0 0 0';
 
     self.pos1 = self.origin;
 
-    self.idle_aim = '0 0 0';
-
     // Our fire routine
     self.turret_firefunc  = ewheel_attack;
     self.turret_postthink = ewheel_postthink;
@@ -306,6 +307,10 @@ void turret_ewheel_dinit()
     self.tur_head.aim_speed = cvar("g_turrets_unit_ewheel_turnrate");
     self.tur_head.aim_speed = self.tur_head.aim_speed / (1 / self.ticrate);
 
+    if (!turret_tag_setup())
+        dprint("Warning: Turret ",self.classname, " faild to initialize md3 tags\n");
+
+    //setorigin(self,self.origin + '0 0 128');
     if (self.target != "")
     {
         e = find(world,targetname,self.target);
@@ -319,7 +324,7 @@ void turret_ewheel_dinit()
             dprint("Warning: not a turrret path\n");
         else
         {
-            self.pathcurrent = WALKER_PATH(self.origin,e.origin);
+            self.pathcurrent = WALKER_PATH(self.origin, e.origin);
             self.pathgoal = e;
         }
     }
@@ -332,6 +337,10 @@ void spawnfunc_turret_ewheel()
     precache_model ("models/turrets/ewheel-base2.md3");
     precache_model ("models/turrets/ewheel-gun1.md3");
 
+    precache_model ("models/pathlib/goodsquare.md3");
+    precache_model ("models/pathlib/badsquare.md3");
+    precache_model ("models/pathlib/square.md3");
+
     turret_ewheel_loadcvars();
 
     self.think = turret_ewheel_dinit;
index 14dd1639719d3ed7a074ddfa45a7e1f2b1d973e3..e1341b4605e48bc7cb0491a2024484d2bc2fb436 100644 (file)
@@ -718,6 +718,9 @@ void turret_walker_dinit()
         return;
     }
 
+    if (!turret_tag_setup())
+        dprint("Warning: Turret ",self.classname, " faild to initialize md3 tags\n");
+
     self.damage_flags |= TFL_DMG_DEATH_NOGIBS;
     self.target_select_flags   = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
     self.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;