Page 1 of 1

[Rseding] [0.18.2] (Minor) Item stack with 0% health builds indestructible entities.

Posted: Thu Feb 06, 2020 12:01 pm
by eradicator
Reproduction:
  1. Take any buildable item stack (furnace, chest, w/e)
  2. Apply /c game.player.cursor_stack.health = 0
  3. Placed entity will have 0/MAX health and thus be indestructible.
Expected behavior:
I guess stacks with 0% health should be blocked from being built? Plain out deleting them could break mods (i.e. if they supply other means of repairing items).

Re: [Rseding] [0.18.2] (Minor) Item stack with 0% health builds indestructible entities.

Posted: Fri Feb 07, 2020 5:50 pm
by Rseding91
Thanks for the report. I see 3 "ok" options:

1. I disallow 0% health items
2. I make entities built with 0% health instant die
3. I do nothing and leave it as is

Adding in extra logic to prevent building with 0% health items just isn't viable. Because it would also have to be done for robots and then you would wonder "why is the robot not using this item to build" and the logistic network has no concept of item health so it would never know to *not* use a given item. It's just overly complicated for such a minor issue.

Re: [Rseding] [0.18.2] (Minor) Item stack with 0% health builds indestructible entities.

Posted: Fri Feb 07, 2020 7:20 pm
by eradicator
"2) instant death" in combination with construction robots sounds like the worst option - they'd build something and it instantly explodes and becomes a ghost again.

"1)" makes the most logical sense, but what would happen instead? error if health=0 but ok if health=0.000000001?

I'd be fine with "3)" too, at least it's documented now for future reference.

What about 4): Any new building has at least 1 health - which is what already happens if the stack has 0.000000001 health.

Re: [Rseding] [0.18.2] (Minor) Item stack with 0% health builds indestructible entities.

Posted: Fri Feb 07, 2020 7:33 pm
by valneq
eradicator wrote: Fri Feb 07, 2020 7:20 pm What about 4): Any new building has at least 1 health - which is what already happens if the stack has 0.000000001 health.
+1 for option 4.

This is what I would expect as a naive user. For the normal user it is not possible to differentiate a stack with 0 health or with 0.000000001 health, since the only indicator (that I am aware of) is the green health bar. Getting a stack with exactly 0 health without scripting or modding is yet another issue. But once you have them, finding their behavior to be different (instant destruction vs. construction with 1 hitpoint) can be very confusing.

Re: [Rseding] [0.18.2] (Minor) Item stack with 0% health builds indestructible entities.

Posted: Fri Feb 07, 2020 8:28 pm
by Rseding91
I would also be ok with giving the entity 1 health minimum. Or leaving it as is; either's fine with me.

Re: [Rseding] [0.18.2] (Minor) Item stack with 0% health builds indestructible entities.

Posted: Fri Feb 07, 2020 9:29 pm
by eradicator
Rseding91 wrote: Fri Feb 07, 2020 8:28 pm giving the entity 1 health minimum.
I prefer that. It prevents the player from manually building entities in "weird" states while not preventing (breaking) mods from doing it anyway if they really want to.

Re: [Rseding] [0.18.2] (Minor) Item stack with 0% health builds indestructible entities.

Posted: Fri Feb 07, 2020 10:57 pm
by Rseding91
Ok, I changed it for the next release. Now entities built from items will always have a minimum of 1 health.

Re: [Rseding] [0.18.2] (Minor) Item stack with 0% health builds indestructible entities.

Posted: Sat Feb 08, 2020 3:39 pm
by eradicator
Thanks for the fix.