CSQC Tracelines
Posted: Wed May 25, 2016 8:57 pm
I'm trying to get ents sent to CSQC via sendentity to be hit by tracelines, but my trace never detects anything. Has anyone got an idea what the problem is? This is in FTE.
SSQC:
CSQC:
SSQC:
Code: Select all
float(entity to, float sendflags) explobox_send =
{
WriteByte(MSG_ENTITY, 1);
WriteByte(MSG_ENTITY, sendflags);
WriteCoord(MSG_ENTITY, self.origin_x);
WriteCoord(MSG_ENTITY, self.origin_y);
WriteCoord(MSG_ENTITY, self.origin_z);
WriteByte(MSG_ENTITY, self.modelindex);
return 1;
};
void() spawn_explobox =
{
self.classname = "misc_explobox";
self.solid = SOLID_BBOX;
self.movetype = MOVETYPE_NONE;
precache_model ("progs/exbox.mdl");
setmodel (self, "progs/exbox.mdl");
setsize (self, '-16 -16 -16', '16 16 16');
precache_sound ("weapons/r_exp3.wav");
self.health = 20;
self.th_die = explobox_boom;
self.takedamage = DAMAGE_AIM;
self.touch = explobox_touch;
self.origin_z = self.origin_z + 32;
// the original quake exploboxes were oriented on a corner, but our new .mdl is centered
// around its origin, therefore we need to nudge it a bit
self.origin_x += 16;
self.origin_y += 16;
self.SendEntity = explobox_send;
if (!droptofloor())
{
dprint ("misc_explobox fell out of level at ");
dprint (vtos(self.origin));
dprint ("\n");
remove(self);
}
};
void() misc_explobox =
{
self.nextthink = time + 0.2;
self.think = spawn_explobox;
};
Code: Select all
void() checkshit =
{
local vector o, v;
o = getviewprop(VF_ORIGIN);
v = getviewprop(VF_ANGLES);
makevectors(v);
traceline(o, o + v_forward * 4096, FALSE, world);
// traceline never detects anything
if (trace_ent != world)
eprint(trace_ent);
};
float(float evtype, float scanx, float chary, float devid) CSQC_InputEvent =
{
if (evtype == IE_KEYDOWN)
{
if (chary == 101)
{
checkshit();
return TRUE;
}
}
return FALSE;
};
void CSQC_Ent_Update (float isnew)
{
local float enttype = readbyte();
local float flags;
switch (enttype)
{
case 1:
flags = readbyte();
self.origin_x = readcoord();
self.origin_y = readcoord();
self.origin_z = readcoord();
setorigin(self, self.origin);
setmodelindex(self, readbyte());
self.drawmask = MASK_ENGINE;
if (isnew)
{
self.solid = SOLID_BBOX;
self.movetype = MOVETYPE_TOSS;
setorigin(self, self.origin);
self.classname = "misc_explobox";
}
break;
default:
break;
}
};