private void OnConnectHost() { //Promises.AddPostWorldLoadOncePromise( () => { Promises.AddValidatedPromise(SaveableEntityComponent.LoadAllValidator, () => { if (TrainEntity.FindMyTrain(this.player) == -1) { var ent = TrainEntity.CreateTrainEntity(this.player); CustomEntityManager.AddToWorld(ent); } return(false); }); }
//////////////// protected override bool ReceiveRequestWithServer(int from_who) { Player player = Main.player[from_who]; Promises.AddValidatedPromise(SaveableEntityComponent.LoadAllValidator, () => { if (TrainEntity.FindMyTrain(player) != -1) { throw new HamstarException("Cannot spawn duplicate train for player " + player.name); } var ent = TrainEntity.CreateTrainEntity(player); CustomEntityManager.AddToWorld(ent); return(false); }); return(true); }