Jump to content

Recommended Posts

Since the new chester skin (the sheep) my chester mod has become unusable due to bugs and crashes

Mod:
https://steamcommunity.com/sharedfiles/filedetails/?id=652179799

I think I've figured out the code side of things, but I cant find the files for the sheep build and I would need to edit those to fix the mod since the original mod has extra chester builds that would need sheep versions. Does anyone know how I can go about fixing this as well as where I can find the files for sheep chester?

https://forums.kleientertainment.com/forums/topic/70107-how-to-open-dyn-files/
Based off of this thread it seems like we're discouraged to open/use DYN files buuut the only files I saw for Woolly Chester was under:
data/anim/dynamic/chester_lamb.dyn

There was also one under:
data/databundles/anim_dynamic.zip/anim/dynamic/chester_lamb.zip

I took a quick look since I had Notepad++ up, but sorry I can't help any more than this! :apologetic:

4 hours ago, owlluna said:

https://forums.kleientertainment.com/forums/topic/70107-how-to-open-dyn-files/
Based off of this thread it seems like we're discouraged to open/use DYN files buuut the only files I saw for Woolly Chester was under:
data/anim/dynamic/chester_lamb.dyn

There was also one under:
data/databundles/anim_dynamic.zip/anim/dynamic/chester_lamb.zip

I took a quick look since I had Notepad++ up, but sorry I can't help any more than this! :apologetic:

Honestly, I mostly just need to see how the code is set up for the sheep chester skin so I know how to reconnect the mod to it without something breaking. If I know how the build is named etc.
chester_lamb.zip has the build file but not the sprite sheet, which I'm assuming is only in the .dyn files. I don't really even need to decompile the .dyn since I can always create my own assets for the skin, but if I could at least see how the sprite sheet is set up I'd be able to jury-rig something together without breaking something. I suppose the best thing to do would be to ask permission from klei or a relevant game dev, since I mostly need that data for the sake of fixing a compatibility issue, but since i assume there's some legal issue there I guess the next best thing would be to ask if there's any way to tell the game to just not morph sheep chester

In chester.lua, this function causes the problems:

local function SetBuild(inst)
    local skin_build = inst:GetSkinBuild()
    if skin_build ~= nil then
        local state = ""
        if inst.ChesterState == "SHADOW" then
            state = "_shadow"
        elseif inst.ChesterState == "SNOW" then
            state = "_snow"
        end

        inst.AnimState:OverrideItemSkinSymbol("chester_body", skin_build, "chester_body" .. state, inst.GUID, "chester_build")
        inst.AnimState:OverrideItemSkinSymbol("chester_foot", skin_build, "chester_foot" .. state, inst.GUID, "chester_build")
        inst.AnimState:OverrideItemSkinSymbol("chester_lid", skin_build, "chester_lid" .. state, inst.GUID, "chester_build")
        inst.AnimState:OverrideItemSkinSymbol("chester_tongue", skin_build, "chester_tongue" .. state, inst.GUID, "chester_build")
    else
        inst.AnimState:ClearAllOverrideSymbols()

        if inst.ChesterState == "SHADOW" then
            inst.AnimState:SetBuild("chester_shadow_build")
        elseif inst.ChesterState == "SNOW" then
            inst.AnimState:SetBuild("chester_snow_build")
        else
            inst.AnimState:SetBuild("chester_build")
        end
    end
end

You changed it in your mod, but you didn't add

inst.SetBuild = SetBuild

in the create_chester function.

That's what causes the crash when reskinning chester, as when reskinning chester, this function is called, as can be seen in prefabskin.lua

function chester_init_fn(inst, build_name)
    if not TheWorld.ismastersim then
        return
    end
    inst:SetBuild()
end

You could also see it by looking at the server log.

  • Like 1
44 minutes ago, Monti18 said:

In chester.lua, this function causes the problems:


local function SetBuild(inst)
    local skin_build = inst:GetSkinBuild()
    if skin_build ~= nil then
        local state = ""
        if inst.ChesterState == "SHADOW" then
            state = "_shadow"
        elseif inst.ChesterState == "SNOW" then
            state = "_snow"
        end

        inst.AnimState:OverrideItemSkinSymbol("chester_body", skin_build, "chester_body" .. state, inst.GUID, "chester_build")
        inst.AnimState:OverrideItemSkinSymbol("chester_foot", skin_build, "chester_foot" .. state, inst.GUID, "chester_build")
        inst.AnimState:OverrideItemSkinSymbol("chester_lid", skin_build, "chester_lid" .. state, inst.GUID, "chester_build")
        inst.AnimState:OverrideItemSkinSymbol("chester_tongue", skin_build, "chester_tongue" .. state, inst.GUID, "chester_build")
    else
        inst.AnimState:ClearAllOverrideSymbols()

        if inst.ChesterState == "SHADOW" then
            inst.AnimState:SetBuild("chester_shadow_build")
        elseif inst.ChesterState == "SNOW" then
            inst.AnimState:SetBuild("chester_snow_build")
        else
            inst.AnimState:SetBuild("chester_build")
        end
    end
end

You changed it in your mod, but you didn't add


inst.SetBuild = SetBuild

in the create_chester function.

That's what causes the crash when reskinning chester, as when reskinning chester, this function is called, as can be seen in prefabskin.lua


function chester_init_fn(inst, build_name)
    if not TheWorld.ismastersim then
        return
    end
    inst:SetBuild()
end

You could also see it by looking at the server log.

part of the issue I've been having with testing is since I do not have the sheep chester skin, I cannot properly test, but I will try what you suggested

8 hours ago, Monti18 said:

I have it, when using your mod with the change I suggested, I had no crash when reskinning chester compared to bef. I didn't test it with the other forms you have, this was only with the base chester form.

could you test with the new forms as well, that seems to be more likely to cause issues. Also, are the form anims still bugged with those changes?

 

14 hours ago, Monti18 said:

In chester.lua, this function causes the problems:


local function SetBuild(inst)
    local skin_build = inst:GetSkinBuild()
    if skin_build ~= nil then
        local state = ""
        if inst.ChesterState == "SHADOW" then
            state = "_shadow"
        elseif inst.ChesterState == "SNOW" then
            state = "_snow"
        end

        inst.AnimState:OverrideItemSkinSymbol("chester_body", skin_build, "chester_body" .. state, inst.GUID, "chester_build")
        inst.AnimState:OverrideItemSkinSymbol("chester_foot", skin_build, "chester_foot" .. state, inst.GUID, "chester_build")
        inst.AnimState:OverrideItemSkinSymbol("chester_lid", skin_build, "chester_lid" .. state, inst.GUID, "chester_build")
        inst.AnimState:OverrideItemSkinSymbol("chester_tongue", skin_build, "chester_tongue" .. state, inst.GUID, "chester_build")
    else
        inst.AnimState:ClearAllOverrideSymbols()

        if inst.ChesterState == "SHADOW" then
            inst.AnimState:SetBuild("chester_shadow_build")
        elseif inst.ChesterState == "SNOW" then
            inst.AnimState:SetBuild("chester_snow_build")
        else
            inst.AnimState:SetBuild("chester_build")
        end
    end
end

You changed it in your mod, but you didn't add


inst.SetBuild = SetBuild

in the create_chester function.

That's what causes the crash when reskinning chester, as when reskinning chester, this function is called, as can be seen in prefabskin.lua


function chester_init_fn(inst, build_name)
    if not TheWorld.ismastersim then
        return
    end
    inst:SetBuild()
end

You could also see it by looking at the server log.

which lines should I put these codes in

i put it here for now is that correct?
image.png.f8f56f23a455b7d179008d0575929ca0.png

Edited by MF99K

