public void Init() { if (ioEnt != null && !entityRef.IsValid(true)) { entityRef.Set(ioEnt); } if (entityRef.IsValid(true)) { ioEnt = entityRef.Get(true).GetComponent <IOEntity>(); } }
public virtual void SetupInitialDoorConnection() { if (targetDoor == null && !entityRef.IsValid(true)) { SetTargetDoor(FindDoor(PairWithLockedDoors())); } if (targetDoor != null && !entityRef.IsValid(true)) { entityRef.Set(targetDoor); } if (entityRef.IsValid(true) && targetDoor == null) { SetTargetDoor(entityRef.Get(true).GetComponent <Door>()); } }
public virtual void BecomeDud() { Vector3 position = base.transform.position; Quaternion rotation = base.transform.rotation; bool flag = false; EntityRef entityRef = parentEntity; while (entityRef.IsValid(base.isServer) && !flag) { BaseEntity baseEntity = entityRef.Get(base.isServer); if (baseEntity.syncPosition) { flag = true; } entityRef = baseEntity.parentEntity; } if (flag) { SetParent(null); } base.transform.SetPositionAndRotation(position, rotation); SetFlag(Flags.On, false); SetCollisionEnabled(true); if (flag) { SetMotionEnabled(true); } Effect.server.Run("assets/bundled/prefabs/fx/impacts/blunt/concrete/concrete1.prefab", this, 0u, Vector3.zero, Vector3.zero); SendNetworkUpdate(); CancelInvoke(base.KillMessage); Invoke(base.KillMessage, 1200f); }
public BaseMountable GetSaddle() { if (!saddleRef.IsValid(base.isServer)) { return(null); } return(saddleRef.Get(base.isServer).GetComponent <BaseMountable>()); }
public void CheckInvalidBoat() { if (!fuelSystem.fuelStorageInstance.IsValid(base.isServer) || !storageUnitInstance.IsValid(base.isServer)) { Debug.Log("Destroying invalid boat "); Invoke(ActualDeath, 1f); } }
public override void PlayerServerInput(InputState inputState, BasePlayer player) { base.PlayerServerInput(inputState, player); if (currentlyControllingEnt.IsValid(true) && Interface.CallHook("OnBookmarkInput", this, player, inputState) == null) { currentlyControllingEnt.Get(true).GetComponent <IRemoteControllable>().UserInput(inputState, player); } }
public void Server_TryOpenMarket(RPCMessage msg) { if (!CanPlayerInteract(msg.player)) { return; } if (!_marketplace.IsValid(true)) { Debug.LogError("Marketplace is not set", this); return; } using (EntityIdList entityIdList = Facepunch.Pool.Get <EntityIdList>()) { entityIdList.entityIds = Facepunch.Pool.GetList <uint>(); GetDeliveryEligibleVendingMachines(entityIdList.entityIds); ClientRPCPlayer(null, msg.player, "Client_OpenMarket", entityIdList); } }
public void AssignPoints() { BaseGameMode activeGameMode = BaseGameMode.GetActiveGameMode(true); if (activeGameMode == null || !activeGameMode.IsMatchActive()) { return; } if (activeGameMode.IsTeamGame()) { if (captureTeam != -1 && captureFraction == 1f) { activeGameMode.ModifyTeamScore(captureTeam, scorePerSecond); } } else if (capturedPlayer.IsValid(true)) { activeGameMode.ModifyPlayerGameScore(capturedPlayer.Get(true).GetComponent <BasePlayer>(), "score", scorePerSecond); } }
public bool IsOccupied(bool isServer = true) { return(horse.IsValid(isServer)); }
public void UpdateCaptureAmount() { if (base.isClient) { return; } float num = captureFraction; BaseGameMode activeGameMode = BaseGameMode.GetActiveGameMode(true); if (activeGameMode == null) { return; } if (captureTrigger.entityContents == null) { SetFlag(Flags.Busy, false, false, false); } else { if (!activeGameMode.IsMatchActive()) { return; } if (activeGameMode.IsTeamGame()) { int[] array = new int[activeGameMode.GetNumTeams()]; foreach (BaseEntity entityContent in captureTrigger.entityContents) { if (!(entityContent == null) && !entityContent.isClient) { BasePlayer component = entityContent.GetComponent <BasePlayer>(); if (!(component == null) && component.IsAlive() && !component.IsNpc && component.gamemodeteam != -1) { array[component.gamemodeteam]++; } } } int num2 = 0; for (int i = 0; i < array.Length; i++) { if (array[i] > 0) { num2++; } } if (num2 < 2) { int num3 = -1; int num4 = 0; for (int j = 0; j < array.Length; j++) { if (array[j] > num4) { num4 = array[j]; num3 = j; } } if (captureTeam == -1 && captureFraction == 0f) { capturingTeam = num3; } if (captureFraction > 0f && num3 != captureTeam && num3 != capturingTeam) { captureFraction = Mathf.Clamp01(captureFraction - Time.deltaTime / timeToCapture); if (captureFraction == 0f) { captureTeam = -1; } } else if (captureTeam == -1 && captureFraction < 1f && capturingTeam == num3) { DoProgressEffect(); captureFraction = Mathf.Clamp01(captureFraction + Time.deltaTime / timeToCapture); if (captureFraction == 1f) { DoCaptureEffect(); captureTeam = num3; } } } SetFlag(Flags.Busy, num2 > 1); } else { if (!capturingPlayer.IsValid(true) && !capturedPlayer.IsValid(true)) { captureFraction = 0f; } if (captureTrigger.entityContents.Count == 0) { capturingPlayer.Set(null); } if (captureTrigger.entityContents.Count == 1) { foreach (BaseEntity entityContent2 in captureTrigger.entityContents) { BasePlayer component2 = entityContent2.GetComponent <BasePlayer>(); if (component2 == null) { continue; } if (!capturedPlayer.IsValid(true) && captureFraction == 0f) { capturingPlayer.Set(component2); } if (captureFraction > 0f && component2 != capturedPlayer.Get(true) && component2 != capturingPlayer.Get(true)) { captureFraction = Mathf.Clamp01(captureFraction - Time.deltaTime / timeToCapture); if (captureFraction == 0f) { capturedPlayer.Set(null); } } else if (!capturedPlayer.Get(true) && captureFraction < 1f && capturingPlayer.Get(true) == component2) { DoProgressEffect(); captureFraction = Mathf.Clamp01(captureFraction + Time.deltaTime / timeToCapture); if (captureFraction == 1f) { DoCaptureEffect(); capturedPlayer.Set(component2); } } break; } } SetFlag(Flags.Busy, captureTrigger.entityContents.Count > 1); } if (num != captureFraction) { SendNetworkUpdate(); } } }