Uses for every material (clay jar, bedroll, pelt rug, fang necklace, bear cloak, pemmican, bait), Q to drop, K/M bag rows on 1-8, help pages; protocol 14
This commit is contained in:
@@ -65,6 +65,10 @@ static func extra_of(stack: Dictionary) -> Dictionary:
|
||||
static var clock := 0.0
|
||||
static var day_seconds := 1200.0
|
||||
static var rot_speed := 1.0
|
||||
## How many times longer food keeps in here (a clay jar: 3), and the clock at
|
||||
## the last spoil() (the time since is what's slowed).
|
||||
var keep_mult := 1.0
|
||||
var _last_clock := -1.0
|
||||
const ROTTEN := "rotten_food"
|
||||
|
||||
static func _db() -> Node:
|
||||
@@ -110,6 +114,15 @@ func spoil() -> int:
|
||||
return 0
|
||||
var rotted := 0
|
||||
var touched := false
|
||||
# A clay jar (keep_mult 3): food in it ages at a third of the rate, so its
|
||||
# "rot" stamp moves back by two thirds of the time that's passed.
|
||||
if keep_mult > 1.0:
|
||||
if _last_clock >= 0.0 and clock > _last_clock:
|
||||
var later := (clock - _last_clock) * (1.0 - 1.0 / keep_mult)
|
||||
for s in slots:
|
||||
if s != null and s.has("rot") and float(s.rot) > _last_clock:
|
||||
s.rot = float(s.rot) + later
|
||||
_last_clock = clock
|
||||
for i in range(slots.size()):
|
||||
var s = slots[i]
|
||||
if s == null or keeps_days(String(s.id)) <= 0.0:
|
||||
|
||||
Reference in New Issue
Block a user