Give Me Your Bugs! - Dec17


Recommended Posts

Update: The latest version of the bug-fixing mod can be found on the other side of this link.

The current fixlist:

  • Endothermic Eggs - Tallbird eggs overheat near Endothermic campfires
  • Fearless Fighters - Some entities (like Koalefants) don't run away when they're supposed to
  • Firing Back - Attacking with Willow's Lighter or a Torch can set the user on fire
  • Hail from Hell - Freshly-fallen hail can be ludicrously destructive
  • Inventory Death Loot - Critters in inventory killed by feeding harmful foods will not properly give you their loot
  • Invisible Drying Fish - Fish items on Drying Racks become invisible after loading a game
  • Pesky Perishing Parrots - Stunned birds placed in inventory disappear when you click on them
  • Too Few Digits - The day counter on the save game detail screen only shows two digits

__________
 
Debugging the game is more fun than I thought, and I want to do more. If you have a bug you want fixed, let me know and I'll take a whack at it! Maybe we can save Klei and Capy some trouble when they go to fix them themselves. (-:
 
Fixed so far:
 
Bug: Some entities like Koalefants don't run away after the December 17 update. Link
Cause: RunAway:Visit() was changed to execute hunterparams as a function expecting an entity, but koalefantbrain passes a function that returns a boolean.
Temporary Fix: Rewrite RunAway to check for misconfigured hunterparams, and fudge a proper return value. Link
Better Fix: Rewrite Koalefant, Floaty Boaty Knight and any other entity that passes a boolean-returning function to RunAway's hunterparams field.
 
Bug: Night Lights don't light after the December 17 update. Link
Cause: nightlight_flame was excluded from prefablist.lua, as was paired_maxwelllight (needed for the adventure epilogue).
Fix: Add nightlight_flame and paired_maxwelllight back into prefablist.lua Link
 
Bug: Fish meat items become invisible on Drying Racks when you reload the game. Link
Cause: Dryer:Load() was passing the prefab name to oncontinuecooking(), which expects a build name for use in AnimState:OverrideSymbol()
Temporary Fix: Rewrite Dryer:OnLoad() to spawn a temporary entity using the prefab and retrieve its override symbol. Link
Better Fix: Save the override symbol name as its own field in Dryer.
 
Bug: Endothermic Fires near a Tallbird Egg still function like hot fires. Link
Cause: Hatchable:OnUpdate() does not distinguish between hot and cold campfires.
Temporary Fix: Rewrite Hatchable:OnUpdate() to exclude Endothermic campfires. Link
Better Fix: Rewrite Hatchable:OnUpdate() to incorporate Endothermic campfires and season.
 
Bug: A bird, once attacked, stunned and picked up, will delete itself from your inventory when you click on it. Link
Cause: Stunned birds don't stop being tracked by the BirdSpawner, which causes some sort of error in Physics:SetActive() and AnimState:Resume().
Fix: Modify SGbird to stop tracking when it enters its hit state. Link
 
Bug: Attacking with a Torch or Willow's Lighter will occasionally set the user on fire. Link
Cause: Calls to Weapon:SetAttackCallback() are passing functions that accept incorrect arguments.
Temporary Fix: Modify Weapon:SetAttackCallback() to fudge the correct arguments back to the custom handler function. Link
Better Fix: Modify Torch and Willow's Lighter to accept the correct arguments.
 
Bug: The text that shows the day count on the save slot detail screen isn't wide enough for more than two digits in a Shipwrecked game. Link
Cause: Between "Shipwrecked" and the font size, there isn't enough horizontal space for three digits of days.
Fix: Slightly decrease the font size. Link

Bug: Killing a pet in inventory by feeding it harmful food will not produce any loot. Link
Cause: LootDropper isn't configured to drop loot into an owner's inventory.
Temporary Fix: Force a killed pet to starve instead of die the normal way. Link
Better Fix: Modify LootDropper to correctly handle owner inventory situations. Link

Bug: Freshly-generated hail occasionally deals an inordinate amount of damage to players and walls. Link
Cause: Somehow certain hailstones don't trigger their onhitground event properly.
Temporary Fix: Force the onhitground event when damage is dealt, and forcibly disable damage. Link
Better Fix: Find out what in the Physics implementation isn't triggering that onhitground event.

Link to comment
Share on other sites

Endothermic fire (and endothermic firepits) heat Tallbird eggs, hatch 'em and make 'em all sweaty when it's supposed to be cold fire.

 

I never knew...

 

