UI and other changes
This commit is contained in:
parent
87b5c11fcf
commit
215e24e246
79 changed files with 70023 additions and 2201 deletions
|
|
@ -5,12 +5,12 @@ extends RefCounted
|
|||
## shooter and pumpkin bombs bought at the supply shed, not the workbench (rapid fire and heavy
|
||||
## seeds, bought at the workbench, need the corn shooter first; a weapon bought goes into its
|
||||
## hand, bombs into the off-hand); switching the main
|
||||
## weapon (Tab / 1-2, owned ones only, not in build mode, never the bombs; one no longer owned
|
||||
## weapon (Tab / the number keys, owned ones only, not in build mode, never the bombs; one no longer owned
|
||||
## falls back to the pitchfork); the off-hand on its own button (right mouse / LT: with the main
|
||||
## weapon in hand, both at once, held, not with the right click that leaves build mode); a bomb's
|
||||
## throw (at the aim, its range clamped), flight, and burst (everything in its radius, crows too,
|
||||
## nothing beyond, not the scarecrow), its recharge and the morning refill; the models on the
|
||||
## scarecrow; the HUD's weapon panel; the shed's other weapons; the Propane Torch's band of
|
||||
## scarecrow; the HUD's hotbar; the shed's other weapons; the Propane Torch's band of
|
||||
## fire and its flame (#17); and the Alien Ray's beam (#18).
|
||||
|
||||
const DT := 1.0 / 60.0
|
||||
|
|
@ -172,8 +172,15 @@ func _switching(r: GameTestRunner, sim: FarmSim) -> void:
|
|||
var first := c.weapon
|
||||
_tap(sim, "weapon_2")
|
||||
r.check(first == W.PITCHFORK and c.weapon == W.CORN_SHOOTER, "1-2 pick one")
|
||||
r.check(c.equip(W.PUMPKIN_BOMB) and c.weapon == W.CORN_SHOOTER and not InputMap.has_action("weapon_3"),
|
||||
"the bombs never take the main hand (and there's no third weapon key)")
|
||||
r.check(c.equip(W.PUMPKIN_BOMB) and c.weapon == W.CORN_SHOOTER, "the bombs never take the main hand")
|
||||
s.upgrades["shurikens"] = 1 # owned: pitchfork, corn shooter, shurikens (no potato cannon)
|
||||
_tap(sim, "weapon_3")
|
||||
var third := c.weapon
|
||||
_tap(sim, "weapon_4")
|
||||
r.check(c.owned_main() == [W.PITCHFORK, W.CORN_SHOOTER, W.SHURIKENS] and third == W.SHURIKENS and c.weapon == W.SHURIKENS,
|
||||
"a number key picks that slot of the weapons owned (3: the shurikens), one past them does nothing")
|
||||
s.upgrades.erase("shurikens")
|
||||
_step(sim, 1)
|
||||
c.equip(W.PITCHFORK)
|
||||
var east := AT + Vector2(5.0, 0.0)
|
||||
_step(sim, c.stab_ticks())
|
||||
|
|
@ -310,24 +317,28 @@ func _bombs(r: GameTestRunner, sim: FarmSim) -> void:
|
|||
func _hud(r: GameTestRunner, farm: Node3D, sim: FarmSim) -> void:
|
||||
var hud := farm.get_node("Hud/ScarecrowHud") as ScarecrowHud
|
||||
var c := sim.combat
|
||||
var cfg := sim.config
|
||||
var s := sim.campaign.state
|
||||
var shown := func() -> Array:
|
||||
return hud.slots().map(func(d: Dictionary) -> Array: return [d["weapon"], d["key"], d["offhand"], d["selected"]])
|
||||
s.upgrades.erase("corn_shooter")
|
||||
c.ready_for_morning()
|
||||
_step(sim, 1)
|
||||
hud._process(0.0)
|
||||
var charged: Array = hud._offhand_rows.map(func(l: Label) -> String: return l.text)
|
||||
var start: Array = shown.call()
|
||||
r.check(start == [[W.PITCHFORK, 1, false, true], [W.PUMPKIN_BOMB, 0, true, true]],
|
||||
"the hotbar shows only what's owned: the pitchfork on 1, in hand, then the bombs, ready: %s" % [start])
|
||||
c.offhand_toward(AT + Vector2(6.0, 0.0))
|
||||
hud._process(0.0)
|
||||
var rows: Array = hud._weapon_rows.map(func(l: Label) -> String: return l.text)
|
||||
var off: Array = hud._offhand_rows.map(func(l: Label) -> String: return l.text)
|
||||
r.check(rows == ["1 Pitchfork", "2 Corn shooter (supply shed)", "Potato cannon (supply shed)",
|
||||
"Shurikens (supply shed)", "Propane torch (supply shed)", "Alien ray (supply shed)"],
|
||||
"the HUD lists the main weapons, the first two by number (no more number keys): %s" % [rows])
|
||||
r.check(charged == ["Pumpkin bombs"] and off == ["Pumpkin bombs %.0f s" % ceilf(cfg.bomb_cooldown)],
|
||||
"and the off-hand's bombs, with their recharge: %s, %s" % [charged, off])
|
||||
r.check(hud._weapon_title.visible and hud._weapon_hint.text.contains("Tab") and hud._offhand_title.text.contains("right mouse"),
|
||||
"with how to switch, and the off-hand's button")
|
||||
r.check(not hud.slots()[1]["selected"], "a bomb recharging isn't lit")
|
||||
s.upgrades["corn_shooter"] = 1
|
||||
s.upgrades["propane_torch"] = 1
|
||||
c.equip(W.PROPANE_TORCH)
|
||||
var mains: Array = shown.call().filter(func(a: Array) -> bool: return not a[2])
|
||||
r.check(mains == [[W.PITCHFORK, 1, false, false], [W.CORN_SHOOTER, 2, false, false], [W.PROPANE_TORCH, 3, false, true]],
|
||||
"bought weapons join it in order, numbered by their key, the one in hand lit: %s" % [mains])
|
||||
sim.build.set_active(true)
|
||||
r.check(hud.slots().is_empty(), "it gives way to the build hotbar in build mode")
|
||||
sim.build.set_active(false)
|
||||
s.upgrades.erase("propane_torch")
|
||||
s.upgrades.erase("corn_shooter")
|
||||
s.upgrades.erase("pumpkin_bomb")
|
||||
_step(sim, 1)
|
||||
sim.bombs.clear()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue