//////////////// public override void OnRespawn(Player player) { Promises.AddValidatedPromise(SaveableEntityComponent.LoadAllValidator, () => { Timers.SetTimer("OnARailRespawn", 30, () => { if (this.MyTrainWho != -1) { TrainEntity.WarpPlayerToTrain(player); } return(false); }); return(false); }); }
private void HandleRecall() { CustomEntity ent = CustomEntityManager.GetEntityByWho(this.MyTrainWho); var train_comp = ent.GetComponentByType <TrainBehaviorEntityComponent>(); if (train_comp.IsMountedBy != -1) { PlayerHelpers.Teleport(this.player, this.PrevPosition); // return to train's last position } else { if (((OnARailMod)this.mod).Config.DebugModeInfo) { Main.NewText("Warping to train..."); } TrainEntity.WarpPlayerToTrain(player); // return to train } }