scripts/components/hatcher.lua contains the code for determining a Tallbird Egg's temperature sensation. The problem with Endothermic fires is that Hatchable makes no distinction between them and regular Campfires (obviously):

 

local fire = FindEntity(self.inst, TUNING.HATCH_CAMPFIRE_RADIUS, function(thing)     return thing:HasTag("campfire") and thing.components.burnable and thing.components.burnable:IsBurning()end)local hasfire = (fire ~= nil)

 

After a source of fire is determined, it can determine the egg's temperature:

  • If near a fire at day, too hot
  • If not near a fire at day, just right
  • If near a fire at night, just right
  • If not near a fire at night, too cold
  • If dusk, just right

That's it. Season does not affect whether a Tallbird egg will overheat or freeze or anything--only the time of day and whether there is a fire nearby.

 

A proper fix would incorporate the season and the type of fire that's nearby, such that winter time not near a fire during the day will freeze it, and summertime near an Endothermic Fire during the day will keep it comfortable... If there's demand for such a fix, I'll make a mod for it. (-:

 

A quick-and-dirty fix for the "overheats next to an Endothermic Fire" thing is to modify hatchable.lua line 81 to check if the fire in question is from one of the Endothermic prefabs:

 

local hasfire = (fire ~= nil and fire.prefab:match("coldfire") == nil)

 

Excluding the Endothermic Fires directly will prevent this troublesome behavior.

Link to comment
Share on other sites

 I might be doing something wrong here, but it seems like adding nightlight_flame and paired_maxwelllight crashes saves. I add them in the prefablist in ABC order, correct?

 

It doesn't really matter where in the list they go, so long as they're quoted and comma-delimited. The following will work:

