X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Ft_plats.qc;h=7bf3c70a8022189253ba90cce1756ecdabd0a2af;hb=ae82f85be7a1ccc080e5ea620976a03c43eeb962;hp=315abe152f50b2d9074b28d1e214fa8d1f199053;hpb=96d50426c7929a9f6b080f575cba5732aa3010d6;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/t_plats.qc b/qcsrc/server/t_plats.qc index 315abe152..7bf3c70a8 100644 --- a/qcsrc/server/t_plats.qc +++ b/qcsrc/server/t_plats.qc @@ -1,3 +1,5 @@ +#ifdef SVQC + .float dmgtime2; void generic_plat_blocked() { @@ -2169,8 +2171,15 @@ void spawnfunc_func_vectormamamam() InitializeEntity(self, func_vectormamamam_findtarget, INITPRIO_FINDTARGET); } +#endif + void conveyor_think() { +#ifdef CSQC + float dt = time - self.move_time; + self.move_time = time; + if(dt <= 0) { return; } +#endif entity e; // set myself as current conveyor where possible @@ -2181,7 +2190,11 @@ void conveyor_think() { for(e = findradius((self.absmin + self.absmax) * 0.5, vlen(self.absmax - self.absmin) * 0.5 + 1); e; e = e.chain) if(!e.conveyor.state) +#ifdef SVQC if(isPushable(e)) +#elif defined(CSQC) + if(e.isplayermodel) +#endif { vector emin = e.absmin; vector emax = e.absmax; @@ -2197,12 +2210,19 @@ void conveyor_think() for(e = world; (e = findentity(e, conveyor, self)); ) { +#ifdef SVQC if(IS_CLIENT(e)) // doing it via velocity has quite some advantages continue; // done in SV_PlayerPhysics +#elif defined(CSQC) + if(e.isplayermodel) + continue; +#endif - setorigin(e, e.origin + self.movedir * sys_frametime); + setorigin(e, e.origin + self.movedir * PHYS_INPUT_FRAMETIME); move_out_of_solid(e); +#ifdef SVQC UpdateCSQCProjectile(e); +#endif /* // stupid conveyor code tracebox(e.origin, e.mins, e.maxs, e.origin + self.movedir * sys_frametime, MOVE_NORMAL, e); @@ -2212,17 +2232,61 @@ void conveyor_think() } } +#ifdef SVQC self.nextthink = time; +#endif } +#ifdef SVQC + void conveyor_use() { self.state = !self.state; + + self.SendFlags |= 2; } void conveyor_reset() { self.state = (self.spawnflags & 1); + + self.SendFlags |= 2; +} + +float conveyor_send(entity to, float sf) +{ + WriteByte(MSG_ENTITY, ENT_CLIENT_CONVEYOR); + WriteByte(MSG_ENTITY, sf); + + if(sf & 1) + { + WriteByte(MSG_ENTITY, self.warpzone_isboxy); + WriteCoord(MSG_ENTITY, self.origin_x); + WriteCoord(MSG_ENTITY, self.origin_y); + WriteCoord(MSG_ENTITY, self.origin_z); + + WriteCoord(MSG_ENTITY, self.mins_x); + WriteCoord(MSG_ENTITY, self.mins_y); + WriteCoord(MSG_ENTITY, self.mins_z); + WriteCoord(MSG_ENTITY, self.maxs_x); + WriteCoord(MSG_ENTITY, self.maxs_y); + WriteCoord(MSG_ENTITY, self.maxs_z); + + WriteCoord(MSG_ENTITY, self.movedir_x); + WriteCoord(MSG_ENTITY, self.movedir_y); + WriteCoord(MSG_ENTITY, self.movedir_z); + + WriteByte(MSG_ENTITY, self.speed); + WriteByte(MSG_ENTITY, self.state); + + WriteString(MSG_ENTITY, self.targetname); + WriteString(MSG_ENTITY, self.target); + } + + if(sf & 2) + WriteByte(MSG_ENTITY, self.state); + + return TRUE; } void conveyor_init() @@ -2240,6 +2304,10 @@ void conveyor_init() } else self.state = 1; + + Net_LinkEntity(self, 0, FALSE, conveyor_send); + + self.SendFlags |= 1; } void spawnfunc_trigger_conveyor() @@ -2256,3 +2324,56 @@ void spawnfunc_func_conveyor() self.movetype = MOVETYPE_NONE; conveyor_init(); } + +#elif defined(CSQC) + +void conveyor_init() +{ + self.draw = conveyor_think; + self.drawmask = MASK_NORMAL; + + self.movetype = MOVETYPE_NONE; + self.model = ""; + self.solid = SOLID_TRIGGER; + self.move_origin = self.origin; + self.move_time = time; +} + +void ent_conveyor() +{ + float sf = ReadByte(); + + if(sf & 1) + { + self.warpzone_isboxy = ReadByte(); + self.origin_x = ReadCoord(); + self.origin_y = ReadCoord(); + self.origin_z = ReadCoord(); + setorigin(self, self.origin); + + self.mins_x = ReadCoord(); + self.mins_y = ReadCoord(); + self.mins_z = ReadCoord(); + self.maxs_x = ReadCoord(); + self.maxs_y = ReadCoord(); + self.maxs_z = ReadCoord(); + setsize(self, self.mins, self.maxs); + + self.movedir_x = ReadCoord(); + self.movedir_y = ReadCoord(); + self.movedir_z = ReadCoord(); + + self.speed = ReadByte(); + self.state = ReadByte(); + + self.targetname = strzone(ReadString()); + self.target = strzone(ReadString()); + + conveyor_init(); + } + + if(sf & 2) + self.state = ReadByte(); +} + +#endif