-- ** Meliandah / Animal Species - PIG PACK / 04.03.2019  ** --
-- Version : 1.0
-- Add x8 new pigs !
 
big_pig_husbandry = {};
big_pig_husbandry.counter = 0;  

--FUNCTION DEBUG
function big_pig_husbandry:debug(message)
  print(('### Animal Species : %s'):format(message));
end;

--  FUNCTION TO PRINT TABLES RECURSIVELY
function printer(myTable)
    DebugUtil.printTableRecursively( myTable, "-",5,10);
end;

function big_pig_husbandry:loadMap(name)
end;

function big_pig_husbandry:keyEvent(unicode, sym, modifier, isDown)
end;

function big_pig_husbandry:update(dt)
    --REFRESH EVERY 1000 LOOPS, IF NEW HUSBANDRY ARE ADDED AND ETC
    if big_pig_husbandry.counter >= 1000 then
        --GET HUSBANDRIES OF SAVAGE PIG AND PUT MAX ANIMALS AT 1000, SET MANURE LANGUAGE AND RE-SET XML Name FOR CUSTOM MAP 
        for i,j in pairs(g_currentMission.husbandries) do                        
            for _,modu in pairs(j.modulesByName) do                
                if modu.animalType == "PIG" then
                    if modu.maxNumAnimals == 511 then
                        --print("PIG KICK AWAY THE MAX NUM SECURITY GUARD ! MAX NUM ANIMALS : 1000");
                        modu.maxNumAnimals = 1000;
                        --printer(modu);
                    end;
                end;                         
            end;                
        end;
        big_pig_husbandry.counter = 0;        
    end; 
    big_pig_husbandry.counter = big_pig_husbandry.counter+1;      
end;

function big_pig_husbandry:draw()
end;

function big_pig_husbandry:deleteMap()
end;

function big_pig_husbandry:mouseEvent(posX, posY, isDown, isUp, button)
end;

addModEventListener(big_pig_husbandry);