-- Generated by exportprefabs.luaPREFABFILES = {  "abigail", "nightlight_flame", "paired_maxwelllight",
Link to comment
Share on other sites

 

It doesn't really matter where in the list they go, so long as they're quoted and comma-delimited. The following will work:

-- Generated by exportprefabs.luaPREFABFILES = {  "abigail", "nightlight_flame", "paired_maxwelllight",

 Thank you. It doesn't crash anymore (I found out that it was because of another problem I caused).

Link to comment
Share on other sites

 

I never knew...

 

scripts/components/hatcher.lua contains the code for determining a Tallbird Egg's temperature sensation. The problem with Endothermic fires is that Hatchable makes no distinction between them and regular Campfires (obviously):

 

local fire = FindEntity(self.inst, TUNING.HATCH_CAMPFIRE_RADIUS, function(thing)     return thing:HasTag("campfire") and thing.components.burnable and thing.components.burnable:IsBurning()end)local hasfire = (fire ~= nil)

 

After a source of fire is determined, it can determine the egg's temperature:

  • If near a fire at day, too hot
  • If not near a fire at day, just right
  • If near a fire at night, just right
  • If not near a fire at night, too cold
  • If dusk, just right

That's it. Season does not affect whether a Tallbird egg will overheat or freeze or anything--only the time of day and whether there is a fire nearby.

 

A proper fix would incorporate the season and the type of fire that's nearby, such that winter time not near a fire during the day will freeze it, and summertime near an Endothermic Fire during the day will keep it comfortable... If there's demand for such a fix, I'll make a mod for it. (-:

 

A quick-and-dirty fix for the "overheats next to an Endothermic Fire" thing is to modify hatchable.lua line 81 to check if the fire in question is from one of the Endothermic prefabs:

 

local hasfire = (fire ~= nil and fire.prefab:match("coldfire") == nil)

 

Excluding the Endothermic Fires directly will prevent this troublesome behavior.

 

It works, thanks a lot ! I've been looking and asking for a solution for months in vain, providence brought you for sure. 

 

Tallbird eggs adapting according to the seasons would be really cool but quite a task, I'm entirely satistified with this simple fix. Tell me if you intend to do it a mod though ! 

Link to comment
Share on other sites

When you catch a pirate parrot, pick it up, and click on it in your inventory, it disappears.

 

This was a tricky one to track down, so I'm not surprised it hasn't been fixed yet. It isn't just parrots this happens with--it's any kind of bird, and it's been happening since the dawn of time. We just never knew about it.

 

BORING TECHNICAL STUFF BEGINS HERE

 

Prior to Shipwrecked, any bird that wasn't killed by an attack would return to its idle state. The only way you could do this would be to sneak up on it while it was sleeping at night and hit it with a Bug Net or something, in which case it would return to its idle state, notice you were so close, then fly away.

 

In Shipwrecked, scripts/stategraphs/SGbird.lua was changed so that it transitions from "hit" to "stunned" rather than from "hit" to "idle", meaning any bird that isn't outright killed by an attack will be incapacitated temporarily. This was almost certainly implemented to accommodate the Eyeshot, which is just about the only weapon you can hit a bird with that won't kill it. But hitting it with a Bug Net while it's sleeping will have the same effect.

 

Modifying SGbird.lua to transition from "hit" to "stunned" in the base game causes this bug to occur as well. I picked up a stunned Crow, which deleted itself when I clicked on it from inventory.

 

Spawning birds directly with c_spawn() doesn't trigger the error, which told me it had something to do with BirdSpawner. Defined in scripts/components/birdspawner.lua, the BirdSpawner is a component of the world prefab that is responsible for, you know, spawning birds. It looks for the player character and, if there aren't already enough birds spawned for him, spawns one. In order to determine whether the maximum number of spawned birds has been reached, it tracks them--something c_spawn() doesn't do.

 

Logically, the BirdSpawner should stop tracking spawned birds once they fly away. That way, more birds can be spawned. This is handled by scripts/prefabs/birds.lua, which tells the BirdSpawner to stop tracking it once it (the bird) is deleted. This happens if you kill it, or if it flies away as specified in the stategraph. It also happens when a bird is trapped in a Bird Trap, since the entity that triggered the trap is actually deleted as soon as the trap is sprung.

 

No problems with tracking in any of those implementations...

 

Picking up a bird stunned with an Eyeshot, on the other hand, has no special accommodation for the BirdSpawner's tracking mechanism. While I don't fully understand why the application throws an internal error when clicking on a tracked bird in inventory (it occurs on lines 128 and 134 in scripts/entityscript.lua if you want to look into it), I imagine it has something to do with the fact that a tracked bird is configured to not persist when the game is shut down.

 

BORING TECHNICAL STUFF ENDS HERE

 

Long story short, the ultimate cause of the bug is putting a bird into your inventory that's currently being tracked by the BirdSpawner. The fix, therefore, is to stop tracking a bird before you put it in your inventory.

 

This can most easily be done by editing scripts/stategraphs/SGbird.lua. I figure, since a stunned bird will immediately fly away once it regains its composure, and the only way a tracked bird can enter the stunned state is if you attack it, then a quick patch to the hit state's handler should do the trick. What that currently looks like is on line 297:

 

onenter = function(inst)    inst.AnimState:PlayAnimation("hit")    inst.Physics:Stop()    local pt = Vector3(inst.Transform:GetWorldPosition())    if pt.y > 1 then        inst.sg:GoToState("fall")    endend,

 

That function is executed when the bird's state becomes "hit". We can add one simple little line to cause BirdSpawner to stop tracking it:

 

onenter = function(inst)    inst:PushEvent("onremove", {})    inst.AnimState:PlayAnimation("hit")

 

Since the bird is already configured to listen for onremove events and stop tracking on its own, that little patch will prevent it from being tracked before it ever goes into your inventory, solving the problem of indiscriminate deletion.

 

And that, my friends, is how to prevent the pesky problem of perishing parrots.

Link to comment
Share on other sites

Sorry if this is me asking too much, but do you know how to bring back the Summer and Winter DSP?

I don't, unfortunately. It's handled through scripts/components/seasonmanager.lua, and all the configurations look like they're still in there. My guess is something may have gotten disabled in TheMixer:SetHighPassFilter() and TheMixer:SetLowPassFilter(). Those are C functions, though, and my efforts disassembling the executable at runtime haven't proven to be particularly fruitful, so I can't look into it any further than that.

 

The same DSP parameters are present in Don't Starve Together, though they're handled through scripts/components/dsp.lua instead, and likewise don't appear to be functioning. Right now, my money's on the C implementation of TheMixer, and I can't fix that from here at this time.

Link to comment
Share on other sites

If you equip Willow's Lighter on a log raft (other boats?) the lighter flame never goes away or stops working until you reload.

 

 

I can't reproduce this bug. Could you give me some instructions on how to trigger it? Doing exactly what you said doesn't seem to cause any problems.

 

 

Also, Willow catches on fire sometimes when hitting mobs with a lighter.

 

 

Certain weapons are configured with special "onattack" event handlers so they can perform special tasks when used in combat.This is handled through scripts/components/weapon.lua, the Weapon component, which can accept a custom event handler function via Weapon.onattack, Weapon:SetOnAttack() or Weapon:SetAttackCallback().

 

The correct function prototype for onattack is as follows (pardon the pseudo-C syntax):

 

void onattack(    weapon,    attacker,    target);

 

That is to say, the weapon itself goes first, followed by the entity doing the attacking, followed by the entity being attacked. scripts/prefabs/lighter.lua, the definition for Willow's Lighter, uses it like this:

 

inst.components.weapon:SetAttackCallback(    function(attacker, target)        if target.components.burnable then            if math.random() < TUNING.LIGHTER_ATTACK_IGNITE_PERCENT*target.components.burnable.flammability then                target.components.burnable:Ignite()            end        end    end)

 

It's easy to see what it's supposed to do: it's supposed to have a chance of setting the target on fire. Note how the function being passed to Weapon:SetAttackCallback() only accepts two arguments: attacker and target. Recall the actual function prototype, where the weapon comes first. When this function is actually called, "attacker" is Willow's Lighter and "target" is Willow because it's being used wrong. The result is that it has a chance of setting Willow on fire!

 

The obvious fix here is to correct the function to include the weapon argument, but the problem doesn't stop there: I went through every weapon prefab (don't worry, I had grep for that) and found that all weapons that use Weapon:SetAttackCallback() have this same bug. It's even present in Don't Starve Together, meaning it's been around for a while. I imagine it's a really old holdover from the days before Weapon:SetOnAttack() came about, and they never went back to update the prefabs that were using it.

 

BROKEN! The following weapons suffer from this bug:

  • Morning Star, although the custom event handler is commented out
  • Torch
  • Willow's Lighter

Weapons that use Weapon:SetOnAttack(), on the other hand, are programmed correctly. Only Bat Bat uses Weapon.onattack directly, and it's programmed correctly as well.

 

There are two ways to fix this problem: the right way and the lazy way.

  • The Right Way - Correct the scripts for Morning Star, Torch and Willow's Lighter to include the weapon entity in their custom onattack event handlers.
  • The Lazy Way - Modify Weapon to wrap an intermediate function around the actual event handler when set via SetAttackCallback().

We're going to do this the lazy way. In scripts/components/weapon.lua, line 68, we've got this:

 

function Weapon:SetAttackCallback(fn)    self.onattack = fnend

 

One minor tweak will fix the problem:

 

function Weapon:SetAttackCallback(fn)    self.onattack = function(weapon, ...) fn(...) endend

 

This will explicitly discard the first argument, representing the weapon entity, and pass only the attacker and target to the intended event handler function. Since this bug is present in all prefabs that use Weapon:SetAttackCallback(), this is a simple fix for all of them.

Link to comment
Share on other sites

Nice thread dude.
There is a bug that sometimes causes hail to damage the player when walked over. (I assume it should only damage the player when falling) And there is a much more rare bug where hail will permanently damage the player until they die. (nothing stops this damage even relogging)

 

Here is a link to people talking about the first one, but I haven't the slightest clue how to help you reproduce the much more deadly second version.

Link to comment
Share on other sites

there's a minor visual issue in the save game menu. the last digit is cut off once someone survived beyond 99 days.

 

my save file is 204 days and I only see 1-20.

 

solution: either give the window more width or lower the font size.

post-352107-0-57274900-1451921033_thumb.

Link to comment
Share on other sites

solution: either give the window more width or lower the font size.

 

Sounds like you could have fixed this one yourself. (-:

 

While I don't have a save file with a three-digit number of days, the fix is still valid. In scripts/screens/slotdetailscreen.lua, line 47, the size of the text is specified:

self.text = self.root:AddChild(Text(TITLEFONT, 60))

That 60 in there is the font size, which of course is indefinite because it's scaled with the size of the parent container, but relative to the window it's a part of, it's still slightly too big.

 

Change it to something like 50 and it should give you plenty of room for a couple more digits:

self.text = self.root:AddChild(Text(TITLEFONT, 50))

post-331005-0-07389400-1451930206_thumb.

post-331005-0-14612000-1451930209_thumb.

Link to comment
Share on other sites

EVERY time that I jump onto a raft or boat of any kind, all of my sand and bone shards are lost.

 

I am not able to reproduce this on my end. Do you have more information on how to reliably cause it to happen, or perhaps a save file where it happens every time you load?

 

 

Fixt.

Bug: Meat cannot be placed on drying racks, I bring the meat over to it, and the interaction doesn't come up, like they're not there.

That sounds an awful lot like this. Does that help, or is this a different issue?

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.