--PLS NO COPY PASTERINO MY LIFES WORK

-- local speedbonus = GetModConfigData("speed")
-- local levelbonus = GetModConfigData("level")
-- local mytype = GetModConfigData("type")
-- local myitem = 1
-- local myhair = GetModConfigData("hairgrow")
-- local mytext=  GetModConfigData("mytext")
-- local mybooster=  GetModConfigData("mybooster")
 local mymod=  GetModConfigData("mymod")
-- GLOBAL.TUNING.BEEFALO_HAIR_GROWTH_DAYS=myhair

PrefabFiles = {
 "koalebeef_summer",
 "koalebeef_winter",
}

---hair growth days--

---Domestication Level---
-- TUNING.BEEFALO_DOMESTICATION_LOSE_DOMESTICATION = 0
-- TUNING.BEEFALO_DOMESTICATION_GAIN_DOMESTICATION = TUNING.BEEFALO_DOMESTICATION_GAIN_DOMESTICATION*levelbonus
-- TUNING.BEEFALO_DOMESTICATION_MAX_LOSS_DAYS = 0
-- TUNING.BEEFALO_DOMESTICATION_OVERFEED_DOMESTICATION = 0
-- TUNING.BEEFALO_DOMESTICATION_ATTACKED_DOMESTICATION = 0
-- TUNING.BEEFALO_DOMESTICATION_ATTACKED_OBEDIENCE = 0
-- TUNING.BEEFALO_DOMESTICATION_ATTACKED_BY_PLAYER_DOMESTICATION = 0
-- TUNING.BEEFALO_DOMESTICATION_BRUSHED_DOMESTICATION = TUNING.BEEFALO_DOMESTICATION_BRUSHED_DOMESTICATION*levelbonus

---Movement Speed Modifier---
-- TUNING.BEEFALO_WALK_SPEED = 1.0
-- TUNING.BEEFALO_RUN_SPEED = {
            -- DEFAULT = 7,
            -- RIDER = 8.0*speedbonus,
            -- ORNERY = 7.0*speedbonus,
            -- PUDGY = 6.0*speedbonus,
        -- }

-- -Type Preference---
-- if mytype == 2 then--Rider
	-- TUNING.BEEFALO_RIDER_RIDDEN = TUNING.BEEFALO_RIDER_RIDDEN*levelbonus
-- end
-- if mytype == 3 then--Ornery
	-- TUNING.BEEFALO_ORNERY_DOATTACK = TUNING.BEEFALO_ORNERY_DOATTACK*levelbonus
	-- TUNING.BEEFALO_ORNERY_ATTACKED = TUNING.BEEFALO_ORNERY_ATTACKED*levelbonus
-- end
-- if mytype == 4 then--Pudgy
	-- TUNING.BEEFALO_PUDGY_WELLFED = TUNING.BEEFALO_PUDGY_WELLFED*levelbonus
	-- TUNING.BEEFALO_PUDGY_OVERFEED = TUNING.BEEFALO_PUDGY_OVERFEED*levelbonus
-- end


--modimport("scripts/prefabs/beefalo.lua")
-- modimport("scripts/patches/babybeefaloabuse.lua")
-- modimport("scripts/patches/beefalodomestication2.lua")
-- modimport("scripts/patches/beefactionpatch.lua")


--modimport("scripts/patches/monumentpatch.lua")
--modimport("modmain1")
local require = GLOBAL.require
-- require "prefabs/veggies"

	-- TUNING.SADDLE_MOON_BONUS_DAMAGE = 1
	-- TUNING.SADDLE_MOON_USES = 10
	-- TUNING.SADDLE_MOON_SPEEDMULT = 1.25

	-- PrefabFiles = {
		-- "fodder2",
		-- "saddle_moon2",
		-- "dragonbulb2",
		-- "beefalocollar2",
		-- "permission2",
		-- "healthregenbufff",
		-- "shit_head",
	    -- "dead_baby_beef_fresh",
	    -- "dead_baby_beef_cooked",
	    -- "dead_baby_beef_dried",
	    -- "weaponized_baby",
	-- }

	-- Assets = {
	    -- Asset( "ANIM", "anim/beefalo_personality_pudgy.zip" ),
		-- Asset("IMAGE", "images/inventoryimages/saddle_moon.tex"),
		-- Asset("ATLAS", "images/inventoryimages/saddle_moon.xml"),
		-- Asset( "IMAGE", "images/inventoryimages/fodder.tex" ),
		-- Asset( "ATLAS", "images/inventoryimages/fodder.xml" ),
		-- Asset( "IMAGE", "images/inventoryimages/dragonbulb.tex" ),
		-- Asset( "ATLAS", "images/inventoryimages/dragonbulb.xml" ),
		-- Asset( "IMAGE", "images/inventoryimages/beefalocollar.tex" ),
		-- Asset( "ATLAS", "images/inventoryimages/beefalocollar.xml" ),
		-- Asset( "IMAGE", "images/inventoryimages/permission.tex" ),
		-- Asset( "ATLAS", "images/inventoryimages/permission.xml" ),
		-- Asset("ATLAS", "images/inventoryimages/shit_head.xml"),
		-- Asset("ANIM", "anim/dead_baby_beef_dried.zip"),
	-- }

    -- local AllRecipes = GLOBAL.AllRecipes
	-- local Ingredient = GLOBAL.Ingredient
	-- local RECIPETABS = GLOBAL.RECIPETABS
	-- local STRINGS = GLOBAL.STRINGS
	-- local TECH = GLOBAL.TECH

