Exemple #1
0
    // Update is called once per frame
    public void Update(float deltaTime)
    {
        NeedActions.CallFunctionsWithNeed(luaUpdate, this, deltaTime);
        if (luaOnly)
        {
            return;
        }

        Amount += growthRate * deltaTime;
        if (character != null && character.CurrTile.GetGasPressure("O2") < 0.15)
        {
            Amount += (addedInVacuum - (addedInVacuum * (character.CurrTile.GetGasPressure("O2") * 5))) * deltaTime;
        }

        if (Amount > 75 && character.MyJob.IsNeed == false)
        {
            Debug.ULogChannel("Need", character.name + " needs " + Name);
            character.AbandonJob(false);
        }

        if (Amount == 100 && character.MyJob.Critical == false && CompleteOnFail)
        {
            Debug.ULogChannel("Need", character.name + " failed their " + Name + " need.");
            character.AbandonJob(false);
        }

        if (Amount == 100)
        {
            // FIXME: Insert need fail damage code here.
        }
    }
Exemple #2
0
    private void LoadNeedLua(string filePath)
    {
        string myLuaCode = System.IO.File.ReadAllText(filePath);

        // Instantiate the singleton.
        NeedActions.AddScript(myLuaCode);
    }
    public void LoadPrototypes()
    {
        PrototypeManager.Furniture.LoadModPrototypesFromFile(mods);
        PrototypeManager.Inventory.LoadModPrototypesFromFile(mods);
        PrototypeManager.Need.LoadModPrototypesFromFile(mods);
        PrototypeManager.Trader.LoadModPrototypesFromFile(mods);

        FurnitureActions.LoadModsScripts(mods);
        NeedActions.LoadModsScripts(mods);
    }
Exemple #4
0
    public void LoadPrototypes()
    {
        PrototypeManager.Furniture.LoadPrototypes(mods);
        PrototypeManager.Inventory.LoadPrototypes(mods);
        PrototypeManager.Need.LoadPrototypes(mods);
        PrototypeManager.Trader.LoadPrototypes(mods);
        PrototypeManager.SchedulerEvent.LoadPrototypes(mods);
        PrototypeManager.Stat.LoadPrototypes(mods);
        PrototypeManager.Quest.LoadPrototypes(mods);

        FurnitureActions.LoadModsScripts(mods);
        NeedActions.LoadModsScripts(mods);
    }
    public NeedActions()
    {
        // Tell the LUA interpreter system to load all the classes
        // that we have marked as [MoonSharpUserData]
        UserData.RegisterAssembly();

        _Instance = this;

        myLuaScript = new Script();

        // If we want to be able to instantiate a new object of a class
        //   i.e. by doing    SomeClass.__new()
        // We need to make the base type visible.
        myLuaScript.Globals["Inventory"] = typeof(Inventory);
        myLuaScript.Globals["Job"]       = typeof(Job);

        // Also to access statics/globals
        myLuaScript.Globals["World"] = typeof(World);
    }
Exemple #6
0
    // Update is called once per frame
    public void Update(float deltaTime)
    {
        NeedActions.CallFunctionsWithNeed(luaUpdate, this, deltaTime);
        if (luaOnly)
        {
            return;
        }

        Amount += growthRate * deltaTime;

        if (character != null && character.CurrTile.GetGasPressure("O2") < 0.15)
        {
            Amount += (addedInVacuum - (addedInVacuum * (character.CurrTile.GetGasPressure("O2") * 5))) * deltaTime;
        }

        if (Amount == 100)
        {
            // FIXME: Insert need fail damage code here.
        }
    }