示例#1
0
    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");
        }
    }
示例#2
0
    public static void AddCurrency(string name, float amount)
    {
        World world;

        if (ModUtils.GetCurrentWorld(out world))
        {
            world.Wallet.AddCurrency(name, amount);
        }
    }
示例#3
0
    public static void SetCharacterHealth(string name, float health)
    {
        World world;

        if (ModUtils.GetCurrentWorld(out world))
        {
            world.CharacterManager.GetFromName(name).Health.CurrentHealth = health;
        }
    }
示例#4
0
    public static void CharacterClearStateQueue(string name)
    {
        World world;

        if (ModUtils.GetCurrentWorld(out world))
        {
            world.CharacterManager.GetFromName(name).ClearStateQueue();
        }
    }
示例#5
0
    public static void DamageCharacter(string name, float amount)
    {
        World world;

        if (ModUtils.GetCurrentWorld(out world))
        {
            world.CharacterManager.GetFromName(name).Health.DamageEntity(amount);
        }
    }
示例#6
0
    public static void RemoveInventoryOfType(string type, int amount, bool onlyFromStockpiles)
    {
        World world;

        if (ModUtils.GetCurrentWorld(out world))
        {
            world.InventoryManager.RemoveInventoryOfType(type, amount, onlyFromStockpiles);
        }
    }
示例#7
0
    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);
        }
    }
示例#8
0
    public static void InvalidateTileGraph()
    {
        World world;

        if (ModUtils.GetCurrentWorld(out world))
        {
            world.InvalidateTileGraph();
        }
    }
示例#9
0
    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);
        }
    }
示例#10
0
    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));
        }
    }
示例#11
0
    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);
        }
    }
示例#12
0
    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);
        }
    }
示例#13
0
    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;
            }
        }
    }
示例#14
0
    public static void AllCharactersClearStateQueue()
    {
        World world;

        if (ModUtils.GetCurrentWorld(out world))
        {
            foreach (Character character in world.CharacterManager)
            {
                character.ClearStateQueue();
            }
        }
    }
示例#15
0
    public static void CharacterClearStateQueue(string name)
    {
        World world;

        if (ModUtils.GetCurrentWorld(out world))
        {
            foreach (Character character in world.CharacterManager.GetAllFromName(name))
            {
                character.ClearStateQueue();
            }
        }
    }
示例#16
0
    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");
            }
        }
    }
示例#17
0
    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");
            }
        }
    }
示例#18
0
    // 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;
        }
    }
示例#19
0
    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());
            }
        }
    }
示例#20
0
    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!");
            }
        }
    }
示例#21
0
    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!");
            }
        }
    }
示例#22
0
        /// <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);
        }