-- if mybooster then	
  -- local lifeinjector_sortkey = AllRecipes["lifeinjector"]["sortkey"]

  -- local beefster = AddRecipe("beefster", {Ingredient("spidergland", 1)}, RECIPETABS.SURVIVAL, TECH.SCIENCE_ONE)
  -- beefster.product = "lifeinjector"
  -- beefster.image = "lifeinjector.tex"
  -- beefster.sortkey = lifeinjector_sortkey + 0.5
  -- beefster.numtogive = 1
  -- STRINGS.NAMES.BEEFSTER = "Cheaper booster shot"
  -- STRINGS.RECIPE_DESC.BEEFSTER = "They're not worth it."
-- end  
	
	-- local saddle_moon = GLOBAL.Recipe("saddle_moon", {Ingredient("dragon_scales", 1), Ingredient("moonrocknugget", 4), Ingredient("steelwool", 2)}, RECIPETABS.TOOLS,  TECH.SCIENCE_TWO)
	-- saddle_moon.atlas = "images/inventoryimages/saddle_moon.xml"
	-- local fodder = GLOBAL.Recipe("fodder", {Ingredient("poop", 2), Ingredient("rope", 1), Ingredient("papyrus", 1)}, RECIPETABS.SURVIVAL,  TECH.SCIENCE_ONE)
	-- fodder.atlas = "images/inventoryimages/fodder.xml"
	-- local dragonbulb = GLOBAL.Recipe("dragonbulb", {Ingredient("dragonfruit", 1), Ingredient("lightbulb", 1)}, RECIPETABS.SURVIVAL,  TECH.SCIENCE_ONE)
	-- dragonbulb.atlas = "images/inventoryimages/dragonbulb.xml"
	        -- local shit_head = GLOBAL.Recipe("shit_head",
        -- { 
                -- Ingredient("poop", 2), 
                -- Ingredient("beefalowool", 2),
        -- },                     
        -- RECIPETABS.TOWN, TECH.NONE, "shit_head_placer" ) 
        -- shit_head.atlas = "images/inventoryimages/shit_head.xml"

-- modimport("scripts/strings/speech_weaponized_baby.lua")
-- GLOBAL.STRINGS.NAMES.WEAPONIZED_BABY = "Magical bat"
-- GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.WEAPONIZED_BABY = "I guess that's one use for him."
-- GLOBAL.STRINGS.RECIPE_DESC.WEAPONIZED_BABY = "A magical and sentient bat."


        -- local weaponized_baby = GLOBAL.Recipe("weaponized_baby",{ Ingredient("thulecite", 4), Ingredient("nightmarefuel", 3),Ingredient("dead_baby_beef_fresh", 1) ,Ingredient("greengem", 1) },                     
        -- RECIPETABS.ANCIENT, TECH.ANCIENT_TWO, nil, nil, true)
        -- weaponized_baby.atlas = "images/inventoryimages/weaponized_baby.xml"
	
-- if mysnack then	
	-- local permission = GLOBAL.Recipe("permission", {Ingredient("honey", 1)},RECIPETABS.SURVIVAL,  TECH.SCIENCE_ONE)
	-- permission.atlas = "images/inventoryimages/permission.xml"
	-- GLOBAL.STRINGS.NAMES.PERMISSION = "Luxurious beefer snack"
	-- GLOBAL.STRINGS.RECIPE_DESC.PERMISSION = "The snack beefalo need, and deserve"
	-- GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.PERMISSION = "This is for the next time they run at me demanding food."
-- end
	
	GLOBAL.STRINGS.NAMES.KOALEBEEF_SUMMER = "Koalefant"
    GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.KOALEBEEF_SUMMER = "It's a koalefant."
    GLOBAL.STRINGS.NAMES.KOALEBEEF_WINTER = "Koalefant"
    GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.KOALEBEEF_WINTER = "It's a koalefant."

-- if not GLOBAL.TheNet:GetIsServer() then
		-- return
-- end


