Jump to content

jiggawutt

Member
  • Posts

    12
  • Joined

  • Last visited

Posts posted by jiggawutt

  1. I'm trying to implement a magnifying glass as a way of starting a fire. I've got most of what I need to determine the weather, time of day/year, but I can't figure out how to test if the player is outside or inside. I tried poking around the files, but didn't find anything in the ones I assumed would be responsible for it.

     

    Does anyone know what function needs to be called? I assume one must exist since Agoraphobia/Claustrophobia are a thing.

  2. On 5/29/2019 at 4:30 PM, Fenris_Wolf said:

     

    Those functions are pretty redundant.

     

    
    getActivatedMods():contains("MyModName")

    Just use the contains() method instead of looping though the array.

     

    Yeah, it appears as if maybe the break statement is causing the code to escape all the way out of every branch in the function, which broke farming. Putting this line as the condition for an if statement does the trick way better (and doesn't break farming).

     

    if (getActivatedMods():contains("FarmingNeverRot")) then
      --NeverRot is this if statement.
      if (luaObject.nbOfGrow >6) then
        luaObject.nbOfGrow = 6
      end
    end
  3. If anyone encounters the same issue I had, this is the exact modified code snippet I've put into my mod. This should be inserted within the if(luaObject.state == "seeded") branch inside the function SFarmingSystem:growPlant(luaObject, nextGrowing, updateNbOfGrow).

     

    The code this file overrides is from media/lua/server/Farming/SFarmingSystem.lua

     


            local actmods = getActivatedMods();
            local activeNR = false;
            for i=0, actmods:size()-1, 1 do
                if actmods:get(i) == "FarmingNeverRot" then
                    activeNR = true;
                    break;
                end
            end
            if (activeNR) then
                --NeverRot is this if statement.
                if (luaObject.nbOfGrow >6) then
                    luaObject.nbOfGrow = 6
                end
            end


  4. I was wondering if anyone knows how to check if a workshop mod has been enabled in the game or not?  The issue is that my mod overwrites another mod called NeverRot. Now, NeverRot is just a three line conditional statement shoved into the SFarmingSystem:growPlant() function.  Unfortunately, I can't just delete my version of this function as it's necessary for the new plants that my mod adds to the game.  So, my thought is just to add another condition to see if NeverRot is enabled in-game.  A clunkier version to this would be to check if the files from NeverRot exist, but I want people to have the choice to have NeverRot enabled or not.

     

    Does anyone have an elegant solution to this problem, or am I just going to have to rely on checking for NeverRot files in the workshop folder?

×
×
  • Create New...