void Start() { _gameInstance = Game.getInstance(); _structureManager = GetComponentInChildren<StructureManager>(); _playerManager = PlayerManager.instance; _cameraTools = GameObject.Find("Camera").GetComponent("CameraTools") as CameraTools; _bk1 = new NailSpitterBase(); loadPlayerPrefs(); _gameInstance.GState = Game.GameState.Loading; }
public StructureData TryGetStructure(Transform transform) { byte x; byte y; ushort index; StructureRegion s; if (StructureManager.tryGetInfo(transform, out x, out y, out index, out s)) { return(s.structures[index]); } return(null); }
public static void AskTransformStructure(byte x, byte y, uint instanceID) { ThreadUtil.assertIsGameThread(); if (!StructureManager.tryGetRegion(x, y, out StructureRegion region)) { return; } int index = region.structures.FindIndex(k => k.instanceID == instanceID); StructureData data = region.structures[index]; StructureDrop drop = region.drops[index]; OnStructureTransformed?.Invoke(data, drop); }
private void OnTimedEvent(RocketPlayer caller) { try { if (destroyList[dIdx].Type == "s") { try { StructureManager.damage(destroyList[dIdx].Transform, destroyList[dIdx].Transform.position, 65535, 1); } catch { } } else if (destroyList[dIdx].Type == "b") { try { BarricadeManager.damage(destroyList[dIdx].Transform, 65535, 1); } catch { } } else if (destroyList[dIdx].Type == "v") { try { destroyList[dIdx].Vehicle.askDamage(65535); } catch { } } else if (destroyList[dIdx].Type == "z") { EPlayerKill pKill; try { for (int i = 0; i < 100; i++) { destroyList[dIdx].Zombie.askDamage(255, destroyList[dIdx].Zombie.transform.up, out pKill); } } catch { } } dIdx++; if (destroyList.Count == dIdx) { RocketChat.Say(caller, Translate("wreckingball_complete", dIdx)); StructureManager.save(); Abort(); processing = false; } } catch (Exception) { throw; } }
public void Execute(IRocketPlayer caller, string[] command) { UnturnedPlayer player = (UnturnedPlayer)caller; if (Physics.Raycast(player.Player.look.aim.position, player.Player.look.aim.forward, out hit, 10, RayMasks.BARRICADE_INTERACT)) { byte x; byte y; ushort plant; ushort index; BarricadeRegion r; StructureRegion s; Transform transform = hit.transform; InteractableVehicle vehicle = transform.gameObject.GetComponent <InteractableVehicle>(); if (transform.GetComponent <InteractableDoorHinge>() != null) { transform = transform.parent.parent; } if (BarricadeManager.tryGetInfo(transform, out x, out y, out plant, out index, out r)) { var bdata = r.barricades[index]; Library.TellInfo(caller, (CSteamID)bdata.owner, (CSteamID)bdata.group); } else if (StructureManager.tryGetInfo(transform, out x, out y, out index, out s)) { var sdata = s.structures[index]; Library.TellInfo(caller, (CSteamID)sdata.owner, (CSteamID)sdata.group); } else if (vehicle != null) { if (vehicle.lockedOwner != CSteamID.Nil) { Library.TellInfo(caller, vehicle.lockedOwner, vehicle.lockedGroup); return; } UnturnedChat.Say(caller, "Vehicle does not have an owner."); } } }
public RaycastResult(RaycastHit Info, bool hit) { RaycastHit = hit; if (hit) { Raycast = Info; Vehicle = TryGetEntity <InteractableVehicle>(); Transform target = Raycast.collider?.transform; if (target != null) { if (target.CompareTag("Barricade")) { target = DamageTool.getBarricadeRootTransform(target); BarricadeRootTransform = target; if (BarricadeManager.tryGetInfo(target, out byte x, out byte y, out ushort plant, out ushort index, out BarricadeRegion Region, out BarricadeDrop Drop)) { BarricadeRegion = Region; BarricadeX = x; BarricadeY = y; BarricadePlant = plant; BarricadeIndex = index; BarricadeData B = Region.barricades.FirstOrDefault(D => D.instanceID == Drop.instanceID); if (B != null) { Barricade = B; } } } else if (target.CompareTag("Structure")) { target = DamageTool.getStructureRootTransform(target); StructureRootTransform = target; if (StructureManager.tryGetInfo(target, out byte x, out byte y, out ushort index, out StructureRegion Region)) { StructureX = x; StructureY = y; StructureIndex = index; StructureRegion = Region; StructureData B = Region.structures[index]; if (B != null) { Structure = B; } } } } } }
public override IEnumerable <IModdable> GetPotentialBroadcastTargets() { var parents = StructureManager.GetStructures(); var moddables = parents.Where(x => x.OverlapsCircle(transform.position, GetRange())) .SelectMany(x => x.GetComponentsInChildren <IModdable>()); foreach (var moddable in moddables) { if (!IncludeSelf && (UnityEngine.Object)moddable == this) { continue; } yield return(moddable); } }
public static async Task PerformStartupActions() { Logging.SetupLogging(); Services.Tracker.Track(App.Settings); await DatabaseManager.Initialize(); StructureManager.Initialize(); await CharacterManager.Initialize(); EveItems.Initialize(); AppDomain.CurrentDomain.ProcessExit += OnApplicationExit; }
public static Transform GetStructureTransform(Player player, out StructureData structureData) { structureData = null; RaycastHit hit; if (PhysicsUtility.raycast(new Ray(player.look.aim.position, player.look.aim.forward), out hit, 3, RayMasks.STRUCTURE_INTERACT)) { if (StructureManager.tryGetInfo(hit.transform, out _, out _, out ushort index, out StructureRegion region)) { structureData = region.structures[index]; return(region.drops[index].model); } } return(null); }
public void Execute(IRocketPlayer caller, string[] args) { Player player = ((UnturnedPlayer)caller).Player; PlayerLook look = player.look; if (PhysicsUtility.raycast(new Ray(look.aim.position, look.aim.forward), out RaycastHit hit, Mathf.Infinity, RayMasks.BARRICADE_INTERACT | RayMasks.STRUCTURE)) { Interactable2SalvageBarricade barri = hit.transform.GetComponent <Interactable2SalvageBarricade>(); Interactable2SalvageStructure struc = hit.transform.GetComponent <Interactable2SalvageStructure>(); if (barri != null) { BarricadeManager.tryGetInfo(barri.root, out byte x, out byte y, out ushort plant, out ushort index, out BarricadeRegion region); region.barricades.RemoveAt(index); BarricadeManager.instance.channel.send("tellTakeBarricade", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] { x, y, plant, index }); UnturnedChat.Say(caller, Util.Translate("barricade_removed")); } else if (struc != null) { StructureManager.tryGetInfo(struc.transform, out byte x, out byte y, out ushort index, out StructureRegion region); region.structures.RemoveAt(index); StructureManager.instance.channel.send("tellTakeStructure", ESteamCall.ALL, x, y, StructureManager.STRUCTURE_REGIONS, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] { x, y, index, (region.drops[index].model.position - player.transform.position).normalized * 100f }); UnturnedChat.Say(caller, Util.Translate("structure_removed")); } else { UnturnedChat.Say(caller, Util.Translate("invalid_destroy")); } }
public void askSalvageStructure(CSteamID steamID, byte x, byte y, ushort index) { StructureRegion structureRegion; bool cancel = false; if (StructureManager.tryGetRegion(x, y, out structureRegion)) { StructureData data = structureRegion.structures[(int)index]; StructureEvents.RunSalvageStructure(UnturnedStructure.Create(data), ref cancel); } if (!cancel) { DetourManager.CallOriginal(typeof(StructureManager).GetMethod("askSalvageStructure", BindingFlags.Instance | BindingFlags.Public), StructureManager.instance, steamID, x, y, index); } }
private void OnSalvageStructureRequested(CSteamID steamId, byte x, byte y, ushort index, ref bool shouldAllow) { if (!StructureManager.tryGetRegion(x, y, out var region)) { return; } var data = region.structures[index]; var drop = region.drops[index]; var @event = new UnturnedStructureSalvagingEvent(new UnturnedStructureBuildable(data, drop)); Emit(@event); shouldAllow = [email protected]; }
public static void dropStructure(Structure structure, Vector3 point, float angle_x, float angle_y, float angle_z, ulong owner, ulong group) { ItemStructureAsset itemStructureAsset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, structure.id); if (itemStructureAsset == null) { return; } Vector3 eulerAngles = Quaternion.Euler(-90f, angle_y, 0f).eulerAngles; angle_x = (float)(Mathf.RoundToInt(eulerAngles.x / 2f) * 2); angle_y = (float)(Mathf.RoundToInt(eulerAngles.y / 2f) * 2); angle_z = (float)(Mathf.RoundToInt(eulerAngles.z / 2f) * 2); byte b; byte b2; StructureRegion structureRegion; bool cancel = false; if (!Regions.tryGetCoordinate(point, out b, out b2) || !StructureManager.tryGetRegion(b, b2, out structureRegion)) { return; } StructureData structureData = new StructureData(structure, point, MeasurementTool.angleToByte(angle_x), MeasurementTool.angleToByte(angle_y), MeasurementTool.angleToByte(angle_z), owner, @group, Provider.time); ServerEvents.RunStructureCreated(structureData, ref cancel); if (cancel) { return; } structureRegion.structures.Add(structureData); StructureManager.instance.channel.send("tellStructure", ESteamCall.ALL, b, b2, StructureManager.STRUCTURE_REGIONS, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] { b, b2, structure.id, structureData.point, structureData.angle_x, structureData.angle_y, structureData.angle_z, owner, @group, (uint)typeof(StructureManager).GetField("instanceCount", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null) }); }
protected override void Initialize() { InactiveSleepTime = new TimeSpan(0); if (sideMenu) { graphics.PreferredBackBufferWidth = 50 + windowSizeX; } else { graphics.PreferredBackBufferWidth = windowSizeX; } graphics.PreferredBackBufferHeight = windowSizeY; graphics.ApplyChanges(); structureMgr = new StructureManager(); base.Initialize(); }
private async void btnClose_Click(object sender, EventArgs e) { Close(); object existingObject = typeof(ConnectionProfile).GetProperties().FirstOrDefault(x => x.Name == structureObject.ObjectType.ToString()).GetValue(profile); string oldName = ((StructureObject)existingObject).InternalName; if (txtName.Text != oldName) { bool result = await StructureManager.UpdateName((StructureObject)existingObject, txtName.Text, profile); if (!result) { new MessageForm("Alert", "Data could not be updated.").ShowDialog(); } } }
private void OnDamageStruct(CSteamID instigatorSteamID, Transform structureTransform, ref ushort pendingTotalDamage, ref bool shouldAllow, EDamageOrigin damageOrigin) { StructureManager.tryGetInfo(structureTransform, out byte x, out byte y, out ushort Index, out StructureRegion StRegion); var currentRegion = GetRegionAt(StRegion.structures[Index].point); if (currentRegion == null) { return; } if (currentRegion.Flags.Exists(fg => fg.Name == "NoDestroy") && !R.Permissions.HasPermission(new RocketPlayer(instigatorSteamID.m_SteamID.ToString()), Configuration.Instance.NoDestroyIgnorePermission) && !Configuration.Instance.NoDestroyIgnoredItems.Exists(k => k == StRegion.structures[Index].structure.id)) { shouldAllow = false; } else { return; } }
public MinimalMockServer(GalacticProperties gp, IDatabaseManager databaseManager, IDbIdIoService dbIdIoService) { Logger.Initialize(); DatabaseManager = databaseManager; DbIdIoService = dbIdIoService; //Minimal initializations GalaxyIDManager = new LocalIDManager(null, IDTypes.GalaxyID); TeamIDManager = new LocalIDManager(null, IDTypes.TeamID); accountIDManager = new LocalIDManager(null, IDTypes.AccountID); InitializeIdData(gp); globalGalaxyIDManager = new GlobalGalaxyIDManager(dbIdIoService, gp); GenerateIDsForLocalIDManager(globalGalaxyIDManager, GalaxyIDManager, gp.IdProperties[IDTypes.GalaxyID].LastIDAdded); globalTeamIDManager = new GlobalTeamIDManager(dbIdIoService, gp); GenerateIDsForLocalIDManager(globalTeamIDManager, TeamIDManager, gp.IdProperties[IDTypes.TeamID].LastIDAdded); globalAccountIDManager = new GlobalAccountIDManager(dbIdIoService, gp); GenerateIDsForLocalIDManager(globalAccountIDManager, accountIDManager, gp.IdProperties[IDTypes.AccountID].LastIDAdded); _redisServer = new RedisServer(Logger.LogRedisError, Logger.LogRedisInfo, new RedisConfig().Address); TeamManager = new GlobalTeamManager(TeamIDManager, null, null, null, DatabaseManager); PlayerManager = new PlayerManager(DatabaseManager, null, _redisServer, GalaxyIDManager, null); GalaxyManager = new GalaxyManager(gp.SolID, TeamManager); shipManager = new ShipManager(null, GalaxyManager, null, null, DatabaseManager); CollisionManager = new CollisionManager(GalaxyManager, null, null, null); GalaxyGenerator = new DebugGalaxyGenerator(PlayerManager, GalaxyManager, shipManager); AccountManager = new AccountManager_MasterServer(accountIDManager, DatabaseManager, false); CargoSynchronizer = new Server.Managers.CargoSynchronizer(); StructureManager = new StructureManager(DatabaseManager, GalaxyManager, GalaxyIDManager, CargoSynchronizer); RegistrationManger = new GalaxyRegistrationManager(GalaxyManager, shipManager, CollisionManager, GalaxyIDManager, PlayerManager, null, CargoSynchronizer, StructureManager); ColonyFactory.Initialize(GalaxyIDManager, RegistrationManger); StructureFactory.Initialize(GalaxyIDManager, RegistrationManger); LocatorService = new LocatorService(RegistrationManger, PlayerManager, GalaxyManager, shipManager, AccountManager, TeamManager, TeamManager, null, StructureManager, null); WarpManager = new WarpManager(GalaxyManager, null, null, _redisServer, AccountManager, null); CargoSynchronizer.Start(10, 4); }
public void Execute(IRocketPlayer caller, string[] command) { UnturnedPlayer Player = (UnturnedPlayer)caller; Transform trans = Base.Tracer.TraceToHit(Player).transform; if (trans == null) { Base.Messages.CommonMessage(Utilities.Messages.CommonMessages.CNoObjectFound, caller); return; } InteractableVehicle vehicle = trans.gameObject.GetComponent <InteractableVehicle>(); if (vehicle != null) { if (vehicle.lockedOwner != CSteamID.Nil) { UnturnedChat.Say(caller, Base.Instance.Translate("vehicle_owned", vehicle.lockedOwner.ToString())); } else { UnturnedChat.Say(caller, Base.Instance.Translate("vehicle_no_owner")); } } else { if (trans.GetComponent <InteractableDoorHinge>() != null) { trans = trans.parent.parent; } if (BarricadeManager.tryGetInfo(trans, out byte x, out byte y, out ushort plant, out ushort index, out BarricadeRegion BarricRegion)) { UnturnedChat.Say(caller, Base.Instance.Translate("object_owned", (CSteamID)BarricRegion.barricades[index].owner)); return; } if (StructureManager.tryGetInfo(trans, out x, out y, out index, out StructureRegion StructRegion)) { UnturnedChat.Say(caller, Base.Instance.Translate("object_owned", (CSteamID)StructRegion.structures[index].owner)); return; } UnturnedChat.Say(caller, Base.Instance.Translate("no_owner_found")); } }
public override void Highlight(IModdable component) { _component = component; IEnumerable <AreaModBroadcaster> broadcasters = StructureManager.GetStructures().Select(x => x.GetComponentInChildren <AreaModBroadcaster>()).Where(x => x != null); foreach (AreaModBroadcaster broadcaster in broadcasters) { bool show = OnlyShowWithinRange ? IsWithinRange(broadcaster) : true; if (broadcaster.Mod.CanMod(component) && show) { RangerHighlighter rh = Instantiate(RangerPrefab, broadcaster.transform.position, Quaternion.identity, transform).GetComponent <RangerHighlighter>(); StructureHighlighter sh = Instantiate(StructurePrefab, broadcaster.transform.position, Quaternion.identity, transform).GetComponent <StructureHighlighter>(); LocalHighlighter highlighter = new LocalHighlighter(rh, sh); highlighter.Highlight(broadcaster); _localHighlighters.Add(broadcaster, highlighter); } } }
public bool Heal(Transform transform, ushort amout) { Interactable2SalvageBarricade bar = transform.GetComponent <Interactable2SalvageBarricade>(); Interactable2SalvageStructure strc = transform.GetComponent <Interactable2SalvageStructure>(); if (bar != null) { BarricadeManager.tryGetInfo(bar.root, out byte x, out byte y, out ushort plant, out ushort index, out BarricadeRegion region); region.barricades[index].barricade.askRepair(amout); return(true); } else if (strc != null) { StructureManager.tryGetInfo(strc.transform, out byte x, out byte y, out ushort index, out StructureRegion region); region.structures[index].structure.askRepair(amout); return(true); } return(false); }
private static void DropStructure(Structure structure, Vector3 point, Quaternion rotation, ulong owner, ulong group, bool __result, uint ___instanceCount) { if (__result) { if (Regions.tryGetCoordinate(point, out byte b, out byte b2)) { if (StructureManager.tryGetRegion(b, b2, out StructureRegion region)) { StructureData data = region.structures.LastOrDefault(); StructureDrop drop = region.drops.LastOrDefault(); if (data?.instanceID == ___instanceCount && drop?.instanceID == ___instanceCount) { OnStructureDeployed?.Invoke(data, drop); } } } } }
async void saveSQLBtn_Click(object sender, EventArgs e) { if (TabControls.GridRows > 0) { string tableName = null; using (InputGUI input = new InputGUI("Please enter the table name", StructureManager.TableName(TabControls.StructureListValue))) { input.ShowDialog(); tableName = input.Input; } if (!string.IsNullOrEmpty(tableName)) { UpdateStatusText("Saving to database..."); await Task.Run(() => { Database.ExportToTable(rCore.Data, tableName); }); UpdateStatusText(""); } } }
public static Transform GetStructureTransform(Vector3 position) { List <Transform> list = new List <Transform>(); List <RegionCoordinate> regions = new List <RegionCoordinate>(); Regions.getRegionsInRadius(position, 0.1f, regions); StructureManager.getStructuresInRadius(position, 0.1f, regions, list); foreach (Transform transform in list) { if (transform.position == position) { if (StructureManager.tryGetInfo(transform, out _, out _, out ushort index, out StructureRegion region)) { return(region.drops[index].model); } } } return(null); }
public override Task DestroyAsync() { async UniTask DestroyTask() { await UniTask.SwitchToMainThread(); if (StructureDrop.GetNetId().IsNull()) // already destroyed { return; } if (!Regions.tryGetCoordinate(StructureDrop.GetServersideData().point, out var x, out var y)) { return; } StructureManager.destroyStructure(StructureDrop, x, y, Vector3.zero); } return(DestroyTask().AsTask()); }
private void OnDamageStructure(CSteamID instigatorSteamID, Transform structureTransform, ref ushort pendingTotalDamage, ref bool shouldAllow, EDamageOrigin damageOrigin) { StructureManager.tryGetInfo(structureTransform, out byte x, out byte y, out ushort Index, out StructureRegion StRegion); var currentRegion = GetRegionAt(StRegion.structures[Index].point); if (currentRegion == null) { return; } bool shouldHandle = true; HandleStructureDamage?.Invoke(currentRegion, structureTransform, damageOrigin, ref shouldHandle); if (!shouldHandle) { return; } if (currentRegion.Flags.Exists(fg => fg.Name.Equals("NoDestroy", StringComparison.OrdinalIgnoreCase))) { UnturnedPlayer dealer = UnturnedPlayer.FromCSteamID(instigatorSteamID); if (dealer == null) { return; } if (dealer.HasPermission(Configuration.Instance.NoDestroyIgnorePermission) || Configuration.Instance.NoDestroyIgnoredItems.Exists(k => k == StRegion.structures[Index].structure.id)) { return; } shouldAllow = false; } else { return; } }
private static void TellTransformStructure(StructureManager __instance, CSteamID steamID, byte x, byte y, uint instanceID) { ThreadUtil.assertIsGameThread(); if (!__instance.channel.checkServer(steamID) || !StructureManager.tryGetRegion(x, y, out var region)) { return; } var index = region.structures.FindIndex(k => k.instanceID == instanceID); if (index < 0) { return; } var data = region.structures[index]; var drop = region.drops[index]; OnStructureTransformed?.Invoke(data, drop, CurrentTransformingPlayerId); }
private void OnSalvageStructureRequested(CSteamID steamId, byte x, byte y, ushort index, ref bool shouldAllow) { if (!StructureManager.tryGetRegion(x, y, out var region)) { return; } var data = region.structures[index]; var drop = region.drops[index]; var nativePlayer = PlayerTool.getPlayer(steamId); var player = GetUnturnedPlayer(nativePlayer); var @event = new UnturnedStructureSalvagingEvent(new UnturnedStructureBuildable(data, drop), player !, steamId) { IsCancelled = !shouldAllow }; Emit(@event); shouldAllow = [email protected]; }
//**1RN**// void FixedUpdate() { //**CBACK**// if (destroyList.Count > 0) { int destroyedThisTick = 0; for (int i = 0; i < destroyList.Count(); i++) { if (destroyedThisTick++ > 2) { break; } else { Commands.Destruct.toDestroy Des = destroyList[i]; StructureManager.damage(Des.transform, Des.transform.position, ushort.MaxValue, 1, false); destroyList.Remove(Des); i = 0; } } } }
public void Execute(IRocketPlayer caller, string[] command) { Transform transform; int transformCount = 0; StructureRegion structureRegion; for (int k = 0; k < StructureManager.StructureRegions.GetLength(0); k++) { for (int l = 0; l < StructureManager.StructureRegions.GetLength(1); l++) { structureRegion = StructureManager.StructureRegions[k, l]; transformCount = structureRegion.Structures.Count; for (int i = 0; i < transformCount; i++) { transform = structureRegion.Structures[i]; StructureManager.repair(transform, 100, 1); } } } UnturnedChat.Say(caller, "Done repairing structures.", Color.cyan); }
public void Execute(IRocketPlayer caller, string[] command) { UnturnedPlayer Player = (UnturnedPlayer)caller; Transform trans = Base.Tracer.TraceToHit(Player).transform; if (trans == null) { Base.Messages.CommonMessage(Utilities.Messages.CommonMessages.CNoObjectFound, caller); return; } InteractableVehicle vehicle = trans.gameObject.GetComponent <InteractableVehicle>(); if (vehicle != null) { vehicle.askRepair(10000); UnturnedChat.Say(caller, Base.Instance.Translate("repair_vehicle")); } else { if (trans.GetComponent <InteractableDoorHinge>() != null) { trans = trans.parent.parent; } if (BarricadeManager.tryGetInfo(trans, out byte x, out byte y, out ushort plant, out ushort index, out BarricadeRegion BarricRegion)) { BarricadeManager.repair(trans, 10000, 1); UnturnedChat.Say(caller, Base.Instance.Translate("repair_object")); return; } if (StructureManager.tryGetInfo(trans, out x, out y, out index, out StructureRegion StructRegion)) { StructureManager.repair(trans, 10000, 1); UnturnedChat.Say(caller, Base.Instance.Translate("repair_object")); return; } Base.Messages.CommonMessage(Utilities.Messages.CommonMessages.CNoObjectFound, caller); } }
public void Execute(IRocketPlayer caller, string[] command) { UnturnedPlayer p = (UnturnedPlayer)caller; var res = new List <Transform>(); float dist = float.Parse(command[0]); res = TransformFinder.FindAll().FindAll(x => Vector3.Distance(p.Position, x.position) <= dist); if (res.Count > 0) { UnturnedChat.Say(caller, Plugin.Instance.Translate("search", res.Count, command[0])); foreach (var v in res) { BarricadeManager.repair(v, -30000, 1); StructureManager.repair(v, -30000, 1); } UnturnedChat.Say(caller, Plugin.Instance.Translate("success")); } else { UnturnedChat.Say(caller, Plugin.Instance.Translate("not_found")); } }
public void HireVillager(Villager villager, StructureManager.Structure struc) { IEnumerable<PhysicalStructure> hiringList = GM.builderHelper.hiringPStructList.Where(x => x.structure == struc); if(hiringList.Count() > 0){ PhysicalStructure hiringStruc = hiringList.First(); if(struc.isHouse){ villager.livesAt = hiringStruc.spotIndex; }else{ villager.worksAt = hiringStruc.spotIndex; } struc.workers.Add(villager); if(hiringStruc.employeeList.Count == 0) struc.activeAmount++; hiringStruc.employeeList.Add(villager); if(hiringStruc.employeeList.Count == struc.workerCapacity) struc.fullyActiveAmount++; } }