P4 hazards: food spoilage with rot speed setting, smoking rack and salt, food poisoning, harsher blizzards, hard winters with lake ice, lightning on trees, snow on roofs (protocol 11)
This commit is contained in:
@@ -82,9 +82,27 @@ func set_stack(stack) -> void:
|
||||
_wear_fill.anchor_right = k
|
||||
_wear_fill.color = Color(0.85, 0.25, 0.2) if k < 0.2 else (Color(0.9, 0.75, 0.25) if k < 0.5 else Color(0.45, 0.8, 0.35))
|
||||
tooltip_text += "\n%d of %d uses left" % [left, full]
|
||||
elif stack.has("rot") and Inventory.keeps_for(String(stack.id)) > 0.0:
|
||||
# Food: a bar that runs down green to brown as it goes off.
|
||||
var k := Inventory.freshness(stack)
|
||||
_wear.visible = true
|
||||
_wear_fill.anchor_right = maxf(k, 0.04)
|
||||
_wear_fill.color = Color(0.45, 0.8, 0.35).lerp(Color(0.5, 0.33, 0.15), 1.0 - k)
|
||||
tooltip_text += "\n" + freshness_text(stack)
|
||||
else:
|
||||
_wear.visible = false
|
||||
|
||||
## "Fresh", "Going off (about 9 hours left)", "Nearly rotten (2 hours left)".
|
||||
static func freshness_text(stack) -> String:
|
||||
var k := Inventory.freshness(stack)
|
||||
var h := Inventory.hours_left(stack)
|
||||
var left := ("%d hours left" % roundi(h)) if h < 48.0 else ("%d days left" % roundi(h / 24.0))
|
||||
if k > 0.6:
|
||||
return "Fresh (%s)" % left
|
||||
if k > 0.2:
|
||||
return "Going off (%s)" % left
|
||||
return "Nearly rotten (%s)" % left
|
||||
|
||||
func set_selected(on: bool) -> void:
|
||||
add_theme_stylebox_override("panel", _selected_style if on else _style)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user