updates
This commit is contained in:
parent
4298caf5cb
commit
2e6638b744
19 changed files with 484 additions and 185 deletions
|
|
@ -20,8 +20,13 @@ extends SceneTree
|
|||
## | toggle_mic | M | - | Co-op |
|
||||
## | sprint (hold)| Shift | L3 (stick) | Sprint |
|
||||
## | weapon_next | Tab | D-pad down | Weapons |
|
||||
## | weapon_1..3 | 1, 2, 3 | - | Weapons |
|
||||
## The weapon keys are build mode's (build_next, build_1..3): outside build mode they pick weapons.
|
||||
## | weapon_1..2 | 1, 2 | - | Weapons |
|
||||
## | offhand | Right mouse | LT | Off-hand |
|
||||
## The weapon keys are build mode's (build_next, build_1..2): outside build mode they pick the
|
||||
## main weapon. offhand shares the right mouse button with cancel: in build mode it dismantles.
|
||||
## STALE actions, from earlier versions of this table, are removed.
|
||||
|
||||
const STALE: Array[String] = ["weapon_3"]
|
||||
|
||||
|
||||
func _initialize() -> void:
|
||||
|
|
@ -41,8 +46,11 @@ func _initialize() -> void:
|
|||
_action("toggle_mic", [_key(KEY_M)])
|
||||
_action("sprint", [_key(KEY_SHIFT), _joy(JOY_BUTTON_LEFT_STICK)])
|
||||
_action("weapon_next", [_key(KEY_TAB), _joy(JOY_BUTTON_DPAD_DOWN)])
|
||||
for i in 3:
|
||||
for i in 2:
|
||||
_action("weapon_%d" % (i + 1), [_key(number_keys[i])])
|
||||
_action("offhand", [_mouse(MOUSE_BUTTON_RIGHT), _axis(JOY_AXIS_TRIGGER_LEFT)])
|
||||
for a in STALE:
|
||||
ProjectSettings.clear("input/" + a)
|
||||
var err := ProjectSettings.save()
|
||||
print("configure_input: save -> %s" % error_string(err))
|
||||
quit(0 if err == OK else 1)
|
||||
|
|
@ -70,3 +78,10 @@ func _joy(button: JoyButton) -> InputEventJoypadButton:
|
|||
var e := InputEventJoypadButton.new()
|
||||
e.button_index = button
|
||||
return e
|
||||
|
||||
|
||||
func _axis(axis: JoyAxis) -> InputEventJoypadMotion:
|
||||
var e := InputEventJoypadMotion.new()
|
||||
e.axis = axis
|
||||
e.axis_value = 1.0
|
||||
return e
|
||||
|
|
|
|||
|
|
@ -11,12 +11,14 @@ extends SceneTree
|
|||
## (127.0.0.1), for networks where broadcasts reach this machine. --online plays over GD-Sync's
|
||||
## servers instead (needs the API keys): the partner finds the host's lobby in the online list.
|
||||
## --host-name=Ana names the host (and so its lobby, "Ana's farm"); give both sides the same one.
|
||||
## --address=192.168.1.20 joins a host at that address (LAN) instead of 127.0.0.1.
|
||||
|
||||
var role := "host"
|
||||
var seconds := 20.0
|
||||
var discover := false
|
||||
var online := false
|
||||
var host_name := "Ana"
|
||||
var address := "127.0.0.1"
|
||||
## --shot=path: a screenshot at night with the enemies in (needs a window, not --headless).
|
||||
var shot := ""
|
||||
var main: Main
|
||||
|
|
@ -35,6 +37,8 @@ func _initialize() -> void:
|
|||
online = true
|
||||
elif String(a).begins_with("--host-name="):
|
||||
host_name = String(a).trim_prefix("--host-name=")
|
||||
elif String(a).begins_with("--address="):
|
||||
address = String(a).trim_prefix("--address=")
|
||||
elif String(a).begins_with("--seconds="):
|
||||
seconds = float(String(a).trim_prefix("--seconds="))
|
||||
_run.call_deferred()
|
||||
|
|
@ -103,7 +107,7 @@ func _run() -> void:
|
|||
_check(true, "found %s %s" % [found[0]["name"], "online" if online else "on the network"])
|
||||
lobby.join(String(found[0]["name"]))
|
||||
else:
|
||||
lobby.join_address("127.0.0.1", "Ben")
|
||||
lobby.join_address(address, "Ben")
|
||||
if not await _wait(func() -> bool: return sim.coop.is_client() and sim.coop._is_welcomed, 40.0):
|
||||
_check(false, "joined and got the farm within 40 s")
|
||||
await _finish()
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ extends SceneTree
|
|||
## guard: it goes for the most urgent threat (carriers, then thieves
|
||||
## taking something, then dropped loot and loose animals, then other
|
||||
## thieves), attacks thieves in range with a clear line with its best
|
||||
## weapon (a pumpkin bomb into a crowd, the corn shooter once bought, else
|
||||
## the pitchfork, closing in to stab), uses fear on a
|
||||
## weapons (a pumpkin bomb from the off-hand into a crowd, and the corn
|
||||
## shooter once bought, else the pitchfork, closing in to stab), uses fear on a
|
||||
## carrier or a crowd in range, leads animals following it back to the pen
|
||||
## when no carrier is close, and patches up when hurt and nothing is close.
|
||||
## --minutes=10 night time to play (rounded up to whole nights)
|
||||
|
|
@ -458,8 +458,8 @@ func _guard() -> void:
|
|||
_walk_toward(goal, me)
|
||||
|
||||
|
||||
## Attacks the thief at target with the best weapon owned: a pumpkin bomb into a crowd of three
|
||||
## or more when one is ready, else the corn shooter, else the pitchfork (only within its reach).
|
||||
## Attacks the thief at target with the best weapons owned: a pumpkin bomb into a crowd of three
|
||||
## or more when one is ready, and the corn shooter, else the pitchfork (only within its reach).
|
||||
## Returns the distance it holds ground at.
|
||||
func _attack(target: Vector2, me: Vector2) -> float:
|
||||
var c := _sim.combat
|
||||
|
|
@ -470,8 +470,8 @@ func _attack(target: Vector2, me: Vector2) -> float:
|
|||
if es.alive[d] == 1 and Vector2(es.pos_x[d], es.pos_z[d]).distance_to(target) <= cfg.bomb_radius:
|
||||
crowd += 1
|
||||
var far := target.distance_to(me)
|
||||
if crowd >= 3 and c.bomb_left == 0.0 and far >= cfg.bomb_min_range and far <= cfg.bomb_range and c.equip(ScarecrowCombat.Weapon.PUMPKIN_BOMB):
|
||||
if c.attack_toward(target):
|
||||
if crowd >= 3 and c.offhand == ScarecrowCombat.Weapon.PUMPKIN_BOMB and far >= cfg.bomb_min_range and far <= cfg.bomb_range:
|
||||
if c.offhand_toward(target):
|
||||
_shots += 1
|
||||
if c.equip(ScarecrowCombat.Weapon.CORN_SHOOTER):
|
||||
if c.attack_toward(target):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue