[Bug] Dogfish on drying rack disappears after relog


Recommended Posts

I have the same problem- fish morsel dissapears after loading saved game. At first I thought my drying racks are empty but the rope looks a bit different- with a hook at the end and you can't hang new meat there. After time need for drying the jerky appears.

Link to comment
Share on other sites

I did some digging and found the source of the problem, but it's kinda technical for people not overly familiar with how the animation system works... So this one's for the devs!

 

Devs...

 

Entity models have "builds", which are collections of triangles linked to a particular texture image, and "banks", which are groups of related animations. Entity:AddAnimState() will configure an entity object with the necessary application-defined resources for representing the entity's model in-game. From here, Entity.AnimState:SetBuild() and Entity.AnimState:SetBank() come into play to configure how to interpret animations when called through Entity.AnimState:PlayAnimation() and Entity.AnimState:PushAnimation(). But you already knew this, because you're the devs.

 

AnimState also has an OverrideSymbol() method, which I admit I don't have a firm grasp of... The fact that Entity and AnimState are both full of C functions makes them harder to reverse-engineer, but doggonit, I'm that devoted to the cause! In any case, a cursory glance suggests that OverrideSymbol() is used to exchange an Anim.Anim.Frame.Element.Symbol identifier with a Build name and Build.Symbol identifier ("symbol" referring to an individual model within a build file). Please let me know how close I am. (-:

 

The Drying Rack problem stems from the fact that, until the fish meats came along, there was not a single type of dryable food item that used a symbol override when hung on a Drying Rack. An assumption was made in scripts/components/dryer.lua that uses the prefab name as the build name in a call to OverrideSymbol(), which worked until now because food items with unconfigured override symbols used their prefab names instead:

self.oncontinuecooking(self.inst, self.ingredient)

self.ingredient is the prefab name of the item hanging on the rack. scripts/prefabs/meatrack.lua's onstartdrying() method expects a build name, however:

local function onstartdrying(inst, build)    if not inst:HasTag("burnt") then        inst.AnimState:PlayAnimation("drying_pre")        inst.AnimState:PushAnimation("drying_loop", true)        inst.AnimState:OverrideSymbol("swap_dried", "meat_rack_food", build)        print("setting override symbol to ",build)    endend

For all dryable food items prior to Shipwrecked, this worked because the build name matched the prefab name. To get this to work for the fish meats, however, a short-term prefab needs to be spawned in order to retrieve the correct build name before calling Dryer.oncontinuecooking(). The following hack to dryer.lua will fix the problem:

local ent = SpawnPrefab(self.ingredient)local build = ent.components.dryable:GetOverrideSymbol()ent:Remove()self.oncontinuecooking(self.inst, build)

Not the most elegant solution, but it gets the job done. What I would do for a proper fix is to add a self.ingredient_build field to Dryer and have it save/load that instead.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.