private Sawmill _getSawmillUnlocked(string name) { if (sawmills.TryGetValue(name, out var sawmill)) { return(sawmill); } var index = name.LastIndexOf('.'); string parentName; if (index == -1) { parentName = ROOT; } else { parentName = name.Substring(0, index); } var parent = _getSawmillUnlocked(parentName); sawmill = new Sawmill(parent, name); sawmills.Add(name, sawmill); return(sawmill); }
public ISawmill GetSawmill(string name) { if (sawmills.TryGetValue(name, out var sawmill)) { return(sawmill); } var index = name.LastIndexOf('.'); string parentname; if (index == -1) { parentname = ROOT; } else { parentname = name.Substring(0, index); } var parent = (Sawmill)GetSawmill(parentname); sawmill = new Sawmill(parent, name); sawmills[name] = sawmill; return(sawmill); }
private void OnTriggerEnter(Collider other) { if (other.tag == "Sawmill") { Sawmill sawmill = other.gameObject.GetComponent <Sawmill>(); if (Utils.v3Equal(navMeshAgent.destination, sawmill.transform.position)) { if (sawmill.lumberjackLists.Count >= 1) { this.isDead = true; navMeshAgent.isStopped = true; animator.SetBool("walk", false); animator.SetBool("isDead", true); } else { gameManager.villagerLists.Remove(this); lumb.transform.position = transform.position; lumb.gameObject.SetActive(true); lumb.gameManager = gameManager; sawmill.lumberjackLists.Add(lumb); Destroy(this.gameObject); } } } if (other.tag == "Waypoint") { GoToWayPoint(); } }
public LogManager() { rootSawmill = new Sawmill(null, ROOT) { Level = LogLevel.Debug, }; sawmills[ROOT] = rootSawmill; }
public void GoToSwarmill() { if (!isDead) { Sawmill sawmill = GetClosestSawmill(); lumb = Instantiate(gameManager.lumberjackPrefab, this.transform.position, this.transform.rotation); lumb.gameObject.SetActive(false); navMeshAgent.destination = sawmill.transform.position; navMeshAgent.isStopped = false; animator.SetBool("walk", true); } }
public override void Started() { base.Started(); // Pick a place to plant the kudzu. if (TryFindRandomTile(out _targetTile, out _, out _targetGrid, out _targetCoords)) { EntityManager.SpawnEntity("Kudzu", _targetCoords); Sawmill.Info($"Spawning a Kudzu at {_targetTile} on {_targetGrid}"); } // If the kudzu tile selection fails we just let the announcement happen anyways because it's funny and people // will be hunting the non-existent, dangerous plant. }
public override bool CheckForNeighbouringBuildings() { Debug.Log("Checks for Sawmill"); List <Sawmill> chainBuildings = GetNeighbouringBuildings <Sawmill>(); if (nextInChain == null && chainBuildings.Count >= 1) { Debug.Log(">= 1"); nextInChain = chainBuildings[0]; AssignCarrierDestination(); return(true); } return(false); }
public override void Started() { base.Started(); // Essentially we'll pick out a target amount of gas to leak, then a rate to leak it at, then work out the duration from there. if (TryFindRandomTile(out _targetTile, out _targetStation, out _targetGrid, out _targetCoords)) { _foundTile = true; _leakGas = RobustRandom.Pick(LeakableGases); // Was 50-50 on using normal distribution. var totalGas = (float)RobustRandom.Next(MinimumGas, MaximumGas); var startAfter = ((StationEventRuleConfiguration)Configuration).StartAfter; _molesPerSecond = RobustRandom.Next(MinimumMolesPerSecond, MaximumMolesPerSecond); _endAfter = totalGas / _molesPerSecond + startAfter; Sawmill.Info($"Leaking {totalGas} of {_leakGas} over {_endAfter - startAfter} seconds at {_targetTile}"); } // Look technically if you wanted to guarantee a leak you'd do this in announcement but having the announcement // there just to f**k with people even if there is no valid tile is funny. }
public override void Started() { base.Started(); var spawnLocations = EntityManager.EntityQuery <VentCritterSpawnLocationComponent, TransformComponent>().ToList(); RobustRandom.Shuffle(spawnLocations); var spawnAmount = RobustRandom.Next(7, 15); // A small colony of critters. for (int i = 0; i < spawnAmount && i < spawnLocations.Count - 1; i++) { var spawnChoice = RobustRandom.Pick(SpawnedPrototypeChoices); if (RobustRandom.Prob(0.01f) || i == 0) //small chance for multiple, but always at least 1 { spawnChoice = "SpawnPointGhostRatKing"; } var coords = spawnLocations[i].Item2.Coordinates; Sawmill.Info($"Spawning mouse {spawnChoice} at {coords}"); EntityManager.SpawnEntity(spawnChoice, coords); } }
public override void Started() { base.Started(); var spawnChoice = RobustRandom.Pick(SpawnedPrototypeChoices); var spawnLocations = EntityManager.EntityQuery <VentCritterSpawnLocationComponent>().ToList(); RobustRandom.Shuffle(spawnLocations); var spawnAmount = RobustRandom.Next(4, 12); // A small colony of critters. Sawmill.Info($"Spawning {spawnAmount} of {spawnChoice}"); foreach (var location in spawnLocations) { if (spawnAmount-- == 0) { break; } var coords = EntityManager.GetComponent <TransformComponent>(location.Owner); EntityManager.SpawnEntity(spawnChoice, coords.Coordinates); } }
private void UnloadCarriedWood(Sawmill s) { s.AddWood(woodCarried); woodCarried = 0; }