public void OnInventoryMoveServer(InventoryMove info) { if (info.ToPlayer != null) { serverHolder = info.ToPlayer.gameObject; shooterRegisterTile = serverHolder.GetComponent <RegisterTile>(); } else { serverHolder = null; shooterRegisterTile = null; } }
void Awake() { itemAtts = GetComponent <ItemAttributes>(); registerTile = GetComponent <RegisterTile>(); damageOff = itemAtts.hitDamage; //leftHandOriginal = itemAtts.inHandReferenceLeft; //rightHandOriginal = itemAtts.inHandReferenceRight; leftHandFlame = leftHandOriginal + 4; rightHandFlame = rightHandOriginal + 4; }
public override void ClearAllTiles() { for (var i = 0; i < Objects.AllObjects.Count; i++) { RegisterTile obj = Objects.AllObjects[i]; if (obj != null) { DestroyImmediate(obj.gameObject); } } base.ClearAllTiles(); }
/// <summary> /// Smart way to detect reach, supports high speeds in ships. Should use it more! /// </summary> /// <param name="from"></param> /// <param name="to"></param> /// <param name="isServer"></param> /// <param name="interactDist"></param> /// <returns></returns> public static bool IsInReach(RegisterTile from, RegisterTile to, bool isServer, float interactDist = PlayerScript.interactionDistance) { if (isServer) { return(from.Matrix == to.Matrix && IsInReach(from.LocalPositionServer, to.LocalPositionServer, interactDist) || IsInReach(from.WorldPositionServer, to.WorldPositionServer, interactDist)); } else { return(from.Matrix == to.Matrix && IsInReach(from.LocalPositionClient, to.LocalPositionClient, interactDist) || IsInReach(from.WorldPositionClient, to.WorldPositionClient, interactDist)); } }
private void Awake() { spriteRenderer = GetComponentInChildren <SpriteRenderer>(); APCConnectionHandler = GetComponent <APCPoweredDevice>(); power = GetComponent <APCPoweredDevice>(); registerTile = GetComponent <RegisterTile>(); integrity = GetComponent <Integrity>(); integrity.OnApplyDamage.AddListener(OnDamageReceived); audioSourceParameters = new AudioSourceParameters(volume: Volume, spatialBlend: 1, spread: Spread, minDistance: MinSoundDistance, maxDistance: MaxSoundDistance, mixerType: MixerType.Muffled, volumeRolloffType: VolumeRolloffType.EaseInAndOut); }
private void Start() { if (isLocalPlayer) { pendingActions = new Queue <PlayerAction>(); UpdatePredictedState(); } playerScript = GetComponent <PlayerScript>(); playerSprites = GetComponent <PlayerSprites>(); healthBehaviorScript = GetComponent <HealthBehaviour>(); registerTile = GetComponent <RegisterTile>(); pushPull = GetComponent <PushPull>(); }
/// <summary> /// Returns whether anything in the same square as some particular object, moving out to a particular destination /// would be blocked by that object /// </summary> /// <param name="to">destination of hypothetical movement</param> /// <param name="isServer">Whether or not being run on server</param> /// <param name="context">the object in question.</param> /// <returns></returns> public bool HasAnyDepartureBlockedByRegisterTile(Vector3Int to, bool isServer, RegisterTile context) { foreach (RegisterTile o in GetTileList(isServer).Get(context.LocalPositionClient)) { if (o.IsPassable(isServer, context.gameObject) == false && context.IsPassableFromInside(to, isServer, o.gameObject) == false) { return(true); } } return(false); }
private void EnsureInit() { if (registerTile == null) { registerTile = GetComponent <RegisterTile>(); } registerTile.SetPipeData(pipeData); Vector2 searchVec = this.registerTile.LocalPosition.To2Int(); pipeData.MonoPipe = this; pipeData.OnEnable(); }
private void EnsureInit() { if (registerTile != null) { return; } registerTile = GetComponent <RegisterTile>(); waterNotifier.PushClear(); weedNotifier.PushClear(); nutrimentNotifier.PushClear(); harvestNotifier.PushClear(); }
private void Awake() { baseSpriteHandler = transform.GetChild(0).GetComponent <SpriteHandler>(); chargingIndicator = transform.GetChild(1).GetComponent <SpriteHandler>(); outputEnabledIndicator = transform.GetChild(2).GetComponent <SpriteHandler>(); chargeLevelIndicator = transform.GetChild(3).GetComponent <SpriteHandler>(); registerTile = GetComponent <RegisterTile>(); objectBehaviour = GetComponent <ObjectBehaviour>(); machine = GetComponent <Machine>(); electricalNodeControl = GetComponent <ElectricalNodeControl>(); batterySupplyingModule = GetComponent <BatterySupplyingModule>(); }
// Interfaces can call this script before Awake() is called. private void EnsureInit() { if (CurrentState != null) { return; } registerTile = GetComponent <RegisterTile>(); spriteHandler = GetComponentInChildren <SpriteHandler>(); storage = GetComponent <ItemStorage>(); poweredDevice = GetComponent <APCPoweredDevice>(); SetState(new MicrowaveUnpowered(this)); }
/// <summary> /// Returns the other side of the relationship relative to one of the /// partners. /// </summary> /// <param name="me"></param> /// <returns></returns> public RegisterTile Other(RegisterTile me) { if (obj1 == me) { return(obj2); } if (obj2 == me) { return(obj1); } return(null); }
public override bool IsPassableAt(Vector3Int origin, Vector3Int to, bool inclPlayers = true, GameObject context = null) { //Targeting windoors here List <RegisterTile> objectsOrigin = Objects.Get(origin); for (var i = 0; i < objectsOrigin.Count; i++) { if (!objectsOrigin[i].IsPassableTo(to) && (!context || objectsOrigin[i].gameObject != context)) { //Can't get outside the tile because windoor doesn't allow us return(false); } } List <RegisterTile> objectsTo = Objects.Get(to); bool toPass; if (inclPlayers) { toPass = true; for (var i = 0; i < objectsTo.Count; i++) { RegisterTile o = objectsTo[i]; if (!o.IsPassable(origin) && (!context || o.gameObject != context)) { toPass = false; break; } } } else { toPass = true; for (var i = 0; i < objectsTo.Count; i++) { RegisterTile o = objectsTo[i]; if (o.ObjectType != ObjectType.Player && !o.IsPassable(origin) && (!context || o.gameObject != context)) { toPass = false; break; } } } bool rods = base.IsPassableAt(origin, to, inclPlayers); // Logger.Log( $"IPA = {toPass} && {rods} @ {MatrixManager.Instance.LocalToWorldInt( origin, MatrixManager.Get(0).Matrix )} -> {MatrixManager.Instance.LocalToWorldInt( to, MatrixManager.Get(0).Matrix )} " + // $" (in local: {origin} -> {to})", Category.Matrix ); return(toPass && rods); }
void Start() //Initialise the contents if there are any { if (Reagents == null) { return; } for (int i = 0; i < Reagents.Count; i++) { Contents[Reagents[i]] = Amounts[i]; } CurrentCapacity = AmountOfReagents(Contents); registerTile = GetComponent <RegisterTile>(); }
private void Awake() { //init weapon with missing settings GetComponent <ItemAttributesV2>().AddTrait(CommonTraits.Instance.Gun); itemStorage = GetComponent <ItemStorage>(); magSlot = itemStorage.GetIndexedItemSlot(0); registerTile = GetComponent <RegisterTile>(); gunTrigger = GetComponent <GunTrigger>(); queuedShots = new Queue <QueuedShot>(); if (gunTrigger == null || magSlot == null || itemStorage == null) { Debug.LogWarning($"{gameObject.name} missing components, may cause issues"); } }
public void Invoke(RegisterTile registerTile) { if (isSideExposure) { if (registerTile.IsAtmosPassable(FireExposure.HotspotLocalPosition, true)) { registerTile.OnExposed(FireExposure); } } else { registerTile.OnExposed(FireExposure); } }
void Open() { if (registerTile == null) { registerTile = gameObject.GetComponent <RegisterTile>(); } registerTile.UpdateTileType(TileType.None); SoundManager.PlayAtPosition("OpenClose", transform.position); spriteRenderer.sprite = doorOpened; if (lockLight != null) { lockLight.Hide(); } }
public void Remove(Vector3Int position, RegisterTile obj = null) { if (_objects.ContainsKey(position)) { if (obj == null) { _objects[position].Clear(); } else { _objects[position].Remove(obj); } } }
public void Remove(Vector3Int position, RegisterTile obj = null) { if (_objects.TryGetValue(position, out var objectsOut)) { if (obj == null) { objectsOut.Clear(); } else { objectsOut.Remove(obj); } } }
public void OnSpawnServer(SpawnInfo info) { var integrity = GetComponent <Integrity>(); integrity.OnExposedEvent.AddListener(SendCloseAlerts); AtmosManager.Instance.inGameFireAlarms.Add(this); RegisterTile registerTile = GetComponent <RegisterTile>(); MetaDataLayer metaDataLayer = MatrixManager.AtPoint(registerTile.WorldPositionServer, true).MetaDataLayer; metaNode = metaDataLayer.Get(registerTile.LocalPositionServer, false); foreach (var firelock in FireLockList) { firelock.fireAlarm = this; } }
public void OnInventoryMoveServer(InventoryMove info) { if (info.ToPlayer != null) { serverHolder = info.ToPlayer.gameObject; shooterRegisterTile = serverHolder.GetComponent <RegisterTile>(); UpdatePredictionCanFire(serverHolder); } else { serverHolder = null; shooterRegisterTile = null; SyncPredictionCanFire(predictionCanFire, false); } }
private void Awake() { //init weapon with missing settings GetComponent <ItemAttributesV2>().AddTrait(CommonTraits.Instance.Gun); itemStorage = GetComponent <ItemStorage>(); magSlot = itemStorage.GetIndexedItemSlot(0); pinSlot = itemStorage.GetIndexedItemSlot(1); suppressorSlot = itemStorage.GetIndexedItemSlot(2); registerTile = GetComponent <RegisterTile>(); queuedShots = new Queue <QueuedShot>(); if (pinSlot == null || magSlot == null || itemStorage == null) { Logger.LogWarning($"{gameObject.name} missing components, may cause issues", Category.Firearms); } }
private void EnsureInit() { if (registerTile == null) { registerTile = GetComponent <RegisterTile>(); } registerTile.SetPipeData(pipeData); pipeData.MonoPipe = this; int Offset = PipeFunctions.GetOffsetAngle(this.transform.localRotation.eulerAngles.z); pipeData.Connections.Rotate(Offset); pipeData.OnEnable(); spritehandler?.SetColor(Colour); }
void Awake() { pickupable = GetComponent <Pickupable>(); reagentContainer = GetComponent <ReagentContainer>(); itemAtts = GetComponent <ItemAttributesV2>(); registerTile = GetComponent <RegisterTile>(); damageOff = itemAtts.ServerHitDamage; //leftHandOriginal = itemAtts.inHandReferenceLeft; //rightHandOriginal = itemAtts.inHandReferenceRight; leftHandFlame = leftHandOriginal + 4; rightHandFlame = rightHandOriginal + 4; }
void OpenClose(bool isClosed) { if (!registerTile) { registerTile = GetComponent <RegisterTile>(); } if (isClosed) { Close(); } else { Open(); } }
private void OnStart() { registerTile = GetComponent <RegisterTile>(); CurrentDirection = MappedDirection; SyncInverted = Inverted; if (isServer) { UpdateDirection(CurrentDirection); } spriteHandler.ChangeSprite((int)CurrentStatus); spriteHandler.ChangeSpriteVariant((int)CurrentDirection); }
private void Awake() { pickupable = GetComponent <Pickupable>(); amount = initialAmount; pushPull = GetComponent <PushPull>(); registerTile = GetComponent <RegisterTile>(); this.WaitForNetworkManager(() => { if (CustomNetworkManager.IsServer) { registerTile.OnLocalPositionChangedServer.AddListener(OnLocalPositionChangedServer); } }); }
private void EnsureInit() { if (pickupable != null) { return; } pickupable = GetComponent <Pickupable>(); itemAtts = GetComponent <ItemAttributesV2>(); registerTile = GetComponent <RegisterTile>(); radioMessager = GetComponent <RadioMessager>(); radioReceiver = GetComponent <RadioReceiver>(); hackDevice = GetComponent <HackingDevice>(); }
public List <RegisterTile> Get(Vector3Int position, ObjectType type) { List <RegisterTile> list = new List <RegisterTile>(); List <RegisterTile> xes = Get(position); for (var i = 0; i < xes.Count; i++) { RegisterTile x = xes[i]; if (x.ObjectType == type) { list.Add(x); } } return(list); }
private void Awake() { registerTile = GetComponent <RegisterTile>(); //init weapon with missing settings if (AmmoType == null) { AmmoType = "12mm"; } if (Projectile == null) { Projectile = Resources.Load("Bullet_12mm") as GameObject; } queuedShots = new Queue <QueuedShot>(); }