-- local function RackPostInit(inst)

	-- local oldonstartdrying = inst.components.dryer.onstartdrying
	-- local newstartdrying = function(inst, dryable, ...)
		-- if dryable == "dead_baby_beef_fresh" then
		    -- inst.AnimState:PlayAnimation("drying_pre")
			-- inst.AnimState:PushAnimation("drying_loop", true)
			-- inst.AnimState:OverrideSymbol("swap_dried", "dead_baby_beef_dried", "symbol_4cee3798")
-- --			if inst.components.freezable.crashdamnyou==2 then end
	    -- else
		-- return oldonstartdrying(inst, dryable, ...)
		-- end
		-- end
	-- local oldondonedrying = inst.components.dryer.ondonedrying
	-- local newdonedrying = function(inst, product, ...)
	    -- if product == "dead_baby_beef_dried" then
		    -- inst.AnimState:PlayAnimation("idle_full")
		    -- inst.AnimState:OverrideSymbol("swap_dried", "dead_baby_beef_dried", "symbol_3a075393")
-- --		    			if inst.components.freezable.crashdamnyou==2 then end
		-- else

	    -- return oldondonedrying(inst, product, ...)
	-- end
	-- end

    -- inst.components.dryer:SetStartDryingFn(newstartdrying)
	-- inst.components.dryer:SetDoneDryingFn(newdonedrying)
-- end
-- AddPrefabPostInit("meatrack", RackPostInit)

-- AddPrefabPostInit("beefalo", function(inst)

 -- inst.tendencies={
    -- DEFAULT =
    -- {
    -- },

    -- ORNERY =
    -- {
    -- },

    -- RIDER =
    -- {
    -- },

    -- PUDGY =
    -- {
        -- build = "beefalo_personality_pudgy",
        -- customactivatefn = function(inst)
            -- inst:AddComponent("sanityaura")
            -- inst.components.sanityaura.aura = TUNING.SANITYAURA_TINY
        -- end,
        -- customdeactivatefn = function(inst)
            -- inst:RemoveComponent("sanityaura")
        -- end,
    -- },
-- }
-- end)
local function ShouldAcceptItema(inst, item)
    return inst.components.eater:CanEat(item)
    --    and not inst.components.combat:HasTarget()
end

local function OnGetItemFromPlayera(inst, giver, item)
    if inst.components.eater:CanEat(item) then
	item:DoTaskInTime(0, item.Remove)
    local grown = GLOBAL.SpawnPrefab("koalebeef_summer")
    grown.Transform:SetPosition(inst.Transform:GetWorldPosition() )
    grown.Transform:SetRotation(inst.Transform:GetRotation() )
--    grown.sg:GoToState("grow_up_pop")
    inst:Remove()
    end
end

local function OnRefuseItema(inst, item)
end

local function Koalebeefsummerint(inst)
if GLOBAL.TheWorld.ismastersim then
    inst.components.eater:SetDiet({ GLOBAL.FOODTYPE.VEGGIE, GLOBAL.FOODTYPE.ROUGHAGE }, { GLOBAL.FOODTYPE.VEGGIE, GLOBAL.FOODTYPE.ROUGHAGE })
    inst:AddComponent("trader")
    inst.components.trader:SetAcceptTest(ShouldAcceptItema)
    inst.components.trader.onaccept = OnGetItemFromPlayera
    inst.components.trader.onrefuse = OnRefuseItema
    inst.components.trader.deleteitemonaccept = false
	end
end
AddPrefabPostInit("koalefant_summer", Koalebeefsummerint)

local function ShouldAcceptItemaa(inst, item)
    return inst.components.eater:CanEat(item)
    --    and not inst.components.combat:HasTarget()
end

local function OnGetItemFromPlayeraa(inst, giver, item)
    if inst.components.eater:CanEat(item) then
	item:DoTaskInTime(0, item.Remove)
    local grown = GLOBAL.SpawnPrefab("koalebeef_winter")
    grown.Transform:SetPosition(inst.Transform:GetWorldPosition() )
    grown.Transform:SetRotation(inst.Transform:GetRotation() )
--    grown.sg:GoToState("grow_up_pop")
    inst:Remove()
    end
end

local function OnRefuseItemaa(inst, item)
end

local function Koalebeefwinterint(inst)
if GLOBAL.TheWorld.ismastersim then
    inst.components.eater:SetDiet({ GLOBAL.FOODTYPE.VEGGIE, GLOBAL.FOODTYPE.ROUGHAGE }, { GLOBAL.FOODTYPE.VEGGIE, GLOBAL.FOODTYPE.ROUGHAGE })
    inst:AddComponent("trader")
    inst.components.trader:SetAcceptTest(ShouldAcceptItemaa)
    inst.components.trader.onaccept = OnGetItemFromPlayeraa
    inst.components.trader.onrefuse = OnRefuseItemaa
    inst.components.trader.deleteitemonaccept = false
	end
end
AddPrefabPostInit("koalefant_winter", Koalebeefwinterint)
if mymod then
modimport("scripts/patches/koalebeefdomestication.lua")
end