X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Ftriggers%2Ffunc%2Ftrain.qc;h=0f827a60e37e4bdef4c8c031a84c5b927f9c11f7;hp=a75ac4192ee1b7bd6a7afe274fd0612b82bcc8bd;hb=e9f30b97435c6afe3d6911f21e1f4fd1b97e93da;hpb=03f978544a8b13a18cef1c7cc3dbcaba1c3aee4c diff --git a/qcsrc/common/triggers/func/train.qc b/qcsrc/common/triggers/func/train.qc index a75ac4192..0f827a60e 100644 --- a/qcsrc/common/triggers/func/train.qc +++ b/qcsrc/common/triggers/func/train.qc @@ -101,10 +101,12 @@ void train_next() _sound(self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_IDLE); } +REGISTER_NET_LINKED(ENT_CLIENT_TRAIN) + #ifdef SVQC float train_send(entity to, float sf) {SELFPARAM(); - WriteByte(MSG_ENTITY, ENT_CLIENT_TRAIN); + WriteHeader(MSG_ENTITY, ENT_CLIENT_TRAIN); WriteByte(MSG_ENTITY, sf); if(sf & SF_TRIGGER_INIT) @@ -161,6 +163,13 @@ void train_link() //Net_LinkEntity(self, 0, false, train_send); } +void train_use() +{ + self.SUB_NEXTTHINK = self.SUB_LTIME + 1; + self.SUB_THINK = train_next; + self.use = func_null; // not again +} + void func_train_find() {SELFPARAM(); entity targ; @@ -169,8 +178,12 @@ void func_train_find() if (self.target == "") objerror("func_train_find: no next target"); SUB_SETORIGIN(self, targ.origin - self.view_ofs); - self.SUB_NEXTTHINK = self.SUB_LTIME + 1; - self.SUB_THINK = train_next; + + if(!(self.spawnflags & 4)) + { + self.SUB_NEXTTHINK = self.SUB_LTIME + 1; + self.SUB_THINK = train_next; + } train_link(); } @@ -197,6 +210,9 @@ spawnfunc(func_train) return; self.effects |= EF_LOWPRECISION; + if(self.spawnflags & 4) + self.use = train_use; + if (self.spawnflags & 2) { self.platmovetype_turn = true; @@ -231,8 +247,8 @@ void train_draw(entity this) Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy); } -void ent_train() -{SELFPARAM(); +NET_HANDLE(ENT_CLIENT_TRAIN, bool isnew) +{ float sf = ReadByte(); if(sf & SF_TRIGGER_INIT) @@ -307,6 +323,8 @@ void ent_train() { // TODO: make a reset function for trains } + + return true; } #endif