public static void GetTemperature(Vector3 pos) { World world; if (ModUtils.GetCurrentWorld(out world)) { DevConsole.Log("Temperature: " + world.temperature.GetTemperature((int)pos.x, (int)pos.y, (int)pos.z), "green"); } }
public static void AddCurrency(string name, float amount) { World world; if (ModUtils.GetCurrentWorld(out world)) { world.Wallet.AddCurrency(name, amount); } }
public static void SetCharacterHealth(string name, float health) { World world; if (ModUtils.GetCurrentWorld(out world)) { world.CharacterManager.GetFromName(name).Health.CurrentHealth = health; } }
public static void CharacterClearStateQueue(string name) { World world; if (ModUtils.GetCurrentWorld(out world)) { world.CharacterManager.GetFromName(name).ClearStateQueue(); } }
public static void DamageCharacter(string name, float amount) { World world; if (ModUtils.GetCurrentWorld(out world)) { world.CharacterManager.GetFromName(name).Health.DamageEntity(amount); } }
public static void RemoveInventoryOfType(string type, int amount, bool onlyFromStockpiles) { World world; if (ModUtils.GetCurrentWorld(out world)) { world.InventoryManager.RemoveInventoryOfType(type, amount, onlyFromStockpiles); } }
public static void PlaceInventoryAmount(string name, int amount, string type, Vector2 stackSizeRange) { World world; if (ModUtils.GetCurrentWorld(out world)) { world.InventoryManager.PlaceInventory(world.CharacterManager.GetFromName(name), new Inventory(type, (int)stackSizeRange.x, (int)stackSizeRange.y), amount); } }
public static void InvalidateTileGraph() { World world; if (ModUtils.GetCurrentWorld(out world)) { world.InvalidateTileGraph(); } }
public static void PlaceFurniture(string type, Vector3 pos, float rotation) { World world; Tile t; if (ModUtils.GetCurrentWorld(out world) && ModUtils.GetTileAt(pos, out t)) { world.FurnitureManager.PlaceFurniture(type, t, true, rotation); } }
public static void PlaceInventory(Vector3 pos, string type, Vector2 stackSizeRange) { World world; Tile t; if (ModUtils.GetCurrentWorld(out world) && ModUtils.GetTileAt(pos, out t)) { world.InventoryManager.PlaceInventory(t, new Inventory(type, (int)stackSizeRange.x, (int)stackSizeRange.y)); } }
public static void ConsumeInventory(Vector3 pos, int amount) { World world; Tile t; if (ModUtils.GetCurrentWorld(out world) && ModUtils.GetTileAt(pos, out t)) { world.InventoryManager.ConsumeInventory(t, amount); } }
public static void FloodFillRoomAt(Vector3 pos) { World world; Tile t; if (ModUtils.GetCurrentWorld(out world) && ModUtils.GetTileAt(pos, out t)) { world.RoomManager.DoRoomFloodFill(t, false, false); } }
public static void SetCharacterHealth(string name, float health) { World world; if (ModUtils.GetCurrentWorld(out world)) { foreach (GameCharacter character in world.CharacterManager.GetAllFromName(name)) { character.Health.CurrentHealth = health; } } }
public static void AllCharactersClearStateQueue() { World world; if (ModUtils.GetCurrentWorld(out world)) { foreach (Character character in world.CharacterManager) { character.ClearStateQueue(); } } }
public static void CharacterClearStateQueue(string name) { World world; if (ModUtils.GetCurrentWorld(out world)) { foreach (Character character in world.CharacterManager.GetAllFromName(name)) { character.ClearStateQueue(); } } }
public static void GetCharacterNames() { World world; if (ModUtils.GetCurrentWorld(out world)) { foreach (Character character in world.CharacterManager) { DevConsole.Log("Say hello to " + character.GetName(), "green"); } } }
public static void GetAllRoomIDs() { World world; if (ModUtils.GetCurrentWorld(out world)) { DevConsole.Log("Room IDs:"); foreach (Room room in world.RoomManager) { DevConsole.Log("Room " + room.ID, "green"); } } }
// Deprecated, but don't remove. Since later on we may want this so just create a struct to hold variables since too many public static void CharacterHealthSystemSet(string name, float hp, bool overheal, bool healable, bool invincible, bool revivable) { World world; if (ModUtils.GetCurrentWorld(out world)) { HealthSystem health = world.CharacterManager.GetFromName(name).Health; health.CanOverheal = overheal; health.CurrentHealth = hp; health.IsHealable = healable; health.IsInvincible = invincible; health.IsRevivable = revivable; } }
public static void NewCharacter(Vector3 pos, string name = null) { World world; Tile t; if (ModUtils.GetCurrentWorld(out world) && ModUtils.GetTileAt(pos, out t)) { Character character = world.CharacterManager.Create(t, name); if (character != null) { DevConsole.Log("Say hello to: " + character.GetName()); } } }
public static void IsWorkSpotClear(string type, Vector3 pos) { World world; Tile t; if (ModUtils.GetCurrentWorld(out world) && ModUtils.GetTileAt(pos, out t)) { if (world.FurnitureManager.IsWorkSpotClear(type, t)) { DevConsole.Log("Work spot is clear!", "green"); } else { DevConsole.LogWarning("Work spot isn't clear!"); } } }
public static void IsPlacementValid(string type, Vector3 pos, float rotation) { World world; Tile t; if (ModUtils.GetCurrentWorld(out world) && ModUtils.GetTileAt(pos, out t)) { if (world.FurnitureManager.IsPlacementValid(type, t, rotation)) { DevConsole.Log("Spot is valid!", "green"); } else { DevConsole.LogWarning("Spot isn't valid!"); } } }
/// <summary> /// Finds any constant matches in the match. /// </summary> /// <param name="match"> A match from a regex expression. </param> /// <returns> The constant value if one exists in the match. </returns> protected string GetConstantForMatch(Match match) { if (match.Groups.Count < 2) { return(string.Empty); } World world; bool worldSuccess = ModUtils.GetCurrentWorld(out world); // 0 is the full text 1 is the match text. switch (match.Groups[1].Value.ToLower()) { case "center": case "centre": if (worldSuccess) { Tile t = world.GetCenterTile(); return("[" + t.X + ", " + t.Y + ", " + t.Z + "]"); } break; case "mousePos": Vector3 mousePos = Input.mousePosition; return("[" + mousePos.x + ", " + mousePos.y + ", " + mousePos.z + "]"); case "timeScale": return((TimeManager.Instance != null) ? TimeManager.Instance.TimeScale.ToString() : string.Empty); case "pi": return(Math.PI.ToString()); case "e": return(Math.E.ToString()); default: DevConsole.LogWarning("You entered an constant identifier that doesn't exist? Check spelling."); break; } return(string.Empty); }