public override void PreUpdate() { if (UsingTubeSystem) { player.width = (int)(Player.defaultWidth * scale); player.position.Y += player.height; player.height = (int)(Player.defaultHeight * scale); player.position.Y -= player.height; player.immune = true; player.immuneTime = 2; player.immuneNoBlink = true; player.fullRotation = 0f; player.gfxOffY = 0f; // todo: use IL editing to prevent dust spawning player.mount?.SetMount(mod.MountType <TubeMount>(), player); } if (Exiting) { Transporting = false; scale = 1f; // todo: lerp player position to this player.position = transportingPlayer.CurrentPosition.ToWorldCoordinates(24 - Player.defaultWidth * 0.5f, 64 - Player.defaultHeight); if (alpha < 1f) { alpha += 0.025f; } else { player.mount?.Dismount(player); Exiting = false; transportingPlayer = null; } } if (Entering) { if (alpha > 0f) { alpha -= 0.025f; } else { Entering = false; Transporting = true; scale = transferScale; // todo: lerp player position to this player.position = transportingPlayer.CurrentPosition.ToWorldCoordinates(24, 24); } } }
public void PopulateGrid() { gridLocations.Clear(); foreach (EntryPoint entryPoint in TerraFirma.Instance.TubeNetworkLayer[Container.Position].Network.GetEntryPoints()) { if (entryPoint == Container) { continue; } UIEntryPointItem entryPointItem = new UIEntryPointItem(entryPoint) { Width = (0, 1), Height = (60, 0) }; entryPointItem.OnClick += (evt, element) => { TubularNetwork network = TerraFirma.Instance.TubeNetworkLayer[Container.Position].Network; Stack <Point16> path = Pathfinding.FindPath(network.Tiles, Container.Position, entryPoint.Position); TransportingPlayer transfer = new TransportingPlayer(Main.LocalPlayer, path); network.TransportingPlayers.Add(transfer); BaseLibrary.BaseLibrary.PanelGUI.UI.CloseUI(Container); }; gridLocations.Add(entryPointItem); } }