This is the create_chester funcion I used, it's completely at the end of the function.

Spoiler

local function create_chester()
    local inst = CreateEntity()

    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    inst.entity:AddSoundEmitter()
    inst.entity:AddDynamicShadow()
    inst.entity:AddMiniMapEntity()
    inst.entity:AddNetwork()
    inst.entity:AddLightWatcher()

    MakeCharacterPhysics(inst, 75, .5)
    inst.Physics:SetCollisionGroup(COLLISION.CHARACTERS)
    inst.Physics:ClearCollisionMask()
    inst.Physics:CollidesWith(COLLISION.WORLD)
    inst.Physics:CollidesWith(COLLISION.OBSTACLES)
    inst.Physics:CollidesWith(COLLISION.CHARACTERS)

    inst:AddTag("companion")
    inst:AddTag("character")
    inst:AddTag("scarytoprey")
    inst:AddTag("chester")
    inst:AddTag("notraptrigger")
    inst:AddTag("noauradamage")

    inst.MiniMapEntity:SetIcon("chester.png")
    inst.MiniMapEntity:SetCanUseCache(false)

    inst.AnimState:SetBank("chester")
    inst.AnimState:SetBuild("chester_build")

    inst.DynamicShadow:SetSize(2, 1.5)

    inst.Transform:SetFourFaced()

    inst._isshadowchester = net_bool(inst.GUID, "_isshadowchester", "onisshadowchesterdirty")

    inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        inst._clientshadowmorphed = false
        inst:ListenForEvent("onisshadowchesterdirty", OnIsShadowChesterDirty)
        return inst
    end

    ------------------------------------------
    inst:AddComponent("maprevealable")
    inst.components.maprevealable:SetIconPrefab("globalmapiconunderfog")

    inst:AddComponent("combat")
    inst.components.combat.hiteffectsymbol = "chester_body"
    inst.components.combat:SetKeepTargetFunction(ShouldKeepTarget)

    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(TUNING.CHESTER_HEALTH)
    inst.components.health:StartRegen(TUNING.CHESTER_HEALTH_REGEN_AMOUNT, TUNING.CHESTER_HEALTH_REGEN_PERIOD)

    inst:AddComponent("inspectable")
    inst.components.inspectable:RecordViews()

    inst:AddComponent("locomotor")
    inst.components.locomotor.walkspeed = 3
    inst.components.locomotor.runspeed = 7

    inst:AddComponent("follower")
    inst:ListenForEvent("stopfollowing", OnStopFollowing)
    inst:ListenForEvent("startfollowing", OnStartFollowing)

    inst:AddComponent("knownlocations")

    MakeSmallBurnableCharacter(inst, "chester_body")

    inst:AddComponent("container")
    inst.components.container:WidgetSetup("chester")
    inst.components.container.onopenfn = OnOpen
    inst.components.container.onclosefn = OnClose

    inst:AddComponent("sleeper")
    inst.components.sleeper:SetResistance(3)
    inst.components.sleeper.testperiod = GetRandomWithVariance(6, 2)
    inst.components.sleeper:SetSleepTest(ShouldSleep)
    inst.components.sleeper:SetWakeTest(ShouldWakeUp)

    MakeHauntableDropFirstItem(inst)
    AddHauntableCustomReaction(inst, OnHaunt, false, false, true)

    inst.sounds = sounds

    inst:SetStateGraph("SGchester")
    inst.sg:GoToState("idle")

    inst:SetBrain(brain)

    inst.ChesterState = "NORMAL"
    inst.MorphChester = MorphChester
    inst:WatchWorldState("isfullmoon", CheckForMorph)
    inst:ListenForEvent("onclose", CheckForMorph)

    inst.OnSave = OnSave
    inst.OnPreLoad = OnPreLoad

    inst.SetBuild = SetBuild

    return inst
end

 

If I have some time, I will see if I can test the other forms.

  • Like 1
  • Thanks 1

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...