X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Ft_plats.qc;h=7b2bc9973eacc411b47d6b7c015163fd717b13a5;hb=22a37c4431f80ece25aeff28c18bc67dd183a352;hp=5b9433af4f2aac3cd7c64f73840cf64a75a6c9e1;hpb=61c76972374b56c3df73abc2a71fe665fffc2212;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/t_plats.qc b/qcsrc/server/t_plats.qc index 5b9433af4..7b2bc9973 100644 --- a/qcsrc/server/t_plats.qc +++ b/qcsrc/server/t_plats.qc @@ -17,6 +17,8 @@ #include "../csqcmodellib/sv_model.qh" #endif +#ifdef SVQC + .float dmgtime2; void generic_plat_blocked() { @@ -2182,8 +2184,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 @@ -2194,7 +2203,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; @@ -2210,12 +2223,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); @@ -2225,17 +2245,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() @@ -2253,6 +2317,10 @@ void conveyor_init() } else self.state = 1; + + Net_LinkEntity(self, 0, false, conveyor_send); + + self.SendFlags |= 1; } void spawnfunc_trigger_conveyor() @@ -2269,3 +2337,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