Stil wählen, merken und fotografieren
F2 wechselt im Spiel den Stil und meldet ihn, --style=NAME wählt ihn beim Start, und das Spiel merkt sich die Wahl in den Einstellungen. Das Bildschirmfoto-Werkzeug nimmt Bilder in einem bestimmten Stil und von der Vitrine auf und zeigt eine zweite Figur mit Namen. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,8 @@ extends RefCounted
|
||||
## --host opens the world for guests at once
|
||||
## --port=PORT the port an open world listens on
|
||||
## --join=ADDRESS joins a host at once; ADDRESS may end in ":PORT"
|
||||
## --style=NAME draws the playing field in the style NAME: warm,
|
||||
## pastel or glow
|
||||
|
||||
## Longest profile name.
|
||||
const MAX_PROFILE_LENGTH := 32
|
||||
@@ -21,6 +23,8 @@ var player_name := ""
|
||||
var start := ""
|
||||
var port := NetLink.DEFAULT_PORT
|
||||
var address := ""
|
||||
## The style to draw in, or empty for the one in the settings.
|
||||
var style := &""
|
||||
## Arguments that were not understood and are ignored.
|
||||
var ignored := PackedStringArray()
|
||||
|
||||
@@ -50,6 +54,11 @@ static func parse(arguments: PackedStringArray) -> LaunchOptions:
|
||||
"--join":
|
||||
options.start = "join"
|
||||
options.address = value
|
||||
"--style":
|
||||
if Art.style_keys().has(StringName(value)):
|
||||
options.style = StringName(value)
|
||||
else:
|
||||
options.ignored.append(argument)
|
||||
_:
|
||||
options.ignored.append(argument)
|
||||
return options
|
||||
|
||||
@@ -83,6 +83,8 @@ func _ready() -> void:
|
||||
clock = TickClock.new(GwSession.TICKS_PER_SECOND)
|
||||
art = Art.new()
|
||||
art.load_overrides(Art.OVERRIDE_DIR)
|
||||
if not art.select(options.style):
|
||||
art.select(StringName(store.style()))
|
||||
map_view = MapView.new()
|
||||
map_view.art = art
|
||||
add_child(map_view)
|
||||
@@ -253,11 +255,13 @@ func _hide_showcase() -> void:
|
||||
showcase.process_mode = Node.PROCESS_MODE_DISABLED
|
||||
|
||||
|
||||
## Draws the playing field again after the style changed.
|
||||
## Draws the playing field again after the style changed, and remembers the
|
||||
## style for the next start.
|
||||
func _redraw_art() -> void:
|
||||
map_view.redraw()
|
||||
for node: Node2D in [marker, figures, avatar]:
|
||||
node.queue_redraw()
|
||||
store.set_style(String(art.style.key()))
|
||||
|
||||
|
||||
## Says in the status line how the game is shared, and with how many.
|
||||
@@ -390,6 +394,9 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
_set_paused(not clock.paused)
|
||||
else:
|
||||
hud.flash("PAUSE_ONLY_ALONE")
|
||||
elif event.is_action_pressed("next_style"):
|
||||
art.select_next()
|
||||
hud.flash("STYLE_SWITCHED", [tr(art.style.title_key())])
|
||||
|
||||
|
||||
## Goes back to the saved world. Only when playing alone: guests would no
|
||||
|
||||
@@ -146,6 +146,15 @@ func set_last_address(address: String) -> void:
|
||||
_set_setting("network", "address", address)
|
||||
|
||||
|
||||
## The key of the style the player chose last time, or an empty text.
|
||||
func style() -> String:
|
||||
return _setting("display", "style")
|
||||
|
||||
|
||||
func set_style(key: String) -> void:
|
||||
_set_setting("display", "style", key)
|
||||
|
||||
|
||||
func _setting(section: String, key: String) -> String:
|
||||
var settings := _read_settings(base_dir.path_join(SETTINGS_FILE))
|
||||
if settings == null:
|
||||
|
||||
Reference in New Issue
Block a user