public static void Create(PortalInfo info, PortalPoint p) { p.GameObject = new GameObject(); PortalEntity portal = p.GameObject.AddComponent <PortalEntity>(); #if DEBUG Interface.Oxide.LogWarning($"Creating portal object!"); #endif p.GameObject.transform.position = p.Location.Vector3; portal.info = info; portal.point = p; #if DEBUG Interface.Oxide.LogWarning($"Creating portal sphere!"); #endif p.Sphere = GameManager.server.CreateEntity("assets/prefabs/visualization/sphere.prefab", p.Location.Vector3, new Quaternion(), true).GetComponent <SphereEntity>(); p.Sphere.currentRadius = 2; p.Sphere.lerpSpeed = 0f; p.Sphere.Spawn(); if (info.DeploySpinner) { #if DEBUG Interface.Oxide.LogWarning($"Creating portal wheel!"); #endif p.Wheel = GameManager.server.CreateEntity("assets/prefabs/deployable/spinner_wheel/spinner.wheel.deployed.prefab", p.Location.Vector3 + new Vector3(0, 0.02f, 0), new Quaternion(), true) as SpinnerWheel; p.Wheel.Spawn(); if (Instance.configData.nameOnWheel) { Instance.NextTick(() => { Interface.Oxide.LogDebug($"Texture size: {p.Wheel.paintableSources.FirstOrDefault().texWidth.ToString()}"); info.ID = info.ID.Trim(); int fontsize = Convert.ToInt32(Math.Floor(100f / info.ID.Length / 2)); #if DEBUG Interface.Oxide.LogWarning($"Writing name, {info.ID}, on portal wheel with fontsize {fontsize.ToString()} and color {Instance.configData.spinnerTextColor.ToString()}!"); #endif // Try to paint the sign using one of two versions of SignArtist try { // The version with this call needs to have the function modified to private to work. Instance.SignArtist?.Call("API_SignText", new BasePlayer(), p.Wheel as Signage, info.ID, fontsize, Instance.configData.spinnerTextColor, Instance.configData.spinnerBGColor); } catch { // The versions with this call should work... Instance.SignArtist?.Call("signText", null, p.Wheel as Signage, info.ID, fontsize, Instance.configData.spinnerTextColor, Instance.configData.spinnerBGColor); } #if DEBUG Interface.Oxide.LogWarning($"Writing done, setting flags."); #endif p.Wheel.SetFlag(BaseEntity.Flags.Busy, true); p.Wheel.SetFlag(BaseEntity.Flags.Reserved3, true); }); } } }
public void Teleport(PortalEntity portal) { if (portal.info.CanUse(player)) { PortalPoint otherPoint = portal.point.PointType == PortalPointType.Entrance ? portal.info.Exit : portal.info.Entrance; Instance.Teleport(player, otherPoint.Location.Vector3); Interface.CallHook("OnPortalUsed", player, JObject.FromObject(portal.info), JObject.FromObject(portal.point)); } }
public void Teleport(PortalEntity portal) { PortalPoint otherPoint = portal.point.PointType == PortalPointType.Entrance ? portal.info.Exit : portal.info.Entrance; Effect.server.Run("assets/bundled/prefabs/fx/explosions/explosion_03.prefab", player.transform.position); Instance.Teleport(player, otherPoint.Location.Vector3); Instance.timer.Once(2f, () => Effect.server.Run("assets/bundled/prefabs/fx/explosions/explosion_01.prefab", otherPoint.Location.Vector3)); Interface.CallHook("OnPortalUsed", player, JObject.FromObject(portal.info), JObject.FromObject(portal.point)); }
public static void Create(PortalInfo info, PortalPoint p) { p.GameObject = new GameObject(); PortalEntity portal = p.GameObject.AddComponent <PortalEntity>(); p.Sphere = GameManager.server.CreateEntity("assets/prefabs/visualization/sphere.prefab", p.Location.Vector3, new Quaternion(), true).GetComponent <SphereEntity>(); p.Sphere.currentRadius = 2; p.Sphere.lerpSpeed = 0f; p.Sphere.Spawn(); p.GameObject.transform.position = p.Location.Vector3; portal.info = info; portal.point = p; }
public void Teleport(PortalEntity portal) { if (portal.info.CanUse(player)) { PortalPoint otherPoint = portal.point.PointType == PortalPointType.Primary ? portal.info.Secondary : portal.info.Primary; Instance.Teleport(player, otherPoint.Location.Vector3); if (portal.point.Wheel && Instance.configData.spinEntrance) { (portal.point.Wheel as SpinnerWheel).velocity += Core.Random.Range(2f, 4f); } if (otherPoint.Wheel && Instance.configData.spinExit) { (otherPoint.Wheel as SpinnerWheel).velocity += Core.Random.Range(2f, 4f); } Interface.CallHook("OnPortalUsed", player, JObject.FromObject(portal.info), JObject.FromObject(portal.point)); } }