Hailstone Glitch/Bug


D0x3r

Recommended Posts

I was playing Shipwrecked in the hurricane season, and while I was taming monkeys, I picked up a piece of hail that dramatically lowered my health, going from 139 to 11. This piece of hail did not hit me, but was on the ground. 

 

Here's a video on what happened in more detail:

 

 

Does anyone know why this happened? Or is it simply a bug?

Link to comment
Share on other sites

I was playing Shipwrecked in the hurricane season, and while I was taming monkeys, I picked up a piece of hail that dramatically lowered my health, going from 139 to 11. This piece of hail did not hit me, but was on the ground. 

 

Here's a video on what happened in more detail:

 

 

Does anyone know why this happened? Or is it simply a bug?

This is a bug that needs fixing badly. I was killed because I didn't know what was hitting me, and then Iwas murdered by stupid hail I picked up...

Link to comment
Share on other sites

Loaded up DS to see how the recent changes have altered the game and...

 

I just died to this stupid piece of hail, lying on the ground, that I ran into. My health went from 120 to 0 in about a second as I pushed it along the ground.

 

Damn well nearly killed me IRL too as I couldn't stop laughing for ages afterwards!

Link to comment
Share on other sites

I've had the same happen with hail, it took two times for me to figure out what actually happened, the first time I thought my boat had sunk or something because there was just the hit sound and I was instantly dead. The second time I survived two hits and died again. Makes it impossible to get past day 21/22 :/

Link to comment
Share on other sites

I've looked into the problem and can reproduce the symptoms programmatically, but it's not something that's supposed to be possible, so I'm not sure how it winds up happening on its own. But at least I know how to stop it.
 
BORING TECHNICAL STUFF BEGINS HERE
 
Entities in the game can have a Physics object associated with them, which is an application-defined thing that allows the entity to interact with other entities within the game engine. The functionality of Physics cannot be modified by the Lua scripting system, but it can be configured. Hail has two types of physics configurations: the usual inventory item variety, and the "falling out of the sky" variety.
 
The file scripts/prefabs/hail.lua doesn't define the hail item itself, but rather a hail spawner. Starting at line 126 is the code that is actually responsible for spawning hail, and line 140 is where the damage is coming from:

hail.Physics:SetCollisionCallback(function(inst, other)    if other and other.components.health then        other.components.health:DoDelta(-TUNING.HURRICANE_HAIL_DAMAGE, false, "hail")    endend)

This is the only place in the game where hail damage exists, so at least we can pin it down to one line of code. (-:
 
The way it's supposed to work is that should you happen to have hail fall on you from the sky, it will do some amount of damage currently defined as 1. Then, when the hail collides with the ground, it stops colliding with characters and stops dealing damage, behaving like a normal inventory item.
 
The switch from "falling out of the sky" to "inventory item" happens in scripts/prefabs/inv_rocks_ice.lua, line 68, which is in the "hit the ground" event handler for the Hail item:

MakeBlowInHurricane(inst)ChangeToInventoryPhysics(inst)

It's simple to see what it's doing: it makes the hail able to be blown about by the wind, and configures its Physics to act like an inventory item. If you comment out that second line, hail that falls from the sky will have the following new behaviors:

  • Any contact will damage the character.
  • You can kick it around like a soccer ball.
  • Picking it up will result in a few frames worth of constant damage until it's added to your inventory.
  • If wind blows it into a wall, it will damage and destroy the wall.

Sound familiar? These are all the symptoms people have been reporting.
 
There's just one issue that irks me: this isn't a typical reproduction of the bug. I had to modify the programming to get it to work. Somehow or other, during the normal course of gameplay, people are experiencing hail from the sky during storms that, for whatever reason, is never switching its physics configuration to the inventory item settings. I expect the root of this problem is actually in the C implementation for the Physics behavior, so I can't really take a look at that right now. Devs, halp!
 
BORING TECHNICAL STUFF ENDS HERE
 
On the other hand, we can stop the hail from being such a problem by forcing it to switch physics mode as soon as it first deals damage, which really is the behavior we want anyway. A little modification to scripts/prefabs/hail.lua can do just that:

hail.Physics:SetCollisionCallback(function(inst, other)    if other and other.components.health then        other.components.health:DoDelta(-TUNING.HURRICANE_HAIL_DAMAGE, false, "hail")        inst:PushEvent("onhitground")        inst.Physics:SetCollisionCallback(nil)    endend)

That first new line of code forces the hail to think it hits the ground once it does damage. The second new line disables the collision callback just in case, so it won't be possible to deal additional damage if all else fails. Maybe not the best solution, but it's a stopgap that should counteract any pertinent bugs in the Physics implementation.

Link to comment
Share on other sites

I'm not sure why, but I honestly don't get this issue. I went an entire Hurricane Season without being damaged by any Hail, and I collected like 200 pieces to fill up my Ice Box as filler food. It never destroyed any of my structures (although I never build walls so that helps me out). I never get any of these symptoms and it's interesting seeing the video posted here to see what others are experiencing. It looks much worse than the normal season I get (which is occasionally being hit in the head when I unequip my umbrella).

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.