Jump to content

Recommended Posts

So I'm trying to make it so this hat restores sanity and has insulation, i believe the insulation is actually working but the sanity boost is not. Any help?

 local assets = {  
  Asset("ANIM", "anim/hat_d.zip"),
   Asset("IMAGE", "images/inventoryimages/hat_d.tex"),   
   Asset("ATLAS", "images/inventoryimages/hat_d.xml"),
 
}
 
local function onequip(inst, owner)
        owner.AnimState:OverrideSymbol("swap_hat", "hat_d", "swap_hat")
        owner.AnimState:Show("HAT")
        owner.AnimState:Show("HAT_HAIR")
        owner.AnimState:Hide("HAIR_NOHAT")
        owner.AnimState:Hide("HAIR")
        
        if owner:HasTag("player") then
owner.AnimState:Hide("HEAD")
owner.AnimState:Show("HEAD_HAIR")
end
    
    end
 
local function onunequip(inst, owner) 
        owner.AnimState:Hide("HAT")
        owner.AnimState:Hide("HAT_HAIR")
        owner.AnimState:Show("HAIR_NOHAT")
        owner.AnimState:Show("HAIR")
 
if owner:HasTag("player") then
       owner.AnimState:Show("HEAD")
owner.AnimState:Hide("HEAD_HAIR")
end
end
 
 
 
 
local function fn(Sim)
local inst = CreateEntity()
local trans = inst.entity:AddTransform()
local anim = inst.entity:AddAnimState()
    MakeInventoryPhysics(inst)
    
inst:AddTag("hat_d")
 
    anim:SetBuild("hat_d")
    anim:PlayAnimation("anim")
 
inst:AddComponent("inspectable")
   
    inst:AddComponent("inventoryitem")
inst.components.inventoryitem.atlasname = "images/inventoryimages/hat_d.xml"
 
    
    inst:AddComponent("tradable")
 
    inst:AddComponent("equippable")
    inst.components.equippable.equipslot = EQUIPSLOTS.HEAD
 
    inst.components.equippable:SetOnEquip( onequip )
 
inst:AddComponent("insulator")
    inst.components.insulator.insulation = TUNING.INSULATION_SMALL
    
   inst:AddComponent("dapperness")
inst.components.dapperness.dapperness = TUNING.DAPPERNESS_MEDIUM
 
    inst.components.equippable:SetOnUnequip( onunequip )
 
 
    return inst
end
 
return Prefab( "common/inventory/hat_d", fn, assets)

Vanilla game uses components.dapperness:GetDapperness(self.inst) , ROG uses components.equippable:GetDapperness(self.inst)

 

Why was the change necessary, and why noone cared to even try to maintain compatibility... is question for someone else, but as it is right now, you have to check if rog is active (or just add dapperness field to both components and hope they don't change it again)

Vanilla game uses components.dapperness:GetDapperness(self.inst) , ROG uses components.equippable:GetDapperness(self.inst)

 

Why was the change necessary, and why noone cared to even try to maintain compatibility... is question for someone else, but as it is right now, you have to check if rog is active (or just add dapperness field to both components and hope they don't change it again)

What do i place after that? I get this error

ps/common/dont_starve/data/scripts/mainfunctions.lua:70: Error loading file prefabs/hat_d
...steamapps/common/dont_starve/data/../mods/clem/scripts/prefabs/hat_d.lua:65: unexpected symbol near '='

Line 65 being

64 inst:AddComponent("dapperness")
65 components.equippable:GetDapperness(self.inst) = I tried using numbers, 3/60 and i tried 3 too.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...