UI and other changes

This commit is contained in:
Forrest 2026-10-07 13:41:38 -04:00
parent 87b5c11fcf
commit 215e24e246
79 changed files with 70023 additions and 2201 deletions

View file

@ -1,7 +1,7 @@
--- ---
name: impl-worker name: impl-worker
description: Implements one task from docs/tasks.md per docs/plan.md, then runs its verification step description: Implements one task from docs/tasks.md per docs/plan.md, then runs its verification step
model: sonnet model: opus
isolation: worktree isolation: worktree
--- ---

View file

@ -98,9 +98,10 @@ pack (`assets/farm/ithappy/farm/prefabs/assets/`).
with the **pitchfork** (melee: a stab every 0.5 s at the nearest few enemies in reach and in with the **pitchfork** (melee: a stab every 0.5 s at the nearest few enemies in reach and in
front). The **corn shooter** (the prototype's gun, through `FarmProjectiles`) and **pumpkin front). The **corn shooter** (the prototype's gun, through `FarmProjectiles`) and **pumpkin
bombs** (thrown, bursting over 3 m: `PumpkinBombs`) are workbench upgrades. The pitchfork and bombs** (thrown, bursting over 3 m: `PumpkinBombs`) are workbench upgrades. The pitchfork and
corn shooter are main weapons (fire; switch with Tab / d-pad down or 1-2 outside build mode); corn shooter are main weapons (fire; switch with Tab / d-pad down, or the number keys 1-6 outside
build mode, key k picking the k-th weapon owned);
the bombs sit in the off-hand, thrown with right mouse / LT. The models are the user's (`assets/weapons/`, posed on the bombs sit in the off-hand, thrown with right mouse / LT. The models are the user's (`assets/weapons/`, posed on
the scarecrow by `WeaponModels`); the HUD's weapon panel (bottom right) shows them. Shots, the the scarecrow by `WeaponModels`); the HUD's hotbar (bottom center) shows the ones owned. Shots, the
corn shooter, and enemy hit proxies sit at 1.8 m, above the sunflowers and the pen fence. corn shooter, and enemy hit proxies sit at 1.8 m, above the sunflowers and the pen fence.
* **Campaign** — `CampaignController` (`game/scripts/campaign_controller.gd`) runs the thirty-night * **Campaign** — `CampaignController` (`game/scripts/campaign_controller.gd`) runs the thirty-night
vacation (`GameConfig.campaign_nights`): Morning → Day → Dusk → Night → Dawn per night, then vacation (`GameConfig.campaign_nights`): Morning → Day → Dusk → Night → Dawn per night, then
@ -108,9 +109,9 @@ pack (`assets/farm/ithappy/farm/prefabs/assets/`).
persists; settings are in `game/resources/game_config.tres` (`GameConfig`). The rules are in persists; settings are in `game/resources/game_config.tres` (`GameConfig`). The rules are in
[`game/RULES.md`](game/RULES.md) and the development plan in [`game/RULES.md`](game/RULES.md) and the development plan in
[`first-game-plan.md`](first-game-plan.md). `CampaignDebug` is a debug readout of the phase and [`first-game-plan.md`](first-game-plan.md). `CampaignDebug` is a debug readout of the phase and
farm state, hidden until F1. Debug keys: F6 ends the current phase, F7 cycles 1× / 5× / 20× farm state, hidden until F1. Debug keys: F4 unlocks everything (every upgrade and shop item at
speed, F8 unlocks everything (every upgrade and shop item at its last level, free; its last level, free; `CampaignDebug.unlock_all`; not F8, Godot's Stop shortcut when run from
`CampaignDebug.unlock_all`), F9 sets the scarecrow to 0 HP, F10 strips the farm (every category), R retries after a the editor), F6 ends the current phase, F7 cycles 1× / 5× / 20× speed, F9 sets the scarecrow to 0 HP, F10 strips the farm (every category), R retries after a
Game Over, and T / G / H send in a thief / a crow / a fence breaker. F2 cycles tonight's plan Game Over, and T / G / H send in a thief / a crow / a fence breaker. F2 cycles tonight's plan
through the debug scenarios (`game/resources/scenarios/`). They introduce the enemies one type at through the debug scenarios (`game/resources/scenarios/`). They introduce the enemies one type at
a time (crows, thieves, fence breakers), then pairs, then all three. In the morning review, a time (crows, thieves, fence breakers), then pairs, then all three. In the morning review,
@ -123,8 +124,9 @@ pack (`assets/farm/ithappy/farm/prefabs/assets/`).
of invulnerability after a hit (the model blinks, the screen tints), fear (Q / LB: enemies of invulnerability after a hit (the model blinks, the screen tints), fear (Q / LB: enemies
within 6 m flee for 2 s, carriers drop their loot, 12 s cooldown), patching up (hold F / Y: within 6 m flee for 2 s, carriers drop their loot, 12 s cooldown), patching up (hold F / Y:
rooted 2 s for +3 HP, cancelled by a hit or letting go), and the fall at 0 HP. Thieves hit it rooted 2 s for +3 HP, cancelled by a hit or letting go), and the fall at 0 HP. Thieves hit it
when touching it, and fence breakers when fighting it (`EnemySystem.evaluate_attacks`). `ScarecrowHud` shows health pips, the fear when touching it, and fence breakers when fighting it (`EnemySystem.evaluate_attacks`). `ScarecrowHud` shows the portrait (top
cooldown, and the patch hint. The scarecrow still looks like the farmer mannequin; left) in a ring that is fear's charge, a health bar with a segment per point of max health, and
(once Sprint is bought) the sprint's stamina. The scarecrow still looks like the farmer mannequin;
its look comes later. `game/tools/soak_night.gd` plays nights headless with a scripted its look comes later. `game/tools/soak_night.gd` plays nights headless with a scripted
scarecrow (`--mode=idle | guard`, `--thieves=N`) and prints what was stolen, recovered, and scarecrow (`--mode=idle | guard`, `--thieves=N`) and prints what was stolen, recovered, and
lost; `--mode=gather` plays a day of gathering everything and reports the time and yield; lost; `--mode=gather` plays a day of gathering everything and reports the time and yield;
@ -138,7 +140,8 @@ pack (`assets/farm/ithappy/farm/prefabs/assets/`).
`Interactions` (`game/scripts/interactions.gd`) handles the interact action: hold at a `Interactions` (`game/scripts/interactions.gd`) handles the interact action: hold at a
`GatherNode` (4 per material, made of the zone's props) to gather by day; press at the `GatherNode` (4 per material, made of the zone's props) to gather by day; press at the
`Workbench` (work area table) to open the upgrade menu (`UpgradePanel`). Patching costs 2 straw. `Workbench` (work area table) to open the upgrade menu (`UpgradePanel`). Patching costs 2 straw.
Points grow back overnight; `ResourceHud` (top right) shows the shed and pouch. Costs live in Points grow back overnight; `ResourceHud` (bottom left) is the backpack with the pouch's count;
I / R3 opens the pouch panel (what's carried, and the shed's stock). Costs live in
`GameConfig.costs`. `GameConfig.costs`.
* **Upgrades** — `Upgrades` (`upgrades.gd`) holds the eleven upgrades in `GameConfig.upgrades`: * **Upgrades** — `Upgrades` (`upgrades.gd`) holds the eleven upgrades in `GameConfig.upgrades`:
@ -158,7 +161,7 @@ pack (`assets/farm/ithappy/farm/prefabs/assets/`).
open pen lets one wander out every few seconds; the pen's gate is a normal gate structure, standing open pen lets one wander out every few seconds; the pen's gate is a normal gate structure, standing
from the start (`GameConfig.start_structures`). `ShedStock` (`shed_stock.gd`) shows the shed's from the start (`GameConfig.start_structures`). `ShedStock` (`shed_stock.gd`) shows the shed's
stock as piles of logs, crates, and hay that grow and shrink with it, and gives supply thieves a stock as piles of logs, crates, and hay that grow and shrink with it, and gives supply thieves a
spot at each pile. `AssetHud` (top center) shows "Crops · Animals · Supplies", flashing on change. spot at each pile. The pause menu shows "Crops · Animals · Supplies".
Rules: `game/RULES.md`; the piles: `game/LAYOUT.md`. Rules: `game/RULES.md`; the piles: `game/LAYOUT.md`.
* **Construction** — `StructureSystem` (`game/scripts/structure_system.gd`) validates, places, * **Construction** — `StructureSystem` (`game/scripts/structure_system.gd`) validates, places,
@ -190,8 +193,9 @@ pack (`assets/farm/ithappy/farm/prefabs/assets/`).
farm itself). `DayNight` (`day_night.gd`) eases the sun, sky, farm itself). `DayNight` (`day_night.gd`) eases the sun, sky,
ambient light, and a whole-picture brightness / saturation between day, sunset, night (moonlight), ambient light, and a whole-picture brightness / saturation between day, sunset, night (moonlight),
and sunrise; the scarecrow carries a lantern that lights up as it gets dark, and thieves glow and sunrise; the scarecrow carries a lantern that lights up as it gets dark, and thieves glow
faintly at night. `PhaseHud` (top left) is the sun / moon dial with "Night N of 30", the phase and faintly at night. `PhaseHud` (top right) is the sun / moon with "Day N of 30", the time left
its time left, a hint line (what tonight brings, enemies on the farm), and a banner at each phase until the next phase and a line filling over it, a hint line under it (what tonight brings,
enemies on the farm), and a banner at each phase
change ("Night 3: Breakers at the fences"), with the dusk hint under it from dusk into the change ("Night 3: Breakers at the fences"), with the dusk hint under it from dusk into the
night. `ReviewPanel` is the morning review: last night's losses per category, what's left, what night. `ReviewPanel` is the morning review: last night's losses per category, what's left, what
needs repair, materials, and tonight's title; "Start the day" ends it. Playtest findings needs repair, materials, and tonight's title; "Start the day" ends it. Playtest findings
@ -207,7 +211,25 @@ pack (`assets/farm/ithappy/farm/prefabs/assets/`).
the reason, and older ones are upgraded (`SaveGame.migrate`). Continue resumes at that morning; the reason, and older ones are upgraded (`SaveGame.migrate`). Continue resumes at that morning;
finishing the vacation deletes the save. `GameSettings` (`game_settings.gd`) keeps the finishing the vacation deletes the save. `GameSettings` (`game_settings.gd`) keeps the
settings in `user://settings.cfg`: volumes per audio bus, stick dead zones, fullscreen, VSync, settings in `user://settings.cfg`: volumes per audio bus, stick dead zones, fullscreen, VSync,
3D resolution scale, and tips; `SettingsMenu` edits them and shows every binding. pixel size, 3D resolution scale, and tips; `SettingsMenu` edits them and shows every binding.
* **Look** — `ToonLook` (`game/scripts/toon_look.gd`), added by `Main`, gives everything 3D a
toon-shaded pixel-art look at runtime. Every lit, opaque StandardMaterial3D on the farm
(imported props, KayKit characters, weapons, primitives built in code, and nodes added later)
is swapped for a toon ShaderMaterial with the same color and texture (`toon.gdshader` /
`toon_double_sided.gdshader`, lighting in `toon_light.gdshaderinc`, which the crow and UFO
shaders include too); unshaded and transparent effects keep their own materials. A
full-screen quad (`pixel_outline.gdshader`) darkens depth edges and lightens creases. The
pixel size setting (default 4) renders the 3D view that many times smaller and scales it back
up with sharp pixels and no MSAA, while the HUD stays at full resolution. Label3Ds would be
pixelated too, so they don't render in 3D: `ScreenLabels` (`screen_labels.gd`) draws them as
sharp text over the 3D view (under the HUD) where they project, at least 16 px tall, nudging
overlapping ones apart. Game code keeps setting the Label3Ds' text, color, and visibility.
The HUD is hand-drawn (`Sketch`, `sketch.gd`): a handwritten font (Gochi Hand,
`assets/fonts/`, SIL OFL), wobbly sketched outlines, and painted icons drawn in code. The
pouch panel, the build bar, the pause menu and its questions, and the workbench and shed shops
share one panel look (a dark wash in a sketched ink frame, slots with a gold focus frame):
`UiTheme.sketch()` is that look as a theme, its boxes drawn by `SketchBox` (`sketch_box.gd`).
`UiTheme` (`ui_theme.gd`, written to `game/resources/ui_theme.tres` by `UiTheme` (`ui_theme.gd`, written to `game/resources/ui_theme.tres` by
`game/tools/build_ui_theme.gd`) is the project's default theme, with a gold focus ring so `game/tools/build_ui_theme.gd`) is the project's default theme, with a gold focus ring so
keyboard and gamepad players always see where they are. keyboard and gamepad players always see where they are.
@ -308,7 +330,7 @@ game/
end_panel.gd, resource_store.gd, gather_node.gd, workbench.gd, end_panel.gd, resource_store.gd, gather_node.gd, workbench.gd,
interactions.gd, resource_hud.gd, structure_system.gd, build_mode.gd, interactions.gd, resource_hud.gd, structure_system.gd, build_mode.gd,
build_hud.gd, action_edges.gd, night_plan.gd, wave_director.gd, day_night.gd, build_hud.gd, action_edges.gd, night_plan.gd, wave_director.gd, day_night.gd,
phase_hud.gd, review_panel.gd, animal_system.gd, shed_stock.gd, asset_hud.gd, phase_hud.gd, review_panel.gd, animal_system.gd, shed_stock.gd, sketch.gd, sketch_box.gd,
enemy_characters.gd, upgrades.gd, upgrade_panel.gd, main.gd, main_menu.gd, enemy_characters.gd, upgrades.gd, upgrade_panel.gd, main.gd, main_menu.gd,
pause_menu.gd, settings_menu.gd, confirm_box.gd, save_game.gd, game_settings.gd, pause_menu.gd, settings_menu.gd, confirm_box.gd, save_game.gd, game_settings.gd,
ui_theme.gd, assessment.gd, farmers_return.gd, tutorial.gd, farm_audio.gd, avatar.gd, ui_theme.gd, assessment.gd, farmers_return.gd, tutorial.gd, farm_audio.gd, avatar.gd,
@ -355,7 +377,8 @@ All tunables live in one resource: **`res://prototype/resources/default_config.t
| Combat height | 1.1 m (gun muzzle, bullets, bird bodies) | | Combat height | 1.1 m (gun muzzle, bullets, bird bodies) |
Project settings written by `prototype/tools/configure_project.gd` (re-runnable, editor closed): Project settings written by `prototype/tools/configure_project.gd` (re-runnable, editor closed):
main scene, 1920 × 1080 reference resolution, Mobile renderer, MSAA 2×, physics interpolation, main scene, 1920 × 1080 reference resolution, Forward+ renderer (the game's pixel outlines need
its normal buffer; the prototype began on Mobile), MSAA 2×, physics interpolation,
InputMap actions (`move_*`, `aim_*`, `fire`, `restart`, `toggle_overlay`; the built-in InputMap actions (`move_*`, `aim_*`, `fire`, `restart`, `toggle_overlay`; the built-in
`ui_accept` / `ui_cancel` cover UI confirm/cancel on keyboard and gamepad), and physics layer `ui_accept` / `ui_cancel` cover UI confirm/cancel on keyboard and gamepad), and physics layer
names. All pre-existing settings (Jolt Physics, D3D12 on Windows, stretch mode) are preserved. names. All pre-existing settings (Jolt Physics, D3D12 on Windows, stretch mode) are preserved.

Binary file not shown.

View file

@ -0,0 +1,36 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://36482sa012ao"
path="res://.godot/imported/GochiHand-Regular.ttf-3e5ea2842ffa61f18b766ee6cdd0e313.fontdata"
[deps]
source_file="res://assets/fonts/GochiHand-Regular.ttf"
dest_files=["res://.godot/imported/GochiHand-Regular.ttf-3e5ea2842ffa61f18b766ee6cdd0e313.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
modulate_color_glyphs=false
hinting=3
subpixel_positioning=4
keep_rounding_remainders=true
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

94
assets/fonts/OFL.txt Normal file
View file

@ -0,0 +1,94 @@
Copyright (c) 2011, Juan Pablo del Peral (juandelperal@htfonts.com),
with Reserved Font Names "Gochi" and "Gochi Hand"
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 KiB

View file

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cfgcs7r67fcis"
path="res://.godot/imported/splash.png-a6b8cb61d92bd44d9ab749ed80e40ece.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/pictures/screens/splash.png"
dest_files=["res://.godot/imported/splash.png-a6b8cb61d92bd44d9ab749ed80e40ece.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -0,0 +1,114 @@
shader_type spatial;
render_mode unshaded;
// MIT License. Made by Leo Peltola
// Inspired by https://threejs.org/examples/webgl_postprocessing_pixel.html
//
// Drawn by ToonLook on a 2 x 2 quad that vertex() pins to the screen (it never culls, so one quad
// outlines whatever camera is current). Needs the Forward+ renderer (the normal-roughness
// buffer). The material draws first among the transparent things, so the effects drawn over the
// farm (zone tints, beams, flames, rings) aren't outlined or painted over.
uniform sampler2D DEPTH_TEXTURE : hint_depth_texture, filter_linear_mipmap;
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
uniform sampler2D NORMAL_TEXTURE : hint_normal_roughness_texture, filter_nearest;
uniform bool shadows_enabled = true;
uniform bool highlights_enabled = true;
uniform float shadow_strength : hint_range(0.0, 1.0, 0.01) = 0.4;
uniform float highlight_strength : hint_range(0.0, 1.0, 0.01) = 0.1;
uniform vec3 highlight_color : source_color = vec3(1.);
uniform vec3 shadow_color : source_color = vec3(0.0);
varying mat4 model_view_matrix;
float getDepth(vec2 screen_uv, sampler2D depth_texture, mat4 inv_projection_matrix){
// Credit: https://godotshaders.com/shader/depth-modulated-pixel-outline-in-screen-space/
float raw_depth = texture(depth_texture, screen_uv)[0];
vec3 normalized_device_coordinates = vec3(screen_uv * 2.0 - 1.0, raw_depth);
vec4 view_space = inv_projection_matrix * vec4(normalized_device_coordinates, 1.0);
view_space.xyz /= view_space.w;
return -view_space.z;
}
vec3 getPos(float depth, mat4 mvm, mat4 ipm, vec2 suv, mat4 wm, mat4 icm){
vec4 pos = inverse(mvm) * ipm * vec4((suv * 2.0 - 1.0), depth * 2.0 - 1.0, 1.0);
pos.xyz /= (pos.w+0.0001*(1.-abs(sign(pos.w))));
return (pos*icm).xyz+wm[3].xyz;
}
float normalIndicator(vec3 normalEdgeBias, vec3 baseNormal, vec3 newNormal, float depth_diff){
// Credit: https://threejs.org/examples/webgl_postprocessing_pixel.html
float normalDiff = dot(baseNormal - newNormal, normalEdgeBias);
float normalIndicator = clamp(smoothstep(-.01, .01, normalDiff), 0.0, 1.0);
float depthIndicator = clamp(sign(depth_diff * .25 + .0025), 0.0, 1.0);
return (1.0 - dot(baseNormal, newNormal)) * depthIndicator * normalIndicator;
}
void vertex(){
// Full screen, at the near plane (reverse Z), for any camera.
POSITION = vec4(VERTEX.xy, 1.0, 1.0);
model_view_matrix = VIEW_MATRIX * mat4(INV_VIEW_MATRIX[0], INV_VIEW_MATRIX[1], INV_VIEW_MATRIX[2], MODEL_MATRIX[3]);
}
void fragment() {
vec2 e = vec2(1./VIEWPORT_SIZE.xy);
// Shadows
float depth_diff = 0.0;
float neg_depth_diff = .5;
if (shadows_enabled) {
float depth = getDepth(SCREEN_UV, DEPTH_TEXTURE, INV_PROJECTION_MATRIX);
float du = getDepth(SCREEN_UV+vec2(0., -1.)*e, DEPTH_TEXTURE, INV_PROJECTION_MATRIX);
float dr = getDepth(SCREEN_UV+vec2(1., 0.)*e, DEPTH_TEXTURE, INV_PROJECTION_MATRIX);
float dd = getDepth(SCREEN_UV+vec2(0., 1.)*e, DEPTH_TEXTURE, INV_PROJECTION_MATRIX);
float dl = getDepth(SCREEN_UV+vec2(-1., 0.)*e, DEPTH_TEXTURE, INV_PROJECTION_MATRIX);
depth_diff += clamp(du - depth, 0., 1.);
depth_diff += clamp(dd - depth, 0., 1.);
depth_diff += clamp(dr - depth, 0., 1.);
depth_diff += clamp(dl - depth, 0., 1.);
neg_depth_diff += depth - du;
neg_depth_diff += depth - dd;
neg_depth_diff += depth - dr;
neg_depth_diff += depth - dl;
neg_depth_diff = clamp(neg_depth_diff, 0., 1.);
neg_depth_diff = clamp(smoothstep(0.5, 0.5, neg_depth_diff)*10., 0., 1.);
depth_diff = smoothstep(0.2, 0.3, depth_diff);
// ALBEDO = vec3(neg_depth_diff);
}
// Highlights
float normal_diff = 0.;
if (highlights_enabled) {
vec3 normal = texture(NORMAL_TEXTURE, SCREEN_UV).rgb * 2.0 - 1.0;
vec3 nu = texture(NORMAL_TEXTURE, SCREEN_UV+vec2(0., -1.)*e).rgb * 2.0 - 1.0;
vec3 nr = texture(NORMAL_TEXTURE, SCREEN_UV+vec2(1., 0.)*e).rgb * 2.0 - 1.0;
vec3 nd = texture(NORMAL_TEXTURE, SCREEN_UV+vec2(0., 1.)*e).rgb * 2.0 - 1.0;
vec3 nl = texture(NORMAL_TEXTURE, SCREEN_UV+vec2(-1., 0.)*e).rgb * 2.0 - 1.0;
vec3 normal_edge_bias = (vec3(1., 1., 1.));
normal_diff += normalIndicator(normal_edge_bias, normal, nu, depth_diff);
normal_diff += normalIndicator(normal_edge_bias, normal, nr, depth_diff);
normal_diff += normalIndicator(normal_edge_bias, normal, nd, depth_diff);
normal_diff += normalIndicator(normal_edge_bias, normal, nl, depth_diff);
normal_diff = smoothstep(0.2, 0.8, normal_diff);
normal_diff = clamp(normal_diff-neg_depth_diff, 0., 1.);
// ALBEDO = vec3(normal_diff);
}
vec3 original_color = texture(SCREEN_TEXTURE, SCREEN_UV).rgb;
vec3 final_highlight_color = mix(original_color, highlight_color, highlight_strength);
vec3 final_shadow_color = mix(original_color, shadow_color, shadow_strength);
vec3 final = original_color;
if (highlights_enabled) {
final = mix(final, final_highlight_color, normal_diff);
}
if (shadows_enabled) {
final = mix(final, final_shadow_color, depth_diff);
}
ALBEDO = final;
float alpha_mask = depth_diff * float(shadows_enabled) + normal_diff * float(highlights_enabled);
ALPHA = clamp((alpha_mask) * 5., 0., 1.);
}

View file

@ -0,0 +1 @@
uid://b4dor4pwrfaxw

View file

@ -1,11 +1,13 @@
shader_type spatial; shader_type spatial;
// Shared enemy material (one MultiMesh batch), from the prototype's bird shader: wings (local // Shared enemy material (one MultiMesh batch), from the prototype's bird shader: wings (local
// |x|) flap with a per-enemy phase from INSTANCE_CUSTOM.r, and a hit flashes the enemy white // |x|) flap with a per-enemy phase from INSTANCE_CUSTOM.r, and a hit flashes the enemy white
// through INSTANCE_CUSTOM.g (1 on the hit, fading). Rim light keeps the near-black crow // through INSTANCE_CUSTOM.g (1 on the hit, fading). Lit like the rest of the farm
// readable against the grass and crops, and night_glow (set by DayNight) adds a faint purple glow // (toon_light.gdshaderinc), whose rim light keeps the near-black crow readable against the grass
// at night. // and crops, and night_glow (set by DayNight) adds a faint purple glow at night.
render_mode cull_disabled; render_mode cull_disabled;
#include "res://game/resources/toon_light.gdshaderinc"
uniform vec3 base_color : source_color = vec3(0.07, 0.07, 0.09); uniform vec3 base_color : source_color = vec3(0.07, 0.07, 0.09);
uniform float flap_speed = 11.0; uniform float flap_speed = 11.0;
uniform float flap_amount = 0.55; uniform float flap_amount = 0.55;
@ -25,6 +27,4 @@ void fragment() {
EMISSION = vec3(1.0, 0.9, 0.8) * flash * 0.6 + vec3(0.5, 0.28, 0.75) * night_glow * 0.35; EMISSION = vec3(1.0, 0.9, 0.8) * flash * 0.6 + vec3(0.5, 0.28, 0.75) * night_glow * 0.35;
ROUGHNESS = 0.55; ROUGHNESS = 0.55;
SPECULAR = 0.4; SPECULAR = 0.4;
RIM = 0.8;
RIM_TINT = 0.3;
} }

View file

@ -0,0 +1,4 @@
shader_type spatial;
// Toon material (ToonLook): see toon_surface.gdshaderinc and toon_light.gdshaderinc.
#include "res://game/resources/toon_surface.gdshaderinc"

View file

@ -0,0 +1 @@
uid://cp1pd2g4f3yps

View file

@ -0,0 +1,6 @@
shader_type spatial;
// Toon material (ToonLook) for double-sided source materials, e.g. the ithappy farm pack's: see
// toon_surface.gdshaderinc and toon_light.gdshaderinc.
render_mode cull_disabled;
#include "res://game/resources/toon_surface.gdshaderinc"

View file

@ -0,0 +1 @@
uid://dikxn4x402j5h

View file

@ -0,0 +1,90 @@
// Toon lighting, shared by toon.gdshader (ToonLook's converted materials) and the enemy shaders
// (thief.gdshader, ufo.gdshader): diffuse light cut into bands, a hard specular spot, and a rim
// light. The Godot 3 toon shader ported to Godot 4: source_color hints, ATTENUATION is a float,
// PI is built in, and LIGHT_COLOR already carries the PI that the "/ PI" divides back out. Omni
// and spot lights fade their rim with distance (a directional light's rim stays whole), and the
// specular and rim powers clamp their base so back faces and grazing angles can't go negative.
uniform bool clamp_diffuse_to_max = false;
uniform int cuts : hint_range(1, 8) = 3;
uniform float wrap : hint_range(-2.0f, 2.0f) = 0.0f;
uniform float steepness : hint_range(1.0f, 8.0f) = 1.0f;
uniform bool use_attenuation = true;
uniform bool use_specular = true;
uniform float specular_strength : hint_range(0.0f, 1.0f) = 1.0f;
uniform float specular_shininess : hint_range(0.0f, 32.0f) = 16.0f;
uniform sampler2D specular_map : source_color;
uniform bool use_rim = true;
uniform float rim_width : hint_range(0.0f, 16.0f) = 8.0f;
uniform vec4 rim_color : source_color = vec4(1.0f);
uniform bool use_ramp = false;
uniform sampler2D ramp : source_color;
uniform bool use_borders = false;
uniform float border_width = 0.01f;
float split_specular(float specular) {
return step(0.5f, specular);
}
void light() {
// Attenuation.
float attenuation = 1.0f;
if (use_attenuation) {
attenuation = ATTENUATION;
}
// Diffuse lighting.
float NdotL = dot(NORMAL, LIGHT);
float diffuse_amount = NdotL + (attenuation - 1.0) + wrap;
diffuse_amount *= steepness;
float cuts_inv = 1.0f / float(cuts);
float diffuse_stepped = clamp(diffuse_amount + mod(1.0f - diffuse_amount, cuts_inv), 0.0f, 1.0f);
// Calculate borders.
float border = 0.0f;
if (use_borders) {
float corr_border_width = length(cross(NORMAL, LIGHT)) * border_width * steepness;
border = step(diffuse_stepped - corr_border_width, diffuse_amount)
- step(1.0 - corr_border_width, diffuse_amount);
}
// Apply diffuse result to different styles.
vec3 diffuse = ALBEDO.rgb * LIGHT_COLOR / PI;
if (use_ramp) {
diffuse *= texture(ramp, vec2(diffuse_stepped * (1.0f - border), 0.0f)).rgb;
} else {
diffuse *= diffuse_stepped * (1.0f - border);
}
if (clamp_diffuse_to_max) {
// Clamp diffuse to max for multiple light sources.
DIFFUSE_LIGHT = max(DIFFUSE_LIGHT, diffuse);
} else {
DIFFUSE_LIGHT += diffuse;
}
// Specular lighting.
if (use_specular) {
vec3 H = normalize(LIGHT + VIEW);
float NdotH = max(dot(NORMAL, H), 0.0f);
float specular_amount = pow(NdotH, specular_shininess * specular_shininess)
* texture(specular_map, UV).r
* attenuation;
specular_amount = split_specular(specular_amount);
SPECULAR_LIGHT += specular_strength * specular_amount * LIGHT_COLOR;
}
// Simple rim lighting.
if (use_rim) {
float NdotV = dot(NORMAL, VIEW);
float rim_light = pow(clamp(1.0 - NdotV, 0.0f, 1.0f), rim_width);
float rim_fade = LIGHT_IS_DIRECTIONAL ? 1.0f : attenuation;
DIFFUSE_LIGHT += rim_light * rim_fade * rim_color.rgb * rim_color.a * LIGHT_COLOR / PI;
}
}

View file

@ -0,0 +1 @@
uid://b7jx3r74b5mgk

View file

@ -0,0 +1,23 @@
// The surface half of ToonLook's converted materials (toon.gdshader, toon_double_sided.gdshader):
// albedo color times albedo texture (times the vertex color when the source material used it),
// lit by toon_light.gdshaderinc. ToonLook copies these from each StandardMaterial3D it replaces.
uniform vec4 albedo : source_color = vec4(1.0f);
uniform sampler2D albedo_texture : source_color, filter_linear_mipmap, repeat_enable;
uniform bool use_vertex_color = false;
uniform vec3 uv1_scale = vec3(1.0f);
uniform vec3 uv1_offset = vec3(0.0f);
#include "res://game/resources/toon_light.gdshaderinc"
void vertex() {
UV = UV * uv1_scale.xy + uv1_offset.xy;
}
void fragment() {
vec3 color = albedo.rgb * texture(albedo_texture, UV).rgb;
if (use_vertex_color) {
color *= COLOR.rgb;
}
ALBEDO = color;
}

View file

@ -0,0 +1 @@
uid://rewmnv65ptqi

View file

@ -3,9 +3,12 @@ shader_type spatial;
// EnemySystem.build_ufo_mesh(): each part's color comes from the vertex COLOR, and its glow and // EnemySystem.build_ufo_mesh(): each part's color comes from the vertex COLOR, and its glow and
// metalness from UV (x, y). No flap: the saucer turns slowly about its axis and bobs a little, // metalness from UV (x, y). No flap: the saucer turns slowly about its axis and bobs a little,
// with a per-enemy phase from INSTANCE_CUSTOM.r, and the rim lights (glow 1) pulse in a chase // with a per-enemy phase from INSTANCE_CUSTOM.r, and the rim lights (glow 1) pulse in a chase
// around the ring. As in thief.gdshader, a hit flashes it white through INSTANCE_CUSTOM.g (1 on // around the ring. As in thief.gdshader, it's lit like the rest of the farm
// the hit, fading), a rim light keeps it readable, and night_glow (set by DayNight) adds a faint // (toon_light.gdshaderinc), a hit flashes it white through INSTANCE_CUSTOM.g (1 on the hit,
// purple glow at night; the lights and the dome glow brighter in the dark. // fading), and night_glow (set by DayNight) adds a faint purple glow at night; the lights and the
// dome glow brighter in the dark.
#include "res://game/resources/toon_light.gdshaderinc"
uniform float spin_speed = 1.2; uniform float spin_speed = 1.2;
uniform float bob_amount = 0.05; uniform float bob_amount = 0.05;
@ -43,6 +46,4 @@ void fragment() {
// The night's purple sits on the hull; the glowing parts keep their own color. // The night's purple sits on the hull; the glowing parts keep their own color.
EMISSION = base * glow * glow_energy * (1.0 + night_glow) + vec3(1.0, 0.9, 0.8) * f * 0.6 EMISSION = base * glow * glow_energy * (1.0 + night_glow) + vec3(1.0, 0.9, 0.8) * f * 0.6
+ vec3(0.5, 0.28, 0.75) * night_glow * 0.35 * (1.0 - glow); + vec3(0.5, 0.28, 0.75) * night_glow * 0.35 * (1.0 - glow);
RIM = 0.6;
RIM_TINT = 0.4;
} }

File diff suppressed because it is too large Load diff

2424
game/scenes/forest.tscn Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,89 +0,0 @@
class_name AssetHud
extends Control
## Top-center readout of what's left to protect: "Crops 28/30 · Animals 7/8 · Supplies 23" (the
## shed's stock plus any sacks still on the farm), each in its category's color. A count flashes
## red when it drops and green when it rises. Categories not in play are left out.
const FLASH_TIME := 1.2
const LOSS := Color(1.0, 0.3, 0.25)
const GAIN := Color(0.5, 1.0, 0.45)
var campaign: CampaignController
var _box: HBoxContainer
var _panel: PanelContainer
var _labels: Array[Label] = []
var _last := PackedInt32Array([-1, -1, -1])
var _flash := PackedFloat32Array([0.0, 0.0, 0.0])
var _flash_color: Array[Color] = [Color.WHITE, Color.WHITE, Color.WHITE]
func setup(p_campaign: CampaignController) -> void:
campaign = p_campaign
_last = _counts()
func _ready() -> void:
set_anchors_preset(Control.PRESET_FULL_RECT)
mouse_filter = Control.MOUSE_FILTER_IGNORE
_panel = PanelContainer.new()
var bg := StyleBoxFlat.new()
bg.bg_color = Color(0.0, 0.0, 0.0, 0.42)
bg.content_margin_left = 18.0
bg.content_margin_right = 18.0
bg.content_margin_top = 4.0
bg.content_margin_bottom = 4.0
_panel.add_theme_stylebox_override("panel", bg)
_panel.mouse_filter = Control.MOUSE_FILTER_IGNORE
add_child(_panel)
_box = HBoxContainer.new()
_box.add_theme_constant_override("separation", 28)
_box.mouse_filter = Control.MOUSE_FILTER_IGNORE
_panel.add_child(_box)
for c in 3:
var l := Label.new()
l.add_theme_font_size_override("font_size", 24)
l.add_theme_color_override("font_color", LootSystem.CATEGORY_COLORS[c])
l.add_theme_color_override("font_outline_color", Color.BLACK)
l.add_theme_constant_override("outline_size", 6)
l.mouse_filter = Control.MOUSE_FILTER_IGNORE
_box.add_child(l)
_labels.append(l)
## "Crops 28/30 · Animals 7/8 · Supplies 23", as the HUD shows it (also used by tests).
func describe() -> String:
var parts: Array[String] = []
for l in _labels:
if l.visible:
parts.append(l.text)
return " · ".join(parts)
func _process(delta: float) -> void:
if campaign == null:
return
var s := campaign.state
var now := _counts()
var texts := ["Crops %d/%d" % [s.crops, s.crops_total], "Animals %d/%d" % [s.animals, s.animals_total],
"Supplies %d" % s.supplies]
var in_play := [s.crops_total > 0, s.animals_total > 0, s.supplies_total > 0]
for c in 3:
var l := _labels[c]
l.visible = in_play[c]
l.text = texts[c]
if _last[c] >= 0 and now[c] != _last[c]:
_flash[c] = FLASH_TIME
_flash_color[c] = LOSS if now[c] < _last[c] else GAIN
_last[c] = now[c]
_flash[c] = maxf(_flash[c] - delta, 0.0)
var k := _flash[c] / FLASH_TIME
var pulse := (0.5 + 0.5 * sin(_flash[c] * 18.0)) * k
l.modulate = Color.WHITE.lerp(_flash_color[c] * 1.4, pulse)
_panel.reset_size()
_panel.position = Vector2((size.x - _panel.size.x) * 0.5, 14.0)
func _counts() -> PackedInt32Array:
var s := campaign.state
return PackedInt32Array([s.crops, s.animals, s.supplies])

View file

@ -1 +0,0 @@
uid://cdhho7exq5x3s

View file

@ -1,19 +1,22 @@
class_name BuildHud class_name BuildHud
extends Control extends Control
## The build hotbar, shown in build mode: one slot per buildable with its key, name, and cost ## The build bar, shown in build mode in the weapons hotbar's place (ScarecrowHud), hand-drawn
## (red when the builder can't afford it from their own pouch and the shed), the selected one ## like the HUD's pouch panel (Sketch): "Build" over a pen rule with how many structures stand on
## highlighted, the controls, and how many structures stand on the farm. ## the farm, one slot per buildable with its key, name, and cost (red when the builder can't
## afford it from their own pouch and the shed), the selected one lifted in a gold frame, and the
## controls in dim text under them.
const SLOT := Vector2(230.0, 76.0) const SLOT := Vector2(250.0, 80.0)
const GAP := 12.0 const GAP := 12.0
const PAD := 18.0
const HEAD := 52.0
const HELP := 32.0
const BOTTOM := 22.0
const SHORT := Color(1.0, 0.45, 0.4)
var build: BuildMode var build: BuildMode
var campaign: CampaignController var campaign: CampaignController
var _names: Array[Label] = []
var _costs: Array[Label] = []
var _help: Label
func setup(p_build: BuildMode, p_campaign: CampaignController) -> void: func setup(p_build: BuildMode, p_campaign: CampaignController) -> void:
build = p_build build = p_build
@ -23,55 +26,47 @@ func setup(p_build: BuildMode, p_campaign: CampaignController) -> void:
func _ready() -> void: func _ready() -> void:
set_anchors_preset(Control.PRESET_FULL_RECT) set_anchors_preset(Control.PRESET_FULL_RECT)
mouse_filter = Control.MOUSE_FILTER_IGNORE mouse_filter = Control.MOUSE_FILTER_IGNORE
for i in StructureSystem.ORDER.size():
_names.append(_label(22))
_costs.append(_label(18))
_help = _label(19)
func _process(_delta: float) -> void: func _process(_delta: float) -> void:
visible = build != null and build.active visible = build != null and build.active
if not visible: if visible:
return
var r := campaign.state.resources
var slot := build.kit.slot if build.kit != null else 0
var origin := _origin()
for i in StructureSystem.ORDER.size():
var t: String = StructureSystem.ORDER[i]
var cost: Dictionary = campaign.config.costs.get(t, {})
var pos := origin + Vector2(i * (SLOT.x + GAP), 0.0)
_names[i].text = "%d %s" % [i + 1, StructureSystem.NAMES[t]]
_names[i].position = pos + Vector2(12.0, 8.0)
_costs[i].text = ResourceStore.describe(cost)
_costs[i].position = pos + Vector2(12.0, 42.0)
_costs[i].add_theme_color_override("font_color", Color(0.9, 0.95, 0.9) if r.can_afford(cost, slot) else Color(1.0, 0.45, 0.4))
_help.text = "Build mode · LMB / RT build · Z C / d-pad rotate · 1-4 / Tab pick · RMB / B dismantle or leave · %d built" % \
build.structures.count()
_help.position = origin + Vector2(0.0, -34.0)
queue_redraw() queue_redraw()
## The controls line, as shown.
func help_text() -> String:
return "LMB / RT build · Z C / d-pad rotate · 1-4 / Tab pick · RMB / B dismantle or leave"
func _draw() -> void: func _draw() -> void:
if build == null or not build.active: if build == null or not build.active:
return return
var origin := _origin() var r := campaign.state.resources
for i in StructureSystem.ORDER.size(): var slot := build.kit.slot if build.kit != null else 0
var rect := Rect2(origin + Vector2(i * (SLOT.x + GAP), 0.0), SLOT)
draw_rect(rect, Color(0.0, 0.0, 0.0, 0.55))
draw_rect(rect, Color(1.0, 0.9, 0.4) if i == build.selected else Color(1.0, 1.0, 1.0, 0.25), false, 3.0 if i == build.selected else 1.5)
func _origin() -> Vector2:
var n := StructureSystem.ORDER.size() var n := StructureSystem.ORDER.size()
var width := n * SLOT.x + (n - 1) * GAP var width := n * SLOT.x + (n - 1) * GAP + PAD * 2.0
return Vector2((size.x - width) * 0.5, size.y - SLOT.y - 28.0) var height := HEAD + SLOT.y + HELP + PAD
var panel := Rect2(Vector2((size.x - width) * 0.5, size.y - BOTTOM - height), Vector2(width, height))
Sketch.panel(self, panel, 801.0)
func _label(font_size: int) -> Label: Sketch.text(self, panel.position + Vector2(PAD, 6.0), "Build", 32)
var l := Label.new() Sketch.text(self, Vector2(panel.end.x - PAD - 8.0, panel.position.y + 12.0), "%d built" % build.structures.count(), 24,
l.add_theme_font_size_override("font_size", font_size) Sketch.DIM, HORIZONTAL_ALIGNMENT_RIGHT, 6)
l.add_theme_color_override("font_outline_color", Color.BLACK) Sketch.rule(self, panel.position.x + 14.0, panel.end.x - 14.0, panel.position.y + 48.0, 802.0)
l.add_theme_constant_override("outline_size", 6) for i in n:
l.mouse_filter = Control.MOUSE_FILTER_IGNORE var t: String = StructureSystem.ORDER[i]
add_child(l) var cost: Dictionary = campaign.config.costs.get(t, {})
return l var rect := Rect2(panel.position + Vector2(PAD + i * (SLOT.x + GAP), HEAD + 4.0), SLOT)
var picked := i == build.selected
if picked:
rect = rect.grow(3.0)
rect.position.y -= 4.0
Sketch.box(self, rect, Sketch.SLOT, Sketch.INK, 2.5, 810.0 + i * 3.0)
if picked:
Sketch.box(self, rect.grow(2.0), Color(0, 0, 0, 0), Sketch.GOLD, 3.5, 830.0 + i)
Sketch.text(self, rect.position + Vector2(12.0, 4.0), "%d %s" % [i + 1, StructureSystem.NAMES[t]], 28, Sketch.TEXT,
HORIZONTAL_ALIGNMENT_LEFT, 6)
Sketch.text(self, rect.position + Vector2(12.0, 42.0), ResourceStore.describe(cost), 22,
Sketch.TEXT if r.can_afford(cost, slot) else SHORT, HORIZONTAL_ALIGNMENT_LEFT, 6)
Sketch.text(self, Vector2(panel.get_center().x, panel.end.y - PAD - 22.0), help_text(), 22, Sketch.DIM,
HORIZONTAL_ALIGNMENT_CENTER, 6)

View file

@ -114,7 +114,7 @@ func morning_snapshot() -> Dictionary:
return _morning_snapshot.duplicate(true) return _morning_snapshot.duplicate(true)
## The farm as it is now becomes this morning's snapshot, the one a retry goes back to (debug: F8 ## The farm as it is now becomes this morning's snapshot, the one a retry goes back to (debug: F4
## in the morning review, so a retry keeps what it unlocked). Nothing is saved. ## in the morning review, so a retry keeps what it unlocked). Nothing is saved.
func retake_morning_snapshot() -> void: func retake_morning_snapshot() -> void:
_morning_snapshot = state.to_dict() _morning_snapshot = state.to_dict()

View file

@ -6,12 +6,13 @@ extends CanvasLayer
## pairs, then all three; game/resources/scenarios/) and back to the real one ## pairs, then all three; game/resources/scenarios/) and back to the real one
## F3 / Shift+F3 in the morning review: jump to the next / previous day's morning, farm as ## F3 / Shift+F3 in the morning review: jump to the next / previous day's morning, farm as
## it is (jump_morning; debug builds only, not on a co-op partner's machine) ## it is (jump_morning; debug builds only, not on a co-op partner's machine)
## F4 unlock everything: every upgrade and shop item at its last level, free
## (unlock_all; debug builds only, not on a co-op partner's machine). Not
## F8: run from the editor, Godot stops the game on F8 (its Stop shortcut)
## N start the night early (only when GameConfig.allow_early_night is on) ## N start the night early (only when GameConfig.allow_early_night is on)
## R after Game Over: retry the night; after the farmers return: new vacation ## R after Game Over: retry the night; after the farmers return: new vacation
## F6 end the current phase now ## F6 end the current phase now
## F7 cycle game speed 1x / 5x / 20x ## F7 cycle game speed 1x / 5x / 20x
## F8 unlock everything: every upgrade and shop item at its last level, free
## (unlock_all; debug builds only, not on a co-op partner's machine)
## F9 debug: scarecrow to 0 HP ## F9 debug: scarecrow to 0 HP
## F10 debug: strip every farm asset ## F10 debug: strip every farm asset
## T / G / H debug: send in a thief / a crow / a fence breaker (FarmSim) ## T / G / H debug: send in a thief / a crow / a fence breaker (FarmSim)
@ -68,6 +69,8 @@ func _unhandled_input(event: InputEvent) -> void:
cycle_scenario() cycle_scenario()
KEY_F3: KEY_F3:
jump_morning(-1 if key.shift_pressed else 1) jump_morning(-1 if key.shift_pressed else 1)
KEY_F4:
unlock_all()
KEY_N: KEY_N:
campaign.start_night_early() campaign.start_night_early()
KEY_F6: KEY_F6:
@ -75,8 +78,6 @@ func _unhandled_input(event: InputEvent) -> void:
KEY_F7: KEY_F7:
_speed_index = (_speed_index + 1) % SPEEDS.size() _speed_index = (_speed_index + 1) % SPEEDS.size()
Engine.time_scale = SPEEDS[_speed_index] Engine.time_scale = SPEEDS[_speed_index]
KEY_F8:
unlock_all()
KEY_F9: KEY_F9:
s.scarecrow_hp = 0 s.scarecrow_hp = 0
KEY_F10: KEY_F10:
@ -168,5 +169,5 @@ func _describe() -> String:
lines.append("[N] start the night early") lines.append("[N] start the night early")
if sim != null and sim.waves.debug_plan != null: if sim != null and sim.waves.debug_plan != null:
lines.append("Scenario: %s (F2 next)" % sim.waves.debug_plan.title) lines.append("Scenario: %s (F2 next)" % sim.waves.debug_plan.title)
lines.append("F1 hide · F2 scenario · F3 / Shift+F3 next / previous morning · F6 next phase · F7 speed · F8 unlock everything · F9 scarecrow to 0 HP · F10 strip farm · T/G/H thief/crow/breaker") lines.append("F1 hide · F2 scenario · F3 / Shift+F3 next / previous morning · F4 unlock everything · F6 next phase · F7 speed · F9 scarecrow to 0 HP · F10 strip farm · T/G/H thief/crow/breaker")
return "\n".join(lines) return "\n".join(lines)

View file

@ -1,7 +1,8 @@
class_name ConfirmBox class_name ConfirmBox
extends CenterContainer extends CenterContainer
## A yes / no question over the menus (Main): the message, the confirming button, and Cancel ## A yes / no question over the menus (Main): the message, the confirming button, and Cancel
## (focused, so a stray Enter / A never throws progress away). Escape / B cancels. ## (focused, so a stray Enter / A never throws progress away). Escape / B cancels. Hand-drawn like
## the pause menu it mostly opens from (UiTheme.sketch).
var message: Label var message: Label
var yes_button: Button var yes_button: Button
@ -13,11 +14,13 @@ var _on_yes: Callable
func _ready() -> void: func _ready() -> void:
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
theme = UiTheme.sketch()
var panel := PanelContainer.new() var panel := PanelContainer.new()
panel.theme_type_variation = &"SolidPanel" # over the pause menu: none of it shows through
add_child(panel) add_child(panel)
var margin := MarginContainer.new() var margin := MarginContainer.new()
for side in ["left", "right", "top", "bottom"]: for side in ["left", "right", "top", "bottom"]:
margin.add_theme_constant_override("margin_" + side, 30) margin.add_theme_constant_override("margin_" + side, 14)
panel.add_child(margin) panel.add_child(margin)
var box := VBoxContainer.new() var box := VBoxContainer.new()
box.add_theme_constant_override("separation", 22) box.add_theme_constant_override("separation", 22)
@ -26,7 +29,7 @@ func _ready() -> void:
message.custom_minimum_size = Vector2(560.0, 0.0) message.custom_minimum_size = Vector2(560.0, 0.0)
message.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART message.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
message.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER message.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
message.add_theme_font_size_override("font_size", 24) message.add_theme_font_size_override("font_size", 30)
box.add_child(message) box.add_child(message)
var row := HBoxContainer.new() var row := HBoxContainer.new()
row.alignment = BoxContainer.ALIGNMENT_CENTER row.alignment = BoxContainer.ALIGNMENT_CENTER
@ -34,11 +37,13 @@ func _ready() -> void:
box.add_child(row) box.add_child(row)
yes_button = Button.new() yes_button = Button.new()
yes_button.custom_minimum_size = Vector2(240.0, 54.0) yes_button.custom_minimum_size = Vector2(240.0, 54.0)
yes_button.add_theme_font_size_override("font_size", 30)
yes_button.pressed.connect(_yes) yes_button.pressed.connect(_yes)
row.add_child(yes_button) row.add_child(yes_button)
no_button = Button.new() no_button = Button.new()
no_button.text = "Cancel" no_button.text = "Cancel"
no_button.custom_minimum_size = Vector2(200.0, 54.0) no_button.custom_minimum_size = Vector2(200.0, 54.0)
no_button.add_theme_font_size_override("font_size", 30)
no_button.pressed.connect(close) no_button.pressed.connect(close)
row.add_child(no_button) row.add_child(no_button)
visible = false visible = false

View file

@ -1,7 +1,7 @@
class_name CoopHud class_name CoopHud
extends Control extends Control
## The co-op part of the HUD (Main adds it to the farm's HUD layer): ## The co-op part of the HUD (Main adds it to the farm's HUD layer):
## * the partner panel, above your own health: their name in their color (P1 gold, P2 blue), ## * the partner panel, under your own portrait and health: their name in their color (P1 gold, P2 blue),
## their health pips, what they're doing (down until morning, patching, gathering, fear ## their health pips, what they're doing (down until morning, patching, gathering, fear
## ready), a speaker mark while their voice comes through, and the ping; plus your ## ready), a speaker mark while their voice comes through, and the ping; plus your
## microphone (on / muted, [M]) ## microphone (on / muted, [M])
@ -9,7 +9,7 @@ extends Control
## * the lobby's status while hosting with nobody in yet ("Waiting for a friend to join ...") ## * the lobby's status while hosting with nobody in yet ("Waiting for a friend to join ...")
## Both scarecrows also wear name tags (PlayerCharacter.set_tag). ## Both scarecrows also wear name tags (PlayerCharacter.set_tag).
const PANEL := Rect2(22.0, -318.0, 336.0, 104.0) # from the bottom left const PANEL := Rect2(22.0, 150.0, 336.0, 104.0) # from the top left
const PIP := Vector2(14.0, 9.0) const PIP := Vector2(14.0, 9.0)
const ARROW_MARGIN := 60.0 const ARROW_MARGIN := 60.0
@ -69,7 +69,7 @@ func _process(delta: float) -> void:
_arrow_label.visible = false _arrow_label.visible = false
if other == null: if other == null:
return return
var base := Vector2(PANEL.position.x, size.y + PANEL.position.y) var base := PANEL.position
_name.text = other.label() _name.text = other.label()
_name.add_theme_color_override("font_color", other.color()) _name.add_theme_color_override("font_color", other.color())
_name.position = base + Vector2(14.0, 6.0) _name.position = base + Vector2(14.0, 6.0)
@ -129,9 +129,9 @@ func _draw() -> void:
if session == null or not session.is_active() or sim == null or sim.partner == null: if session == null or not session.is_active() or sim == null or sim.partner == null:
return return
var other := sim.avatars[0] if session.is_client() else sim.partner var other := sim.avatars[0] if session.is_client() else sim.partner
var base := Vector2(PANEL.position.x, size.y + PANEL.position.y) var base := PANEL.position
draw_rect(Rect2(base, PANEL.size), Color(0.0, 0.0, 0.0, 0.45)) Sketch.box(self, Rect2(base, PANEL.size), Sketch.WASH, Color(0, 0, 0, 0), 0.0, 601.0)
draw_rect(Rect2(base, Vector2(5.0, PANEL.size.y)), other.color()) Sketch.line(self, base + Vector2(3.0, 4.0), base + Vector2(3.0, PANEL.size.y - 4.0), other.color(), 5.0, 602.0)
var hp := other.kit.hp() var hp := other.kit.hp()
var top := other.kit.max_hp() var top := other.kit.max_hp()
for i in top: for i in top:
@ -162,9 +162,7 @@ func _measure_ping() -> void:
func _label(font_size: int) -> Label: func _label(font_size: int) -> Label:
var l := Label.new() var l := Label.new()
l.add_theme_font_size_override("font_size", font_size) Sketch.style(l, font_size + 2, Sketch.TEXT, 6)
l.add_theme_color_override("font_outline_color", Color.BLACK)
l.add_theme_constant_override("outline_size", 6)
l.mouse_filter = Control.MOUSE_FILTER_IGNORE l.mouse_filter = Control.MOUSE_FILTER_IGNORE
l.visible = false l.visible = false
add_child(l) add_child(l)

View file

@ -18,8 +18,8 @@ extends Node
## WaveDirector), sunrise makes them retreat (carriers keep running), the end of the dawn grace ## WaveDirector), sunrise makes them retreat (carriers keep running), the end of the dawn grace
## sends the rest off the farm with whatever they carry, returns dropped loot (and the animals ## sends the rest off the farm with whatever they carry, returns dropped loot (and the animals
## still following the scarecrow) home, and regrows the gather points, and every new morning (also after a retry) resets the ## still following the scarecrow) home, and regrows the gather points, and every new morning (also after a retry) resets the
## theft state from the farm state. DayNight lights the phases; PhaseHud, AssetHud, ReviewPanel, ## theft state from the farm state. DayNight lights the phases; PhaseHud, ReviewPanel, and the
## and the other HUD parts show them. Co-op (CoopSession): a second scarecrow (add_partner) is ## other HUD parts show them. Co-op (CoopSession): a second scarecrow (add_partner) is
## simulated alongside the first, and on the partner's machine the farm is a replica: nothing is ## simulated alongside the first, and on the partner's machine the farm is a replica: nothing is
## simulated there, the host's state is applied instead (replica = true), and player, scarecrow, ## simulated there, the host's state is applied instead (replica = true), and player, scarecrow,
## combat, and interactions are that machine's own scarecrow's (player 2's). ## combat, and interactions are that machine's own scarecrow's (player 2's).
@ -42,7 +42,6 @@ const NIGHT_PLAN_PATH := "res://game/resources/nights/night_%d.tres"
@export var resource_hud: ResourceHud @export var resource_hud: ResourceHud
@export var build_hud: BuildHud @export var build_hud: BuildHud
@export var phase_hud: PhaseHud @export var phase_hud: PhaseHud
@export var asset_hud: AssetHud
@export var review_panel: ReviewPanel @export var review_panel: ReviewPanel
@export var upgrade_panel: UpgradePanel @export var upgrade_panel: UpgradePanel
@export var shed_panel: UpgradePanel @export var shed_panel: UpgradePanel
@ -146,7 +145,7 @@ func _ready() -> void:
shed_stock = ShedStock.new() shed_stock = ShedStock.new()
shed_stock.name = "ShedStock" shed_stock.name = "ShedStock"
add_child(shed_stock) add_child(shed_stock)
shed_stock.setup(campaign, shed_zone, player) # every pile prop in place for the navigation shed_stock.setup(campaign, shed_zone) # every pile prop in place for the navigation
nav.build(get_parent(), zones.playable.grow(5.0), config.nav_cell_size, config.enemy_radius + config.nav_inflate_margin) nav.build(get_parent(), zones.playable.grow(5.0), config.nav_cell_size, config.enemy_radius + config.nav_inflate_margin)
shed_stock.refresh() shed_stock.refresh()
# #13: three CROP_FIELD zones (the original field, lettuce/cabbage, corn). #20: each keeps its # #13: three CROP_FIELD zones (the original field, lettuce/cabbage, corn). #20: each keeps its
@ -293,13 +292,10 @@ func _ready() -> void:
combat.equip(w)) combat.equip(w))
if resource_hud != null: if resource_hud != null:
resource_hud.setup(campaign) resource_hud.setup(campaign)
resource_hud.structures = structures
if build_hud != null: if build_hud != null:
build_hud.setup(build, campaign) build_hud.setup(build, campaign)
if phase_hud != null: if phase_hud != null:
phase_hud.setup(campaign, waves, enemies) phase_hud.setup(campaign, waves, enemies)
if asset_hud != null:
asset_hud.setup(campaign)
if review_panel != null: if review_panel != null:
review_panel.setup(campaign, structures) review_panel.setup(campaign, structures)
review_panel.animals = animals review_panel.animals = animals
@ -307,6 +303,7 @@ func _ready() -> void:
review_panel.refresh() review_panel.refresh()
if hud != null: if hud != null:
hud.setup(scarecrow, campaign, combat) hud.setup(scarecrow, campaign, combat)
hud.build = build
if hud != null and hud.get_parent() != null: if hud != null and hud.get_parent() != null:
var radar_hud := RadarHud.new() var radar_hud := RadarHud.new()
radar_hud.name = "RadarHud" radar_hud.name = "RadarHud"
@ -561,7 +558,6 @@ func set_local(a: Avatar) -> void:
audio.focus = a.body audio.focus = a.body
if alerts != null: if alerts != null:
alerts.player = a.body alerts.player = a.body
shed_stock.player = a.body
## Restarts every flow-field job for the current structure layout. ## Restarts every flow-field job for the current structure layout.

View file

@ -6,7 +6,9 @@ extends RefCounted
## * Controls: the dead zones of the move stick (the move_* actions) and the aim stick ## * Controls: the dead zones of the move stick (the move_* actions) and the aim stick
## (GameConfig.aim_dead_zone). Mouse aim follows the cursor directly, so it has no ## (GameConfig.aim_dead_zone). Mouse aim follows the cursor directly, so it has no
## sensitivity to set. ## sensitivity to set.
## * Display: fullscreen, VSync, and the 3D resolution scale (the HUD stays sharp). ## * Display: fullscreen, VSync, the pixel size (the 3D view renders that many times smaller
## and scales back up with sharp pixels, for ToonLook's pixel-art look; 1 = off), and the 3D
## resolution scale, used when the pixel size is 1 (the HUD stays sharp either way).
## * Gameplay: whether the tips show on the first day and night (Tutorial). ## * Gameplay: whether the tips show on the first day and night (Tutorial).
## * Co-op: your player name, and whether your microphone is sent in voice chat. ## * Co-op: your player name, and whether your microphone is sent in voice chat.
## Values missing from the file or out of range fall back to the defaults, so an old or ## Values missing from the file or out of range fall back to the defaults, so an old or
@ -17,12 +19,14 @@ const BUSES: Array[String] = ["Master", "Music", "SFX", "Ambience", "Voice"]
const BUS_NAMES := {"Master": "Master volume", "Music": "Music and stingers", "SFX": "Sound effects", "Ambience": "Ambience", const BUS_NAMES := {"Master": "Master volume", "Music": "Music and stingers", "SFX": "Sound effects", "Ambience": "Ambience",
"Voice": "Voice chat (your friend)"} "Voice": "Voice chat (your friend)"}
const DEFAULT_VOLUME := {"Master": 0.8, "Music": 0.7, "SFX": 0.8, "Ambience": 0.6, "Voice": 1.0} const DEFAULT_VOLUME := {"Master": 0.8, "Music": 0.7, "SFX": 0.8, "Ambience": 0.6, "Voice": 1.0}
const MAX_PIXEL_SIZE := 8
var volume := DEFAULT_VOLUME.duplicate() var volume := DEFAULT_VOLUME.duplicate()
var move_dead_zone := 0.2 var move_dead_zone := 0.2
var aim_dead_zone := 0.3 var aim_dead_zone := 0.3
var fullscreen := false var fullscreen := false
var vsync := true var vsync := true
var pixel_size := 4
var resolution_scale := 1.0 var resolution_scale := 1.0
var show_tips := true var show_tips := true
## Co-op: your name for the lobby and the name tag, and whether your microphone is sent. ## Co-op: your name for the lobby and the name tag, and whether your microphone is sent.
@ -41,6 +45,7 @@ static func load_from(path: String = PATH) -> GameSettings:
g.aim_dead_zone = _number(f.get_value("controls", "aim_dead_zone", g.aim_dead_zone), 0.05, 0.9, g.aim_dead_zone) g.aim_dead_zone = _number(f.get_value("controls", "aim_dead_zone", g.aim_dead_zone), 0.05, 0.9, g.aim_dead_zone)
g.fullscreen = _flag(f.get_value("display", "fullscreen", g.fullscreen), g.fullscreen) g.fullscreen = _flag(f.get_value("display", "fullscreen", g.fullscreen), g.fullscreen)
g.vsync = _flag(f.get_value("display", "vsync", g.vsync), g.vsync) g.vsync = _flag(f.get_value("display", "vsync", g.vsync), g.vsync)
g.pixel_size = roundi(_number(f.get_value("display", "pixel_size", g.pixel_size), 1.0, MAX_PIXEL_SIZE, g.pixel_size))
g.resolution_scale = _number(f.get_value("display", "resolution_scale", g.resolution_scale), 0.5, 1.0, g.resolution_scale) g.resolution_scale = _number(f.get_value("display", "resolution_scale", g.resolution_scale), 0.5, 1.0, g.resolution_scale)
g.show_tips = _flag(f.get_value("gameplay", "show_tips", g.show_tips), g.show_tips) g.show_tips = _flag(f.get_value("gameplay", "show_tips", g.show_tips), g.show_tips)
var n: Variant = f.get_value("coop", "player_name", "") var n: Variant = f.get_value("coop", "player_name", "")
@ -57,6 +62,7 @@ func save_to(path: String = PATH) -> Error:
f.set_value("controls", "aim_dead_zone", aim_dead_zone) f.set_value("controls", "aim_dead_zone", aim_dead_zone)
f.set_value("display", "fullscreen", fullscreen) f.set_value("display", "fullscreen", fullscreen)
f.set_value("display", "vsync", vsync) f.set_value("display", "vsync", vsync)
f.set_value("display", "pixel_size", pixel_size)
f.set_value("display", "resolution_scale", resolution_scale) f.set_value("display", "resolution_scale", resolution_scale)
f.set_value("gameplay", "show_tips", show_tips) f.set_value("gameplay", "show_tips", show_tips)
f.set_value("coop", "player_name", player_name) f.set_value("coop", "player_name", player_name)
@ -80,7 +86,7 @@ func apply(viewport: Viewport, config: GameConfig = null) -> void:
if config != null: if config != null:
config.aim_dead_zone = aim_dead_zone config.aim_dead_zone = aim_dead_zone
if viewport != null: if viewport != null:
viewport.scaling_3d_scale = resolution_scale apply_pixels(viewport)
if DisplayServer.get_name() == "headless": if DisplayServer.get_name() == "headless":
return return
var mode := DisplayServer.window_get_mode() var mode := DisplayServer.window_get_mode()
@ -91,6 +97,20 @@ func apply(viewport: Viewport, config: GameConfig = null) -> void:
DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_ENABLED if vsync else DisplayServer.VSYNC_DISABLED) DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_ENABLED if vsync else DisplayServer.VSYNC_DISABLED)
## The 3D view's size: pixel_size > 1 renders it that many times smaller with sharp (nearest)
## upscaling and no MSAA, so each art pixel is a clean block; 1 renders it at resolution_scale
## with the project's MSAA.
func apply_pixels(viewport: Viewport) -> void:
if pixel_size > 1:
viewport.scaling_3d_mode = Viewport.SCALING_3D_MODE_NEAREST
viewport.scaling_3d_scale = 1.0 / pixel_size
viewport.msaa_3d = Viewport.MSAA_DISABLED
else:
viewport.scaling_3d_mode = Viewport.SCALING_3D_MODE_BILINEAR
viewport.scaling_3d_scale = resolution_scale
viewport.msaa_3d = ProjectSettings.get_setting("rendering/anti_aliasing/quality/msaa_3d", Viewport.MSAA_DISABLED)
static func _number(v: Variant, lo: float, hi: float, fallback: float) -> float: static func _number(v: Variant, lo: float, hi: float, fallback: float) -> float:
if not (v is float or v is int): if not (v is float or v is int):
return fallback return fallback

View file

@ -54,6 +54,9 @@ func _ready() -> void:
farm.process_mode = Node.PROCESS_MODE_PAUSABLE farm.process_mode = Node.PROCESS_MODE_PAUSABLE
settings = GameSettings.load_from(settings_path) settings = GameSettings.load_from(settings_path)
settings.apply(get_viewport(), sim.config) settings.apply(get_viewport(), sim.config)
var look := ToonLook.new() # toon shading and pixel outlines on the farm
look.name = "ToonLook"
add_child(look)
sim.campaign.save_path = save_path sim.campaign.save_path = save_path
if sim.end_panel != null: if sim.end_panel != null:
sim.end_panel.has_menu = true sim.end_panel.has_menu = true

View file

@ -1,8 +1,10 @@
class_name PauseMenu class_name PauseMenu
extends CenterContainer extends CenterContainer
## Escape / Start during play (Main pauses the tree): where you are, then Resume, Restart the ## Escape / Start during play (Main pauses the tree), hand-drawn like the HUD's pouch panel
## night, Settings, Save & quit to the menu, and Quit the game, with a reminder of what Continue ## (UiTheme.sketch): where you are and what's left to protect
## picks up (the vacation is saved every morning). ## (crops, animals, supplies; asset_counts), then Resume, Restart the night, Settings, Save & quit
## to the menu, and Quit the game, with a reminder of what Continue picks up (the vacation is
## saved every morning).
signal resume_requested signal resume_requested
signal restart_requested signal restart_requested
@ -17,15 +19,17 @@ var menu_button: Button
var quit_button: Button var quit_button: Button
var _where: Label var _where: Label
var _note: Label var _note: Label
var _assets: Array[Label] = []
func _ready() -> void: func _ready() -> void:
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
theme = UiTheme.sketch()
var panel := PanelContainer.new() var panel := PanelContainer.new()
add_child(panel) add_child(panel)
var margin := MarginContainer.new() var margin := MarginContainer.new()
for side in ["left", "right", "top", "bottom"]: for side in ["left", "right", "top", "bottom"]:
margin.add_theme_constant_override("margin_" + side, 32) margin.add_theme_constant_override("margin_" + side, 14)
panel.add_child(margin) panel.add_child(margin)
var box := VBoxContainer.new() var box := VBoxContainer.new()
box.add_theme_constant_override("separation", 14) box.add_theme_constant_override("separation", 14)
@ -33,13 +37,24 @@ func _ready() -> void:
var title := Label.new() var title := Label.new()
title.text = "Paused" title.text = "Paused"
title.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER title.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
title.add_theme_font_size_override("font_size", 48) title.add_theme_font_size_override("font_size", 56)
title.add_theme_color_override("font_color", UiTheme.GOLD)
box.add_child(title) box.add_child(title)
box.add_child(HSeparator.new())
_where = Label.new() _where = Label.new()
_where.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER _where.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
_where.add_theme_font_size_override("font_size", 22) _where.add_theme_font_size_override("font_size", 28)
_where.add_theme_color_override("font_color", Sketch.DIM)
box.add_child(_where) box.add_child(_where)
var assets := HBoxContainer.new()
assets.alignment = BoxContainer.ALIGNMENT_CENTER
assets.add_theme_constant_override("separation", 30)
box.add_child(assets)
for c in 3:
var l := Label.new()
l.add_theme_font_size_override("font_size", 30)
l.add_theme_color_override("font_color", LootSystem.CATEGORY_COLORS[c])
assets.add_child(l)
_assets.append(l)
resume_button = _button(box, "Resume") resume_button = _button(box, "Resume")
resume_button.pressed.connect(func() -> void: resume_requested.emit()) resume_button.pressed.connect(func() -> void: resume_requested.emit())
restart_button = _button(box, "Restart the night") restart_button = _button(box, "Restart the night")
@ -54,8 +69,8 @@ func _ready() -> void:
_note.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER _note.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
_note.custom_minimum_size = Vector2(520.0, 0.0) _note.custom_minimum_size = Vector2(520.0, 0.0)
_note.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART _note.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
_note.add_theme_font_size_override("font_size", 18) _note.add_theme_font_size_override("font_size", 22)
_note.add_theme_color_override("font_color", Color(0.72, 0.74, 0.68)) _note.add_theme_color_override("font_color", Sketch.DIM)
box.add_child(_note) box.add_child(_note)
visible = false visible = false
mouse_filter = Control.MOUSE_FILTER_IGNORE mouse_filter = Control.MOUSE_FILTER_IGNORE
@ -66,6 +81,10 @@ func open(campaign: CampaignController, coop: int = 0) -> void:
var s := campaign.state var s := campaign.state
var phase: String = CampaignController.Phase.keys()[s.phase] var phase: String = CampaignController.Phase.keys()[s.phase]
_where.text = "Night %d of %d · %s" % [s.night, campaign.config.campaign_nights, phase.replace("_", " ").capitalize()] _where.text = "Night %d of %d · %s" % [s.night, campaign.config.campaign_nights, phase.replace("_", " ").capitalize()]
var counts := asset_counts(s)
for c in 3:
_assets[c].text = counts[c]
_assets[c].visible = counts[c] != ""
var over := campaign.outcome == CampaignController.Outcome.VACATION_COMPLETE var over := campaign.outcome == CampaignController.Outcome.VACATION_COMPLETE
restart_button.disabled = over or coop == 2 restart_button.disabled = over or coop == 2
menu_button.text = "Leave the game" if coop == 2 else "Save & quit to menu" menu_button.text = "Leave the game" if coop == 2 else "Save & quit to menu"
@ -80,6 +99,23 @@ func open(campaign: CampaignController, coop: int = 0) -> void:
resume_button.grab_focus.call_deferred() resume_button.grab_focus.call_deferred()
## "Crops 28/30", "Animals 7/8", "Supplies 23" (the shed's stock plus any sacks still on the
## farm): what's left to protect, "" for a category not in play.
static func asset_counts(s: FarmState) -> PackedStringArray:
return PackedStringArray(["Crops %d/%d" % [s.crops, s.crops_total] if s.crops_total > 0 else "",
"Animals %d/%d" % [s.animals, s.animals_total] if s.animals_total > 0 else "",
"Supplies %d" % s.supplies if s.supplies_total > 0 else ""])
## The assets line as shown: "Crops 28/30 · Animals 7/8 · Supplies 23" (tests).
func describe_assets() -> String:
var parts := PackedStringArray()
for l in _assets:
if l.visible:
parts.append(l.text)
return " · ".join(parts)
func _draw() -> void: func _draw() -> void:
draw_rect(Rect2(Vector2.ZERO, size), Color(0.0, 0.0, 0.0, 0.4)) # dims what's behind draw_rect(Rect2(Vector2.ZERO, size), Color(0.0, 0.0, 0.0, 0.4)) # dims what's behind
@ -93,6 +129,6 @@ func _button(parent: Control, text: String) -> Button:
var b := Button.new() var b := Button.new()
b.text = text b.text = text
b.custom_minimum_size = Vector2(420.0, 56.0) b.custom_minimum_size = Vector2(420.0, 56.0)
b.add_theme_font_size_override("font_size", 24) b.add_theme_font_size_override("font_size", 30)
parent.add_child(b) parent.add_child(b)
return b return b

View file

@ -1,22 +1,27 @@
class_name PhaseHud class_name PhaseHud
extends Control extends Control
## Top-left phase indicator: a dial whose ring fills over the current phase with a sun (day), a ## Top-right day and time, hand-drawn (Sketch): a sun by day (a moon at night) on a light wash,
## setting sun (dusk), a moon (night), or a rising sun (dawn) in it; "Night N of M"; the phase ## "Day N of M", the time left in the phase ("1:42 until Dusk"), and a thin teal line filling
## and its time left; and a hint line (what tonight brings at dusk, thieves on the farm at night, the ## over the phase; under it, a hint when there is one (what tonight brings at dusk, who's on the
## early-night key when allowed). Each phase also announces itself with a banner that fades; ## farm at night, the early-night key when allowed). Each phase also announces itself with a
## from dusk into the night, tonight's dusk hint (NightPlan.dusk_hint) shows under it. ## banner that fades; from dusk into the night, tonight's dusk hint (NightPlan.dusk_hint) shows
## under it.
const DIAL_CENTER := Vector2(62.0, 64.0)
const DIAL_RADIUS := 34.0
const BANNER_TIME := 3.0 const BANNER_TIME := 3.0
const WIDGET := Vector2(430.0, 112.0)
const MARGIN := Vector2(24.0, 18.0)
const PROGRESS := Color(0.3, 0.82, 0.8)
const HINT_SIZE := 22
const HINT_LINE := 28.0
var campaign: CampaignController var campaign: CampaignController
var waves: WaveDirector var waves: WaveDirector
var enemies: EnemySystem var enemies: EnemySystem
var _title: Label ## What the widget shows: "Day 2 of 30", "1:42 until Dusk", and the hint ("" for none).
var _sub: Label var title := ""
var _hint: Label var sub := ""
var hint := ""
var _banner: Label var _banner: Label
var _banner_left: float = 0.0 var _banner_left: float = 0.0
var _dusk_hint: Label var _dusk_hint: Label
@ -33,38 +38,40 @@ func setup(p_campaign: CampaignController, p_waves: WaveDirector, p_enemies: Ene
func _ready() -> void: func _ready() -> void:
set_anchors_preset(Control.PRESET_FULL_RECT) set_anchors_preset(Control.PRESET_FULL_RECT)
mouse_filter = Control.MOUSE_FILTER_IGNORE mouse_filter = Control.MOUSE_FILTER_IGNORE
_title = _label(28, Vector2(112.0, 26.0))
_sub = _label(22, Vector2(112.0, 62.0))
_hint = _label(19, Vector2(112.0, 92.0))
_banner = Label.new() _banner = Label.new()
_banner.set_anchors_preset(Control.PRESET_TOP_WIDE) _banner.set_anchors_preset(Control.PRESET_TOP_WIDE)
_banner.offset_top = 250.0 _banner.offset_top = 250.0
_banner.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER _banner.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
_banner.add_theme_font_size_override("font_size", 52) Sketch.style(_banner, 60, Sketch.TEXT, 14)
_banner.add_theme_color_override("font_outline_color", Color.BLACK)
_banner.add_theme_constant_override("outline_size", 12)
_banner.mouse_filter = Control.MOUSE_FILTER_IGNORE _banner.mouse_filter = Control.MOUSE_FILTER_IGNORE
_banner.modulate.a = 0.0 _banner.modulate.a = 0.0
add_child(_banner) add_child(_banner)
_dusk_hint = Label.new() _dusk_hint = Label.new()
_dusk_hint.set_anchors_preset(Control.PRESET_CENTER_TOP) _dusk_hint.set_anchors_preset(Control.PRESET_CENTER_TOP)
_dusk_hint.offset_top = 330.0 _dusk_hint.offset_top = 336.0
_dusk_hint.offset_left = -520.0 _dusk_hint.offset_left = -520.0
_dusk_hint.offset_right = 520.0 _dusk_hint.offset_right = 520.0
_dusk_hint.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER _dusk_hint.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
_dusk_hint.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART _dusk_hint.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
_dusk_hint.add_theme_font_size_override("font_size", 26) Sketch.style(_dusk_hint, 30, Color(1.0, 0.88, 0.7), 10)
_dusk_hint.add_theme_color_override("font_color", Color(1.0, 0.88, 0.7))
_dusk_hint.add_theme_color_override("font_outline_color", Color.BLACK)
_dusk_hint.add_theme_constant_override("outline_size", 8)
_dusk_hint.mouse_filter = Control.MOUSE_FILTER_IGNORE _dusk_hint.mouse_filter = Control.MOUSE_FILTER_IGNORE
_dusk_hint.visible = false _dusk_hint.visible = false
add_child(_dusk_hint) add_child(_dusk_hint)
## "Night 1 of 5 · Day · 2:34 left", as the HUD shows it (also used by tests). ## "Day 1 of 5 · 2:34 until Dusk", as the HUD shows it (also used by tests).
func describe() -> String: func describe() -> String:
return "%s · %s" % [_title.text, _sub.text] return "%s · %s" % [title, sub]
## The widget's rect (canvas), and the bottom of it and its hint (RadarHud sits under that).
func widget_rect() -> Rect2:
return Rect2(Vector2(size.x - MARGIN.x - WIDGET.x, MARGIN.y), WIDGET)
func bottom() -> float:
var lines := hint.count("\n") + 1 if hint != "" else 0
return widget_rect().end.y + 10.0 + lines * HINT_LINE
func _process(delta: float) -> void: func _process(delta: float) -> void:
@ -72,29 +79,28 @@ func _process(delta: float) -> void:
return return
var s := campaign.state var s := campaign.state
var cfg := campaign.config var cfg := campaign.config
_title.text = "Night %d of %d" % [s.night, cfg.campaign_nights] title = "Day %d of %d" % [s.night, cfg.campaign_nights]
var left := _clock(s.phase_time_left) var left := _clock(s.phase_time_left)
var hint := "" hint = ""
match s.phase: match s.phase:
CampaignController.Phase.MORNING: CampaignController.Phase.MORNING:
_sub.text = "Morning" sub = "Morning"
CampaignController.Phase.DAY: CampaignController.Phase.DAY:
_sub.text = "Day · %s left" % left sub = "%s until Dusk" % left
if campaign.can_start_night_early(): if campaign.can_start_night_early():
hint = "[N] start the night early" hint = "[N] start the night early"
CampaignController.Phase.DUSK: CampaignController.Phase.DUSK:
_sub.text = "Dusk · nightfall in %s" % left sub = "%s until Nightfall" % left
hint = "\n".join(waves.tonight_warning()) if waves != null else "" hint = "\n".join(waves.tonight_warning()) if waves != null else ""
CampaignController.Phase.NIGHT: CampaignController.Phase.NIGHT:
_sub.text = "Night · sunrise in %s" % left sub = "%s until Dawn" % left
hint = on_the_farm(enemies) hint = on_the_farm(enemies)
CampaignController.Phase.DAWN: CampaignController.Phase.DAWN:
_sub.text = "Dawn · the aliens are fleeing (%s)" % left sub = "%s until Morning" % left
CampaignController.Phase.FARMERS_RETURN: CampaignController.Phase.FARMERS_RETURN:
_sub.text = "The farmers are back" sub = "The farmers are back"
CampaignController.Phase.GAME_OVER: CampaignController.Phase.GAME_OVER:
_sub.text = "Game over" sub = "Game over"
_hint.text = hint
var plan := waves.tonight() if waves != null else null var plan := waves.tonight() if waves != null else null
_dusk_hint.visible = plan != null and plan.dusk_hint != "" and waves.warning_active() _dusk_hint.visible = plan != null and plan.dusk_hint != "" and waves.warning_active()
if _dusk_hint.visible: if _dusk_hint.visible:
@ -109,25 +115,21 @@ func _draw() -> void:
return return
var s := campaign.state var s := campaign.state
var length := campaign.phase_length(s.phase) var length := campaign.phase_length(s.phase)
var frac := 1.0 - s.phase_time_left / length if is_finite(length) and length > 0.0 else 0.0 var frac := clampf(1.0 - s.phase_time_left / length, 0.0, 1.0) if is_finite(length) and length > 0.0 else 0.0
var phase := s.phase var r := widget_rect()
var night := phase == CampaignController.Phase.NIGHT Sketch.box(self, r, Sketch.WASH, Color(0, 0, 0, 0), 0.0, 301.0)
var hint_size := _hint.get_minimum_size() if _hint.text != "" else Vector2.ZERO Sketch.icon(self, "moon" if s.phase == CampaignController.Phase.NIGHT else "sun", Rect2(r.position + Vector2(4.0, 4.0), Vector2(104.0, 104.0)))
var box := Vector2(maxf(430.0, 112.0 + hint_size.x + 18.0), maxf(104.0, 92.0 + hint_size.y - 14.0 + 22.0)) var right := r.end.x - 18.0
draw_rect(Rect2(Vector2(14.0, 14.0), box), Color(0.0, 0.0, 0.0, 0.42)) Sketch.text(self, Vector2(right, r.position.y + 6.0), title, 40, Sketch.TEXT, HORIZONTAL_ALIGNMENT_RIGHT)
draw_circle(DIAL_CENTER, DIAL_RADIUS, Color(0.08, 0.1, 0.18, 0.95) if night else Color(0.25, 0.45, 0.7, 0.95)) Sketch.text(self, Vector2(right, r.position.y + 54.0), sub, 36, Sketch.TEXT, HORIZONTAL_ALIGNMENT_RIGHT)
var ring := Color(0.6, 0.7, 1.0) if night else Color(1.0, 0.85, 0.4) var y := r.end.y + 1.0
draw_arc(DIAL_CENTER, DIAL_RADIUS - 4.0, -PI * 0.5, -PI * 0.5 + TAU * frac, 48, ring, 5.0) Sketch.line(self, Vector2(r.position.x + 6.0, y), Vector2(r.end.x - 6.0, y), Color(PROGRESS, 0.25), 4.0, 302.0, 0.8)
match phase: if frac > 0.0:
CampaignController.Phase.NIGHT: Sketch.line(self, Vector2(r.position.x + 6.0, y), Vector2(r.position.x + 6.0 + (r.size.x - 12.0) * frac, y), PROGRESS, 4.0, 302.0, 0.8)
draw_circle(DIAL_CENTER, 15.0, Color(0.93, 0.95, 1.0)) var lines := hint.split("\n", false)
draw_circle(DIAL_CENTER + Vector2(7.0, -5.0), 13.0, Color(0.08, 0.1, 0.18)) for i in lines.size():
CampaignController.Phase.DUSK, CampaignController.Phase.DAWN: Sketch.text(self, Vector2(right, r.end.y + 10.0 + i * HINT_LINE), lines[i], HINT_SIZE, Color(1.0, 0.93, 0.75),
var c := DIAL_CENTER + Vector2(0.0, 8.0) HORIZONTAL_ALIGNMENT_RIGHT, 6)
draw_circle(c, 15.0, Color(1.0, 0.55, 0.3) if phase == CampaignController.Phase.DUSK else Color(1.0, 0.72, 0.6))
draw_rect(Rect2(c + Vector2(-20.0, 4.0), Vector2(40.0, 16.0)), Color(0.12, 0.2, 0.12))
_:
draw_circle(DIAL_CENTER, 15.0, Color(1.0, 0.88, 0.35))
func _on_phase_changed(phase: CampaignController.Phase, _previous: CampaignController.Phase) -> void: func _on_phase_changed(phase: CampaignController.Phase, _previous: CampaignController.Phase) -> void:
@ -183,13 +185,3 @@ static func join_words(words: PackedStringArray) -> String:
return "".join(words) return "".join(words)
return ", ".join(words.slice(0, words.size() - 1)) + " and " + words[words.size() - 1] return ", ".join(words.slice(0, words.size() - 1)) + " and " + words[words.size() - 1]
func _label(font_size: int, at: Vector2) -> Label:
var l := Label.new()
l.position = at
l.add_theme_font_size_override("font_size", font_size)
l.add_theme_color_override("font_outline_color", Color.BLACK)
l.add_theme_constant_override("outline_size", 6)
l.mouse_filter = Control.MOUSE_FILTER_IGNORE
add_child(l)
return l

View file

@ -1,6 +1,6 @@
class_name RadarHud class_name RadarHud
extends Control extends Control
## Top-right minimap, under ResourceHud's materials readout (Task #8): the playable farm's ## Top-right minimap, under PhaseHud's day and time (Task #8): the playable farm's
## outline scaled into a small panel, a white dot for the local scarecrow, and one dot per alive ## outline scaled into a small panel, a white dot for the local scarecrow, and one dot per alive
## enemy within GameConfig.radar_range meters of it, colored by type. Hidden unless the Radar ## enemy within GameConfig.radar_range meters of it, colored by type. Hidden unless the Radar
## upgrade is bought (Upgrades.owned(state, "radar")); like the Alien Ray, it's a hidden shed item ## upgrade is bought (Upgrades.owned(state, "radar")); like the Alien Ray, it's a hidden shed item
@ -8,12 +8,11 @@ extends Control
## GameConfig.radar_refresh seconds rather than every frame, matching the "sweep" feel of a radar ## GameConfig.radar_refresh seconds rather than every frame, matching the "sweep" feel of a radar
## rather than a live camera. ## rather than a live camera.
## Panel size, and its offset from the screen's top-right corner (below ResourceHud, which uses ## Panel size, and its offset from the screen's top-right corner (MARGIN_TOP when there's no
## roughly the top 120 px of that corner: PhaseHud/AssetHud/ScarecrowHud/CoopHud leave the rest of ## PhaseHud; else just under its widget and hint, PhaseHud.bottom()).
## the right side clear).
const MAP_SIZE := Vector2(190.0, 190.0) const MAP_SIZE := Vector2(190.0, 190.0)
const MARGIN_RIGHT := 24.0 const MARGIN_RIGHT := 24.0
const MARGIN_TOP := 140.0 const MARGIN_TOP := 150.0
const DOT_RADIUS := 4.0 const DOT_RADIUS := 4.0
const PLAYER_RADIUS := 5.0 const PLAYER_RADIUS := 5.0
## thief (alien), crow, breaker (alien robot), ufo: EnemySystem.TYPE_*. ## thief (alien), crow, breaker (alien robot), ufo: EnemySystem.TYPE_*.
@ -40,9 +39,7 @@ func _ready() -> void:
mouse_filter = Control.MOUSE_FILTER_IGNORE mouse_filter = Control.MOUSE_FILTER_IGNORE
_title = Label.new() _title = Label.new()
_title.text = "Radar" _title.text = "Radar"
_title.add_theme_font_size_override("font_size", 18) Sketch.style(_title, 22, Sketch.TEXT, 6)
_title.add_theme_color_override("font_outline_color", Color.BLACK)
_title.add_theme_constant_override("outline_size", 6)
_title.mouse_filter = Control.MOUSE_FILTER_IGNORE _title.mouse_filter = Control.MOUSE_FILTER_IGNORE
add_child(_title) add_child(_title)
@ -51,7 +48,10 @@ func _process(delta: float) -> void:
visible = sim != null and sim.campaign != null and Upgrades.owned(sim.campaign.state, "radar") visible = sim != null and sim.campaign != null and Upgrades.owned(sim.campaign.state, "radar")
if not visible: if not visible:
return return
_title.position = _rect().position + Vector2(10.0, 6.0) var at := _rect().position + Vector2(10.0, 0.0)
if at != _title.position:
_title.position = at
queue_redraw() # moved with PhaseHud's hint
_refresh_left -= delta _refresh_left -= delta
if _refresh_left <= 0.0: if _refresh_left <= 0.0:
_refresh() _refresh()
@ -87,10 +87,9 @@ func _draw() -> void:
if not visible: if not visible:
return return
var r := _rect() var r := _rect()
draw_rect(r, Color(0.0, 0.0, 0.0, 0.42)) Sketch.box(self, r, Sketch.WASH, Color(0, 0, 0, 0), 0.0, 501.0)
var inner := Rect2(r.position + Vector2(10.0, 30.0), r.size - Vector2(20.0, 40.0)) var inner := Rect2(r.position + Vector2(10.0, 30.0), r.size - Vector2(20.0, 40.0))
draw_rect(inner, Color(0.08, 0.14, 0.08, 0.85)) Sketch.box(self, inner, Color(0.08, 0.14, 0.08, 0.85), Color(0.6, 0.8, 0.6, 0.7), 2.0, 502.0)
draw_rect(inner, Color(0.5, 0.7, 0.5, 0.6), false, 1.5)
if sim == null or sim.zones == null: if sim == null or sim.zones == null:
return return
var playable: Rect2 = sim.zones.playable var playable: Rect2 = sim.zones.playable
@ -111,4 +110,5 @@ static func _to_map(inner: Rect2, playable: Rect2, world: Vector2) -> Vector2:
func _rect() -> Rect2: func _rect() -> Rect2:
return Rect2(Vector2(size.x - MARGIN_RIGHT - MAP_SIZE.x, MARGIN_TOP), MAP_SIZE) var top := sim.phase_hud.bottom() + 8.0 if sim != null and sim.phase_hud != null else MARGIN_TOP
return Rect2(Vector2(size.x - MARGIN_RIGHT - MAP_SIZE.x, top), MAP_SIZE)

View file

@ -1,79 +1,111 @@
class_name ResourceHud class_name ResourceHud
extends Control extends Control
## Top-right materials readout: what the supply shed holds, and what this machine's scarecrow ## Bottom-left backpack, hand-drawn (Sketch): this machine's scarecrow's pouch, "used/capacity"
## carries in its own pouch (with its capacity). A line flashes when its numbers change. ## beside it, and a red dot once something new has gone into it since it was last opened (gone
## again when the pouch is emptied). The pouch action (I / R3) opens the pouch panel over it, and
## closes it again: each material carried, and how much of each the supply shed holds.
## The backpack icon, from the screen's bottom-left corner.
const ICON := Rect2(26.0, -136.0, 108.0, 108.0)
const PANEL_WIDTH := 410.0
const ROW := 46.0
const DOT := Color(0.92, 0.12, 0.1)
const SHED := Color(1.0, 0.9, 0.62)
var campaign: CampaignController var campaign: CampaignController
## The avatar slot whose pouch is shown (FarmSim.set_local: the partner's machine shows P2's). ## The avatar slot whose pouch is shown (FarmSim.set_local: the partner's machine shows P2's).
var slot: int = 0 var slot: int = 0
## The pouch panel is open.
var open := false
## Something went into the pouch since it was last opened.
var new_items := false
## Set by FarmSim: shows how many structures stand. var _last := {}
var structures: StructureSystem
var _shed: RichTextLabel
var _pouch: RichTextLabel
var _built: RichTextLabel
var _last_shed := ""
var _last_pouch := ""
var _flash_shed: float = 0.0
var _flash_pouch: float = 0.0
func setup(p_campaign: CampaignController) -> void: func setup(p_campaign: CampaignController) -> void:
campaign = p_campaign campaign = p_campaign
_last = campaign.state.resources.pouch_of(slot).duplicate()
func _ready() -> void: func _ready() -> void:
set_anchors_preset(Control.PRESET_FULL_RECT) set_anchors_preset(Control.PRESET_FULL_RECT)
mouse_filter = Control.MOUSE_FILTER_IGNORE mouse_filter = Control.MOUSE_FILTER_IGNORE
_shed = _line(20.0)
_pouch = _line(52.0)
_built = _line(84.0)
func _process(delta: float) -> void: func _unhandled_input(event: InputEvent) -> void:
if campaign != null and is_visible_in_tree() and event.is_action_pressed("pouch", false):
toggle()
get_viewport().set_input_as_handled()
func toggle() -> void:
open = not open
if open:
new_items = false
## "6/15": what the pouch holds, of what it can.
func count_text() -> String:
var r := campaign.state.resources
return "%d/%d" % [r.pouch_total(slot), r.pouch_capacity]
## The pouch panel's rows: {material, pouch, shed}, one per material (ResourceStore.MATERIALS).
func rows() -> Array[Dictionary]:
var out: Array[Dictionary] = []
var r := campaign.state.resources
var p := r.pouch_of(slot)
for m in ResourceStore.MATERIALS:
out.append({"material": m, "pouch": int(p.get(m, 0)), "shed": int(r.shed.get(m, 0))})
return out
func _process(_delta: float) -> void:
if campaign == null: if campaign == null:
return return
var r := campaign.state.resources var r := campaign.state.resources
var shed := "Shed %s" % _amounts(r.shed) var p := r.pouch_of(slot)
var total := r.pouch_total(slot)
var pouch := "Pouch %d/%d %s" % [total, r.pouch_capacity, _amounts(r.pouch_of(slot)) if total > 0 else "empty"]
if shed != _last_shed:
_last_shed = shed
_shed.text = shed
_flash_shed = 1.0
if pouch != _last_pouch:
_last_pouch = pouch
_pouch.text = pouch
_flash_pouch = 1.0
_flash_shed = maxf(_flash_shed - delta * 2.0, 0.0)
_flash_pouch = maxf(_flash_pouch - delta * 2.0, 0.0)
if structures != null:
_built.text = "Built %d structures [B] build" % structures.count()
_shed.modulate = Color.WHITE.lerp(Color(1.0, 1.0, 0.55), _flash_shed)
_pouch.modulate = Color.WHITE.lerp(Color(1.0, 1.0, 0.55), _flash_pouch)
func _amounts(d: Dictionary) -> String:
var parts: Array[String] = []
for m in ResourceStore.MATERIALS: for m in ResourceStore.MATERIALS:
parts.append("[color=#%s]%s %d[/color]" % [GatherNode.COLORS[m].to_html(false), m.capitalize(), int(d.get(m, 0))]) if int(p.get(m, 0)) > int(_last.get(m, 0)) and not open:
return " ".join(parts) new_items = true
_last = p.duplicate()
if r.pouch_total(slot) == 0:
new_items = false
queue_redraw()
func _line(y: float) -> RichTextLabel: func _draw() -> void:
var l := RichTextLabel.new() if campaign == null:
l.bbcode_enabled = true return
l.fit_content = true var icon := Rect2(Vector2(ICON.position.x, size.y + ICON.position.y), ICON.size)
l.scroll_active = false Sketch.icon(self, "backpack", icon)
l.autowrap_mode = TextServer.AUTOWRAP_OFF if new_items:
l.mouse_filter = Control.MOUSE_FILTER_IGNORE var at := icon.position + Vector2(icon.size.x - 16.0, 16.0)
l.add_theme_font_size_override("normal_font_size", 22) draw_colored_polygon(Sketch.blob(at, 11.0, 11.0, 401.0, 0.04, 20), DOT)
l.add_theme_color_override("font_outline_color", Color.BLACK) Sketch.circle(self, at, 11.5, Sketch.INK, 2.0, 402.0)
l.add_theme_constant_override("outline_size", 6) Sketch.text(self, Vector2(icon.end.x + 4.0, icon.get_center().y - 18.0), count_text(), 42)
l.set_anchors_preset(Control.PRESET_TOP_RIGHT) if open:
l.offset_left = -520.0 _draw_panel(icon)
l.offset_right = -24.0
l.offset_top = y
add_child(l) func _draw_panel(icon: Rect2) -> void:
return l var list := rows()
var height := 52.0 + list.size() * ROW + 12.0
var r := Rect2(Vector2(icon.position.x - 4.0, icon.position.y - 14.0 - height), Vector2(PANEL_WIDTH, height))
Sketch.panel(self, r, 411.0)
var pouch_x := r.position.x + 290.0
var shed_x := r.end.x - 26.0
Sketch.text(self, r.position + Vector2(18.0, 8.0), "Pouch", 32)
Sketch.text(self, Vector2(pouch_x, r.position.y + 14.0), "Carried", 24, Sketch.DIM, HORIZONTAL_ALIGNMENT_RIGHT, 6)
Sketch.text(self, Vector2(shed_x, r.position.y + 14.0), "Shed", 24, Sketch.DIM, HORIZONTAL_ALIGNMENT_RIGHT, 6)
Sketch.rule(self, r.position.x + 14.0, r.end.x - 14.0, r.position.y + 50.0, 412.0)
for i in list.size():
var row: Dictionary = list[i]
var m: String = row["material"]
var y := r.position.y + 56.0 + i * ROW
Sketch.icon(self, m, Rect2(Vector2(r.position.x + 14.0, y), Vector2(40.0, 40.0)))
Sketch.text(self, Vector2(r.position.x + 62.0, y + 2.0), m.capitalize(), 30, GatherNode.COLORS[m])
var carried: int = row["pouch"]
Sketch.text(self, Vector2(pouch_x, y + 2.0), str(carried), 30, Sketch.TEXT if carried > 0 else Sketch.DIM, HORIZONTAL_ALIGNMENT_RIGHT)
Sketch.text(self, Vector2(shed_x, y + 2.0), str(row["shed"]), 30, SHED, HORIZONTAL_ALIGNMENT_RIGHT)

View file

@ -114,7 +114,7 @@ func refresh() -> void:
_title.text = "The farmers are away" _title.text = "The farmers are away"
lines.append("Keep the farm safe for %d nights until they come home: the crops, the animals in the pen, and the supplies in the shed." % nights) lines.append("Keep the farm safe for %d nights until they come home: the crops, the animals in the pen, and the supplies in the shed." % nights)
lines.append("By day, gather wood, scrap, and straw (hold E), store them at the barn, and build defenses (B). There's more to gather off the farm, to the north, east, and south.") lines.append("By day, gather wood, scrap, and straw (hold E), store them at the barn, and build defenses (B). There's more to gather off the farm, to the north, east, and south.")
lines.append("At night, stab aliens with your pitchfork (left mouse), scare them off (Q), and pick up anything they drop. Animals roam loose until you lead them into the pen: walk up to one and it follows you. The supply shed sells a corn shooter (switch weapons with Tab or 1-2), and more weapons arrive there over the days.") lines.append("At night, stab aliens with your pitchfork (left mouse), scare them off (Q), and pick up anything they drop. Animals roam loose until you lead them into the pen: walk up to one and it follows you. The supply shed sells a corn shooter (switch weapons with Tab or the number keys), and more weapons arrive there over the days.")
else: else:
var e: Dictionary = s.night_log[s.night_log.size() - 1] var e: Dictionary = s.night_log[s.night_log.size() - 1]
_title.text = "Morning of day %d of %d" % [s.night, nights] _title.text = "Morning of day %d of %d" % [s.night, nights]

View file

@ -6,9 +6,9 @@ extends Node3D
## scarecrow's from the start; or the corn shooter, Potato Cannon, Shurikens, Propane Torch, or ## scarecrow's from the start; or the corn shooter, Potato Cannon, Shurikens, Propane Torch, or
## Alien Ray, every one bought at the supply shed, Upgrades.shop_of "shed"), and pumpkin bombs ## Alien Ray, every one bought at the supply shed, Upgrades.shop_of "shed"), and pumpkin bombs
## in the off-hand (the left, also shed-bought). weapon_next (Tab / d-pad down) cycles through ## in the off-hand (the left, also shed-bought). weapon_next (Tab / d-pad down) cycles through
## the main weapons owned; weapon_1..2 (1-2) pick the first two only (Task #7 added more main ## the main weapons owned; weapon_1..6 (1-6) pick the first, second, ... of the ones owned
## weapons than there are number keys — the rest are Tab-cycle only), both only outside build ## (owned_main: the HUD's hotbar slots, numbered the same way), both only outside build mode
## mode (where those keys pick structures) and with no menu open. The off-hand holds the ## (where those keys pick structures) and with no menu open. The off-hand holds the
## off-hand weapon owned (OFFHAND_WEAPONS; there's no pick while there's only one). A main ## off-hand weapon owned (OFFHAND_WEAPONS; there's no pick while there's only one). A main
## weapon no longer owned (a retry from before it was bought) goes back to the pitchfork, an ## weapon no longer owned (a retry from before it was bought) goes back to the pitchfork, an
## off-hand one out of the hand. The Alien Ray stays hidden (GameConfig "hidden") until enough ## off-hand one out of the hand. The Alien Ray stays hidden (GameConfig "hidden") until enough
@ -85,13 +85,14 @@ const WEAPON_IDS: Array[String] = ["pitchfork", "corn_shooter", "pumpkin_bomb",
"propane_torch", "alien_ray"] "propane_torch", "alien_ray"]
const WEAPON_NAMES: Array[String] = ["Pitchfork", "Corn shooter", "Pumpkin bombs", "Potato cannon", "Shurikens", const WEAPON_NAMES: Array[String] = ["Pitchfork", "Corn shooter", "Pumpkin bombs", "Potato cannon", "Shurikens",
"Propane torch", "Alien ray"] "Propane torch", "Alien ray"]
## The main weapons (Weapon), in the order weapon_next cycles them, and the off-hand ones. ## The main weapons (Weapon), in the order weapon_next cycles them and the hotbar shows them, and
## weapon_1.. only picks the first SWITCH_ACTIONS.size() - 1 of MAIN_WEAPONS directly (no new ## the off-hand ones. weapon_k picks the k-th main weapon owned (owned_main), one number key per
## number-key actions were added for Task #7's four); the rest are reached by cycling. ## main weapon.
const MAIN_WEAPONS: Array[int] = [Weapon.PITCHFORK, Weapon.CORN_SHOOTER, Weapon.POTATO_CANNON, Weapon.SHURIKENS, const MAIN_WEAPONS: Array[int] = [Weapon.PITCHFORK, Weapon.CORN_SHOOTER, Weapon.POTATO_CANNON, Weapon.SHURIKENS,
Weapon.PROPANE_TORCH, Weapon.ALIEN_RAY] Weapon.PROPANE_TORCH, Weapon.ALIEN_RAY]
const OFFHAND_WEAPONS: Array[int] = [Weapon.PUMPKIN_BOMB] const OFFHAND_WEAPONS: Array[int] = [Weapon.PUMPKIN_BOMB]
const SWITCH_ACTIONS: Array[StringName] = [&"weapon_next", &"weapon_1", &"weapon_2"] const SWITCH_ACTIONS: Array[StringName] = [&"weapon_next", &"weapon_1", &"weapon_2", &"weapon_3", &"weapon_4",
&"weapon_5", &"weapon_6"]
## Main weapons that fire from the muzzle (SIDE_OFFSET/muzzle_distance), so aiming at a target ## Main weapons that fire from the muzzle (SIDE_OFFSET/muzzle_distance), so aiming at a target
## needs the same muzzle correction as the corn shooter's (attack_toward, the mouse in _update_aim). ## needs the same muzzle correction as the corn shooter's (attack_toward, the mouse in _update_aim).
## The Propane Torch's band runs along the gun's line too (#17), and the Alien Ray's beam (#18). ## The Propane Torch's band runs along the gun's line too (#17), and the Alien Ray's beam (#18).
@ -199,6 +200,16 @@ func owns(w: int) -> bool:
return w > 0 and w < WEAPON_IDS.size() and campaign != null and Upgrades.owned(campaign.state, WEAPON_IDS[w]) return w > 0 and w < WEAPON_IDS.size() and campaign != null and Upgrades.owned(campaign.state, WEAPON_IDS[w])
## The main weapons this scarecrow owns, in MAIN_WEAPONS order: the hotbar's slots, weapon_k
## picking the k-th.
func owned_main() -> Array[int]:
var out: Array[int] = []
for w in MAIN_WEAPONS:
if owns(w):
out.append(w)
return out
## Takes the weapon up if it's owned: a main weapon into the hand, an off-hand one into the ## Takes the weapon up if it's owned: a main weapon into the hand, an off-hand one into the
## off-hand. Returns whether it's there now. ## off-hand. Returns whether it's there now.
func equip(w: int) -> bool: func equip(w: int) -> bool:
@ -277,11 +288,10 @@ func tick(dt: float, can_switch: bool) -> void:
return return
if p[&"weapon_next"]: if p[&"weapon_next"]:
cycle() cycle()
# Only the first SWITCH_ACTIONS.size() - 1 main weapons have a number key (Task #7 added more var owned := owned_main()
# MAIN_WEAPONS than keys; the rest are Tab-cycle only). for k in mini(owned.size(), SWITCH_ACTIONS.size() - 1):
for k in mini(MAIN_WEAPONS.size(), SWITCH_ACTIONS.size() - 1):
if p[SWITCH_ACTIONS[k + 1]]: if p[SWITCH_ACTIONS[k + 1]]:
equip(MAIN_WEAPONS[k]) equip(owned[k])
## One physics tick while the scarecrow can attack: update the aim, then attack with the main ## One physics tick while the scarecrow can attack: update the aim, then attack with the main

View file

@ -1,42 +1,49 @@
class_name ScarecrowHud class_name ScarecrowHud
extends Control extends Control
## Bottom-left status for the scarecrow: health as pips, the fear ability as a circle that ## The scarecrow's part of the HUD, hand-drawn (Sketch):
## sweeps full while it cools down and flashes when it is ready again, the patch hint with its ## * Top-left: its portrait in a ring that is the fear ability's charge: a dim ring with a blue
## progress, and once the Sprint upgrade is bought a sprint line (ready, seconds left, or ## arc sweeping round while fear recharges, glowing blue when it's ready (a flash as it
## recharging); plus a red screen tint when the scarecrow is hit. Bottom-right, the weapons: ## becomes ready); greyed out while the scarecrow is down. Beside it the health bar, one
## the main ones by number, the one in hand marked, and how to switch; under them the off-hand ## segment per point of max health (red filled, grey empty; while patching, the segments the
## (pumpkin bombs, marked when one is ready, else its recharge) and its button. The ones not ## patch will fill fill in), and under it, once the Sprint upgrade is bought, a thin green
## bought yet are greyed out (with where to buy them: Upgrades.shop_of). ## bar: the sprint's stamina (draining while sprinting, filling back while it recharges).
## * Bottom-center: the hotbar, one slot per main weapon owned (locked ones aren't shown),
## numbered by the key that picks it (ScarecrowCombat.owned_main: weapon_k picks slot k), the
## one in hand highlighted; then past a divider the off-hand weapons owned (pumpkin bombs), in a
## bolder frame, darkened from the top while a bomb recharges. Hidden in build mode (BuildHud
## has the bottom then).
## * A red tint over the screen when the scarecrow is hit.
const PIP := Vector2(22.0, 16.0) const PORTRAIT_CENTER := Vector2(78.0, 76.0)
const PIP_GAP := 5.0 const PORTRAIT_RADIUS := 50.0
const FEAR_RADIUS := 26.0 const FEAR_COLOR := Color(0.36, 0.74, 1.0)
## Extra height of the panel for the sprint line. const BAR_ORIGIN := Vector2(146.0, 32.0)
const SPRINT_ROW := 30.0 const SEGMENT := Vector2(54.0, 22.0)
## The weapon panel, from the bottom-right corner: its row height, and its width (its height grows const SEGMENT_GAP := 8.0
## with ScarecrowCombat.MAIN_WEAPONS / OFFHAND_WEAPONS, see _weapons_rect / _offhand_top). const SEGMENT_SKEW := 7.0
const WEAPON_PANEL_WIDTH := 320.0 ## The health bar grows a segment per point of max health up to this width, then its segments
const WEAPON_ROW := 30.0 ## get narrower.
const BAR_MAX_WIDTH := 360.0
const STAMINA_HEIGHT := 6.0
const HEALTH := Color(0.88, 0.14, 0.12)
const EMPTY := Color(0.62, 0.62, 0.6, 0.85)
const STAMINA := Color(0.3, 0.9, 0.25)
const SLOT := Vector2(78.0, 72.0)
const SLOT_GAP := 16.0
const DIVIDER_GAP := 30.0
const HOTBAR_BOTTOM := 22.0
var kit: Scarecrow var kit: Scarecrow
## This machine's scarecrow's weapons. ## This machine's scarecrow's weapons.
var combat: ScarecrowCombat var combat: ScarecrowCombat
var campaign: CampaignController var campaign: CampaignController
## The health line's name ("Scarecrow"; in co-op "P1 Scarecrow" / "P2 Scarecrow"). ## Set by FarmSim: the hotbar hides in build mode.
var label := "Scarecrow" var build: BuildMode
var _tint: ColorRect var _tint: ColorRect
var _hp_label: Label
var _fear_label: Label
var _patch_label: Label
var _sprint_label: Label
var _weapon_title: Label
var _weapon_rows: Array[Label] = []
var _weapon_hint: Label
var _offhand_title: Label
var _offhand_rows: Array[Label] = []
var _hit: float = 0.0 var _hit: float = 0.0
var _ready_flash: float = 0.0 var _ready_flash: float = 0.0
var _time: float = 0.0
func setup(p_kit: Scarecrow, p_campaign: CampaignController, p_combat: ScarecrowCombat = null) -> void: func setup(p_kit: Scarecrow, p_campaign: CampaignController, p_combat: ScarecrowCombat = null) -> void:
@ -71,102 +78,48 @@ func _ready() -> void:
_tint.color = Color(0.85, 0.05, 0.0, 0.0) _tint.color = Color(0.85, 0.05, 0.0, 0.0)
_tint.mouse_filter = Control.MOUSE_FILTER_IGNORE _tint.mouse_filter = Control.MOUSE_FILTER_IGNORE
add_child(_tint) add_child(_tint)
_hp_label = _label(22)
_fear_label = _label(20)
_patch_label = _label(20)
_sprint_label = _label(20)
_weapon_title = _label(18)
_weapon_title.text = "Main weapon"
for i in ScarecrowCombat.MAIN_WEAPONS.size():
_weapon_rows.append(_label(20))
_weapon_hint = _label(16)
_weapon_hint.text = "Switch: Tab / 1-2 / d-pad down"
_offhand_title = _label(18)
_offhand_title.text = "Off-hand right mouse / LT"
for i in ScarecrowCombat.OFFHAND_WEAPONS.size():
_offhand_rows.append(_label(20))
func _process(delta: float) -> void: func _process(delta: float) -> void:
_time += delta
_hit = maxf(_hit - delta * 2.5, 0.0) _hit = maxf(_hit - delta * 2.5, 0.0)
_ready_flash = maxf(_ready_flash - delta * 2.0, 0.0) _ready_flash = maxf(_ready_flash - delta * 2.0, 0.0)
_tint.color.a = 0.22 * _hit _tint.color.a = 0.22 * _hit
if kit == null:
return
var base := _base()
var s := campaign.state
_hp_label.text = "%s %d/%d" % [label, kit.hp(), kit.max_hp()]
_hp_label.position = base + Vector2(0.0, -34.0)
if not kit.alive:
_fear_label.text = "Fear"
elif kit.fear_left == 0.0:
_fear_label.text = "Fear Q / LB"
else:
_fear_label.text = "Fear %.0f s" % ceilf(kit.fear_left)
_fear_label.position = base + Vector2(FEAR_RADIUS * 2.0 + 14.0, 34.0)
if not kit.alive:
_patch_label.text = "Patch"
elif kit.patching:
_patch_label.text = "Patching up..."
elif kit.hp() >= kit.max_hp():
_patch_label.text = "Patch (full health)"
else:
_patch_label.text = "Patch hold F / Y (%s)" % ResourceStore.describe(kit.config.costs.get("patch", {}))
_patch_label.position = base + Vector2(FEAR_RADIUS * 2.0 + 14.0, 62.0)
var body := kit.player
_sprint_label.visible = _sprint_shown()
if _sprint_label.visible:
if not kit.alive:
_sprint_label.text = "Sprint"
elif body.sprinting:
_sprint_label.text = "Sprinting %.1f s" % body.sprint_left
elif body.sprint_recharge > 0.0:
_sprint_label.text = "Sprint %.0f s" % ceilf(body.sprint_recharge)
else:
_sprint_label.text = "Sprint hold Shift / L3"
_sprint_label.position = base + Vector2(0.0, 100.0)
_update_weapons()
queue_redraw() queue_redraw()
func _update_weapons() -> void: ## Whether the green stamina bar shows: only once the Sprint upgrade is bought.
var shown := combat != null func stamina_shown() -> bool:
for l: Label in [_weapon_title, _weapon_hint, _offhand_title] + _weapon_rows + _offhand_rows: var body := kit.player if kit != null else null
l.visible = shown return body != null and body.config != null and body.can_sprint()
if not shown:
return
var at := _weapons_rect().position
_weapon_title.position = at + Vector2(12.0, 6.0)
# weapon_1.. only picks the first SWITCH_ACTIONS.size() - 1 (Task #7 added more main weapons
# than there are number keys): only those rows get a number, the rest just their name.
var keyed := ScarecrowCombat.SWITCH_ACTIONS.size() - 1
for k in _weapon_rows.size():
var w := ScarecrowCombat.MAIN_WEAPONS[k]
var text := "%d %s" % [k + 1, ScarecrowCombat.WEAPON_NAMES[w]] if k < keyed else ScarecrowCombat.WEAPON_NAMES[w]
_weapon_row(_weapon_rows[k], text, w, w == combat.weapon)
_weapon_rows[k].position = at + Vector2(30.0, 30.0 + k * WEAPON_ROW)
_weapon_hint.position = at + Vector2(12.0, 30.0 + _weapon_rows.size() * WEAPON_ROW + 2.0)
_offhand_title.position = at + Vector2(12.0, _offhand_top() + 6.0)
for k in _offhand_rows.size():
var w := ScarecrowCombat.OFFHAND_WEAPONS[k]
var text := ScarecrowCombat.WEAPON_NAMES[w]
if w == ScarecrowCombat.Weapon.PUMPKIN_BOMB and combat.owns(w) and combat.bomb_left > 0.0:
text += " %.0f s" % ceilf(combat.bomb_left)
_weapon_row(_offhand_rows[k], text, w, _offhand_lit(w))
_offhand_rows[k].position = at + Vector2(30.0, _offhand_top() + 30.0 + k * WEAPON_ROW)
## A weapon's row: greyed out until it's bought, gold when it's in hand (lit). ## The green bar's fill, 0..1: the sprint left while sprinting, its recharge after, else full.
func _weapon_row(l: Label, text: String, w: int, lit: bool) -> void: func stamina() -> float:
var color := Color(0.95, 0.95, 0.95) if not stamina_shown():
if not combat.owns(w): return 1.0
var shop := Upgrades.shop_of(campaign.config, ScarecrowCombat.WEAPON_IDS[w]) if campaign != null else "workbench" var body := kit.player
text += " (%s)" % ("supply shed" if shop == "shed" else "workbench") if body.sprinting:
color = Color(0.55, 0.55, 0.55) return clampf(body.sprint_left / maxf(body.config.sprint_time, 0.001), 0.0, 1.0)
elif lit: if body.sprint_recharge > 0.0:
color = Color(1.0, 0.85, 0.3) return clampf(1.0 - body.sprint_recharge / maxf(body.config.sprint_cooldown, 0.001), 0.0, 1.0)
l.text = text return 1.0
l.add_theme_color_override("font_color", color)
## The hotbar's slots as shown, left to right: {weapon, key (the number that picks it; 0 for
## the off-hand), offhand, selected}. Empty while it's hidden (build mode, no weapons).
func slots() -> Array[Dictionary]:
var out: Array[Dictionary] = []
if combat == null or (build != null and build.active):
return out
var owned := combat.owned_main()
for k in owned.size():
out.append({"weapon": owned[k], "key": k + 1 if k < ScarecrowCombat.SWITCH_ACTIONS.size() - 1 else 0,
"offhand": false, "selected": owned[k] == combat.weapon})
for w in ScarecrowCombat.OFFHAND_WEAPONS:
if combat.owns(w):
out.append({"weapon": w, "key": 0, "offhand": true, "selected": _offhand_lit(w)})
return out
## Whether the off-hand weapon is in the off-hand and ready (a pumpkin bomb not recharging). ## Whether the off-hand weapon is in the off-hand and ready (a pumpkin bomb not recharging).
@ -174,73 +127,110 @@ func _offhand_lit(w: int) -> bool:
return w == combat.offhand and not (w == ScarecrowCombat.Weapon.PUMPKIN_BOMB and combat.bomb_left > 0.0) return w == combat.offhand and not (w == ScarecrowCombat.Weapon.PUMPKIN_BOMB and combat.bomb_left > 0.0)
## Top of the off-hand section, under the main weapon rows and the switch hint (grows with
## ScarecrowCombat.MAIN_WEAPONS.size()).
func _offhand_top() -> float:
return 30.0 + ScarecrowCombat.MAIN_WEAPONS.size() * WEAPON_ROW + 32.0
func _weapons_rect() -> Rect2:
var height := _offhand_top() + 30.0 + ScarecrowCombat.OFFHAND_WEAPONS.size() * WEAPON_ROW + 12.0
return Rect2(size - Vector2(WEAPON_PANEL_WIDTH + 36.0, height + 26.0), Vector2(WEAPON_PANEL_WIDTH, height))
func _draw() -> void: func _draw() -> void:
if kit == null: if kit == null:
return return
var base := _base() _draw_portrait()
var s := campaign.state _draw_health()
var height := 146.0 + (SPRINT_ROW if _sprint_shown() else 0.0) _draw_hotbar()
draw_rect(Rect2(base - Vector2(14.0, 46.0), Vector2(340.0, height)), Color(0.0, 0.0, 0.0, 0.42))
var frac := float(kit.hp()) / float(maxi(kit.max_hp(), 1))
var full := Color(0.45, 0.9, 0.35) if frac > 0.5 else (Color(1.0, 0.8, 0.2) if frac > 0.25 else Color(1.0, 0.3, 0.2)) func _draw_portrait() -> void:
full = full.lerp(Color.WHITE, _hit * 0.6) var c := PORTRAIT_CENTER
for i in kit.max_hp(): var r := PORTRAIT_RADIUS
var r := Rect2(base + Vector2(i * (PIP.x + PIP_GAP), 0.0), PIP) var box := Rect2(c - Vector2(r, r) * 0.98, Vector2(r, r) * 1.96)
draw_rect(r, full if i < kit.hp() else Color(0.15, 0.15, 0.15, 0.8)) Sketch.icon(self, "portrait", box)
draw_rect(r, Color(0.0, 0.0, 0.0, 0.9), false, 2.0) if not kit.alive:
# Fear: dark disc, a sweep that fills while cooling down, bright when ready. draw_circle(c, r - 3.0, Color(0.16, 0.16, 0.16, 0.6))
var c := base + Vector2(FEAR_RADIUS, 32.0 + FEAR_RADIUS)
var ready := kit.fear_left == 0.0 and kit.alive var ready := kit.fear_left == 0.0 and kit.alive
draw_circle(c, FEAR_RADIUS, Color(0.08, 0.1, 0.14, 0.9))
if ready: if ready:
draw_circle(c, FEAR_RADIUS - 5.0, Color(0.55, 0.85, 1.0).lerp(Color.WHITE, _ready_flash)) var pulse := 0.75 + 0.25 * sin(_time * 3.2)
for k in 4:
Sketch.circle(self, c, r + 3.0 + k * 3.5, Color(FEAR_COLOR, (0.32 - k * 0.07) * pulse), 4.5, 3.0 + k)
Sketch.circle(self, c, r, Color(0.62, 0.9, 1.0).lerp(Color.WHITE, _ready_flash), 5.0, 1.0)
else: else:
draw_arc(c, FEAR_RADIUS - 8.0, -PI * 0.5, -PI * 0.5 + TAU * kit.fear_charge(), 48, Color(0.4, 0.6, 0.75), 9.0) Sketch.circle(self, c, r, Color(0.32, 0.42, 0.5, 0.85) if kit.alive else Color(0.4, 0.4, 0.4, 0.85), 5.0, 1.0)
draw_arc(c, FEAR_RADIUS + 3.0 + _ready_flash * 10.0, 0.0, TAU, 48, Color(1.0, 1.0, 1.0, 0.25 + 0.75 * _ready_flash), 2.5) if kit.alive:
if combat != null: Sketch.circle(self, c, r, FEAR_COLOR, 5.0, 2.0, -PI * 0.5, -PI * 0.5 + TAU * kit.fear_charge())
var w := _weapons_rect() if _ready_flash > 0.0:
draw_rect(w, Color(0.0, 0.0, 0.0, 0.42)) Sketch.circle(self, c, r + 6.0 + (1.0 - _ready_flash) * 18.0, Color(0.8, 0.95, 1.0, _ready_flash), 3.0, 4.0)
_draw_lit_row(w, 32.0 + ScarecrowCombat.MAIN_WEAPONS.find(combat.weapon) * WEAPON_ROW) Sketch.circle(self, c, r + 2.8, Color(Sketch.INK, 0.8), 1.5, 5.0)
var off := ScarecrowCombat.OFFHAND_WEAPONS.find(combat.offhand) Sketch.circle(self, c, r - 2.8, Color(Sketch.INK, 0.8), 1.5, 6.0)
if off >= 0 and _offhand_lit(combat.offhand):
_draw_lit_row(w, _offhand_top() + 32.0 + off * WEAPON_ROW)
func _draw_health() -> void:
var top := maxi(kit.max_hp(), 1)
var hp := kit.hp()
var step := minf(SEGMENT.x + SEGMENT_GAP, (BAR_MAX_WIDTH + SEGMENT_GAP) / top)
var seg := Vector2(maxf(step - SEGMENT_GAP, 4.0), SEGMENT.y)
var width := step * top - SEGMENT_GAP
var healing := 0
var heal_frac := 0.0
if kit.patching: if kit.patching:
var bar := Rect2(base + Vector2(FEAR_RADIUS * 2.0 + 14.0, 92.0), Vector2(210.0, 8.0)) healing = mini(kit.config.patch_heal, top - hp)
draw_rect(bar, Color(0.1, 0.1, 0.1, 0.9)) heal_frac = clampf(kit.patch_elapsed / maxf(kit.config.patch_time, 0.001), 0.0, 1.0)
draw_rect(Rect2(bar.position, Vector2(bar.size.x * kit.patch_elapsed / kit.config.patch_time, bar.size.y)), Color(0.45, 1.0, 0.4)) var full := HEALTH.lerp(Color.WHITE, _hit * 0.6)
for i in top:
var at := BAR_ORIGIN + Vector2(i * step, 0.0)
var pts := _segment(at, seg, 20.0 + i)
draw_colored_polygon(pts, full if i < hp else EMPTY)
if i >= hp and i < hp + healing:
draw_colored_polygon(_segment(at, Vector2(seg.x * heal_frac, seg.y), 40.0 + i), Color(HEALTH.lightened(0.35), 0.85))
if i < hp: # a darker stroke along the bottom, like paint pooling
Sketch.line(self, at + Vector2(3.0, seg.y - 4.0), at + Vector2(seg.x - 3.0, seg.y - 4.0), full.darkened(0.3), 3.0, 60.0 + i, 0.6)
Sketch.outline(self, pts, Color(Sketch.INK, 0.55), 1.5, 80.0 + i, 0.8, 1)
if not stamina_shown():
return
# The stamina bar, as wide as the health bar.
var bar := Rect2(BAR_ORIGIN + Vector2(0.0, SEGMENT.y + 12.0), Vector2(maxf(width, 120.0), STAMINA_HEIGHT))
var y := bar.get_center().y
Sketch.line(self, Vector2(bar.position.x, y), Vector2(bar.end.x, y), Color(Sketch.INK, 0.6), STAMINA_HEIGHT + 3.0, 101.0, 0.6)
Sketch.line(self, Vector2(bar.position.x, y), Vector2(bar.end.x, y), Color(0.16, 0.3, 0.14, 0.9), STAMINA_HEIGHT, 101.0, 0.6)
var fill := stamina()
if fill > 0.0:
Sketch.line(self, Vector2(bar.position.x, y), Vector2(bar.position.x + bar.size.x * fill, y), STAMINA, STAMINA_HEIGHT, 102.0, 0.6)
## The marked row of the weapon panel w, top pixels down. ## A health segment: a slanted brush stroke.
func _draw_lit_row(w: Rect2, top: float) -> void: func _segment(at: Vector2, seg: Vector2, seed: float) -> PackedVector2Array:
var row := Rect2(w.position + Vector2(6.0, top), Vector2(w.size.x - 12.0, WEAPON_ROW - 2.0)) var w := 1.2
draw_rect(row, Color(1.0, 0.85, 0.3, 0.18)) return PackedVector2Array([at + Vector2(SEGMENT_SKEW, 0.0) + Sketch.jitter(seed, w),
draw_rect(Rect2(row.position, Vector2(4.0, row.size.y)), Color(1.0, 0.85, 0.3)) at + Vector2(SEGMENT_SKEW + seg.x, 1.5) + Sketch.jitter(seed + 1.0, w),
at + Vector2(seg.x, seg.y) + Sketch.jitter(seed + 2.0, w), at + Vector2(0.0, seg.y - 1.0) + Sketch.jitter(seed + 3.0, w)])
func _base() -> Vector2: func _draw_hotbar() -> void:
return Vector2(36.0, size.y - 126.0 - (SPRINT_ROW if _sprint_shown() else 0.0)) var list := slots()
if list.is_empty():
return
func _sprint_shown() -> bool: var mains := 0
return kit != null and kit.player != null and kit.player.can_sprint() for s in list:
if not s["offhand"]:
mains += 1
func _label(font_size: int) -> Label: var width := list.size() * SLOT.x + (list.size() - 1) * SLOT_GAP + (DIVIDER_GAP * 2.0 - SLOT_GAP if mains < list.size() else 0.0)
var l := Label.new() var x := (size.x - width) * 0.5
l.add_theme_font_size_override("font_size", font_size) var y := size.y - HOTBAR_BOTTOM - SLOT.y
l.add_theme_color_override("font_outline_color", Color.BLACK) for i in list.size():
l.add_theme_constant_override("outline_size", 6) var s: Dictionary = list[i]
l.mouse_filter = Control.MOUSE_FILTER_IGNORE var w: int = s["weapon"]
add_child(l) if i == mains and i > 0:
return l var div := x - SLOT_GAP + DIVIDER_GAP
Sketch.line(self, Vector2(div, y - 10.0), Vector2(div, y + SLOT.y + 12.0), Sketch.INK, 3.0, 200.0, 1.5)
x += DIVIDER_GAP * 2.0 - SLOT_GAP
var r := Rect2(Vector2(x, y), SLOT)
var lit: bool = s["selected"] and not s["offhand"] # the off-hand's ready shows by not being darkened
if lit:
r = r.grow(3.0)
r.position.y -= 4.0
Sketch.box(self, r, Sketch.SLOT, Sketch.INK, 4.5 if s["offhand"] else 2.5, 210.0 + i * 3.0)
Sketch.icon(self, ScarecrowCombat.WEAPON_IDS[w], Rect2(r.get_center() - Vector2(38.0, 36.0), Vector2(76.0, 76.0)))
var cooldown := campaign.config.bomb_cooldown if campaign != null else 0.0
if w == ScarecrowCombat.Weapon.PUMPKIN_BOMB and combat.bomb_left > 0.0 and cooldown > 0.0:
var left := clampf(combat.bomb_left / cooldown, 0.0, 1.0)
draw_colored_polygon(Sketch.corners(Rect2(r.position, Vector2(r.size.x, r.size.y * left)).grow(-2.0), 230.0 + i),
Color(0.04, 0.05, 0.04, 0.6))
if lit:
Sketch.box(self, r.grow(2.0), Color(0, 0, 0, 0), Sketch.GOLD, 3.5, 240.0 + i)
if int(s["key"]) > 0:
Sketch.text(self, r.position + Vector2(7.0, 1.0), str(s["key"]), 20, Sketch.TEXT, HORIZONTAL_ALIGNMENT_LEFT, 6)
x += SLOT.x + SLOT_GAP

View file

@ -0,0 +1,108 @@
class_name ScreenLabels
extends Control
## Draws the farm's Label3Ds as flat text over the 3D view, so they stay sharp and readable when
## the 3D view is pixelated (GameSettings.pixel_size). ToonLook tracks every Label3D; a tracked
## label stops rendering in 3D (layers 0) and is drawn here instead, centered on where it projects,
## with its text, colors, and outline (in the HUD's handwritten font, Sketch, unless it has its own
## font), at the size it would have on screen but never smaller than
## MIN_SIZE (far-off ones, under HIDE_BELOW, aren't drawn at all). Labels that would overlap are
## nudged apart: the lowest on screen keeps its place and the ones over it move up clear of it.
## The game's labels are all
## billboards drawn over the scene (no_depth_test), so nothing is lost by drawing them flat, and
## game code keeps using the Label3Ds as before (text, modulate, visible, position). Sits on a
## CanvasLayer under the HUD and the menus.
const MIN_SIZE := 16.0 # canvas pixels (1080 high): smaller labels are drawn at this size...
const HIDE_BELOW := 6.0 # ...unless they'd be this small on screen, when they're not drawn
const GAP := 2.0 # canvas pixels between labels nudged apart
var _labels: Array = [] # Label3D; untyped, so freed ones can be dropped
func _ready() -> void:
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
mouse_filter = Control.MOUSE_FILTER_IGNORE
func track(label: Label3D) -> void:
if _labels.has(label):
return
label.layers = 0 # drawn here instead
_labels.append(label)
func _process(_delta: float) -> void:
queue_redraw()
## What to draw this frame, one entry per shown label in front of the camera: label, text, font,
## font_size, outline_size, color, outline_color, and rect (canvas: the text and its outline,
## after nudging overlapping labels apart).
func entries() -> Array[Dictionary]:
var out: Array[Dictionary] = []
_labels = _labels.filter(func(l: Variant) -> bool: return is_instance_valid(l))
var cam := get_viewport().get_camera_3d()
if cam == null:
return out
var up := cam.global_basis.y
var fallback := Sketch.font()
for l: Label3D in _labels:
if l.text == "" or not l.is_visible_in_tree():
continue
var world := l.get_global_transform_interpolated().origin
if cam.is_position_behind(world):
continue
var at := cam.unproject_position(world) # already in canvas units (the stretched 1080-high view)
var tall := at.distance_to(cam.unproject_position(world + up * l.font_size * l.pixel_size))
if tall < HIDE_BELOW:
continue
var scale := maxf(tall, MIN_SIZE) / l.font_size
var outline := l.outline_modulate
outline.a *= l.modulate.a
var font: Font = l.font if l.font != null else fallback
var size := roundi(l.font_size * scale)
var outline_size := roundi(l.outline_size * scale)
var box := font.get_multiline_string_size(l.text, HORIZONTAL_ALIGNMENT_CENTER, -1, size) + Vector2.ONE * outline_size
var center := at + Vector2(l.offset.x, -l.offset.y) * scale
out.append({"label": l, "text": l.text, "font": font, "font_size": size, "outline_size": outline_size,
"color": l.modulate, "outline_color": outline, "rect": Rect2(center - box * 0.5, box)})
_separate(out)
return out
## Nudges overlapping labels apart: from the lowest on screen up, each label that overlaps one
## already placed moves up until it clears it.
static func _separate(list: Array[Dictionary]) -> void:
list.sort_custom(func(a: Dictionary, b: Dictionary) -> bool:
var ya: float = (a["rect"] as Rect2).get_center().y
var yb: float = (b["rect"] as Rect2).get_center().y
if ya != yb:
return ya > yb
return (a["label"] as Object).get_instance_id() < (b["label"] as Object).get_instance_id())
var placed: Array[Rect2] = []
for e in list:
var r: Rect2 = e["rect"]
var moved := true
while moved:
moved = false
for p in placed:
if r.intersects(p):
r.position.y = p.position.y - r.size.y - GAP
moved = true
placed.append(r)
e["rect"] = r
func _draw() -> void:
for e in entries():
var font: Font = e["font"]
var text: String = e["text"]
var size: int = e["font_size"]
var outline_size: int = e["outline_size"]
var rect: Rect2 = e["rect"]
var pos := rect.position + Vector2(outline_size * 0.5, outline_size * 0.5 + font.get_ascent(size))
var width := rect.size.x - outline_size
if outline_size > 0:
draw_multiline_string_outline(font, pos, text, HORIZONTAL_ALIGNMENT_CENTER, width, size, -1,
outline_size, e["outline_color"])
draw_multiline_string(font, pos, text, HORIZONTAL_ALIGNMENT_CENTER, width, size, -1, e["color"])

View file

@ -0,0 +1 @@
uid://bqyaq20hq8ek5

View file

@ -19,7 +19,7 @@ const BINDINGS := [
["Aim", []], ["Aim", []],
["Attack (main weapon)", ["fire"]], ["Attack (main weapon)", ["fire"]],
["Throw a pumpkin bomb (off-hand)", ["offhand"]], ["Throw a pumpkin bomb (off-hand)", ["offhand"]],
["Switch main weapon", ["weapon_1", "weapon_2", "weapon_next"]], ["Switch main weapon", ["weapon_1", "weapon_2", "weapon_3", "weapon_4", "weapon_5", "weapon_6", "weapon_next"]],
["Fear", ["fear"]], ["Fear", ["fear"]],
["Patch up (hold)", ["patch"]], ["Patch up (hold)", ["patch"]],
["Gather / repair / workbench", ["interact"]], ["Gather / repair / workbench", ["interact"]],
@ -27,6 +27,7 @@ const BINDINGS := [
["Pick a buildable", ["build_1", "build_2", "build_3", "build_4", "build_next"]], ["Pick a buildable", ["build_1", "build_2", "build_3", "build_4", "build_next"]],
["Rotate", ["rotate_left", "rotate_right"]], ["Rotate", ["rotate_left", "rotate_right"]],
["Dismantle / leave build mode", ["cancel"]], ["Dismantle / leave build mode", ["cancel"]],
["Pouch (what you carry, the shed's stock)", ["pouch"]],
["Pause", ["pause"]], ["Pause", ["pause"]],
["Hide tips", ["hide_tips"]], ["Hide tips", ["hide_tips"]],
["Microphone on / off (co-op)", ["toggle_mic"]], ["Microphone on / off (co-op)", ["toggle_mic"]],
@ -87,7 +88,9 @@ func _ready() -> void:
_head("Display") _head("Display")
_check("fullscreen", "Fullscreen") _check("fullscreen", "Fullscreen")
_check("vsync", "VSync") _check("vsync", "VSync")
_slider("pixel_size", "Pixel size", 1.0, GameSettings.MAX_PIXEL_SIZE, 1.0)
_slider("resolution_scale", "3D resolution scale", 0.5, 1.0, 0.05) _slider("resolution_scale", "3D resolution scale", 0.5, 1.0, 0.05)
_note("Pixel size 1 turns the pixel look off; the resolution scale is used only then.")
_head("Gameplay") _head("Gameplay")
_check("show_tips", "Tips on the first day and night") _check("show_tips", "Tips on the first day and night")
_head("Co-op") _head("Co-op")
@ -106,7 +109,7 @@ func _ready() -> void:
reset.custom_minimum_size = Vector2(280.0, 54.0) reset.custom_minimum_size = Vector2(280.0, 54.0)
reset.pressed.connect(func() -> void: reset.pressed.connect(func() -> void:
var fresh := GameSettings.new() var fresh := GameSettings.new()
for key in ["volume", "move_dead_zone", "aim_dead_zone", "fullscreen", "vsync", "resolution_scale", "show_tips"]: for key in ["volume", "move_dead_zone", "aim_dead_zone", "fullscreen", "vsync", "pixel_size", "resolution_scale", "show_tips"]:
settings.set(key, fresh.get(key)) settings.set(key, fresh.get(key))
_load() _load()
changed.emit()) changed.emit())
@ -196,14 +199,18 @@ func _apply_value(key: String, v: Variant) -> void:
if key.begins_with("volume/"): if key.begins_with("volume/"):
settings.volume[key.trim_prefix("volume/")] = float(v) settings.volume[key.trim_prefix("volume/")] = float(v)
else: else:
settings.set(key, v) settings.set(key, roundi(v) if key == "pixel_size" else v)
if v is float: if v is float:
_show_value(key, v) _show_value(key, v)
changed.emit() changed.emit()
func _show_value(key: String, v: float) -> void: func _show_value(key: String, v: float) -> void:
if _values.has(key): if not _values.has(key):
return
if key == "pixel_size":
(_values[key] as Label).text = "Off" if roundi(v) <= 1 else "%d×" % roundi(v)
else:
(_values[key] as Label).text = "%d%%" % roundi(v * 100.0) (_values[key] as Label).text = "%d%%" % roundi(v * 100.0)

View file

@ -5,13 +5,12 @@ extends Node3D
## the rest added here); a pile shows one prop per `per` units, up to all of them. Every prop has ## the rest added here); a pile shows one prop per `per` units, up to all of them. Every prop has
## collision, and all of them are in place when the farm's navigation is built, so a pile's ## collision, and all of them are in place when the farm's navigation is built, so a pile's
## footprint never changes for enemies; a hidden prop only stops colliding for the scarecrow and ## footprint never changes for enemies; a hidden prop only stops colliding for the scarecrow and
## shots. Each pile has a spot in front of it where supply thieves stand to fill their sacks, and a ## shots. Each pile has a spot in front of it where supply thieves stand to fill their sacks. (How
## label with the amount while the scarecrow is nearby. ## much the shed holds shows in the HUD's pouch panel, ResourceHud.)
const PREF := "res://assets/farm/ithappy/farm/prefabs/assets/" const PREF := "res://assets/farm/ithappy/farm/prefabs/assets/"
const LABEL_RANGE := 9.0
## material -> adopt (scene props under the shed zone, in fill order), extra ([prefab, world ## material -> adopt (scene props under the shed zone, in fill order), extra ([prefab, world
## position, yaw in degrees, scale]), per (units per prop), front (thieves' spot), label (world). ## position, yaw in degrees, scale]), per (units per prop), front (thieves' spot).
const PILES := { const PILES := {
"wood": { "wood": {
"adopt": ["firewood_010_1", "firewood_010_2"], "adopt": ["firewood_010_1", "firewood_010_2"],
@ -24,7 +23,6 @@ const PILES := {
], ],
"per": 4, "per": 4,
"front": Vector2(2.6, -18.6), "front": Vector2(2.6, -18.6),
"label": Vector3(4.2, 2.2, -18.7),
}, },
"scrap": { "scrap": {
"adopt": ["box_004_1", "box_004_2", "case_001_1", "box_004_3"], "adopt": ["box_004_1", "box_004_2", "case_001_1", "box_004_3"],
@ -38,7 +36,6 @@ const PILES := {
], ],
"per": 3, "per": 3,
"front": Vector2(-3.0, -15.1), "front": Vector2(-3.0, -15.1),
"label": Vector3(-3.4, 2.8, -18.6),
}, },
"straw": { "straw": {
"adopt": ["hay_001_1"], "adopt": ["hay_001_1"],
@ -51,9 +48,8 @@ const PILES := {
], ],
"per": 4, "per": 4,
"front": Vector2(6.75, -16.25), "front": Vector2(6.75, -16.25),
"label": Vector3(6.2, 3.2, -18.4),
}, },
## No pile of its own yet (placeholder: it never shows props), but it needs a real front/label ## No pile of its own yet (placeholder: it never shows props), but it needs a real front
## spot so a supply thief sent for it (once it's the shed's most-stocked material) has ## spot so a supply thief sent for it (once it's the shed's most-stocked material) has
## somewhere reachable to stand; the wood pile's spot is already proven walkable. ## somewhere reachable to stand; the wood pile's spot is already proven walkable.
"alien_goop": { "alien_goop": {
@ -61,26 +57,22 @@ const PILES := {
"extra": [], "extra": [],
"per": 1, "per": 1,
"front": Vector2(2.6, -18.6), "front": Vector2(2.6, -18.6),
"label": Vector3(4.2, 2.6, -18.3),
}, },
} }
var campaign: CampaignController var campaign: CampaignController
var player: Node3D
## material -> Array[Node3D], in fill order. ## material -> Array[Node3D], in fill order.
var slots := {} var slots := {}
var shown := {} var shown := {}
var _labels := {}
var _bodies := {} # material -> Array (per slot: Array[CollisionObject3D]) var _bodies := {} # material -> Array (per slot: Array[CollisionObject3D])
var _last := {} var _last := {}
## Before the navigation is built: adopts the scene's piles and adds the extra props (every prop ## Before the navigation is built: adopts the scene's piles and adds the extra props (every prop
## present and colliding). ## present and colliding).
func setup(p_campaign: CampaignController, shed_zone: Node3D, p_player: Node3D) -> void: func setup(p_campaign: CampaignController, shed_zone: Node3D) -> void:
campaign = p_campaign campaign = p_campaign
player = p_player
for m: String in PILES: for m: String in PILES:
var pile: Dictionary = PILES[m] var pile: Dictionary = PILES[m]
var list: Array[Node3D] = [] var list: Array[Node3D] = []
@ -99,18 +91,6 @@ func setup(p_campaign: CampaignController, shed_zone: Node3D, p_player: Node3D)
for n in list: for n in list:
bodies.append(n.find_children("*", "CollisionObject3D", true, false)) bodies.append(n.find_children("*", "CollisionObject3D", true, false))
_bodies[m] = bodies _bodies[m] = bodies
var l := Label3D.new()
l.billboard = BaseMaterial3D.BILLBOARD_ENABLED
l.no_depth_test = true
l.shaded = false
l.font_size = 44
l.outline_size = 10
l.pixel_size = 0.0075
l.modulate = GatherNode.COLORS[m]
l.visible = false
add_child(l)
l.global_position = pile["label"]
_labels[m] = l
## Where supply thieves stand to take this material. ## Where supply thieves stand to take this material.
@ -148,10 +128,3 @@ func _process(_delta: float) -> void:
if int(shed.get(m, 0)) != int(_last.get(m, -1)): if int(shed.get(m, 0)) != int(_last.get(m, -1)):
refresh() refresh()
break break
var near := player != null
for m: String in _labels:
var l := _labels[m] as Label3D
var at: Vector3 = PILES[m]["label"]
l.visible = near and Vector2(player.global_position.x - at.x, player.global_position.z - at.z).length() < LABEL_RANGE
if l.visible:
l.text = "%s %d" % [m.capitalize(), int(shed.get(m, 0))]

367
game/scripts/sketch.gd Normal file
View file

@ -0,0 +1,367 @@
class_name Sketch
extends RefCounted
## The HUD's hand-drawn look, drawn into any CanvasItem from its _draw() (lines, outlines, and
## boxes also into a canvas item RID, for SketchBox, the look's StyleBox): a handwritten font
## (Gochi Hand, assets/fonts, SIL OFL) with a dark outline so text reads over the farm, wobbly
## sketched outlines (each edge drawn twice, slightly off, overshooting its corners), painted
## fills (a flat color, a lighter dab, a darker rim), and painted icons for the weapons, the
## materials, the backpack, the sun and moon, and the scarecrow's portrait. Every wobble comes
## from a hash of a seed, so a shape is drawn the same way each frame (no flicker).
## Icons are designed in a 100 x 100 box and scaled to the rect they're drawn in.
const FONT_PATH := "res://assets/fonts/GochiHand-Regular.ttf"
const INK := Color(0.07, 0.06, 0.05)
const TEXT := Color(0.98, 0.97, 0.92)
## The few panels left: a light wash, not a solid block.
const WASH := Color(0.06, 0.08, 0.06, 0.4)
## A panel with things to read in it (the pouch panel, the build bar, the menus over the farm):
## a darker wash in a sketched ink frame (panel()), its heading in TEXT, a pen rule under it,
## its column headings and hints in DIM.
const PANEL := Color(0.06, 0.08, 0.06, 0.86)
const PANEL_INK := 3.0
const DIM := Color(0.7, 0.7, 0.66)
const RULE := Color(0.98, 0.97, 0.92, 0.35)
## A slot or button in a panel or the hotbar, and the gold of the one picked (in hand, focused).
const SLOT := Color(0.1, 0.24, 0.1, 0.62)
const GOLD := Color(1.0, 0.86, 0.35)
const TEXT_OUTLINE := 8
## Icon ids (icon()): ScarecrowCombat.WEAPON_IDS, ResourceStore.MATERIALS, and these.
const ICONS: Array[String] = ["pitchfork", "corn_shooter", "pumpkin_bomb", "potato_cannon", "shurikens",
"propane_torch", "alien_ray", "wood", "scrap", "straw", "alien_goop", "backpack", "sun", "moon", "portrait"]
static var _font: Font
static func font() -> Font:
if _font == null:
_font = load(FONT_PATH) as Font
if _font == null:
_font = ThemeDB.fallback_font
return _font
## Gives a code-built Label the HUD's handwritten look.
static func style(l: Label, font_size: int, color: Color = TEXT, outline: int = TEXT_OUTLINE) -> void:
l.add_theme_font_override("font", font())
l.add_theme_font_size_override("font_size", font_size)
l.add_theme_color_override("font_color", color)
l.add_theme_color_override("font_outline_color", INK)
l.add_theme_constant_override("outline_size", outline)
## Outlined handwritten text with its top at pos.y; pos.x is its left edge, center, or right
## edge (align). Returns its width.
static func text(ci: CanvasItem, pos: Vector2, s: String, size: int, color: Color = TEXT,
align: HorizontalAlignment = HORIZONTAL_ALIGNMENT_LEFT, outline: int = TEXT_OUTLINE) -> float:
var f := font()
var w := f.get_string_size(s, HORIZONTAL_ALIGNMENT_LEFT, -1, size).x
var x := pos.x
if align == HORIZONTAL_ALIGNMENT_RIGHT:
x -= w
elif align == HORIZONTAL_ALIGNMENT_CENTER:
x -= w * 0.5
var base := Vector2(x, pos.y + f.get_ascent(size))
if outline > 0:
ci.draw_string_outline(f, base, s, HORIZONTAL_ALIGNMENT_LEFT, -1, size, outline, Color(INK, INK.a * color.a))
ci.draw_string(f, base, s, HORIZONTAL_ALIGNMENT_LEFT, -1, size, color)
return w
static func text_width(s: String, size: int) -> float:
return font().get_string_size(s, HORIZONTAL_ALIGNMENT_LEFT, -1, size).x
## A repeatable pseudo-random value in -1..1 for a seed.
static func noise(seed: float) -> float:
var x := sin(seed * 12.9898 + 78.233) * 43758.5453
return (x - floorf(x)) * 2.0 - 1.0
static func jitter(seed: float, amount: float) -> Vector2:
return Vector2(noise(seed), noise(seed + 0.37)) * amount
## One pen stroke from a to b: slightly bowed, a little shaky, running past both ends. ci is a
## CanvasItem (in its _draw()) or a canvas item RID (a StyleBox's _draw()), as for outline() and
## box().
static func line(ci: Variant, a: Vector2, b: Vector2, color: Color, width: float, seed: float, wobble: float = 1.4) -> void:
var pts := line_points(a, b, seed, wobble)
if not pts.is_empty():
_polyline(ci, pts, color, width)
## The points of line()'s stroke (empty when a and b meet).
static func line_points(a: Vector2, b: Vector2, seed: float, wobble: float = 1.4) -> PackedVector2Array:
var d := b - a
var length := d.length()
if length < 0.01:
return PackedVector2Array()
var dir := d / length
var n := dir.orthogonal()
var bow := noise(seed) * wobble
var steps := clampi(int(length / 16.0) + 2, 2, 14)
var pts := PackedVector2Array()
for i in steps + 1:
var t := float(i) / steps
pts.append(a.lerp(b, t) + n * (bow * sin(PI * t) + noise(seed + 1.3 + i) * wobble * 0.3))
pts[0] -= dir * wobble * (0.8 + 0.6 * noise(seed + 9.1))
pts[steps] += dir * wobble * (0.8 + 0.6 * noise(seed + 9.7))
return pts
static func _polyline(ci: Variant, pts: PackedVector2Array, color: Color, width: float) -> void:
if ci is RID:
RenderingServer.canvas_item_add_polyline(ci, pts, PackedColorArray([color]), width, true)
else:
(ci as CanvasItem).draw_polyline(pts, color, width, true)
static func _polygon(ci: Variant, pts: PackedVector2Array, color: Color) -> void:
if ci is RID:
RenderingServer.canvas_item_add_polygon(ci, pts, PackedColorArray([color]))
else:
(ci as CanvasItem).draw_colored_polygon(pts, color)
## A sketched outline around a closed shape: every edge stroked twice (the second lighter).
static func outline(ci: Variant, pts: PackedVector2Array, color: Color, width: float, seed: float,
wobble: float = 1.6, passes: int = 2) -> void:
var n := pts.size()
for p in passes:
var c := color if p == 0 else Color(color, color.a * 0.5)
for i in n:
line(ci, pts[i], pts[(i + 1) % n], c, width if p == 0 else maxf(width * 0.6, 1.0), seed + p * 31.0 + i * 7.0, wobble)
## A rect's corners, each nudged off true.
static func corners(r: Rect2, seed: float, wobble: float = 2.0) -> PackedVector2Array:
return PackedVector2Array([r.position + jitter(seed, wobble), Vector2(r.end.x, r.position.y) + jitter(seed + 1.0, wobble),
r.end + jitter(seed + 2.0, wobble), Vector2(r.position.x, r.end.y) + jitter(seed + 3.0, wobble)])
## A hand-drawn box: a wobbly fill (skipped when transparent) and a sketched outline (skipped
## when width is 0).
static func box(ci: Variant, r: Rect2, fill: Color, ink: Color = INK, width: float = 2.5, seed: float = 1.0) -> void:
var c := corners(r, seed)
if fill.a > 0.0:
_polygon(ci, c, fill)
if width > 0.0 and ink.a > 0.0:
outline(ci, c, ink, width, seed + 5.0)
## A panel to read things in (PANEL in a sketched ink frame).
static func panel(ci: Variant, r: Rect2, seed: float = 1.0) -> void:
box(ci, r, PANEL, INK, PANEL_INK, seed)
## The pen rule under a panel's heading, from x0 to x1 at y.
static func rule(ci: Variant, x0: float, x1: float, y: float, seed: float = 1.0) -> void:
line(ci, Vector2(x0, y), Vector2(x1, y), RULE, 2.0, seed)
## Points around a wobbly ellipse (radii rx, ry), turned by rot.
static func blob(center: Vector2, rx: float, ry: float, seed: float, wobble: float = 0.05, n: int = 28, rot: float = 0.0) -> PackedVector2Array:
var pts := PackedVector2Array()
for i in n:
var a := TAU * i / n
var k := 1.0 + noise(seed + i * 0.71) * wobble
pts.append(center + Vector2(cos(a) * rx * k, sin(a) * ry * k).rotated(rot))
return pts
## A wobbly circle outline (or arc, from..to radians, clockwise on screen from the right).
static func circle(ci: CanvasItem, c: Vector2, r: float, color: Color, width: float, seed: float,
from: float = 0.0, to: float = TAU, wobble: float = 0.025) -> void:
var span := to - from
if absf(span) < 0.001:
return
var n := maxi(int(absf(span) / TAU * 64.0), 3)
var pts := PackedVector2Array()
for i in n + 1:
var a := from + span * i / n
pts.append(c + Vector2(cos(a), sin(a)) * r * (1.0 + wobble * (sin(a * 3.0 + seed) * 0.6 + sin(a * 7.0 + seed * 1.7) * 0.4)))
ci.draw_polyline(pts, color, width, true)
## A painted shape: its color, a lighter dab toward the top-left, and a darker rim.
static func paint(ci: CanvasItem, pts: PackedVector2Array, color: Color, seed: float, rim: float = 3.0) -> void:
ci.draw_colored_polygon(pts, color)
var center := Vector2.ZERO
for p in pts:
center += p
center /= pts.size()
var size := Vector2.ZERO
for p in pts:
size = size.max((p - center).abs())
var dab := PackedVector2Array()
for p in pts:
dab.append(center + (p - center) * 0.55 - size * Vector2(0.18, 0.22))
ci.draw_colored_polygon(dab, Color(color.lightened(0.28), 0.55))
if rim > 0.0:
outline(ci, pts, Color(color.darkened(0.62), 0.95), rim, seed, 0.8, 1)
## A thick inked stroke: dark under, color on top.
static func stroke(ci: CanvasItem, a: Vector2, b: Vector2, color: Color, width: float, seed: float) -> void:
line(ci, a, b, INK, width + 4.0, seed, 0.8)
line(ci, a, b, color, width, seed, 0.8)
static func _bezier(a: Vector2, q: Vector2, b: Vector2, n: int) -> PackedVector2Array:
var pts := PackedVector2Array()
for i in n + 1:
var t := float(i) / n
pts.append(a.lerp(q, t).lerp(q.lerp(b, t), t))
return pts
## Draws an icon (ICONS) into rect r.
static func icon(ci: CanvasItem, id: String, r: Rect2) -> void:
ci.draw_set_transform(r.position, 0.0, r.size / 100.0)
_icon(ci, id)
ci.draw_set_transform_matrix(Transform2D.IDENTITY)
static func _icon(ci: CanvasItem, id: String) -> void:
match id:
"pitchfork":
stroke(ci, Vector2(14.0, 90.0), Vector2(60.0, 44.0), Color(0.6, 0.4, 0.22), 8.0, 11.0)
var metal := Color(0.74, 0.76, 0.8)
stroke(ci, Vector2(48.7, 32.7), Vector2(71.3, 55.3), metal, 6.0, 12.0)
for k: float in [-14.0, 0.0, 14.0]:
var root := Vector2(60.0, 44.0) + Vector2(0.707, 0.707) * k
stroke(ci, root, root + Vector2(0.707, -0.707) * 30.0, metal, 5.0, 13.0 + k)
"corn_shooter":
var green := Color(0.24, 0.55, 0.22)
paint(ci, PackedVector2Array([Vector2(26, 52), Vector2(44, 52), Vector2(38, 84), Vector2(22, 82)]), green.darkened(0.15), 21.0)
paint(ci, PackedVector2Array([Vector2(14, 42), Vector2(82, 40), Vector2(84, 58), Vector2(16, 60)]), green, 22.0)
paint(ci, blob(Vector2(88, 49), 5.0, 10.0, 23.0), green.darkened(0.3), 24.0, 2.0)
paint(ci, blob(Vector2(52, 30), 24.0, 10.0, 25.0, 0.04, 24, -0.08), Color(0.98, 0.84, 0.24), 26.0)
for i in 6:
ci.draw_circle(Vector2(36.0 + i * 6.5, 27.0 + (i % 2) * 5.0), 2.2, Color(0.85, 0.62, 0.1))
paint(ci, PackedVector2Array([Vector2(26, 30), Vector2(40, 20), Vector2(38, 34)]), Color(0.45, 0.75, 0.3), 27.0, 2.0)
"potato_cannon":
stroke(ci, Vector2(16.0, 82.0), Vector2(44.0, 58.0), Color(0.3, 0.32, 0.35), 22.0, 31.0)
paint(ci, blob(Vector2(16, 82), 8.0, 8.0, 32.0), Color(0.22, 0.23, 0.25), 33.0, 2.0)
var potato := blob(Vector2(62, 38), 27.0, 19.0, 34.0, 0.07, 26, -0.45)
paint(ci, potato, Color(0.8, 0.62, 0.36), 35.0)
for p: Vector2 in [Vector2(54, 32), Vector2(68, 44), Vector2(71, 28)]:
ci.draw_circle(p, 2.6, Color(0.5, 0.36, 0.18))
"shurikens":
var star := PackedVector2Array()
for i in 8:
var a := TAU * i / 8.0 + 0.35
star.append(Vector2(50, 50) + Vector2(cos(a), sin(a)) * (40.0 if i % 2 == 0 else 12.0) + jitter(41.0 + i, 1.5))
paint(ci, star, Color(0.63, 0.67, 0.72), 42.0)
ci.draw_circle(Vector2(50, 50), 6.0, INK)
"propane_torch":
paint(ci, PackedVector2Array([Vector2(22, 44), Vector2(56, 42), Vector2(58, 88), Vector2(22, 90)]), Color(0.92, 0.9, 0.84), 51.0)
paint(ci, blob(Vector2(39, 44), 17.0, 8.0, 52.0), Color(0.92, 0.9, 0.84), 53.0, 0.0)
paint(ci, PackedVector2Array([Vector2(22, 60), Vector2(57, 59), Vector2(57, 68), Vector2(22, 69)]), Color(0.85, 0.25, 0.2), 54.0, 2.0)
paint(ci, PackedVector2Array([Vector2(33, 26), Vector2(45, 26), Vector2(46, 40), Vector2(32, 40)]), Color(0.78, 0.62, 0.25), 55.0, 2.0)
stroke(ci, Vector2(44.0, 30.0), Vector2(70.0, 24.0), Color(0.6, 0.6, 0.62), 4.0, 56.0)
var flame := PackedVector2Array([Vector2(70, 16), Vector2(86, 14), Vector2(97, 22), Vector2(86, 31), Vector2(70, 31)])
paint(ci, flame, Color(1.0, 0.55, 0.15), 57.0, 2.0)
ci.draw_colored_polygon(PackedVector2Array([Vector2(72, 20), Vector2(84, 19), Vector2(90, 23), Vector2(83, 27), Vector2(72, 27)]), Color(1.0, 0.88, 0.4))
"alien_ray":
var body := Color(0.42, 0.7, 0.74)
paint(ci, PackedVector2Array([Vector2(30, 54), Vector2(44, 54), Vector2(40, 82), Vector2(28, 80)]), body.darkened(0.2), 61.0)
paint(ci, PackedVector2Array([Vector2(16, 46), Vector2(70, 40), Vector2(72, 60), Vector2(16, 58)]), body, 62.0)
for i in 3:
paint(ci, blob(Vector2(74.0 + i * 8.0, 50.0), 4.0, 12.0 - i * 3.0, 63.0 + i), Color(0.55, 0.95, 0.35), 64.0 + i, 2.0)
paint(ci, blob(Vector2(40, 36), 11.0, 11.0, 66.0), Color(0.55, 0.95, 0.35), 67.0)
ci.draw_circle(Vector2(36, 32), 3.0, Color(0.9, 1.0, 0.8))
"pumpkin_bomb":
var orange := Color(0.95, 0.52, 0.12)
paint(ci, blob(Vector2(34, 60), 18.0, 25.0, 71.0), orange.darkened(0.1), 72.0)
paint(ci, blob(Vector2(66, 60), 18.0, 25.0, 73.0), orange.darkened(0.1), 74.0)
paint(ci, blob(Vector2(50, 60), 22.0, 27.0, 75.0), orange, 76.0)
paint(ci, PackedVector2Array([Vector2(46, 36), Vector2(54, 35), Vector2(57, 20), Vector2(49, 19)]), Color(0.3, 0.55, 0.2), 77.0, 2.0)
ci.draw_polyline(_bezier(Vector2(56, 22), Vector2(68, 8), Vector2(78, 18), 8), INK, 3.0, true)
ci.draw_circle(Vector2(79, 18), 4.0, Color(1.0, 0.85, 0.3))
"wood":
paint(ci, PackedVector2Array([Vector2(16, 36), Vector2(78, 34), Vector2(80, 68), Vector2(18, 70)]), Color(0.6, 0.38, 0.2), 81.0)
for k in 2:
line(ci, Vector2(24, 46.0 + k * 12.0), Vector2(68, 45.0 + k * 12.0), Color(0.4, 0.24, 0.12), 2.0, 82.0 + k)
paint(ci, blob(Vector2(79, 51), 10.0, 17.0, 83.0), Color(0.88, 0.68, 0.42), 84.0)
circle(ci, Vector2(79, 51), 6.0, Color(0.6, 0.42, 0.24), 2.0, 85.0)
"scrap":
paint(ci, PackedVector2Array([Vector2(20, 38), Vector2(66, 26), Vector2(82, 58), Vector2(42, 76), Vector2(16, 60)]), Color(0.6, 0.68, 0.76), 91.0)
for p: Vector2 in [Vector2(36, 46), Vector2(60, 56)]:
paint(ci, blob(p, 6.0, 6.0, 92.0 + p.x), Color(0.42, 0.46, 0.52), 93.0, 1.5)
"straw":
for i in 9:
var x := 36.0 + i * 3.5
line(ci, Vector2(x, 86.0), Vector2(18.0 + i * 8.0, 20.0 + absf(i - 4.0) * 3.0), Color(0.98, 0.86, 0.38), 4.0, 101.0 + i, 1.0)
for i in 9:
line(ci, Vector2(37.0 + i * 3.5, 86.0), Vector2(20.0 + i * 8.0, 24.0 + absf(i - 4.0) * 3.0), Color(0.8, 0.62, 0.2), 1.5, 111.0 + i, 1.0)
paint(ci, PackedVector2Array([Vector2(32, 58), Vector2(70, 58), Vector2(70, 66), Vector2(32, 66)]), Color(0.55, 0.35, 0.18), 121.0, 2.0)
"alien_goop":
var drop := PackedVector2Array([Vector2(50, 14)])
for i in 15:
var a := lerpf(-0.3, PI + 0.3, i / 14.0) # round the bottom, right to left
drop.append(Vector2(50, 62) + Vector2(cos(a), sin(a)) * 26.0 + jitter(131.0 + i, 1.2))
paint(ci, drop, Color(0.5, 0.92, 0.3), 132.0)
ci.draw_circle(Vector2(42, 58), 5.0, Color(0.85, 1.0, 0.75, 0.9))
"backpack":
var leather := Color(0.82, 0.46, 0.14)
circle(ci, Vector2(50, 26), 11.0, leather.darkened(0.45), 5.0, 141.0, PI, TAU)
paint(ci, PackedVector2Array([Vector2(10, 54), Vector2(26, 52), Vector2(27, 84), Vector2(12, 84)]), leather.darkened(0.15), 142.0)
paint(ci, PackedVector2Array([Vector2(22, 30), Vector2(78, 28), Vector2(82, 92), Vector2(20, 94)]), leather, 143.0)
paint(ci, PackedVector2Array([Vector2(18, 26), Vector2(82, 25), Vector2(80, 52), Vector2(20, 54)]), leather.darkened(0.22), 144.0)
paint(ci, PackedVector2Array([Vector2(34, 64), Vector2(66, 63), Vector2(66, 86), Vector2(34, 87)]), leather.darkened(0.12), 145.0, 2.0)
paint(ci, PackedVector2Array([Vector2(46, 48), Vector2(54, 48), Vector2(54, 60), Vector2(46, 60)]), Color(0.9, 0.78, 0.4), 146.0, 1.5)
"sun":
var sun := PackedVector2Array()
for i in 54:
var a := TAU * i / 54.0
sun.append(Vector2(50, 50) + Vector2(cos(a), sin(a)) * (34.0 + 7.0 * sin(a * 9.0) + noise(151.0 + i) * 1.5))
paint(ci, sun, Color(0.98, 0.74, 0.22), 152.0, 2.0)
ci.draw_colored_polygon(blob(Vector2(48, 47), 18.0, 18.0, 153.0), Color(1.0, 0.86, 0.42))
"moon":
# The part of one circle outside another, offset up and to the right.
var c1 := Vector2(50, 50)
var c2 := c1 + Vector2(0.8, -0.6) * 12.0
var moon := _arc_through(c1, 32.0, c2, 30.0, c1 * 2.0 - c2)
moon.append_array(_arc_through(c2, 30.0, c1, 32.0, c1).slice(1, -1))
paint(ci, moon, Color(0.92, 0.93, 0.82), 161.0, 2.0)
ci.draw_circle(Vector2(30, 52), 3.0, Color(0.78, 0.79, 0.68))
ci.draw_circle(Vector2(38, 70), 2.5, Color(0.78, 0.79, 0.68))
"portrait":
ci.draw_colored_polygon(blob(Vector2(50, 50), 46.0, 46.0, 171.0, 0.01, 40), Color(0.64, 0.8, 0.82))
var straw := Color(0.96, 0.82, 0.36)
for i in 5:
line(ci, Vector2(26.0 + i * 3.0, 50.0), Vector2(12.0 + i * 2.0, 68.0 + i * 2.0), straw, 3.5, 172.0 + i, 1.0)
line(ci, Vector2(74.0 - i * 3.0, 50.0), Vector2(88.0 - i * 2.0, 68.0 + i * 2.0), straw, 3.5, 178.0 + i, 1.0)
paint(ci, blob(Vector2(50, 64), 29.0, 30.0, 184.0, 0.04), Color(0.84, 0.76, 0.36), 185.0)
for k: float in [-1.0, 1.0]:
var e := Vector2(50.0 + 12.0 * k, 62.0)
line(ci, e + Vector2(-6, -6), e + Vector2(6, 6), INK, 4.0, 186.0 + k, 0.6)
line(ci, e + Vector2(6, -6), e + Vector2(-6, 6), INK, 4.0, 188.0 + k, 0.6)
var mouth := _bezier(Vector2(35, 79), Vector2(50, 86), Vector2(65, 78), 8)
ci.draw_polyline(mouth, INK, 3.0, true)
for i in range(1, 8, 2):
ci.draw_line(mouth[i] + Vector2(0, -4.0), mouth[i] + Vector2(0, 4.0), INK, 2.2, true)
paint(ci, PackedVector2Array([Vector2(31, 42), Vector2(69, 41), Vector2(65, 11), Vector2(35, 12)]), Color(0.62, 0.42, 0.22), 190.0)
paint(ci, PackedVector2Array([Vector2(32, 35), Vector2(68, 34), Vector2(68, 41), Vector2(32, 42)]), Color(0.42, 0.26, 0.14), 191.0, 0.0)
paint(ci, blob(Vector2(50, 43), 44.0, 8.0, 192.0, 0.03, 28, -0.06), Color(0.72, 0.52, 0.28), 193.0)
## Points along a circle (center c, radius r) between where it crosses another circle (o, ro),
## taking the way round that passes nearest to the point toward.
static func _arc_through(c: Vector2, r: float, o: Vector2, ro: float, toward: Vector2) -> PackedVector2Array:
var d := c.distance_to(o)
var a := (r * r - ro * ro + d * d) / (2.0 * d)
var h := sqrt(maxf(r * r - a * a, 0.0))
var u := (o - c) / d
var mid := c + u * a
var from := (mid + u.orthogonal() * h - c).angle()
var to := (mid - u.orthogonal() * h - c).angle()
var sweep := wrapf(to - from, 0.0, TAU)
if wrapf((toward - c).angle() - from, 0.0, TAU) > sweep:
sweep -= TAU
var pts := PackedVector2Array()
for i in 25:
var t := from + sweep * i / 24.0
pts.append(c + Vector2(cos(t), sin(t)) * r)
return pts

View file

@ -0,0 +1 @@
uid://cyj812m7bxr3w

View file

@ -0,0 +1,30 @@
class_name SketchBox
extends StyleBox
## A StyleBox in the HUD's hand-drawn look (Sketch), for the menus built from Controls
## (UiTheme.sketch): a wobbly fill and a sketched outline (either can be left out), or, as a rule,
## one pen line across the middle (an HSeparator's). Each box's wobble is seeded from its rect,
## so boxes differ from each other and each stays put.
var fill := Color(0, 0, 0, 0)
var ink := Sketch.INK
var width := 2.5
var as_rule := false
## How far past the rect it's drawn (a focus frame around a button).
var grow := 0.0
func _init(p_fill: Color = Color(0, 0, 0, 0), p_ink: Color = Sketch.INK, p_width: float = 2.5, p_rule: bool = false) -> void:
fill = p_fill
ink = p_ink
width = p_width
as_rule = p_rule
func _draw(to_canvas_item: RID, p_rect: Rect2) -> void:
var rect := p_rect.grow(grow)
var seed := fmod(rect.position.x * 0.013 + rect.position.y * 0.007 + rect.size.x * 0.011, 97.0)
if as_rule:
var y := rect.get_center().y
Sketch.line(to_canvas_item, Vector2(rect.position.x, y), Vector2(rect.end.x, y), ink, width, seed)
return
Sketch.box(to_canvas_item, rect, fill, ink, width, seed)

View file

@ -0,0 +1 @@
uid://ewfhmslc1j5q

148
game/scripts/toon_look.gd Normal file
View file

@ -0,0 +1,148 @@
class_name ToonLook
extends Node
## The game's look: toon shading and pixel outlines on everything 3D. Main adds one at start.
## * Every lit, opaque StandardMaterial3D in the scene tree is swapped for a toon ShaderMaterial
## (toon.gdshader; toon_double_sided.gdshader for double-sided ones) with the same color,
## texture, and vertex-color use: the farm's imported props, the KayKit characters, the
## weapons, and the primitives built in code. Unshaded or transparent materials (effects and
## indicators: beams, flames, rings, zone tints, ghosts) are left alone, as are ShaderMaterials
## (the crows' and UFOs' shaders include the toon lighting themselves).
## * The swap goes on the nodes (material_override, or a surface override per surface), so the
## asset files never change. Nodes added later (enemy pools, the partner's scarecrow, debris,
## the farmers' return) are swapped at the end of the frame they arrive in, after the code that
## built them has set and tinted their materials.
## * A full-screen quad (pixel_outline.gdshader) darkens depth edges and lightens creases for
## whatever camera is current. It needs the Forward+ renderer.
## * Label3Ds aren't rendered in 3D (they'd be pixelated): ScreenLabels draws them as sharp text
## over the 3D view, under the HUD.
## The pixel size (rendering the 3D view small and scaling it up with sharp pixels) is a display
## setting: GameSettings.pixel_size.
const TOON := preload("res://game/resources/toon.gdshader")
const TOON_DOUBLE_SIDED := preload("res://game/resources/toon_double_sided.gdshader")
const OUTLINE := preload("res://game/resources/pixel_outline.gdshader")
var outline: MeshInstance3D
var labels: ScreenLabels
## Source material -> its toon material (shared materials, like the farm pack's, convert once).
var _swapped := {}
var _pending: Array = [] # untyped: a node may be freed before the flush
func _ready() -> void:
outline = make_outline()
add_child(outline)
var layer := CanvasLayer.new()
layer.name = "Labels"
layer.layer = -1 # over the 3D view, under the HUD (1) and the menus (10)
add_child(layer)
labels = ScreenLabels.new()
labels.name = "ScreenLabels"
layer.add_child(labels)
get_tree().node_added.connect(_on_node_added)
apply_to(get_tree().root)
## Swaps the materials of root and everything under it (and hands its Label3Ds to ScreenLabels).
func apply_to(root: Node) -> void:
if root is GeometryInstance3D:
_take(root as GeometryInstance3D)
for node in root.find_children("*", "GeometryInstance3D", true, false):
_take(node as GeometryInstance3D)
## Swaps one node's materials: its material override, else each surface of its mesh (a
## MeshInstance3D), else the single surface of a particle or MultiMesh mesh (as an override).
func swap_node(g: GeometryInstance3D) -> void:
if g.material_override != null:
g.material_override = toon_material(g.material_override)
return
var mi := g as MeshInstance3D
if mi != null:
if mi.mesh == null:
return
for i in mi.get_surface_override_material_count():
var src := mi.get_active_material(i)
if src == null:
continue
var toon := toon_material(src)
if toon != src:
mi.set_surface_override_material(i, toon)
return
var mesh: Mesh = null
if g is CPUParticles3D:
mesh = (g as CPUParticles3D).mesh
elif g is MultiMeshInstance3D and (g as MultiMeshInstance3D).multimesh != null:
mesh = (g as MultiMeshInstance3D).multimesh.mesh
if mesh != null and mesh.get_surface_count() == 1 and mesh.surface_get_material(0) != null:
var src := mesh.surface_get_material(0)
var toon := toon_material(src)
if toon != src:
g.material_override = toon
## The toon material that replaces src (one per source material), or src itself when it stays.
func toon_material(src: Material) -> Material:
if _swapped.has(src):
return _swapped[src]
var m := src as BaseMaterial3D
if m == null or not swappable(m):
return src
var toon := ShaderMaterial.new()
toon.resource_name = m.resource_name
toon.shader = TOON_DOUBLE_SIDED if m.cull_mode == BaseMaterial3D.CULL_DISABLED else TOON
toon.render_priority = m.render_priority
toon.next_pass = m.next_pass
toon.set_shader_parameter("albedo", m.albedo_color)
toon.set_shader_parameter("albedo_texture", m.albedo_texture)
toon.set_shader_parameter("use_vertex_color", m.vertex_color_use_as_albedo)
toon.set_shader_parameter("uv1_scale", m.uv1_scale)
toon.set_shader_parameter("uv1_offset", m.uv1_offset)
_swapped[src] = toon
return toon
## Whether a material takes the toon look: lit, opaque, depth-tested, not a billboard.
static func swappable(m: BaseMaterial3D) -> bool:
return m.shading_mode != BaseMaterial3D.SHADING_MODE_UNSHADED \
and m.transparency == BaseMaterial3D.TRANSPARENCY_DISABLED \
and m.billboard_mode == BaseMaterial3D.BILLBOARD_DISABLED \
and not m.no_depth_test
## The outline pass: a quad that pixel_outline.gdshader pins over the whole screen.
static func make_outline() -> MeshInstance3D:
var quad := QuadMesh.new()
quad.size = Vector2(2.0, 2.0)
var mat := ShaderMaterial.new()
mat.shader = OUTLINE
mat.render_priority = Material.RENDER_PRIORITY_MIN # under the transparent effects
var mi := MeshInstance3D.new()
mi.name = "Outline"
mi.mesh = quad
mi.material_override = mat
mi.cast_shadow = GeometryInstance3D.SHADOW_CASTING_SETTING_OFF
mi.gi_mode = GeometryInstance3D.GI_MODE_DISABLED
mi.extra_cull_margin = 16384.0 # the screen pins it; never let the camera's frustum cull it
return mi
func _on_node_added(node: Node) -> void:
if node is GeometryInstance3D:
if _pending.is_empty():
_flush.call_deferred()
_pending.append(node)
func _flush() -> void:
for g: Variant in _pending:
if is_instance_valid(g) and (g as Node).is_inside_tree():
_take(g as GeometryInstance3D)
_pending.clear()
func _take(g: GeometryInstance3D) -> void:
if g is Label3D:
labels.track(g as Label3D)
else:
swap_node(g)

View file

@ -0,0 +1 @@
uid://wosfneqkuepf

View file

@ -14,10 +14,10 @@ extends Control
const TEXT := { const TEXT := {
"move": "Move with [W A S D] or the left stick. You're the scarecrow: keep the farm safe until the farmers are back.", "move": "Move with [W A S D] or the left stick. You're the scarecrow: keep the farm safe until the farmers are back.",
"gather": "Hold [E / X] at a dead tree, the haystacks, or the scrap heap to gather wood, straw, and scrap.", "gather": "Hold [E / X] at a dead tree, the haystacks, or the scrap heap to gather wood, straw, and scrap.",
"store": "Your pouch only holds so much: walk onto the barn's apron (the Supply Shed) to store what you carry.", "store": "Your pouch only holds so much ([I] shows what's in it): walk onto the barn's apron (the Supply Shed) to store what you carry.",
"build": "Press [B / d-pad up] to build. Pick a fence [1], place it with left mouse / RT. Aliens have to break through fences.", "build": "Press [B / d-pad up] to build. Pick a fence [1], place it with left mouse / RT. Aliens have to break through fences.",
"dusk": "Dusk: aliens come at nightfall, from every side of the farm.", "dusk": "Dusk: aliens come at nightfall, from every side of the farm.",
"shoot": "Aim with the mouse or the right stick and hold left mouse / RT to stab with your pitchfork. The supply shed sells a corn shooter (switch with [Tab / 1-2]); more weapons arrive there over the days, like pumpkin bombs for your off-hand (throw them with [right mouse / LT]).", "shoot": "Aim with the mouse or the right stick and hold left mouse / RT to stab with your pitchfork. The supply shed sells a corn shooter (switch with [Tab / the number keys]); more weapons arrive there over the days, like pumpkin bombs for your off-hand (throw them with [right mouse / LT]).",
"fear": "Crowded? [Q / LB] Fear scares off everything nearby, and they drop what they carry.", "fear": "Crowded? [Q / LB] Fear scares off everything nearby, and they drop what they carry.",
"recover": "Something was dropped! Walk over it to bring it home. A dropped animal follows you back to the pen.", "recover": "Something was dropped! Walk over it to bring it home. A dropped animal follows you back to the pen.",
"patch": "Hurt? Hold [F / Y] to patch up with straw. Health carries over to the next night.", "patch": "Hurt? Hold [F / Y] to patch up with straw. Health carries over to the next night.",

View file

@ -5,11 +5,74 @@ extends RefCounted
## dark straw-trimmed panels, buttons that light up gold on hover and show a thick gold ring ## dark straw-trimmed panels, buttons that light up gold on hover and show a thick gold ring
## when focused (keyboard and gamepad players always see where they are), sliders, check ## when focused (keyboard and gamepad players always see where they are), sliders, check
## boxes, and tabs to match. Labels keep the default look; the HUD sets its own sizes. ## boxes, and tabs to match. Labels keep the default look; the HUD sets its own sizes.
## sketch() is the hand-drawn theme the in-game panels use instead (the pause menu and its
## questions, the workbench and shed shops), to match the HUD's pouch panel (Sketch).
const TEXT := Color(0.95, 0.93, 0.85) const TEXT := Color(0.95, 0.93, 0.85)
const GOLD := Color(0.95, 0.82, 0.45) const GOLD := Color(0.95, 0.82, 0.45)
const DIM := Color(0.5, 0.5, 0.45) const DIM := Color(0.5, 0.5, 0.45)
static var _sketch: Theme
## The hand-drawn theme (Sketch, SketchBox), set as a panel's theme: the handwritten font with a
## dark outline on every label and button; panels in the pouch panel's dark wash and sketched ink
## frame; buttons as hotbar slots that light up on hover, with the hotbar's gold frame when
## focused; HSeparators as a pen rule; and SolidPanel, a PanelContainer variation without the
## see-through wash. Anything it leaves out (sliders, check boxes) falls back
## to the project's theme.
static func sketch() -> Theme:
if _sketch != null:
return _sketch
var t := Theme.new()
t.default_font = Sketch.font()
t.default_font_size = 28
var panel := SketchBox.new(Sketch.PANEL, Sketch.INK, Sketch.PANEL_INK)
_margins(panel, 26.0, 20.0)
t.set_stylebox("panel", "PanelContainer", panel)
t.set_stylebox("panel", "Panel", panel)
# The same panel without the see-through wash, for a question over another panel.
var solid := SketchBox.new(Color(Sketch.PANEL, 1.0), Sketch.INK, Sketch.PANEL_INK)
_margins(solid, 26.0, 20.0)
t.set_type_variation(&"SolidPanel", &"PanelContainer")
t.set_stylebox("panel", "SolidPanel", solid)
t.set_color("font_color", "Label", Sketch.TEXT)
t.set_color("font_outline_color", "Label", Sketch.INK)
t.set_constant("outline_size", "Label", 6)
var hover := Color(Sketch.SLOT.lightened(0.12), 0.8)
var styles := {
"normal": SketchBox.new(Sketch.SLOT, Sketch.INK, 2.5),
"hover": SketchBox.new(hover, Sketch.INK, 2.5),
"pressed": SketchBox.new(Color(Sketch.SLOT.darkened(0.3), 0.8), Sketch.GOLD, 2.5),
"disabled": SketchBox.new(Color(0.12, 0.12, 0.11, 0.5), Color(Sketch.INK, 0.6), 2.0),
"focus": SketchBox.new(Color(0, 0, 0, 0), Sketch.GOLD, 3.5),
}
for key: String in styles:
var b: SketchBox = styles[key]
_margins(b, 18.0, 6.0)
if key == "focus":
b.grow = 3.0
t.set_stylebox(key, "Button", b)
t.set_color("font_color", "Button", Sketch.TEXT)
t.set_color("font_hover_color", "Button", Color(1.0, 0.95, 0.7))
t.set_color("font_focus_color", "Button", Color(1.0, 0.95, 0.7))
t.set_color("font_hover_pressed_color", "Button", Sketch.GOLD)
t.set_color("font_pressed_color", "Button", Sketch.GOLD)
t.set_color("font_disabled_color", "Button", Sketch.DIM)
t.set_color("font_outline_color", "Button", Sketch.INK)
t.set_constant("outline_size", "Button", 6)
t.set_stylebox("separator", "HSeparator", SketchBox.new(Color(0, 0, 0, 0), Sketch.RULE, 2.0, true))
t.set_constant("separation", "HSeparator", 12)
_sketch = t
return t
static func _margins(s: StyleBox, x: float, y: float) -> void:
s.content_margin_left = x
s.content_margin_right = x
s.content_margin_top = y
s.content_margin_bottom = y
static func build() -> Theme: static func build() -> Theme:
var t := Theme.new() var t := Theme.new()

View file

@ -9,7 +9,8 @@ extends CenterContainer
## (shop "shed": weapons and other purchasable items) opens with interact at the shed's counter by ## (shop "shed": weapons and other purchasable items) opens with interact at the shed's counter by
## day (Interactions). Buy with a click, or the arrows / d-pad and Enter / A. Close it with Close, ## day (Interactions). Buy with a click, or the arrows / d-pad and Enter / A. Close it with Close,
## Escape / B, interact again, by walking off, or at nightfall. The scarecrow stands still and ## Escape / B, interact again, by walking off, or at nightfall. The scarecrow stands still and
## can't shoot while either is open. ## can't shoot while either is open. Hand-drawn like the HUD's pouch panel (UiTheme.sketch): the
## title over a pen rule, the tracks' names dim like the pouch's column headings, a slot per row.
## A purchase's result text. Nothing shows it on screen since #23 (the rows say what's missing); ## A purchase's result text. Nothing shows it on screen since #23 (the rows say what's missing);
## tests listen to it. ## tests listen to it.
@ -49,20 +50,20 @@ func setup(p_campaign: CampaignController, p_structures: StructureSystem, p_play
track = String(u.get("track", "")) track = String(u.get("track", ""))
var head := Label.new() var head := Label.new()
head.text = track head.text = track
head.add_theme_font_size_override("font_size", 20) head.add_theme_font_size_override("font_size", 24)
head.add_theme_color_override("font_color", Color(0.75, 0.85, 0.75)) head.add_theme_color_override("font_color", Sketch.DIM)
box.add_child(head) box.add_child(head)
var b := Button.new() var b := Button.new()
b.alignment = HORIZONTAL_ALIGNMENT_LEFT b.alignment = HORIZONTAL_ALIGNMENT_LEFT
b.custom_minimum_size = Vector2(720.0, 44.0) b.custom_minimum_size = Vector2(860.0, 46.0)
b.add_theme_font_size_override("font_size", 20) b.add_theme_font_size_override("font_size", 25)
b.pressed.connect(func() -> void: _buy(id)) b.pressed.connect(func() -> void: _buy(id))
box.add_child(b) box.add_child(b)
_rows[id] = b _rows[id] = b
_close = Button.new() _close = Button.new()
_close.text = "Close" _close.text = "Close"
_close.custom_minimum_size = Vector2(200.0, 48.0) _close.custom_minimum_size = Vector2(200.0, 48.0)
_close.add_theme_font_size_override("font_size", 22) _close.add_theme_font_size_override("font_size", 28)
_close.size_flags_horizontal = Control.SIZE_SHRINK_CENTER _close.size_flags_horizontal = Control.SIZE_SHRINK_CENTER
_close.pressed.connect(close) _close.pressed.connect(close)
box.add_child(_close) box.add_child(_close)
@ -70,22 +71,23 @@ func setup(p_campaign: CampaignController, p_structures: StructureSystem, p_play
func _ready() -> void: func _ready() -> void:
set_anchors_preset(Control.PRESET_FULL_RECT) set_anchors_preset(Control.PRESET_FULL_RECT)
theme = UiTheme.sketch()
var panel := PanelContainer.new() var panel := PanelContainer.new()
panel.name = "Panel" panel.name = "Panel"
panel.add_theme_stylebox_override("panel", ReviewPanel.backing())
add_child(panel) add_child(panel)
var margin := MarginContainer.new() var margin := MarginContainer.new()
margin.name = "Margin" margin.name = "Margin"
for side in ["left", "right", "top", "bottom"]: for side in ["left", "right", "top", "bottom"]:
margin.add_theme_constant_override("margin_" + side, 24) margin.add_theme_constant_override("margin_" + side, 8)
panel.add_child(margin) panel.add_child(margin)
var box := VBoxContainer.new() var box := VBoxContainer.new()
box.name = "Box" box.name = "Box"
box.add_theme_constant_override("separation", 6) box.add_theme_constant_override("separation", 6)
margin.add_child(box) margin.add_child(box)
_title = Label.new() _title = Label.new()
_title.add_theme_font_size_override("font_size", 32) _title.add_theme_font_size_override("font_size", 36)
box.add_child(_title) box.add_child(_title)
box.add_child(HSeparator.new())
visible = false visible = false
mouse_filter = Control.MOUSE_FILTER_IGNORE mouse_filter = Control.MOUSE_FILTER_IGNORE

View file

@ -243,7 +243,7 @@ static func level_up(campaign: CampaignController, id: String, structures: Struc
s.resources.pouch_capacity += add s.resources.pouch_capacity += add
## Debug (CampaignDebug, F8): every upgrade and shop item to its last level, free, whatever the ## Debug (CampaignDebug, F4): every upgrade and shop item to its last level, free, whatever the
## day, the goop, or "requires" say, each level's effect applied as if bought. Not counted as ## day, the goop, or "requires" say, each level's effect applied as if bought. Not counted as
## bought in the night record. Returns how many levels it added. ## bought in the night record. Returns how many levels it added.
static func grant_all(campaign: CampaignController, structures: StructureSystem = null) -> int: static func grant_all(campaign: CampaignController, structures: StructureSystem = null) -> int:

View file

@ -23,6 +23,7 @@ const SUITES := [
"res://game/tests/test_cycle.gd", "res://game/tests/test_cycle.gd",
"res://game/tests/test_flow.gd", "res://game/tests/test_flow.gd",
"res://game/tests/test_coop.gd", "res://game/tests/test_coop.gd",
"res://game/tests/test_look.gd",
] ]
const TICK := 1.0 / 60.0 const TICK := 1.0 / 60.0
## Points on the farm's edge (FarmZones.edge) for tests that send an enemy in from a known side: ## Points on the farm's edge (FarmZones.edge) for tests that send an enemy in from a known side:

View file

@ -28,9 +28,8 @@ func run(r: GameTestRunner) -> void:
# counts this test tracks across night 1 (it isn't about the Workbench itself) # counts this test tracks across night 1 (it isn't about the Workbench itself)
var review := farm.get_node("Hud/ReviewPanel") as ReviewPanel var review := farm.get_node("Hud/ReviewPanel") as ReviewPanel
var hud := farm.get_node("Hud/PhaseHud") as PhaseHud var hud := farm.get_node("Hud/PhaseHud") as PhaseHud
var assets := farm.get_node("Hud/AssetHud") as AssetHud var assets := " · ".join(PauseMenu.asset_counts(sim.campaign.state))
assets._process(0.0) r.check(assets == "Crops 30/30 · Animals 8/8 · Supplies 10", "the pause menu's assets read '%s'" % assets)
r.check(assets.describe() == "Crops 30/30 · Animals 8/8 · Supplies 10", "the asset HUD reads '%s'" % assets.describe())
sim.structures.destroyed.connect(func(_id: int, _t: String, _at: Vector3) -> void: _broken.append(1)) sim.structures.destroyed.connect(func(_id: int, _t: String, _at: Vector3) -> void: _broken.append(1))
_morning(r, sim, review, hud) _morning(r, sim, review, hud)
_day(r, sim, player, hud) _day(r, sim, player, hud)
@ -47,7 +46,7 @@ func _morning(r: GameTestRunner, sim: FarmSim, review: ReviewPanel, hud: PhaseHu
r.check(sim.campaign.state.phase == P.MORNING and review.visible and review._title.text == "The farmers are away", r.check(sim.campaign.state.phase == P.MORNING and review.visible and review._title.text == "The farmers are away",
"the first morning shows the review panel with the introduction") "the first morning shows the review panel with the introduction")
hud._process(0.0) hud._process(0.0)
r.check(hud.describe() == "Night 1 of %d · Morning" % sim.config.campaign_nights, "the phase HUD reads '%s'" % hud.describe()) r.check(hud.describe() == "Day 1 of %d · Morning" % sim.config.campaign_nights, "the phase HUD reads '%s'" % hud.describe())
sim.day_night.snap() sim.day_night.snap()
var day_energy := sim.sun.light_energy var day_energy := sim.sun.light_energy
r.check(sim.day_night.lantern.light_energy < 0.6 and day_energy > 0.8, "morning light: bright sun, lantern nearly off") r.check(sim.day_night.lantern.light_energy < 0.6 and day_energy > 0.8, "morning light: bright sun, lantern nearly off")
@ -59,7 +58,7 @@ func _day(r: GameTestRunner, sim: FarmSim, player: PlayerCharacter, hud: PhaseHu
var c := sim.campaign var c := sim.campaign
var s := c.state var s := c.state
hud._process(0.0) hud._process(0.0)
r.check(hud.describe() == "Night 1 of %d · Day · 3:00 left" % sim.config.campaign_nights, "the phase HUD reads '%s'" % hud.describe()) r.check(hud.describe() == "Day 1 of %d · 3:00 until Dusk" % sim.config.campaign_nights, "the phase HUD reads '%s'" % hud.describe())
sim.day_night.snap() sim.day_night.snap()
r.check(is_equal_approx(sim.day_night.lantern.light_energy, 0.0) and sim.sun.light_energy > 1.0, "daylight: full sun, no lantern") r.check(is_equal_approx(sim.day_night.lantern.light_energy, 0.0) and sim.sun.light_energy > 1.0, "daylight: full sun, no lantern")
# A day's work: gather into the pouch, build, take some damage, patch up. # A day's work: gather into the pouch, build, take some damage, patch up.
@ -96,7 +95,7 @@ func _dusk(r: GameTestRunner, sim: FarmSim, hud: PhaseHud) -> void:
r.check(w.warning_active() and w.tonight_entries() == [[EnemySystem.TYPE_CROW, LootSystem.Category.CROP]], "dusk warns of what tonight brings: %s" % [w.tonight_entries()]) r.check(w.warning_active() and w.tonight_entries() == [[EnemySystem.TYPE_CROW, LootSystem.Category.CROP]], "dusk warns of what tonight brings: %s" % [w.tonight_entries()])
hud._process(0.0) hud._process(0.0)
var warning := "Tonight, from every side: crows" var warning := "Tonight, from every side: crows"
r.check(hud._hint.text == warning, "the HUD warns, by target: '%s'" % hud._hint.text.replace("\n", " / ")) r.check(hud.hint == warning, "the HUD warns, by target: '%s'" % hud.hint.replace("\n", " / "))
var marked := w.get_children().filter(func(n: Node) -> bool: return n is Node3D and (n as Node3D).visible) var marked := w.get_children().filter(func(n: Node) -> bool: return n is Node3D and (n as Node3D).visible)
r.check(marked.is_empty() and sim.alerts.collect().is_empty(), "nothing marks tonight's arrivals on the farm or at the screen edge") r.check(marked.is_empty() and sim.alerts.collect().is_empty(), "nothing marks tonight's arrivals on the farm or at the screen edge")
r.check(hud._dusk_hint.visible and hud._dusk_hint.text == plan.dusk_hint and hud._banner.text == "Dusk: %s" % plan.title, r.check(hud._dusk_hint.visible and hud._dusk_hint.text == plan.dusk_hint and hud._banner.text == "Dusk: %s" % plan.title,

View file

@ -12,7 +12,8 @@ extends RefCounted
## supply shed's own shop (#6): weapons (corn_shooter, pumpkin_bomb) bought at its counter ## supply shed's own shop (#6): weapons (corn_shooter, pumpkin_bomb) bought at its counter
## (ShedCounter), not the workbench, with the walk-in pouch deposit unaffected. And a pouch per ## (ShedCounter), not the workbench, with the walk-in pouch deposit unaffected. And a pouch per
## scarecrow (#16): filled, deposited, and spent from by its own avatar slot, one shared capacity. ## scarecrow (#16): filled, deposited, and spent from by its own avatar slot, one shared capacity.
## And upgrade levels and timed shed stock (#26, _tiers and _stock). ## And upgrade levels and timed shed stock (#26, _tiers and _stock). And the HUD's backpack and
## pouch panel (ResourceHud).
const P := CampaignController.Phase const P := CampaignController.Phase
const DT := 1.0 / 60.0 const DT := 1.0 / 60.0
@ -38,6 +39,7 @@ func run(r: GameTestRunner) -> void:
sim.waves.enabled = false sim.waves.enabled = false
var player := farm.get_node("Player") as PlayerCharacter var player := farm.get_node("Player") as PlayerCharacter
_layout(r, sim) _layout(r, sim)
_pouch_hud(r, farm, sim)
_gathering(r, sim, player) _gathering(r, sim, player)
_deposit_and_night(r, sim, player) _deposit_and_night(r, sim, player)
_patch_cost(r, sim) _patch_cost(r, sim)
@ -384,7 +386,7 @@ func _tiers(r: GameTestRunner) -> void:
## Timed shed stock (#26): each shed item arrives on its day ("from_day"; day N is the day before ## Timed shed stock (#26): each shed item arrives on its day ("from_day"; day N is the day before
## night N) and can't be bought before it. Its row shows just its name, greyed, and "Arrives on ## night N) and can't be bought before it. Its row shows just its name, greyed, and "Arrives on
## day N"; a hidden one shows "?" and its day until it arrives, then the bare "?" until revealed. ## day N"; a hidden one shows "?" and its day until it arrives, then the bare "?" until revealed.
## Debug F8 (CampaignDebug.unlock_all): on day 1, every upgrade and shop item goes to its last ## Debug F4 (CampaignDebug.unlock_all): on day 1, every upgrade and shop item goes to its last
## level for free, each level's effect applied; a retry from the morning review keeps it, one from ## level for free, each level's effect applied; a retry from the morning review keeps it, one from
## later in the day goes back to the morning without it. ## later in the day goes back to the morning without it.
func _unlock_all(r: GameTestRunner) -> void: func _unlock_all(r: GameTestRunner) -> void:
@ -400,14 +402,14 @@ func _unlock_all(r: GameTestRunner) -> void:
var shed: Dictionary = s.resources.shed.duplicate() var shed: Dictionary = s.resources.shed.duplicate()
var damage := Upgrades.value(cfg, s, "shot_damage") var damage := Upgrades.value(cfg, s, "shot_damage")
var key := InputEventKey.new() var key := InputEventKey.new()
key.physical_keycode = KEY_F8 key.physical_keycode = KEY_F4
key.pressed = true key.pressed = true
debug._unhandled_input(key) debug._unhandled_input(key)
var all_max := true var all_max := true
for id: String in cfg.upgrades: for id: String in cfg.upgrades:
all_max = all_max and Upgrades.maxed(cfg, s, id) and Upgrades.blocker(c, id) == "Done" all_max = all_max and Upgrades.maxed(cfg, s, id) and Upgrades.blocker(c, id) == "Done"
r.check(all_max and s.night == 1 and Upgrades.levels_bought(cfg, s) == Upgrades.levels_total(cfg), r.check(all_max and s.night == 1 and Upgrades.levels_bought(cfg, s) == Upgrades.levels_total(cfg),
"F8 on the first morning: every upgrade and shop item at its last level (%d levels), hidden and not-yet-arrived ones too" "F4 on the first morning: every upgrade and shop item at its last level (%d levels), hidden and not-yet-arrived ones too"
% Upgrades.levels_bought(cfg, s)) % Upgrades.levels_bought(cfg, s))
r.check(s.resources.shed == shed and int(s.night_events.get("upgrades_bought", 0)) == 0, "free, and not counted as bought") r.check(s.resources.shed == shed and int(s.night_events.get("upgrades_bought", 0)) == 0, "free, and not counted as bought")
r.check(s.scarecrow_max_hp == hp + 6 and s.scarecrow_hp == hp + 6 and s.resources.pouch_capacity == pouch + 16 r.check(s.scarecrow_max_hp == hp + 6 and s.scarecrow_hp == hp + 6 and s.resources.pouch_capacity == pouch + 16
@ -576,6 +578,44 @@ func _gathering(r: GameTestRunner, sim: FarmSim, player: PlayerCharacter) -> voi
_step(sim, 1) _step(sim, 1)
## The HUD's backpack: "used/capacity", a red dot once something new is carried (gone once the pouch
## is opened, or emptied), and the pouch panel (I / R3) with what's carried and what the shed holds.
func _pouch_hud(r: GameTestRunner, farm: Node3D, sim: FarmSim) -> void:
var hud := farm.get_node("Hud/ResourceHud") as ResourceHud
var res := sim.campaign.state.resources
var keep_shed: Dictionary = res.shed.duplicate()
var keep_pouch: Dictionary = res.pouch.duplicate()
for m in ResourceStore.MATERIALS:
res.pouch[m] = 0
hud._process(0.0)
hud.open = false
r.check(not hud.new_items and hud.count_text() == "0/%d" % res.pouch_capacity, "an empty pouch: '%s', no dot" % hud.count_text())
res.add_to_pouch("wood", 3)
res.shed["scrap"] = 7
hud._process(0.0)
r.check(hud.count_text() == "3/%d" % res.pouch_capacity and hud.new_items, "the backpack counts what's carried ('%s'), with a dot for the new wood" % hud.count_text())
var press := InputEventAction.new()
press.action = &"pouch"
press.pressed = true
hud._unhandled_input(press)
var rows := hud.rows()
r.check(hud.open and not hud.new_items and rows.size() == ResourceStore.MATERIALS.size()
and rows[0] == {"material": "wood", "pouch": 3, "shed": int(res.shed["wood"])} and int(rows[1]["shed"]) == 7,
"I opens the pouch: what's carried and the shed's stock of each, and the dot goes: %s" % [rows])
hud._unhandled_input(press)
r.check(not hud.open, "and closes it again")
res.add_to_pouch("straw", 1)
hud._process(0.0)
var dot := hud.new_items
res.deposit()
hud._process(0.0)
r.check(dot and not hud.new_items, "emptying the pouch clears the dot")
for m in ResourceStore.MATERIALS:
res.shed[m] = int(keep_shed.get(m, 0))
res.pouch[m] = int(keep_pouch.get(m, 0))
hud._process(0.0)
func _deposit_and_night(r: GameTestRunner, sim: FarmSim, player: PlayerCharacter) -> void: func _deposit_and_night(r: GameTestRunner, sim: FarmSim, player: PlayerCharacter) -> void:
var c := sim.campaign var c := sim.campaign
var res := c.state.resources var res := c.state.resources

View file

@ -81,15 +81,15 @@ func _zones(r: GameTestRunner, zones: FarmZones) -> void:
r.check(not o.rect().intersects(z.rect()), "%s and %s don't overlap" % [o.display_name, z.display_name]) r.check(not o.rect().intersects(z.rect()), "%s and %s don't overlap" % [o.display_name, z.display_name])
## #13: 20 more crop units in two later-sprouting fields (lettuce/cabbage, corn), 10 each, ids ## #13: 60 more crop units in two later-sprouting fields (lettuce/cabbage, corn), 30 each, ids
## 31..40 and 41..50, continuing the original field's plot numbering (7..10). GameConfig.start_crops ## 31..60 and 61..90, continuing the original field's plot numbering (7..18). GameConfig.start_crops
## (30) only counts the original, always-grown field; the later fields grow FarmState.crops_total ## (30) only counts the original, always-grown field; the later fields grow FarmState.crops_total
## when they sprout (LootSystem), so it's not part of this static count. ## when they sprout (LootSystem), so it's not part of this static count.
func _crops(r: GameTestRunner, zones: FarmZones) -> void: func _crops(r: GameTestRunner, zones: FarmZones) -> void:
var cfg := load("res://game/resources/game_config.tres") as GameConfig var cfg := load("res://game/resources/game_config.tres") as GameConfig
var units := zones.crop_units() var units := zones.crop_units()
var fields := zones.zones_of(FarmZone.Kind.CROP_FIELD) var fields := zones.zones_of(FarmZone.Kind.CROP_FIELD)
r.check(units.size() == cfg.start_crops + 20, "%d crop units: %d in the original field, 20 in the two later ones" % [units.size(), cfg.start_crops]) r.check(units.size() == cfg.start_crops + 60, "%d crop units: %d in the original field, 60 in the two later ones" % [units.size(), cfg.start_crops])
var ids := {} var ids := {}
var per_plot := {} var per_plot := {}
var fewest := 1 << 30 var fewest := 1 << 30
@ -104,14 +104,14 @@ func _crops(r: GameTestRunner, zones: FarmZones) -> void:
g["count"] = int(g["count"]) + 1 g["count"] = int(g["count"]) + 1
by_crop[u.crop] = g by_crop[u.crop] = g
r.check(ids.size() == units.size() and ids.has(1) and ids.has(units.size()), "crop unit ids are unique, 1..%d" % units.size()) r.check(ids.size() == units.size() and ids.has(1) and ids.has(units.size()), "crop unit ids are unique, 1..%d" % units.size())
r.check(per_plot.size() == 10 and per_plot.values().all(func(n: int) -> bool: return n == 5), "10 plots of 5 units (%s)" % [per_plot]) r.check(per_plot.size() == 18 and per_plot.values().all(func(n: int) -> bool: return n == 5), "18 plots of 5 units (%s)" % [per_plot])
r.check(fewest >= 8, "every unit is a visible cluster (fewest plants: %d)" % fewest) r.check(fewest >= 8, "every unit is a visible cluster (fewest plants: %d)" % fewest)
r.check(by_crop.get("sunflower", {}).get("count", 0) == cfg.start_crops and by_crop["sunflower"]["sprout_night"] == 0, r.check(by_crop.get("sunflower", {}).get("count", 0) == cfg.start_crops and by_crop["sunflower"]["sprout_night"] == 0,
"the original field's %d units are sunflowers, already grown" % cfg.start_crops) "the original field's %d units are sunflowers, already grown" % cfg.start_crops)
r.check(by_crop.get("lettuce", {}).get("count", 0) == 10 and by_crop["lettuce"]["sprout_night"] == 2, r.check(by_crop.get("lettuce", {}).get("count", 0) == 30 and by_crop["lettuce"]["sprout_night"] == 2,
"10 lettuce/cabbage units sprout after night 2") "30 lettuce/cabbage units sprout after night 2")
r.check(by_crop.get("corn", {}).get("count", 0) == 10 and by_crop["corn"]["sprout_night"] == 4, r.check(by_crop.get("corn", {}).get("count", 0) == 30 and by_crop["corn"]["sprout_night"] == 4,
"10 corn units sprout after night 4") "30 corn units sprout after night 4")
## #20: the lettuce/cabbage and corn fields grow on the bare plowed soil south of the original map ## #20: the lettuce/cabbage and corn fields grow on the bare plowed soil south of the original map

194
game/tests/test_look.gd Normal file
View file

@ -0,0 +1,194 @@
extends RefCounted
## The toon look (ToonLook): lit, opaque StandardMaterial3Ds become toon ShaderMaterials with the
## same color, texture, and vertex-color use (double-sided ones get the double-sided shader), one
## per source material; unshaded, transparent, billboard, and no-depth-test materials stay. Nodes
## added later are swapped by the end of their frame, after their builder tinted them (the
## co-op partner's blue scarecrow). On the real farm no lit StandardMaterial3D is left showing,
## and the outline quad never casts a shadow and draws under the transparent effects. Label3Ds
## stop rendering in 3D (they'd be pixelated) and ScreenLabels draws them as flat text where they
## project, at least MIN_SIZE tall, only while shown and in front of the camera, and nudged apart
## where they'd overlap.
const TOON := "res://game/resources/toon.gdshader"
const TOON_DOUBLE_SIDED := "res://game/resources/toon_double_sided.gdshader"
func run(r: GameTestRunner) -> void:
_materials(r)
await _farm(r)
func _materials(r: GameTestRunner) -> void:
var look := ToonLook.new()
var lit := StandardMaterial3D.new()
lit.albedo_color = Color(0.8, 0.3, 0.1)
var tex := PlaceholderTexture2D.new()
lit.albedo_texture = tex
lit.vertex_color_use_as_albedo = true
var toon := look.toon_material(lit) as ShaderMaterial
r.check(toon != null and toon.shader.resource_path == TOON, "a lit, opaque material becomes a toon ShaderMaterial")
r.check(toon != null and toon.get_shader_parameter("albedo") == lit.albedo_color
and toon.get_shader_parameter("albedo_texture") == tex and toon.get_shader_parameter("use_vertex_color") == true,
"with the same color, texture, and vertex-color use")
r.check(look.toon_material(lit) == toon and look.toon_material(toon) == toon,
"one toon material per source (and swapping again changes nothing)")
var two_sided := StandardMaterial3D.new()
two_sided.cull_mode = BaseMaterial3D.CULL_DISABLED
r.check((look.toon_material(two_sided) as ShaderMaterial).shader.resource_path == TOON_DOUBLE_SIDED,
"a double-sided material gets the double-sided toon shader")
var unshaded := StandardMaterial3D.new()
unshaded.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED
var glass := StandardMaterial3D.new()
glass.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
var facing := StandardMaterial3D.new()
facing.billboard_mode = BaseMaterial3D.BILLBOARD_ENABLED
var overlay := StandardMaterial3D.new()
overlay.no_depth_test = true
var kept := 0
for m: StandardMaterial3D in [unshaded, glass, facing, overlay]:
if look.toon_material(m) == m:
kept += 1
r.check(kept == 4, "unshaded, transparent, billboard, and no-depth-test materials stay (%d of 4)" % kept)
var mesh := BoxMesh.new()
mesh.material = lit
var mi := MeshInstance3D.new()
mi.mesh = mesh
look.swap_node(mi)
r.check(mi.get_surface_override_material(0) == toon and mesh.material == lit,
"a mesh's own material is swapped with a surface override (the mesh resource is untouched)")
var over := MeshInstance3D.new()
over.mesh = mesh
over.material_override = two_sided
look.swap_node(over)
r.check(over.material_override == look.toon_material(two_sided), "a material override is swapped in place")
var debris := CPUParticles3D.new()
debris.mesh = mesh
look.swap_node(debris)
r.check(debris.material_override == toon, "particles swap their mesh's material through an override")
mi.free()
over.free()
debris.free()
look.free()
func _farm(r: GameTestRunner) -> void:
var farm := (load("res://game/scenes/farm.tscn") as PackedScene).instantiate() as Node3D
r.root.add_child(farm)
await r.process_frame
var sim := farm.get_node("FarmSim") as FarmSim
sim.set_physics_process(false)
var look := ToonLook.new()
r.root.add_child(look)
var left := _lit_left(farm)
r.check(left.is_empty(), "no lit StandardMaterial3D is left showing on the farm (%d left: %s)" % [left.size(), ", ".join(left.slice(0, 5))])
r.check(_toon_count(farm) > 100, "the farm's props, characters, and weapons are toon-shaded (%d surfaces)" % _toon_count(farm))
var a := sim.add_partner(false, "Ben")
var body := a.body
r.check(not _lit_left(body).is_empty(), "the partner's scarecrow arrives with lit materials (tinted blue)")
await r.process_frame
await r.process_frame
r.check(_lit_left(body).is_empty(), "and is toon-shaded by the end of the frame it arrived in")
var blue := false
for mi in body.find_children("*", "MeshInstance3D", true, false):
var m := (mi as MeshInstance3D).material_override as ShaderMaterial
if m != null and m.get_shader_parameter("albedo") == Color(0.55, 0.75, 1.0):
blue = true
r.check(blue, "keeping its blue tint")
var label3ds := farm.find_children("*", "Label3D", true, false)
r.check(label3ds.size() >= 5 and label3ds.all(func(l: Node) -> bool: return (l as Label3D).layers == 0),
"the farm's %d Label3Ds don't render in 3D (ScreenLabels draws them)" % label3ds.size())
var cam := r.root.get_camera_3d()
var sign := Label3D.new()
sign.text = "Wood 4"
sign.font_size = 40
sign.pixel_size = 0.0075
sign.outline_size = 10
sign.modulate = Color(1.0, 0.8, 0.3)
farm.add_child(sign)
sign.global_position = cam.global_position - cam.global_basis.z * 12.0
sign.reset_physics_interpolation() # drawn where it's displayed, as in 3D
await r.process_frame
var drawn := look.labels.entries().filter(func(e: Dictionary) -> bool: return e["label"] == sign)
r.check(drawn.size() == 1 and drawn[0]["text"] == "Wood 4" and drawn[0]["color"] == sign.modulate
and drawn[0]["font_size"] >= ScreenLabels.MIN_SIZE and drawn[0]["outline_size"] > 0
and r.root.get_visible_rect().encloses(drawn[0]["rect"]),
"a label added later is drawn flat on screen with its text, color, and outline, readable size (%s)"
% [drawn[0]["font_size"] if drawn.size() == 1 else "not drawn"])
var twin := sign.duplicate() as Label3D
twin.text = "Alien Goop 0"
farm.add_child(twin)
twin.global_position = sign.global_position
twin.reset_physics_interpolation()
await r.process_frame
var pair := look.labels.entries().filter(func(e: Dictionary) -> bool: return e["label"] in [sign, twin])
r.check(pair.size() == 2 and not (pair[0]["rect"] as Rect2).intersects(pair[1]["rect"]),
"two labels at the same spot are nudged apart, so both can be read")
twin.queue_free()
sign.visible = false
r.check(not look.labels.entries().any(func(e: Dictionary) -> bool: return e["label"] == sign), "but not while hidden")
sign.visible = true
sign.global_position = cam.global_position + cam.global_basis.z * 12.0
sign.reset_physics_interpolation()
await r.process_frame # (the displayed position moves with the frame)
r.check(not look.labels.entries().any(func(e: Dictionary) -> bool: return e["label"] == sign), "or behind the camera")
var outline := look.outline
var outline_mat := outline.material_override as ShaderMaterial
r.check(outline.is_inside_tree() and outline_mat.shader.resource_path == "res://game/resources/pixel_outline.gdshader"
and outline.cast_shadow == GeometryInstance3D.SHADOW_CASTING_SETTING_OFF
and outline_mat.render_priority == Material.RENDER_PRIORITY_MIN,
"the outline quad is in the world, casts no shadow, and draws under the transparent effects")
look.queue_free()
farm.queue_free()
await r.process_frame
## The nodes under root still showing a lit StandardMaterial3D, by name.
static func _lit_left(root: Node) -> Array[String]:
var out: Array[String] = []
for node in [root] + root.find_children("*", "GeometryInstance3D", true, false):
var g := node as GeometryInstance3D
if g == null:
continue
for m in _shown(g):
if m is BaseMaterial3D and ToonLook.swappable(m as BaseMaterial3D):
out.append(String(g.name))
return out
static func _toon_count(root: Node) -> int:
var n := 0
for node in root.find_children("*", "GeometryInstance3D", true, false):
for m in _shown(node as GeometryInstance3D):
var s := m as ShaderMaterial
if s != null and s.shader != null and s.shader.resource_path in [TOON, TOON_DOUBLE_SIDED]:
n += 1
return n
## The materials a node draws with.
static func _shown(g: GeometryInstance3D) -> Array[Material]:
var out: Array[Material] = []
if g.material_override != null:
out.append(g.material_override)
return out
var mesh: Mesh = null
if g is MeshInstance3D:
var mi := g as MeshInstance3D
if mi.mesh != null:
for i in mi.get_surface_override_material_count():
if mi.get_active_material(i) != null:
out.append(mi.get_active_material(i))
return out
if g is CPUParticles3D:
mesh = (g as CPUParticles3D).mesh
elif g is MultiMeshInstance3D and (g as MultiMeshInstance3D).multimesh != null:
mesh = (g as MultiMeshInstance3D).multimesh.mesh
if mesh != null:
for i in mesh.get_surface_count():
if mesh.surface_get_material(i) != null:
out.append(mesh.surface_get_material(i))
return out

View file

@ -0,0 +1 @@
uid://8pt5we4ip4pk

View file

@ -406,7 +406,7 @@ func _night_jump(r: GameTestRunner, farm: Node3D, sim: FarmSim) -> void:
r.check(c.morning_snapshot() == s.to_dict() and sim.review_panel.visible and body.contains("Tonight: %s." % tonight), r.check(c.morning_snapshot() == s.to_dict() and sim.review_panel.visible and body.contains("Tonight: %s." % tonight),
"the retry snapshot and the review panel are day 2's") "the retry snapshot and the review panel are day 2's")
debug._unhandled_input(f3) debug._unhandled_input(f3)
r.check(s.night == 3 and s.nights_survived == 2 and s.crops_total == crops + 10 and sim.loot.count(LootSystem.Status.DORMANT) == dormant - 10, r.check(s.night == 3 and s.nights_survived == 2 and s.crops_total == crops + 30 and sim.loot.count(LootSystem.Status.DORMANT) == dormant - 30,
"F3 again: day 3, and the field due after night 2 sprouts (%d crops)" % s.crops_total) "F3 again: day 3, and the field due after night 2 sprouts (%d crops)" % s.crops_total)
var back := f3.duplicate() as InputEventKey var back := f3.duplicate() as InputEventKey
back.shift_pressed = true back.shift_pressed = true

View file

@ -195,7 +195,7 @@ func _settings(r: GameTestRunner) -> void:
_clean() _clean()
var fresh := GameSettings.load_from(SETTINGS) var fresh := GameSettings.load_from(SETTINGS)
r.check(fresh.volume == GameSettings.DEFAULT_VOLUME and fresh.show_tips and fresh.vsync and not fresh.fullscreen r.check(fresh.volume == GameSettings.DEFAULT_VOLUME and fresh.show_tips and fresh.vsync and not fresh.fullscreen
and fresh.resolution_scale == 1.0, "no settings file: the defaults") and fresh.resolution_scale == 1.0 and fresh.pixel_size == 4, "no settings file: the defaults")
var g := GameSettings.new() var g := GameSettings.new()
g.volume = {"Master": 0.5, "Music": 0.25, "SFX": 0.0, "Ambience": 1.0, "Voice": 0.6} g.volume = {"Master": 0.5, "Music": 0.25, "SFX": 0.0, "Ambience": 1.0, "Voice": 0.6}
g.move_dead_zone = 0.35 g.move_dead_zone = 0.35
@ -203,6 +203,7 @@ func _settings(r: GameTestRunner) -> void:
g.fullscreen = true g.fullscreen = true
g.vsync = false g.vsync = false
g.resolution_scale = 0.75 g.resolution_scale = 0.75
g.pixel_size = 2
g.show_tips = false g.show_tips = false
g.player_name = "Ana" g.player_name = "Ana"
g.microphone = false g.microphone = false
@ -210,16 +211,27 @@ func _settings(r: GameTestRunner) -> void:
var back := GameSettings.load_from(SETTINGS) var back := GameSettings.load_from(SETTINGS)
r.check(back.volume == g.volume and back.move_dead_zone == 0.35 and back.aim_dead_zone == 0.15 and back.fullscreen r.check(back.volume == g.volume and back.move_dead_zone == 0.35 and back.aim_dead_zone == 0.15 and back.fullscreen
and not back.vsync and back.resolution_scale == 0.75 and not back.show_tips and back.player_name == "Ana" and not back.vsync and back.resolution_scale == 0.75 and not back.show_tips and back.player_name == "Ana"
and not back.microphone, "and load back unchanged (co-op name and microphone too)") and not back.microphone and back.pixel_size == 2, "and load back unchanged (co-op name, microphone, pixel size too)")
var f := ConfigFile.new() var f := ConfigFile.new()
f.set_value("audio", "master", 7.0) f.set_value("audio", "master", 7.0)
f.set_value("audio", "music", "loud") f.set_value("audio", "music", "loud")
f.set_value("display", "fullscreen", "yes") f.set_value("display", "fullscreen", "yes")
f.set_value("display", "resolution_scale", 0.1) f.set_value("display", "resolution_scale", 0.1)
f.set_value("display", "pixel_size", 40)
f.save(SETTINGS) f.save(SETTINGS)
var odd := GameSettings.load_from(SETTINGS) var odd := GameSettings.load_from(SETTINGS)
r.check(odd.volume["Master"] == 1.0 and odd.volume["Music"] == GameSettings.DEFAULT_VOLUME["Music"] and not odd.fullscreen r.check(odd.volume["Master"] == 1.0 and odd.volume["Music"] == GameSettings.DEFAULT_VOLUME["Music"] and not odd.fullscreen
and odd.resolution_scale == 0.5, "out-of-range and wrong-typed values are clamped or fall back") and odd.resolution_scale == 0.5 and odd.pixel_size == GameSettings.MAX_PIXEL_SIZE,
"out-of-range and wrong-typed values are clamped or fall back")
var view := SubViewport.new()
g.apply_pixels(view)
r.check(view.scaling_3d_mode == Viewport.SCALING_3D_MODE_NEAREST and is_equal_approx(view.scaling_3d_scale, 0.5)
and view.msaa_3d == Viewport.MSAA_DISABLED, "pixel size 2 renders the 3D view at half size, sharp-scaled, no MSAA")
g.pixel_size = 1
g.apply_pixels(view)
r.check(view.scaling_3d_mode == Viewport.SCALING_3D_MODE_BILINEAR and is_equal_approx(view.scaling_3d_scale, 0.75),
"pixel size 1 turns that off and uses the resolution scale")
view.free()
var cfg := (load("res://game/resources/game_config.tres") as GameConfig).duplicate() as GameConfig var cfg := (load("res://game/resources/game_config.tres") as GameConfig).duplicate() as GameConfig
g.apply(null, cfg) g.apply(null, cfg)
var music := AudioServer.get_bus_index("Music") var music := AudioServer.get_bus_index("Music")

View file

@ -189,7 +189,7 @@ func _sprint(r: GameTestRunner, sim: FarmSim, player: PlayerCharacter, hud: Scar
var s := sim.campaign.state var s := sim.campaign.state
s.upgrades.erase("sprint") s.upgrades.erase("sprint")
hud._process(0.0) hud._process(0.0)
r.check(not player.can_sprint() and not hud._sprint_label.visible, "no sprint (and no sprint line on the HUD) before the upgrade") r.check(not player.can_sprint() and not hud.stamina_shown(), "no sprint before the upgrade (and no stamina bar on the HUD)")
# On the real body, over physics frames: the open ground south-west of the pen. # On the real body, over physics frames: the open ground south-west of the pen.
player.global_position = Vector3(0.0, 0.0, 6.0) player.global_position = Vector3(0.0, 0.0, 6.0)
player.velocity = Vector3.ZERO player.velocity = Vector3.ZERO
@ -206,13 +206,12 @@ func _sprint(r: GameTestRunner, sim: FarmSim, player: PlayerCharacter, hud: Scar
r.check(player.animation_player.current_animation == player.run_animation and player.animation_player.speed_scale > 1.5, r.check(player.animation_player.current_animation == player.run_animation and player.animation_player.speed_scale > 1.5,
"the run clip plays faster (x%.2f)" % player.animation_player.speed_scale) "the run clip plays faster (x%.2f)" % player.animation_player.speed_scale)
r.check(player.move_strength() > 1.5, "the partner's machine is told it's sprinting (strength %.2f)" % player.move_strength()) r.check(player.move_strength() > 1.5, "the partner's machine is told it's sprinting (strength %.2f)" % player.move_strength())
hud._process(0.0) r.check(hud.stamina_shown() and hud.stamina() < 1.0 and is_equal_approx(hud.stamina(), player.sprint_left / cfg.sprint_time),
r.check(hud._sprint_label.visible and hud._sprint_label.text.begins_with("Sprinting"), "the HUD shows the sprint running: '%s'" % hud._sprint_label.text) "the HUD's stamina bar appears, and drains while sprinting (%.2f)" % hud.stamina())
Input.action_release("move_right") Input.action_release("move_right")
await _frames(r, 2) await _frames(r, 2)
r.check(not player.sprinting and player.sprint_recharge > cfg.sprint_cooldown - 0.1, "stopping ends it, and the recharge starts") r.check(not player.sprinting and player.sprint_recharge > cfg.sprint_cooldown - 0.1, "stopping ends it, and the recharge starts")
hud._process(0.0) r.check(hud.stamina() < 0.1, "and starts filling back as it recharges (%.2f)" % hud.stamina())
r.check(hud._sprint_label.text == "Sprint %.0f s" % ceilf(player.sprint_recharge), "the HUD counts the recharge down: '%s'" % hud._sprint_label.text)
Input.action_release("sprint") Input.action_release("sprint")
await _frames(r, 30) await _frames(r, 30)
player.velocity = Vector3.ZERO player.velocity = Vector3.ZERO
@ -236,8 +235,7 @@ func _sprint(r: GameTestRunner, sim: FarmSim, player: PlayerCharacter, hud: Scar
player.step_sprint(DT, true, false) player.step_sprint(DT, true, false)
r.check(not player.sprinting, "and it doesn't start standing still") r.check(not player.sprinting, "and it doesn't start standing still")
sim.scarecrow.reset_for_morning() sim.scarecrow.reset_for_morning()
hud._process(0.0) r.check(player.sprint_recharge == 0.0 and hud.stamina() == 1.0, "a new morning has it ready (a full bar)")
r.check(player.sprint_recharge == 0.0 and hud._sprint_label.text == "Sprint hold Shift / L3", "a new morning has it ready: '%s'" % hud._sprint_label.text)
s.upgrades.erase("sprint") s.upgrades.erase("sprint")

View file

@ -553,15 +553,13 @@ func _fallback(r: GameTestRunner, sim: FarmSim) -> void:
sim.animals.sync_from_state() sim.animals.sync_from_state()
func _hud(r: GameTestRunner, farm: Node3D, sim: FarmSim) -> void: func _hud(r: GameTestRunner, _farm: Node3D, sim: FarmSim) -> void:
var hud := farm.get_node("Hud/AssetHud") as AssetHud
var s := sim.campaign.state var s := sim.campaign.state
hud._process(0.0) var before := " · ".join(PauseMenu.asset_counts(s))
var before := hud.describe()
s.lose_animal(s.animals_total if not s.is_animal_lost(s.animals_total) else 1) s.lose_animal(s.animals_total if not s.is_animal_lost(s.animals_total) else 1)
hud._process(0.05) var after := " · ".join(PauseMenu.asset_counts(s))
r.check(hud.describe() == "Crops %d/%d · Animals %d/%d · Supplies %d" % [s.crops, s.crops_total, s.animals, s.animals_total, s.supplies] r.check(after == "Crops %d/%d · Animals %d/%d · Supplies %d" % [s.crops, s.crops_total, s.animals, s.animals_total, s.supplies]
and hud.describe() != before and hud._flash[1] > 0.0 and hud._flash_color[1] == AssetHud.LOSS, "the asset HUD updates and flashes red on a loss: '%s'" % hud.describe()) and after != before, "the pause menu's assets count the loss: '%s'" % after)
## The farm is stripped when the last supplies are carried off with every crop and animal gone. ## The farm is stripped when the last supplies are carried off with every crop and animal gone.

View file

@ -29,16 +29,16 @@ func run(r: GameTestRunner) -> void:
sim.loot.loot_event.connect(func(kind: StringName, _id: int, _p: Vector3) -> void: sim.loot.loot_event.connect(func(kind: StringName, _id: int, _p: Vector3) -> void:
_events[kind] = int(_events.get(kind, 0)) + 1) _events[kind] = int(_events.get(kind, 0)) + 1)
r.info("farm sim loaded in %d ms (nav %d cells)" % [sim.load_msec, sim.nav.cell_count()]) r.info("farm sim loaded in %d ms (nav %d cells)" % [sim.load_msec, sim.nav.cell_count()])
r.check(sim.loot.unit_count == 50 and sim.loot.count(S.HOME, LootSystem.Category.CROP) == 30 and sim.campaign.state.crops == 30 r.check(sim.loot.unit_count == 90 and sim.loot.count(S.HOME, LootSystem.Category.CROP) == 30 and sim.campaign.state.crops == 30
and sim.loot.count(S.DORMANT, LootSystem.Category.CROP) == 20, and sim.loot.count(S.DORMANT, LootSystem.Category.CROP) == 60,
"30 crop units start at home, 20 more dormant in the two later fields (#13)") "30 crop units start at home, 60 more dormant in the two later fields (#13)")
# #20: the map reaches z 35 now, so its south edge (3 m out) is at z 38; z 18 is inside the map. # #20: the map reaches z 35 now, so its south edge (3 m out) is at z 38; z 18 is inside the map.
var edge_cells := [Vector2(-16.0, -6.0), Vector2(20.0, 38.0), Vector2(50.0, 0.0), Vector2(-16.0, 10.0)].filter(func(p: Vector2) -> bool: var edge_cells := [Vector2(-16.0, -6.0), Vector2(20.0, 38.0), Vector2(50.0, 0.0), Vector2(-16.0, 10.0)].filter(func(p: Vector2) -> bool:
return sim.escape_field[sim.nav.cell_of(p.x, p.y)] == 0) return sim.escape_field[sim.nav.cell_of(p.x, p.y)] == 0)
r.check(edge_cells.size() == 4 and sim.escape_field[sim.nav.cell_of(10.0, -8.0)] > 0, "the farm's edge, all around, is where carriers escape") r.check(edge_cells.size() == 4 and sim.escape_field[sim.nav.cell_of(10.0, -8.0)] > 0, "the farm's edge, all around, is where carriers escape")
r.check(sim.escape_field[sim.nav.cell_of(20.0, 18.0)] > 0, "(20, 18), where the south edge used to be, is inside the map now") r.check(sim.escape_field[sim.nav.cell_of(20.0, 18.0)] > 0, "(20, 18), where the south edge used to be, is inside the map now")
# #20: a carried or dropped crop shows the plant of its own field. # #20: a carried or dropped crop shows the plant of its own field.
var tokens := [1, 31, 41].map(func(id: int) -> String: return sim.loot._tokens[id].scene_file_path.get_file().get_basename()) var tokens := [1, 31, 61].map(func(id: int) -> String: return sim.loot._tokens[id].scene_file_path.get_file().get_basename())
r.check(tokens == ["plant_007", "plant_004", "plant_001"], "crop tokens match their crop: sunflower, cabbage, corn (%s)" % [tokens]) r.check(tokens == ["plant_007", "plant_004", "plant_001"], "crop tokens match their crop: sunflower, cabbage, corn (%s)" % [tokens])
_steal_and_drop(r, sim, player) _steal_and_drop(r, sim, player)
@ -302,7 +302,7 @@ func _night_arrivals(r: GameTestRunner, sim: FarmSim) -> void:
sim.waves.enabled = false sim.waves.enabled = false
## #13: the two later fields (lettuce/cabbage, ids 31-40; corn, 41-50) start dormant -- hidden, ## #13: the two later fields (lettuce/cabbage, ids 31-60; corn, 61-90) start dormant -- hidden,
## not claimable, not scored -- and sprout on schedule: field A the morning after night 2, field B ## not claimable, not scored -- and sprout on schedule: field A the morning after night 2, field B
## the morning after night 4. Once sprouted a unit is a crop like any other: visible, stealable by ## the morning after night 4. Once sprouted a unit is a crop like any other: visible, stealable by
## a crow, and counted in crops_total and the score. ## a crow, and counted in crops_total and the score.
@ -314,15 +314,15 @@ func _staged_fields(r: GameTestRunner, sim: FarmSim) -> void:
_play_to_next_morning(sim) _play_to_next_morning(sim)
r.check(c.state.phase == P.MORNING and c.state.nights_survived == 2, "played to the morning after night 2") r.check(c.state.phase == P.MORNING and c.state.nights_survived == 2, "played to the morning after night 2")
var a_ok := true var a_ok := true
for id in range(31, 41): for id in range(31, 61):
a_ok = a_ok and loot.status[id] == S.HOME and loot._units[id].visible a_ok = a_ok and loot.status[id] == S.HOME and loot._units[id].visible
r.check(a_ok, "field A (lettuce/cabbage, 31..40) sprouted after night 2: visible and home") r.check(a_ok, "field A (lettuce/cabbage, 31..60) sprouted after night 2: visible and home")
var b_dormant := true var b_dormant := true
for id in range(41, 51): for id in range(61, 91):
b_dormant = b_dormant and loot.status[id] == S.DORMANT and not loot._units[id].visible b_dormant = b_dormant and loot.status[id] == S.DORMANT and not loot._units[id].visible
r.check(b_dormant, "field B (corn, 41..50) is still dormant: hidden, not home") r.check(b_dormant, "field B (corn, 61..90) is still dormant: hidden, not home")
r.check(c.state.crops_total == 30 + 10, "crops_total grew by field A's 10 units") r.check(c.state.crops_total == 30 + 30, "crops_total grew by field A's 30 units")
r.check(not loot.recover(41) and not loot.is_claimed_by(41, -1), "a dormant unit can't be recovered or claimed") r.check(not loot.recover(61) and not loot.is_claimed_by(61, -1), "a dormant unit can't be recovered or claimed")
# A crow can claim (by hand, as other tests here do), steal, and carry off a field-A crop: it # A crow can claim (by hand, as other tests here do), steal, and carry off a field-A crop: it
# counts exactly like any other crop. # counts exactly like any other crop.
@ -343,19 +343,19 @@ func _staged_fields(r: GameTestRunner, sim: FarmSim) -> void:
_play_to_next_morning(sim) _play_to_next_morning(sim)
r.check(c.state.phase == P.MORNING and c.state.nights_survived == 4, "played to the morning after night 4") r.check(c.state.phase == P.MORNING and c.state.nights_survived == 4, "played to the morning after night 4")
var b_ok := true var b_ok := true
for id in range(41, 51): for id in range(61, 91):
b_ok = b_ok and loot.status[id] == S.HOME and loot._units[id].visible b_ok = b_ok and loot.status[id] == S.HOME and loot._units[id].visible
r.check(b_ok, "field B (corn, 41..50) sprouted after night 4: visible and home") r.check(b_ok, "field B (corn, 61..90) sprouted after night 4: visible and home")
r.check(c.state.crops_total == 30 + 10 + 10, "crops_total grew by field B's 10 units too") r.check(c.state.crops_total == 30 + 30 + 30, "crops_total grew by field B's 30 units too")
var before2 := c.state.crops var before2 := c.state.crops
var h2 := es.spawn(EnemySystem.TYPE_CROW, -20.0, 0.0, Vector2.RIGHT) var h2 := es.spawn(EnemySystem.TYPE_CROW, -20.0, 0.0, Vector2.RIGHT)
var d2 := es.resolve_handle(h2) var d2 := es.resolve_handle(h2)
loot.holder[41] = h2 loot.holder[61] = h2
r.check(loot.pick_up(41, h2), "field B crop 41 can be claimed and picked up") r.check(loot.pick_up(61, h2), "field B crop 61 can be claimed and picked up")
es.carry[d2] = 41 es.carry[d2] = 61
loot.escape(41, h2) loot.escape(61, h2)
r.check(c.state.is_crop_lost(41) and loot.status[41] == S.LOST and c.state.crops == before2 - 1, r.check(c.state.is_crop_lost(61) and loot.status[61] == S.LOST and c.state.crops == before2 - 1,
"a stolen field-B crop is lost and scored like any other") "a stolen field-B crop is lost and scored like any other")
es.apply_hit(d2, 99) es.apply_hit(d2, 99)
_step(sim, 1) _step(sim, 1)
@ -368,7 +368,7 @@ func _staged_fields(r: GameTestRunner, sim: FarmSim) -> void:
r.check(restored.crops_total == c.state.crops_total and restored.nights_survived == c.state.nights_survived, r.check(restored.crops_total == c.state.crops_total and restored.nights_survived == c.state.nights_survived,
"crops_total and nights_survived survive a save/JSON round trip") "crops_total and nights_survived survive a save/JSON round trip")
loot.sync_from_state() # as a real load or retry would trigger loot.sync_from_state() # as a real load or retry would trigger
r.check(c.state.crops_total == 50, "sync_from_state() repairs crops_total to the same, fully-sprouted total") r.check(c.state.crops_total == 90, "sync_from_state() repairs crops_total to the same, fully-sprouted total")
## Advances from wherever the campaign is now to the next morning (one full day/night/dawn cycle), ## Advances from wherever the campaign is now to the next morning (one full day/night/dawn cycle),

View file

@ -5,12 +5,12 @@ extends RefCounted
## shooter and pumpkin bombs bought at the supply shed, not the workbench (rapid fire and heavy ## 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 ## 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 ## 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 ## 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 ## 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, ## 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 ## 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). ## fire and its flame (#17); and the Alien Ray's beam (#18).
const DT := 1.0 / 60.0 const DT := 1.0 / 60.0
@ -172,8 +172,15 @@ func _switching(r: GameTestRunner, sim: FarmSim) -> void:
var first := c.weapon var first := c.weapon
_tap(sim, "weapon_2") _tap(sim, "weapon_2")
r.check(first == W.PITCHFORK and c.weapon == W.CORN_SHOOTER, "1-2 pick one") 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"), r.check(c.equip(W.PUMPKIN_BOMB) and c.weapon == W.CORN_SHOOTER, "the bombs never take the main hand")
"the bombs never take the main hand (and there's no third weapon key)") 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) c.equip(W.PITCHFORK)
var east := AT + Vector2(5.0, 0.0) var east := AT + Vector2(5.0, 0.0)
_step(sim, c.stab_ticks()) _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: func _hud(r: GameTestRunner, farm: Node3D, sim: FarmSim) -> void:
var hud := farm.get_node("Hud/ScarecrowHud") as ScarecrowHud var hud := farm.get_node("Hud/ScarecrowHud") as ScarecrowHud
var c := sim.combat var c := sim.combat
var cfg := sim.config
var s := sim.campaign.state 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") s.upgrades.erase("corn_shooter")
c.ready_for_morning() c.ready_for_morning()
_step(sim, 1) _step(sim, 1)
hud._process(0.0) var start: Array = shown.call()
var charged: Array = hud._offhand_rows.map(func(l: Label) -> String: return l.text) 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)) c.offhand_toward(AT + Vector2(6.0, 0.0))
hud._process(0.0) r.check(not hud.slots()[1]["selected"], "a bomb recharging isn't lit")
var rows: Array = hud._weapon_rows.map(func(l: Label) -> String: return l.text) s.upgrades["corn_shooter"] = 1
var off: Array = hud._offhand_rows.map(func(l: Label) -> String: return l.text) s.upgrades["propane_torch"] = 1
r.check(rows == ["1 Pitchfork", "2 Corn shooter (supply shed)", "Potato cannon (supply shed)", c.equip(W.PROPANE_TORCH)
"Shurikens (supply shed)", "Propane torch (supply shed)", "Alien ray (supply shed)"], var mains: Array = shown.call().filter(func(a: Array) -> bool: return not a[2])
"the HUD lists the main weapons, the first two by number (no more number keys): %s" % [rows]) r.check(mains == [[W.PITCHFORK, 1, false, false], [W.CORN_SHOOTER, 2, false, false], [W.PROPANE_TORCH, 3, false, true]],
r.check(charged == ["Pumpkin bombs"] and off == ["Pumpkin bombs %.0f s" % ceilf(cfg.bomb_cooldown)], "bought weapons join it in order, numbered by their key, the one in hand lit: %s" % [mains])
"and the off-hand's bombs, with their recharge: %s, %s" % [charged, off]) sim.build.set_active(true)
r.check(hud._weapon_title.visible and hud._weapon_hint.text.contains("Tab") and hud._offhand_title.text.contains("right mouse"), r.check(hud.slots().is_empty(), "it gives way to the build hotbar in build mode")
"with how to switch, and the off-hand's button") sim.build.set_active(false)
s.upgrades.erase("propane_torch")
s.upgrades.erase("corn_shooter")
s.upgrades.erase("pumpkin_bomb") s.upgrades.erase("pumpkin_bomb")
_step(sim, 1) _step(sim, 1)
sim.bombs.clear() sim.bombs.clear()

View file

@ -20,13 +20,15 @@ extends SceneTree
## | toggle_mic | M | - | Co-op | ## | toggle_mic | M | - | Co-op |
## | sprint (hold)| Shift | L3 (stick) | Sprint | ## | sprint (hold)| Shift | L3 (stick) | Sprint |
## | weapon_next | Tab | D-pad down | Weapons | ## | weapon_next | Tab | D-pad down | Weapons |
## | weapon_1..2 | 1, 2 | - | Weapons | ## | weapon_1..6 | 1 - 6 | - | Weapons |
## | offhand | Right mouse | LT | Off-hand | ## | offhand | Right mouse | LT | Off-hand |
## The weapon keys are build mode's (build_next, build_1..2): outside build mode they pick the ## | pouch | I | R3 (stick) | HUD |
## main weapon. offhand shares the right mouse button with cancel: in build mode it dismantles. ## The weapon keys share build mode's (build_next, build_1..4): outside build mode they pick the
## STALE actions, from earlier versions of this table, are removed. ## main weapon (the k-th owned, ScarecrowCombat.owned_main). 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"] const STALE: Array[String] = []
func _initialize() -> void: func _initialize() -> void:
@ -37,7 +39,7 @@ func _initialize() -> void:
_action("rotate_left", [_key(KEY_Z), _joy(JOY_BUTTON_DPAD_LEFT)]) _action("rotate_left", [_key(KEY_Z), _joy(JOY_BUTTON_DPAD_LEFT)])
_action("rotate_right", [_key(KEY_C), _joy(JOY_BUTTON_DPAD_RIGHT)]) _action("rotate_right", [_key(KEY_C), _joy(JOY_BUTTON_DPAD_RIGHT)])
_action("build_next", [_key(KEY_TAB), _joy(JOY_BUTTON_DPAD_DOWN)]) _action("build_next", [_key(KEY_TAB), _joy(JOY_BUTTON_DPAD_DOWN)])
var number_keys: Array[Key] = [KEY_1, KEY_2, KEY_3, KEY_4] var number_keys: Array[Key] = [KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6]
for i in 4: for i in 4:
_action("build_%d" % (i + 1), [_key(number_keys[i])]) _action("build_%d" % (i + 1), [_key(number_keys[i])])
_action("cancel", [_mouse(MOUSE_BUTTON_RIGHT), _joy(JOY_BUTTON_B)]) _action("cancel", [_mouse(MOUSE_BUTTON_RIGHT), _joy(JOY_BUTTON_B)])
@ -46,9 +48,10 @@ func _initialize() -> void:
_action("toggle_mic", [_key(KEY_M)]) _action("toggle_mic", [_key(KEY_M)])
_action("sprint", [_key(KEY_SHIFT), _joy(JOY_BUTTON_LEFT_STICK)]) _action("sprint", [_key(KEY_SHIFT), _joy(JOY_BUTTON_LEFT_STICK)])
_action("weapon_next", [_key(KEY_TAB), _joy(JOY_BUTTON_DPAD_DOWN)]) _action("weapon_next", [_key(KEY_TAB), _joy(JOY_BUTTON_DPAD_DOWN)])
for i in 2: for i in 6:
_action("weapon_%d" % (i + 1), [_key(number_keys[i])]) _action("weapon_%d" % (i + 1), [_key(number_keys[i])])
_action("offhand", [_mouse(MOUSE_BUTTON_RIGHT), _axis(JOY_AXIS_TRIGGER_LEFT)]) _action("offhand", [_mouse(MOUSE_BUTTON_RIGHT), _axis(JOY_AXIS_TRIGGER_LEFT)])
_action("pouch", [_key(KEY_I), _joy(JOY_BUTTON_RIGHT_STICK)])
for a in STALE: for a in STALE:
ProjectSettings.clear("input/" + a) ProjectSettings.clear("input/" + a)
var err := ProjectSettings.save() var err := ProjectSettings.save()

View file

@ -34,17 +34,25 @@
"32": "FarmSim Tick & Camera", "32": "FarmSim Tick & Camera",
"33": "Interactions & Gathering", "33": "Interactions & Gathering",
"34": "Shed Stock & Supply Targets", "34": "Shed Stock & Supply Targets",
"35": "ResourceStore",
"36": "Farm Projectiles", "36": "Farm Projectiles",
"37": "Alert Manager", "37": "Alert Manager",
"38": "Net Budget Tool", "38": "Net Budget Tool",
"39": "Enemy Roster Tests", "39": "Enemy Roster Tests",
"40": "Co-op Menu UI", "40": "Co-op Menu UI",
"41": "Harvest Season — co-op",
"42": "Snapshot Decoding", "42": "Snapshot Decoding",
"43": "Enemy Characters & Hits", "43": "Enemy Characters & Hits",
"44": "send",
"45": "Interactions",
"46": "Upgrades",
"47": "Prop Collision Builder", "47": "Prop Collision Builder",
"48": "Horde Performance Report", "48": "Horde Performance Report",
"49": "test_weapons.gd",
"50": "GameConfig",
"51": "Co-op Send Path", "51": "Co-op Send Path",
"52": "Pause Menu Signals", "52": "Pause Menu Signals",
"53": "Tutorial",
"54": "GD-Sync Sync Icons", "54": "GD-Sync Sync Icons",
"55": "Pine & Foliage Textures", "55": "Pine & Foliage Textures",
"56": "Campaign Experience (Step 11)", "56": "Campaign Experience (Step 11)",
@ -72,6 +80,11 @@
"78": "Mushrooms Texture", "78": "Mushrooms Texture",
"79": "Project Icon", "79": "Project Icon",
"80": "Alien overhaul — task list", "80": "Alien overhaul — task list",
"81": "test_theft.gd",
"82": "explorer.md", "82": "explorer.md",
"83": "impl-worker.md" "83": "impl-worker.md",
"84": "equip",
"85": "stop",
"86": "MainMenu",
"87": "step"
} }

View file

@ -0,0 +1,77 @@
{
"0": "Campaign Controller & Farm State",
"1": "Structures & Build Mode",
"2": "Audio & Farmers Return Ending",
"3": "Scarecrow Weapons & Bombs",
"4": "Waves, Night Plans & Review",
"5": "First Game Plan & Milestones",
"6": "Horde Prototype (README)",
"7": "Co-op Lobby & Smoke Test",
"8": "Scarecrow Defender & Fear",
"9": "Loot & Theft Events",
"10": "Settings, Input & UI Theme",
"11": "Main Scene & Title Menu",
"12": "Farm Zones & Layout Tests",
"13": "Enemy System & Theft Tests",
"14": "Co-op Session Host/Client",
"15": "Rules of the Vacation",
"16": "Game Flow, Save & Pause",
"17": "Farm Navigation Flow Fields",
"18": "Resource Economy & Upgrades",
"19": "Animal System",
"20": "Test Runner & Farm Targets",
"21": "Co-op Docs & GD-Sync Link",
"22": "Enemy Roster & Construction Plan",
"23": "Playtest Notes & Scaling",
"24": "Farm Sim Setup Wiring",
"25": "Co-op Link Transport",
"26": "Thief Behavior AI",
"27": "Soak Night & Benchmarks",
"28": "Co-op Tests",
"29": "Player Character Movement",
"30": "Farm Layout Doc",
"31": "Co-op Voice Chat",
"32": "FarmSim Tick & Camera",
"33": "Interactions & Gathering",
"34": "Shed Stock & Supply Targets",
"36": "Farm Projectiles",
"37": "Alert Manager",
"38": "Net Budget Tool",
"39": "Enemy Roster Tests",
"40": "Co-op Menu UI",
"42": "Snapshot Decoding",
"43": "Enemy Characters & Hits",
"47": "Prop Collision Builder",
"48": "Horde Performance Report",
"51": "Co-op Send Path",
"52": "Pause Menu Signals",
"54": "GD-Sync Sync Icons",
"55": "Pine & Foliage Textures",
"56": "Campaign Experience (Step 11)",
"57": "Overview Render Tool",
"58": "Prototype Round Lifecycle",
"59": "Grid Design & Scope Limits",
"60": "GD-Sync Physics/Voice Icons",
"61": "AGENTS.md graphify Rules",
"62": "Bark Textures",
"63": "Leaf Cluster Textures",
"64": "Rock Textures",
"65": "opencode graphify Plugin",
"66": "GD-Sync Interest Icons",
"67": "Farm Pack Textures",
"68": "Mannequin Textures",
"69": "Bark Normal Maps",
"70": "Nature MegaKit License",
"71": "Benchmark Summarizer",
"72": "GD-Sync Logo",
"73": "GD-Sync Load Icon",
"74": "GD-Sync Instantiator Icon",
"75": "Twisted Bark Texture",
"76": "Flowers Texture",
"77": "Grass Texture",
"78": "Mushrooms Texture",
"79": "Project Icon",
"80": "Alien overhaul — task list",
"82": "explorer.md",
"83": "impl-worker.md"
}

View file

@ -0,0 +1,420 @@
# Graph Report - harvest-season (2026-10-06)
## Corpus Check
- 39 files · ~1,607,953 words
- Verdict: corpus is large enough that graph structure adds value.
## Summary
- 1365 nodes · 4087 edges · 75 communities (61 shown, 14 thin omitted)
- Extraction: 87% EXTRACTED · 13% INFERRED · 0% AMBIGUOUS · INFERRED: 542 edges (avg confidence: 0.91)
- Token cost: 0 input · 0 output
## Graph Freshness
- Built from commit: `eac2cb65`
- Run `git rev-parse HEAD` and compare to check if the graph is stale.
- Run `graphify update .` after code changes (no API cost).
## Community Hubs (Navigation)
- Campaign Controller & Farm State
- Structures & Build Mode
- Audio & Farmers Return Ending
- Scarecrow Weapons & Bombs
- Waves, Night Plans & Review
- First Game Plan & Milestones
- Horde Prototype (README)
- Co-op Lobby & Smoke Test
- Scarecrow Defender & Fear
- Loot & Theft Events
- Settings, Input & UI Theme
- Main Scene & Title Menu
- Farm Zones & Layout Tests
- Enemy System & Theft Tests
- Co-op Session Host/Client
- Rules of the Vacation
- Game Flow, Save & Pause
- Farm Navigation Flow Fields
- Resource Economy & Upgrades
- Animal System
- Test Runner & Farm Targets
- Co-op Docs & GD-Sync Link
- Enemy Roster & Construction Plan
- Playtest Notes & Scaling
- Farm Sim Setup Wiring
- Co-op Link Transport
- Thief Behavior AI
- Soak Night & Benchmarks
- Co-op Tests
- Player Character Movement
- Farm Layout Doc
- Co-op Voice Chat
- FarmSim Tick & Camera
- Interactions & Gathering
- Shed Stock & Supply Targets
- Farm Projectiles
- Alert Manager
- Net Budget Tool
- Enemy Roster Tests
- Co-op Menu UI
- Snapshot Decoding
- Enemy Characters & Hits
- Prop Collision Builder
- Horde Performance Report
- Co-op Send Path
- Pause Menu Signals
- GD-Sync Sync Icons
- Pine & Foliage Textures
- Campaign Experience (Step 11)
- Overview Render Tool
- Prototype Round Lifecycle
- Grid Design & Scope Limits
- GD-Sync Physics/Voice Icons
- AGENTS.md graphify Rules
- Bark Textures
- Leaf Cluster Textures
- Rock Textures
- opencode graphify Plugin
- GD-Sync Interest Icons
- Farm Pack Textures
- Mannequin Textures
- Bark Normal Maps
- Nature MegaKit License
- GD-Sync Logo
- GD-Sync Load Icon
- GD-Sync Instantiator Icon
- Twisted Bark Texture
- Flowers Texture
- Grass Texture
- Mushrooms Texture
- Project Icon
- Alien overhaul — task list
## God Nodes (most connected - your core abstractions)
1. `CampaignController` - 120 edges
2. `EnemySystem` - 109 edges
3. `StructureSystem` - 98 edges
4. `FarmSim` - 96 edges
5. `LootSystem` - 89 edges
6. `ScarecrowCombat` - 81 edges
7. `FarmState` - 76 edges
8. `PlayerCharacter` - 73 edges
9. `GameConfig` - 70 edges
10. `CoopSession` - 68 edges
## Surprising Connections (you probably didn't know these)
- `Scripted soak runs (soak_night.gd)` --semantically_similar_to--> `Stress presets (25/50 to 1,000/2,000 birds)` [INFERRED] [semantically similar]
first-game-plan.md → plan.md
- `Ground-bound birds (no flying navigation)` --semantically_similar_to--> `Gameplay is 2-D on the XZ plane` [INFERRED] [semantically similar]
plan.md → first-game-plan.md
- `Prototype scope boundaries` --semantically_similar_to--> `Deferred from version 1 (farming sim, multiplayer, tech trees)` [INFERRED] [semantically similar]
plan.md → first-game.md
- `PumpkinBomb_texture (11x11 Material-style color palette swatch grid for PumpkinBomb.glb)` --references--> `PumpkinBombs` [INFERRED]
assets/weapons/PumpkinBomb_texture.png → game/scripts/pumpkin_bombs.gd
- `PumpkinBomb_texture (11x11 Material-style color palette swatch grid for PumpkinBomb.glb)` --references--> `WeaponModels` [INFERRED]
assets/weapons/PumpkinBomb_texture.png → game/scripts/weapon_models.gd
## Import Cycles
- 3-file cycle: `game/scripts/enemy_system.gd -> game/scripts/structure_system.gd -> game/scripts/farm_projectiles.gd -> game/scripts/enemy_system.gd`
- 4-file cycle: `game/scripts/enemy_system.gd -> game/scripts/loot_system.gd -> game/scripts/structure_system.gd -> game/scripts/farm_projectiles.gd -> game/scripts/enemy_system.gd`
- 4-file cycle: `game/scripts/enemy_system.gd -> game/scripts/scarecrow.gd -> game/scripts/remote_controls.gd -> game/scripts/scarecrow_combat.gd -> game/scripts/enemy_system.gd`
- 5-file cycle: `game/scripts/enemy_characters.gd -> game/scripts/loot_system.gd -> game/scripts/structure_system.gd -> game/scripts/farm_projectiles.gd -> game/scripts/enemy_system.gd -> game/scripts/enemy_characters.gd`
- 5-file cycle: `game/scripts/enemy_characters.gd -> game/scripts/thief_behavior.gd -> game/scripts/structure_system.gd -> game/scripts/farm_projectiles.gd -> game/scripts/enemy_system.gd -> game/scripts/enemy_characters.gd`
- 5-file cycle: `game/scripts/enemy_system.gd -> game/scripts/scarecrow.gd -> game/scripts/remote_controls.gd -> game/scripts/scarecrow_combat.gd -> game/scripts/farm_projectiles.gd -> game/scripts/enemy_system.gd`
- 5-file cycle: `game/scripts/enemy_system.gd -> game/scripts/scarecrow.gd -> game/scripts/remote_controls.gd -> game/scripts/scarecrow_combat.gd -> game/scripts/pumpkin_bombs.gd -> game/scripts/enemy_system.gd`
- 5-file cycle: `game/scripts/enemy_system.gd -> game/scripts/scarecrow.gd -> game/scripts/thief_behavior.gd -> game/scripts/structure_system.gd -> game/scripts/farm_projectiles.gd -> game/scripts/enemy_system.gd`
## Hyperedges (group relationships)
- **Prototype classes forked or generalized into game/ systems** — readme_hordesystem, game_scripts_enemy_system, readme_chasebehavior, game_scripts_thief_behavior, readme_arenanavigation, game_scripts_farm_navigation, readme_roundcontroller, game_scripts_campaign_controller, readme_prototypeconfig, game_scripts_game_config [EXTRACTED 1.00]
- **First enemy roster: crow, ground thief, fence breaker** — first_game_plan_crow, first_game_plan_ground_thief, first_game_plan_fence_breaker, first_game_plan_enemy_type_table, game_scripts_enemy_system, game_scripts_thief_behavior, game_scripts_enemy_characters [EXTRACTED 1.00]
- **The four buildables run by StructureSystem** — first_game_plan_fence, first_game_plan_gate, first_game_plan_slowing_trap, first_game_plan_automated_defense, game_scripts_structure_system [EXTRACTED 1.00]
- **Synchronized node-type icons for GD-Sync** — addons__gd-sync__ui__icons__synchronizedanimatedsprite_synchronized_animated_sprite_icon, addons__gd-sync__ui__icons__synchronizedanimationplayer_synchronized_animation_player_icon, addons__gd-sync__ui__icons__synchronizedanimationtree_synchronized_animation_tree_icon, addons__gd-sync__ui__icons__synchronizedaudiostreamplayer_synchronized_audio_stream_player_icon [INFERRED 0.95]
- **Interest system icons (object and viewer)** — addons__gd-sync__ui__icons__interestobject_interest_object_icon, addons__gd-sync__ui__icons__interestviewer_interest_viewer_icon [INFERRED 0.90]
- **GD-Sync editor UI icons set** — addons__gd-sync__ui__configmenu__gdslogo_gds_logo, addons__gd-sync__ui__icons__loadicon_load_icon, addons__gd-sync__ui__icons__nodeinstantiator_node_instantiator_icon, addons__gd-sync__ui__icons__synchronizeicon_synchronize_icon [INFERRED 0.75]
- **GD-Sync UI icons** — addons__gd_sync__ui__icons__synchronizedgpuparticles_cloud_rain_icon, addons__gd_sync__ui__icons__synchronizedrigidbody3d_globe_icon, addons__gd_sync__ui__icons__voicechaticon_microphone_icon [INFERRED 0.95]
- **KayKit mannequin character textures** — assets__kaykit_characters__characters__mannequin_large_mannequin_texture_mannequin_texture, assets__kaykit_characters__characters__mannequin_medium_mannequin_texture_mannequin_texture [INFERRED 0.95]
- **Nature megakit bark textures** — assets__nature_megakit__bark_deadtree_bark_texture, assets__nature_megakit__bark_deadtree_normal_normal_map, assets__nature_megakit__bark_normaltree_bark_texture [INFERRED 0.95]
- **Nature megakit bark texture maps (diffuse and normal maps)** — assets__nature_megakit__bark_normaltree_normal_bark_normal_map, assets__nature_megakit__bark_twistedtree_twisted_tree_bark_diffuse, assets__nature_megakit__bark_twistedtree_normal_twisted_tree_bark_normal_map [EXTRACTED 1.00]
- **Nature megakit foliage and leaf sprite assets** — assets__nature_megakit__leaf_pine_white_pine_foliage_alpha, assets__nature_megakit__leaf_pine_c_green_pine_foliage_fill, assets__nature_megakit__leaves_leaf_sprite_sheet, assets__nature_megakit__leaves_giantpine_c_green_blob_foliage, assets__nature_megakit__leaves_normaltree_white_leaf_alpha_blobs [EXTRACTED 1.00]
- **Nature megakit flower and grass color assets** — assets__nature_megakit__flowers_flower_sprites, assets__nature_megakit__grass_grass_color_gradient_strips [INFERRED 0.65]
- **Nature MegaKit foliage/rock/mushroom texture set** — assets_nature_megakit_leaves_normaltree_c, assets_nature_megakit_leaves_twistedtree, assets_nature_megakit_leaves_twistedtree_c, assets_nature_megakit_mushrooms, assets_nature_megakit_pathrocks_diffuse, assets_nature_megakit_rocks_desert_diffuse, assets_nature_megakit_rocks_diffuse [INFERRED 0.95]
- **Enemy roster (crow, thief, fence breaker)** — game_rules_enemy_crow, game_rules_enemy_thief, game_rules_enemy_fence_breaker [EXTRACTED 1.00]
- **Co-op bandwidth minimization for GD-Sync's data allowance** — game_coop_packed_snapshots, game_coop_partner_input_record, game_coop_dead_reckoning, game_coop_zstd_compression, game_coop_voice_chat, game_coop_data_budget [EXTRACTED 1.00]
- **Scarecrow weapon kit (pitchfork, corn shooter, pumpkin bombs)** — game_rules_pitchfork, game_rules_corn_shooter, game_rules_pumpkin_bombs [EXTRACTED 1.00]
- **Co-op host/join flow: CoopMenu -> Main -> CoopLobby (GD-Sync) -> GDSyncLink -> CoopSession** — game_scripts_coop_menu, game_scripts_main, game_scripts_coop_lobby, addons_gd_sync_multiplayerclient, game_scripts_gdsync_link, game_scripts_coop_session, game_scripts_coop_voice [EXTRACTED 1.00]
- **Enemy dead-reckoning replication (host records on drift, partner extrapolates)** — game_scripts_coop_session_due_foes, game_scripts_coop_session_foe_changed, game_scripts_coop_session_enemy_bytes, game_scripts_coop_session_send_snapshot, game_scripts_coop_session_apply_snap, game_scripts_coop_session_apply_foes, game_scripts_coop_session_replica_tick, game_scripts_coop_session_remove_foe [INFERRED 0.95]
- **Packed binary co-op wire format (StreamPeerBuffer quantization helpers)** — game_scripts_coop_link_put_cm, game_scripts_coop_link_put_v3, game_scripts_coop_link_put_angle, game_scripts_coop_link_put_time, game_scripts_coop_link_put_text, game_scripts_coop_link_reader, game_scripts_coop_session_put_avatar, game_scripts_coop_session_read_avatar, game_scripts_remote_controls_sender_record, game_scripts_remote_controls_apply [INFERRED 0.95]
- **Weapons damaging enemies through EnemySystem.apply_hit** — game_scripts_scarecrow_combat_stab, game_scripts_farm_projectiles_resolve_segment, game_scripts_pumpkin_bombs_burst, game_scripts_enemy_system_apply_hit [EXTRACTED 1.00]
- **ThiefBehavior enemy AI state machine (SEEK/STEAL/CARRY/RETREAT/FLEE/BREAK/FIGHT)** — game_scripts_thief_behavior_update, game_scripts_thief_behavior_seek, game_scripts_thief_behavior_crow_seek, game_scripts_thief_behavior_breaker_seek, game_scripts_thief_behavior_steal, game_scripts_thief_behavior_carry, game_scripts_thief_behavior_fly_off, game_scripts_thief_behavior_leave, game_scripts_thief_behavior_flee, game_scripts_thief_behavior_break, game_scripts_thief_behavior_fight [EXTRACTED 1.00]
- **Per-tick enemy simulation pipeline (behavior, motion, melee, deferred removal, render)** — game_scripts_enemy_system_step, game_scripts_thief_behavior_update, game_scripts_enemy_system_evaluate_attacks, game_scripts_enemy_system_commit_removals, game_scripts_enemy_system_commit_render [INFERRED 0.85]
- **Morning reset: systems resync from FarmState** — game_scripts_farm_sim_on_phase_changed, game_scripts_loot_system_sync_from_state, game_scripts_animal_system_sync_from_state, game_scripts_structure_system_sync_from_state, game_scripts_shed_stock_refresh, game_scripts_interactions_cancel [EXTRACTED 1.00]
- **Co-op host->partner replica state transfer** — game_scripts_loot_system_replica_record, game_scripts_loot_system_apply_replica, game_scripts_animal_system_replica_record, game_scripts_animal_system_apply_replica, game_scripts_farm_sim_step_replica [INFERRED 0.85]
- **Why-not reason-string validators ("" = allowed)** — game_scripts_structure_system_validate, game_scripts_upgrades_blocker, game_scripts_interactions_blocker [INFERRED 0.75]
- **CampaignController.phase_changed listeners** — game_scripts_campaign_controller_phase_changed, game_scripts_farmers_return_setup, game_scripts_tutorial_setup, game_scripts_farm_audio_setup, game_scripts_end_panel_setup, game_scripts_review_panel_setup, game_scripts_phase_hud_setup [EXTRACTED 1.00]
- **Vacation-complete ending flow (outcome -> cutscene -> final assessment)** — game_scripts_campaign_controller_resolve, game_scripts_campaign_controller_campaign_ended, game_scripts_farmers_return_start, game_scripts_farmers_return_finished, game_scripts_end_panel_on_ended, game_scripts_end_panel_show_assessment, game_scripts_assessment_of [INFERRED 0.95]
- **Co-op partner actions forwarded to the host via Callables** — game_scripts_campaign_controller_begin_day, game_scripts_campaign_controller_retry_night, game_scripts_campaign_controller_start_night_early, game_scripts_upgrade_panel_buy, game_scripts_farm_audio_play, game_scripts_farm_audio_play_remote [INFERRED 0.85]
- **Farm-scene integration tests (farm.tscn loaded, FarmSim stepped by hand at 60 Hz, waves disabled)** — game_tests_test_cycle_run, game_tests_test_scarecrow_run, game_tests_test_structures_run, game_tests_test_targets_run, game_tests_test_theft_run, game_tests_test_weapons_run, game_scripts_farm_sim [EXTRACTED 1.00]
- **Retry restores the morning snapshot (CampaignController.retry_night)** — game_tests_test_cycle_retry, game_tests_test_theft_retry, game_tests_test_structures_persistence, game_tests_test_save_autosave, game_tests_test_targets_breach, game_tests_test_scarecrow_defeat, game_scripts_campaign_controller [INFERRED 0.85]
- **Game Over tie policy: scarecrow fall reported ahead of a stripped farm and ahead of completion** — game_tests_test_outcome_run, game_tests_test_outcome_final_dawn_tie, game_tests_test_scarecrow_defeat, game_tests_test_targets_stripped [INFERRED 0.85]
- **GameTestRunner shared check/fixture API used by every suite** — game_tests_run_tests_check, game_tests_run_tests_info, game_tests_run_tests_make_campaign, game_tests_run_tests_run_phase, game_tests_run_tests_run_until, game_tests_run_tests_lose_crops, game_tests_run_tests_edge, game_tests_run_tests_sky [EXTRACTED 1.00]
- **Retry restores the failed night's morning snapshot (verified across suites)** — game_tests_test_campaign_retry, game_tests_test_economy_deposit_and_night, game_tests_test_coop_fall_rule, game_tests_test_flow_failure, game_tests_test_nights_upgrades [INFERRED 0.85]
- **Suites that instantiate farm.tscn and step FarmSim by hand at 60 Hz** — game_tests_test_coop, game_tests_test_economy, game_tests_test_farm_layout, game_tests_test_nights, game_tests_test_roster [EXTRACTED 1.00]
## Communities (75 total, 14 thin omitted)
### Community 0 - "Campaign Controller & Farm State"
Cohesion: 0.05
Nodes (82): D2: Early campaign end (scarecrow death or farm stripped), Outcome evaluator check_outcome, Assessment, CampaignController, advance_phase(), begin_day(), campaign_ended (signal), can_start_night_early() (+74 more)
### Community 1 - "Structures & Build Mode"
Cohesion: 0.13
Nodes (32): StructureSystem, _add_view(), _build_view(), built (signal), damage(), destroyed (signal), dismantle(), hurt (signal) (+24 more)
### Community 2 - "Audio & Farmers Return Ending"
Cohesion: 0.09
Nodes (45): _on_ended(), FarmAudio, _free_voice(), _on_loot(), _on_phase(), _on_removed(), _physics_process(), play() (+37 more)
### Community 3 - "Scarecrow Weapons & Bombs"
Cohesion: 0.05
Nodes (73): Prototype Kit texture (8x8 RGB color palette swatch atlas for flat-shaded prototype pieces), PumpkinBomb_texture (11x11 Material-style color palette swatch grid for PumpkinBomb.glb), ActionEdges, note(), BuildHud, _process(), BuildMode, dismantled (signal) (+65 more)
### Community 4 - "Waves, Night Plans & Review"
Cohesion: 0.14
Nodes (29): NightPlan, count_scale_in(), problems(), scaled_count(), scaled_every(), spacing_scale_in(), total(), type_counts() (+21 more)
### Community 5 - "First Game Plan & Milestones"
Cohesion: 0.09
Nodes (35): First complete version — five-night vacation build steps, Harvest Season — first game development plan, D1: Starting the night early (allow_early_night, off by default), D3: Phase lengths, D4: Sunrise retreat and dawn grace, D5: Killing or fearing a carrier drops its loot, D6: Recovery rules (touch to recover; animals follow, max 3), D7: Scarecrow HP carries over between nights (+27 more)
### Community 6 - "Horde Prototype (README)"
Cohesion: 0.12
Nodes (35): D10: Ground enemies before Step 9, Crows on MultiMesh, ground enemies from a KayKit pool, One fixed-order simulation tick, Game code in game/, prototype/ frozen (fork rule), One GameConfig resource, Thief states ENTER / SEEK / STEAL / CARRY / ESCAPED, Horde survival prototype — coding-agent implementation plan, Centralized simulation with reusable storage (+27 more)
### Community 7 - "Co-op Lobby & Smoke Test"
Cohesion: 0.15
Nodes (34): CoopLobby, _begin(), failed (signal), has_online_keys(), host(), host_addresses(), join(), join_address() (+26 more)
### Community 8 - "Scarecrow Defender & Fear"
Cohesion: 0.06
Nodes (65): Fear ability (6 m burst, 2 s flee, 12 s cooldown), The scarecrow (player defender), Step 4: Establish the scarecrow's defensive tools, User feedback: "extraordinarily easy" → 30-day scale pass, 5x enemies scale pass (up to 160 enemies; FarmSim.step 0.45 ms avg), Day/night lighting and lantern, pressed(), DayNight (+57 more)
### Community 9 - "Loot & Theft Events"
Cohesion: 0.14
Nodes (28): place(), record_event(), LootSystem, animal_home(), animal_strays(), claim(), _claim_home(), drop() (+20 more)
### Community 10 - "Settings, Input & UI Theme"
Cohesion: 0.16
Nodes (19): _open_settings(), SettingsMenu, _apply_value(), _bindings(), changed (signal), close(), closed (signal), describe_keys() (+11 more)
### Community 11 - "Main Scene & Title Menu"
Cohesion: 0.13
Nodes (29): ended (signal), partner_left (signal), stop(), _ask_new_vacation(), continue_vacation(), _host_coop(), _leave_as_partner(), MainMenu (+21 more)
### Community 12 - "Farm Zones & Layout Tests"
Cohesion: 0.07
Nodes (74): Harvest Season — farm layout, Animal Pen zone, Crop Field zone, Crop units (30 row segments in 6 plots), The farm's edge (random enemy arrivals and carrier escapes), Farm zones (FarmZone rectangles under Zones/), Farmers' return route and staging points, Fence gaps (GapNorth, GapDriveway, GapEast) (+66 more)
### Community 13 - "Enemy System & Theft Tests"
Cohesion: 0.16
Nodes (23): clear(), release(), EnemySystem, apply_hit_handle(), clear(), commit_removals(), enemy_removed (signal), _load_types() (+15 more)
### Community 14 - "Co-op Session Host/Client"
Cohesion: 0.14
Nodes (33): reader(), send(), CoopSession, _apply_avatar(), _apply_event(), _apply_foes(), _apply_snap(), _apply_state() (+25 more)
### Community 15 - "Rules of the Vacation"
Cohesion: 0.05
Nodes (58): KayKit Character Animations license (CC0), KayKit: Character Animations 1.1 (Kay Lousberg), Prototype Kit license (CC0, Rgsdev), Prototype Kit (Raphael Gonçalves / Rgsdev), MultiMesh batching for birds and bullets, Simulation tick profile at 2,000 birds (steering, motion+collision, flow-field slice, grid), GDScript simulation is the bottleneck, not rendering, Co-op fall rule (out until morning; Game Over only when both are down) (+50 more)
### Community 16 - "Game Flow, Save & Pause"
Cohesion: 0.28
Nodes (17): ConfirmBox, close(), _yes(), Main, SaveGame, _audio(), _continue_and_new(), _coop_quit_to_menu() (+9 more)
### Community 17 - "Farm Navigation Flow Fields"
Cohesion: 0.07
Nodes (64): Alerts (labeled edge arrows, priority, grouping), AlertManager, _alert(), _arrow(), cap(), collect(), _draw(), _escalation() (+56 more)
### Community 18 - "Resource Economy & Upgrades"
Cohesion: 0.12
Nodes (20): Harvest Season — audio credits, Kenney Digital Audio pack, Kenney Impact Sounds pack, Kenney Interface Sounds pack, Kenney Music Jingles pack (pizzicato set), Kenney RPG Audio pack, Kenney UI Audio (UI SFX Set) pack, "On the Farm" (music track) (+12 more)
### Community 19 - "Animal System"
Cohesion: 0.17
Nodes (18): AnimalSystem, _apply_visuals(), _follow(), _move(), position(), _record_trail(), replica_record(), start_following() (+10 more)
### Community 20 - "Test Runner & Farm Targets"
Cohesion: 0.20
Nodes (10): PlayerCharacter, can_sprint(), die(), _follow_net(), _move_direction(), _physics_process(), reset_sprint(), revive() (+2 more)
### Community 21 - "Co-op Docs & GD-Sync Link"
Cohesion: 0.09
Nodes (27): Harvest Season — co-op, GD-Sync API keys (keys.cfg), GD-Sync data allowance budget (22 MB per vacation, ~12 KB/s), Unreliable message size limit (under 1,100 bytes; GD-Sync splits at 1,200), Dead reckoning for enemies (25 cm error threshold), Harvest Season patches to GD-Sync (4), Host-authoritative simulation with partner replica (FarmSim.replica), LAN join by address (+19 more)
### Community 22 - "Enemy Roster & Construction Plan"
Cohesion: 0.14
Nodes (19): Alert priorities, grouping, and cap, Automated defense (buildable), Crow (enemy), Enemy type table (GameConfig.enemy_types), Fence (buildable), Fence breaker (enemy), Flying rule (fences, gates, traps ignore flyers), Gameplay is 2-D on the XZ plane (+11 more)
### Community 23 - "Playtest Notes & Scaling"
Cohesion: 0.11
Nodes (30): enemies_line(), materials_line(), of(), _process(), show_assessment(), show_failure(), _totals_text(), PhaseHud (+22 more)
### Community 24 - "Farm Sim Setup Wiring"
Cohesion: 0.19
Nodes (13): find_animals(), pen_changed (signal), setup(), update_pen_open(), arrival_message(), _count_removal(), _on_night_ending(), _on_phase_changed() (+5 more)
### Community 25 - "Co-op Link Transport"
Cohesion: 0.13
Nodes (27): CoopLink, close(), _deliver(), get_angle(), get_cm(), get_text(), get_time(), get_v3() (+19 more)
### Community 26 - "Thief Behavior AI"
Cohesion: 0.22
Nodes (9): Farmers' return ending, Five-night farm vacation (core loop), Step 10: The five-night progression, Planned 30-night campaign, Wave count and spacing scaling, Step 10: Build the five-night progression, Night plans (NightPlan night_1..5), Scarecrow weapons: pitchfork, corn shooter, pumpkin bombs (+1 more)
### Community 27 - "Soak Night & Benchmarks"
Cohesion: 0.38
Nodes (12): _attack(), _build_tick(), _cycles(), _gather_day(), _gather_tick(), _guard(), _quit(), _run() (+4 more)
### Community 28 - "Co-op Tests"
Cohesion: 0.53
Nodes (6): GDSync (GD-Sync plugin autoload), net_receive(), start_voice(), GDSyncLink, _on_joined(), _on_partner_arrived()
### Community 29 - "Player Character Movement"
Cohesion: 0.17
Nodes (21): _process(), pay(), structure(), show_state(), _process(), describe(), pay(), _ground_y() (+13 more)
### Community 30 - "Farm Layout Doc"
Cohesion: 0.17
Nodes (15): Pen gate breach (gate as start structure), Supply bundles (sacks from the most-stocked material), Step 8: Expand to all three farm targets, Three farm targets: crops, animals, supplies, Shed stock piles (ShedStock), Supply Shed zone, Finding: a broken pen gate is the costliest event, Animals and the pen (open pen, loose animals, leading home) (+7 more)
### Community 31 - "Co-op Voice Chat"
Cohesion: 0.29
Nodes (11): CoopVoice, decode(), encode(), _encode_next(), feed(), _gate(), loud_parts(), make() (+3 more)
### Community 32 - "FarmSim Tick & Camera"
Cohesion: 0.10
Nodes (19): 1. With losses permanent, the density decides when the farm is empty, 2. Match the breakers to their pool, 3. Straw and Alien Goop pile up; wood runs out, Appendix: every night, per seed, Arrivals, the peak on the farm, and the tick, Character pools, Method, Not measured (+11 more)
### Community 33 - "Interactions & Gathering"
Cohesion: 0.50
Nodes (4): Farm occupancy grid with one flow field per goal set, Deferred from version 1 (farming sim, multiplayer, tech trees), Prototype scope boundaries, Shared octile flow field toward the player
### Community 34 - "Shed Stock & Supply Targets"
Cohesion: 0.29
Nodes (16): SKY, _crowd(), _enemies_match(), _fall_rule(), _join(), _leaving(), _night(), _partner_moves_and_gathers() (+8 more)
### Community 36 - "Farm Projectiles"
Cohesion: 0.17
Nodes (9): _release_slot(), sweep_hit(), FarmProjectiles, fire(), hit (signal), _release(), _resolve_segment(), step() (+1 more)
### Community 37 - "Alert Manager"
Cohesion: 0.23
Nodes (13): _breaker_goals(), _start_field_rebuild(), can_afford(), missing(), blocks(), corners(), _distance_to_outline(), footprint() (+5 more)
### Community 38 - "Net Budget Tool"
Cohesion: 0.31
Nodes (12): _kill_one(), MeterLink, _deliver(), _pump(), _report(), _run(), _setup(), WireModel (+4 more)
### Community 39 - "Enemy Roster Tests"
Cohesion: 0.15
Nodes (12): #23 [pop-ups] Remove the zone banner and the message feed, #24 [30] Nights by count, per-night enemy speed and HP, #25 [30] Arrivals wait for a free character, #26 [30] Upgrade tiers and timed shed stock, #27 [30] The thirty nights, #28 [30] Thirty-night soak, pool sizes, and a balance report, Decisions (the user's, 2026-10-06), Defaults (assumed; flip any of these on request) (+4 more)
### Community 40 - "Co-op Menu UI"
Cohesion: 0.38
Nodes (11): CoopMenu, back_requested (signal), host_requested (signal), join_address_requested (signal), join_requested (signal), open(), _ready(), search_requested (signal) (+3 more)
### Community 42 - "Snapshot Decoding"
Cohesion: 0.15
Nodes (12): Alien overhaul — follow-ups (outside docs/tasks.md scope), Crop fields (#13), Docs sweep after renames/rebalances, Housekeeping, Loose animals (#12), Playtest after #11 (player-built pen), Post-overhaul fix batch (#16–#22, 2026-10-06), Spec items from the review with no task (+4 more)
### Community 43 - "Enemy Characters & Hits"
Cohesion: 0.18
Nodes (16): EnemyCharacters, acquire(), _animate(), hit(), _process(), spawn(), visual_position(), EDGE (+8 more)
### Community 47 - "Prop Collision Builder"
Cohesion: 0.42
Nodes (8): _band_points(), _build(), _faces(), _fit(), _initialize(), _kind(), _process_prefab(), _restore_uids()
### Community 48 - "Horde Performance Report"
Cohesion: 0.13
Nodes (16): Performance report (prototype horde benchmarks), First shot / first hit stutter check (no first-use stutter), Largest tested passing population: 2,000 birds, 10-minute headless 1,000-bird recycle soak (flat memory), Start-up hitches (10–36 ms frames in the first second), Labeled stress benchmark presets (25–2,000 birds, compact/enlarged layouts), VSync-on ~1 s stalls (compositor throttling of hidden windows), run() (+8 more)
### Community 51 - "Co-op Send Path"
Cohesion: 0.29
Nodes (6): Decisions (resolved), Harvest Season — alien overhaul: review, decisions, and task plan, Headline finding from the review, Open assumptions (flagged, not yet confirmed), Suggested starting order, Task breakdown (mirrors Task tool `#1`–`#15`)
### Community 52 - "Pause Menu Signals"
Cohesion: 0.52
Nodes (7): PauseMenu, menu_requested (signal), quit_requested (signal), _ready(), restart_requested (signal), resume_requested (signal), settings_requested (signal)
### Community 54 - "GD-Sync Sync Icons"
Cohesion: 0.50
Nodes (5): Synchronized AnimatedSprite icon - neon yellow smiling square face with trailing frames, Synchronized AnimationPlayer icon - neon yellow film strip frame, Synchronized AnimationTree icon - neon yellow branching node tree diagram, Synchronized AudioStreamPlayer icon - neon yellow speaker with sound waves, Synchronize icon - neon yellow circular arrows refresh symbol
### Community 55 - "Pine & Foliage Textures"
Cohesion: 0.40
Nodes (5): Leaf_Pine_C solid dark-green pine foliage silhouette, Leaf_Pine white alpha silhouette of a pine foliage cluster, Leaves_GiantPine_C solid green rounded foliage blob shapes, Leaves sprite sheet with colorful painted leaf shapes, ferns, clovers, Leaves_NormalTree white alpha silhouettes of normal tree leaf clusters
### Community 56 - "Campaign Experience (Step 11)"
Cohesion: 0.22
Nodes (9): D9: Retry from the failed night's morning, One authoritative FarmState, Step 11: The complete campaign experience, Step 11: Add the complete campaign experience, Farm audio cues and buses (FarmAudio), Kenney CC0 audio packs, Morning autosave and save migration (SaveGame), Morning review and nightly results (+1 more)
### Community 57 - "Overview Render Tool"
Cohesion: 0.31
Nodes (10): start_channel(), stop_channel(), UpgradePanel, bought (signal), _buy(), close(), message (signal), open() (+2 more)
### Community 58 - "Prototype Round Lifecycle"
Cohesion: 0.27
Nodes (10): Menus, pause, and settings (user://settings.cfg), set_microphone(), GameSettings, apply(), load_from(), save_to(), _on_settings_changed(), pause() (+2 more)
### Community 59 - "Grid Design & Scope Limits"
Cohesion: 0.19
Nodes (17): AssetHud, GameTestRunner, _initialize(), _main(), _animal_theft(), _breach(), _bundle_limits(), _fallback() (+9 more)
### Community 60 - "GD-Sync Physics/Voice Icons"
Cohesion: 0.67
Nodes (3): SynchronizedGPUParticles icon (lime cloud with rain drops), SynchronizedRigidBody3D icon (lime globe), VoiceChatIcon (lime microphone)
### Community 61 - "AGENTS.md graphify Rules"
Cohesion: 0.67
Nodes (3): AGENTS.md — graphify rules for agents, Query the graph first (graphify query / path / explain), Run graphify update after code changes
### Community 62 - "Bark Textures"
Cohesion: 0.67
Nodes (3): Bark_DeadTree gray dead-tree bark diffuse texture, Bark_DeadTree_Normal purple normal map, Bark_NormalTree brown tree bark texture
### Community 63 - "Leaf Cluster Textures"
Cohesion: 0.67
Nodes (3): Leaves_NormalTree_C (green leaf-cluster alpha card texture, CommonTree_1-5 / Bush_Common_Flowers), Leaves_TwistedTree (untinted white leaf alpha mask, unreferenced by any gltf), Leaves_TwistedTree_C (red/autumn blob-leaf alpha card texture, TwistedTree_1-5 / Bush_Common)
### Community 64 - "Rock Textures"
Cohesion: 0.67
Nodes (3): PathRocks_Diffuse (mossy grey stepping-stone UV atlas diffuse, Pebble_* / RockPath_* models), Rocks_Desert_Diffuse (sandstone/ochre recolor of rock UV atlas, 2048px, unreferenced by any gltf), Rocks_Diffuse (mossy grey-green rock UV atlas diffuse, 2048px, Rock_Medium_1-3)
### Community 80 - "Alien overhaul — task list"
Cohesion: 0.18
Nodes (10): Alien overhaul — task list, Dependent, Independent, Post-overhaul fix batch (2026-10-06), Thirty nights — task list (2026-10-06), Wave 1, Wave 1, Wave 2 (+2 more)
## Ambiguous Edges - Review These
- `KayKit Rig_Medium animation libraries (CombatMelee, CombatRanged, General, Movement, Simulation, Special, Tools)` → `Final assessment (weighted share kept, 0–100 points, ratings)` [AMBIGUOUS]
game/RULES.md · relation: conceptually_related_to
## Knowledge Gaps
- **102 isolated node(s):** `Headline finding from the review`, `Decisions (resolved)`, `Open assumptions (flagged, not yet confirmed)`, `Task breakdown (mirrors Task tool `#1`–`#15`)`, `Suggested starting order` (+97 more)
These have ≤1 connection - possible missing edges or undocumented components.
- **14 thin communities (<3 nodes) omitted from report** — run `graphify query` to explore isolated nodes.
## Suggested Questions
_Questions this graph is uniquely positioned to answer:_
- **What is the exact relationship between `KayKit Rig_Medium animation libraries (CombatMelee, CombatRanged, General, Movement, Simulation, Special, Tools)` and `Final assessment (weighted share kept, 0–100 points, ratings)`?**
_Edge tagged AMBIGUOUS (relation: conceptually_related_to) - confidence is low._
- **Why does `CoopSession` connect `Co-op Session Host/Client` to `Campaign Controller & Farm State`, `Structures & Build Mode`, `Shed Stock & Supply Targets`, `Scarecrow Weapons & Bombs`, `Net Budget Tool`, `Co-op Lobby & Smoke Test`, `Scarecrow Defender & Fear`, `Main Scene & Title Menu`, `Farm Zones & Layout Tests`, `Enemy System & Theft Tests`, `Game Flow, Save & Pause`, `Co-op Docs & GD-Sync Link`, `Co-op Link Transport`, `Prototype Round Lifecycle`, `Co-op Tests`, `Player Character Movement`, `Co-op Voice Chat`?**
_High betweenness centrality (0.116) - this node is a cross-community bridge._
- **Why does `CampaignController` connect `Campaign Controller & Farm State` to `Structures & Build Mode`, `Audio & Farmers Return Ending`, `Scarecrow Weapons & Bombs`, `Waves, Night Plans & Review`, `First Game Plan & Milestones`, `Horde Prototype (README)`, `Co-op Lobby & Smoke Test`, `Scarecrow Defender & Fear`, `Loot & Theft Events`, `Farm Zones & Layout Tests`, `Enemy System & Theft Tests`, `Co-op Session Host/Client`, `Rules of the Vacation`, `Game Flow, Save & Pause`, `Farm Navigation Flow Fields`, `Animal System`, `Test Runner & Farm Targets`, `Playtest Notes & Scaling`, `Farm Sim Setup Wiring`, `Soak Night & Benchmarks`, `Player Character Movement`, `Farm Layout Doc`, `Shed Stock & Supply Targets`, `Alert Manager`, `Net Budget Tool`, `Enemy Characters & Hits`, `Pause Menu Signals`, `Overview Render Tool`, `Grid Design & Scope Limits`?**
_High betweenness centrality (0.113) - this node is a cross-community bridge._
- **Why does `FarmSim` connect `Scarecrow Defender & Fear` to `Campaign Controller & Farm State`, `Structures & Build Mode`, `Audio & Farmers Return Ending`, `Scarecrow Weapons & Bombs`, `Waves, Night Plans & Review`, `Horde Prototype (README)`, `Loot & Theft Events`, `Farm Zones & Layout Tests`, `Enemy System & Theft Tests`, `Co-op Session Host/Client`, `Rules of the Vacation`, `Game Flow, Save & Pause`, `Farm Navigation Flow Fields`, `Animal System`, `Test Runner & Farm Targets`, `Co-op Docs & GD-Sync Link`, `Playtest Notes & Scaling`, `Farm Sim Setup Wiring`, `Soak Night & Benchmarks`, `Farm Layout Doc`, `Shed Stock & Supply Targets`, `Farm Projectiles`, `Alert Manager`, `Net Budget Tool`, `Enemy Characters & Hits`, `Overview Render Tool`, `Grid Design & Scope Limits`?**
_High betweenness centrality (0.112) - this node is a cross-community bridge._
- **Are the 12 inferred relationships involving `CampaignController` (e.g. with `Outcome evaluator check_outcome` and `_night_log()`) actually correct?**
_`CampaignController` has 12 INFERRED edges - model-reasoned connections that need verification._
- **Are the 13 inferred relationships involving `EnemySystem` (e.g. with `AlertManager` and `_describe()`) actually correct?**
_`EnemySystem` has 13 INFERRED edges - model-reasoned connections that need verification._
- **Are the 36 inferred relationships involving `StructureSystem` (e.g. with `Automated defense (buildable)` and `Fence (buildable)`) actually correct?**
_`StructureSystem` has 36 INFERRED edges - model-reasoned connections that need verification._

View file

@ -0,0 +1,12 @@
{
"runs": [
{
"date": "2026-10-04T23:31:40.808114+00:00",
"input_tokens": 1119866,
"output_tokens": 0,
"files": 193
}
],
"total_input_tokens": 1119866,
"total_output_tokens": 0
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,16 +1,16 @@
# Graph Report - harvest-season (2026-10-06) # Graph Report - harvest-season (2026-10-07)
## Corpus Check ## Corpus Check
- 39 files · ~1,607,953 words - 39 files · ~1,634,481 words
- Verdict: corpus is large enough that graph structure adds value. - Verdict: corpus is large enough that graph structure adds value.
## Summary ## Summary
- 1365 nodes · 4087 edges · 75 communities (61 shown, 14 thin omitted) - 1361 nodes · 4076 edges · 88 communities (74 shown, 14 thin omitted)
- Extraction: 87% EXTRACTED · 13% INFERRED · 0% AMBIGUOUS · INFERRED: 542 edges (avg confidence: 0.91) - Extraction: 87% EXTRACTED · 13% INFERRED · 0% AMBIGUOUS · INFERRED: 542 edges (avg confidence: 0.91)
- Token cost: 0 input · 0 output - Token cost: 0 input · 0 output
## Graph Freshness ## Graph Freshness
- Built from commit: `eac2cb65` - Built from commit: `87b5c11f`
- Run `git rev-parse HEAD` and compare to check if the graph is stale. - Run `git rev-parse HEAD` and compare to check if the graph is stale.
- Run `graphify update .` after code changes (no API cost). - Run `graphify update .` after code changes (no API cost).
@ -50,17 +50,25 @@
- FarmSim Tick & Camera - FarmSim Tick & Camera
- Interactions & Gathering - Interactions & Gathering
- Shed Stock & Supply Targets - Shed Stock & Supply Targets
- ResourceStore
- Farm Projectiles - Farm Projectiles
- Alert Manager - Alert Manager
- Net Budget Tool - Net Budget Tool
- Enemy Roster Tests - Enemy Roster Tests
- Co-op Menu UI - Co-op Menu UI
- Harvest Season — co-op
- Snapshot Decoding - Snapshot Decoding
- Enemy Characters & Hits - Enemy Characters & Hits
- send
- Interactions
- Upgrades
- Prop Collision Builder - Prop Collision Builder
- Horde Performance Report - Horde Performance Report
- test_weapons.gd
- GameConfig
- Co-op Send Path - Co-op Send Path
- Pause Menu Signals - Pause Menu Signals
- Tutorial
- GD-Sync Sync Icons - GD-Sync Sync Icons
- Pine & Foliage Textures - Pine & Foliage Textures
- Campaign Experience (Step 11) - Campaign Experience (Step 11)
@ -87,13 +95,18 @@
- Mushrooms Texture - Mushrooms Texture
- Project Icon - Project Icon
- Alien overhaul — task list - Alien overhaul — task list
- test_theft.gd
- equip
- stop
- MainMenu
- step
## God Nodes (most connected - your core abstractions) ## God Nodes (most connected - your core abstractions)
1. `CampaignController` - 120 edges 1. `CampaignController` - 119 edges
2. `EnemySystem` - 109 edges 2. `EnemySystem` - 109 edges
3. `StructureSystem` - 98 edges 3. `StructureSystem` - 98 edges
4. `FarmSim` - 96 edges 4. `FarmSim` - 95 edges
5. `LootSystem` - 89 edges 5. `LootSystem` - 88 edges
6. `ScarecrowCombat` - 81 edges 6. `ScarecrowCombat` - 81 edges
7. `FarmState` - 76 edges 7. `FarmState` - 76 edges
8. `PlayerCharacter` - 73 edges 8. `PlayerCharacter` - 73 edges
@ -103,14 +116,14 @@
## Surprising Connections (you probably didn't know these) ## Surprising Connections (you probably didn't know these)
- `Scripted soak runs (soak_night.gd)` --semantically_similar_to--> `Stress presets (25/50 to 1,000/2,000 birds)` [INFERRED] [semantically similar] - `Scripted soak runs (soak_night.gd)` --semantically_similar_to--> `Stress presets (25/50 to 1,000/2,000 birds)` [INFERRED] [semantically similar]
first-game-plan.md → plan.md first-game-plan.md → plan.md
- `PumpkinBomb_texture (11x11 Material-style color palette swatch grid for PumpkinBomb.glb)` --references--> `WeaponModels` [INFERRED]
assets/weapons/PumpkinBomb_texture.png → game/scripts/weapon_models.gd
- `Ground-bound birds (no flying navigation)` --semantically_similar_to--> `Gameplay is 2-D on the XZ plane` [INFERRED] [semantically similar] - `Ground-bound birds (no flying navigation)` --semantically_similar_to--> `Gameplay is 2-D on the XZ plane` [INFERRED] [semantically similar]
plan.md → first-game-plan.md plan.md → first-game-plan.md
- `Prototype scope boundaries` --semantically_similar_to--> `Deferred from version 1 (farming sim, multiplayer, tech trees)` [INFERRED] [semantically similar] - `Prototype scope boundaries` --semantically_similar_to--> `Deferred from version 1 (farming sim, multiplayer, tech trees)` [INFERRED] [semantically similar]
plan.md → first-game.md plan.md → first-game.md
- `PumpkinBomb_texture (11x11 Material-style color palette swatch grid for PumpkinBomb.glb)` --references--> `PumpkinBombs` [INFERRED] - `PumpkinBomb_texture (11x11 Material-style color palette swatch grid for PumpkinBomb.glb)` --references--> `PumpkinBombs` [INFERRED]
assets/weapons/PumpkinBomb_texture.png → game/scripts/pumpkin_bombs.gd assets/weapons/PumpkinBomb_texture.png → game/scripts/pumpkin_bombs.gd
- `PumpkinBomb_texture (11x11 Material-style color palette swatch grid for PumpkinBomb.glb)` --references--> `WeaponModels` [INFERRED]
assets/weapons/PumpkinBomb_texture.png → game/scripts/weapon_models.gd
## Import Cycles ## Import Cycles
- 3-file cycle: `game/scripts/enemy_system.gd -> game/scripts/structure_system.gd -> game/scripts/farm_projectiles.gd -> game/scripts/enemy_system.gd` - 3-file cycle: `game/scripts/enemy_system.gd -> game/scripts/structure_system.gd -> game/scripts/farm_projectiles.gd -> game/scripts/enemy_system.gd`
@ -158,131 +171,131 @@
- **Retry restores the failed night's morning snapshot (verified across suites)** — game_tests_test_campaign_retry, game_tests_test_economy_deposit_and_night, game_tests_test_coop_fall_rule, game_tests_test_flow_failure, game_tests_test_nights_upgrades [INFERRED 0.85] - **Retry restores the failed night's morning snapshot (verified across suites)** — game_tests_test_campaign_retry, game_tests_test_economy_deposit_and_night, game_tests_test_coop_fall_rule, game_tests_test_flow_failure, game_tests_test_nights_upgrades [INFERRED 0.85]
- **Suites that instantiate farm.tscn and step FarmSim by hand at 60 Hz** — game_tests_test_coop, game_tests_test_economy, game_tests_test_farm_layout, game_tests_test_nights, game_tests_test_roster [EXTRACTED 1.00] - **Suites that instantiate farm.tscn and step FarmSim by hand at 60 Hz** — game_tests_test_coop, game_tests_test_economy, game_tests_test_farm_layout, game_tests_test_nights, game_tests_test_roster [EXTRACTED 1.00]
## Communities (75 total, 14 thin omitted) ## Communities (88 total, 14 thin omitted)
### Community 0 - "Campaign Controller & Farm State" ### Community 0 - "Campaign Controller & Farm State"
Cohesion: 0.05 Cohesion: 0.13
Nodes (82): D2: Early campaign end (scarecrow death or farm stripped), Outcome evaluator check_outcome, Assessment, CampaignController, advance_phase(), begin_day(), campaign_ended (signal), can_start_night_early() (+74 more) Nodes (28): CampaignController, advance_phase(), begin_day(), can_start_night_early(), check_outcome(), _enter(), is_over(), is_timed() (+20 more)
### Community 1 - "Structures & Build Mode" ### Community 1 - "Structures & Build Mode"
Cohesion: 0.13 Cohesion: 0.15
Nodes (32): StructureSystem, _add_view(), _build_view(), built (signal), damage(), destroyed (signal), dismantle(), hurt (signal) (+24 more) Nodes (28): StructureSystem, _add_view(), _build_view(), damage(), destroyed (signal), _ground_y(), hurt (signal), make_ghost() (+20 more)
### Community 2 - "Audio & Farmers Return Ending" ### Community 2 - "Audio & Farmers Return Ending"
Cohesion: 0.09 Cohesion: 0.07
Nodes (45): _on_ended(), FarmAudio, _free_voice(), _on_loot(), _on_phase(), _on_removed(), _physics_process(), play() (+37 more) Nodes (45): Harvest Season — audio credits, Kenney Digital Audio pack, Kenney Impact Sounds pack, Kenney Interface Sounds pack, Kenney Music Jingles pack (pizzicato set), Kenney RPG Audio pack, Kenney UI Audio (UI SFX Set) pack, "On the Farm" (music track) (+37 more)
### Community 3 - "Scarecrow Weapons & Bombs" ### Community 3 - "Scarecrow Weapons & Bombs"
Cohesion: 0.05 Cohesion: 0.15
Nodes (73): Prototype Kit texture (8x8 RGB color palette swatch atlas for flat-shaded prototype pieces), PumpkinBomb_texture (11x11 Material-style color palette swatch grid for PumpkinBomb.glb), ActionEdges, note(), BuildHud, _process(), BuildMode, dismantled (signal) (+65 more) Nodes (25): ScarecrowCombat, _aim_at(), attack(), attack_toward(), attacked (signal), _clear_line(), fired (signal), interval_ticks() (+17 more)
### Community 4 - "Waves, Night Plans & Review" ### Community 4 - "Waves, Night Plans & Review"
Cohesion: 0.14 Cohesion: 0.07
Nodes (29): NightPlan, count_scale_in(), problems(), scaled_count(), scaled_every(), spacing_scale_in(), total(), type_counts() (+21 more) Nodes (59): Wave count and spacing scaling, User feedback: "extraordinarily easy" → 30-day scale pass, 5x enemies scale pass (up to 160 enemies; FarmSim.step 0.45 ms avg), Dusk warning (banner, hint, phase HUD list), Night plans (NightPlan groups: time, count, spacing, type, target), enemies_line(), materials_line(), show_failure() (+51 more)
### Community 5 - "First Game Plan & Milestones" ### Community 5 - "First Game Plan & Milestones"
Cohesion: 0.09 Cohesion: 0.09
Nodes (35): First complete version — five-night vacation build steps, Harvest Season — first game development plan, D1: Starting the night early (allow_early_night, off by default), D3: Phase lengths, D4: Sunrise retreat and dawn grace, D5: Killing or fearing a carrier drops its loot, D6: Recovery rules (touch to recover; animals follow, max 3), D7: Scarecrow HP carries over between nights (+27 more) Nodes (34): Harvest Season — first game development plan, D10: Ground enemies before Step 9, D2: Early campaign end (scarecrow death or farm stripped), D3: Phase lengths, D4: Sunrise retreat and dawn grace, D5: Killing or fearing a carrier drops its loot, D6: Recovery rules (touch to recover; animals follow, max 3), D7: Scarecrow HP carries over between nights (+26 more)
### Community 6 - "Horde Prototype (README)" ### Community 6 - "Horde Prototype (README)"
Cohesion: 0.12 Cohesion: 0.14
Nodes (35): D10: Ground enemies before Step 9, Crows on MultiMesh, ground enemies from a KayKit pool, One fixed-order simulation tick, Game code in game/, prototype/ frozen (fork rule), One GameConfig resource, Thief states ENTER / SEEK / STEAL / CARRY / ESCAPED, Horde survival prototype — coding-agent implementation plan, Centralized simulation with reusable storage (+27 more) Nodes (32): Crows on MultiMesh, ground enemies from a KayKit pool, One fixed-order simulation tick, Game code in game/, prototype/ frozen (fork rule), One GameConfig resource, Horde survival prototype — coding-agent implementation plan, Centralized simulation with reusable storage, Prototype implementation milestones and gates, Pool reuse rules (no hot-path allocation) (+24 more)
### Community 7 - "Co-op Lobby & Smoke Test" ### Community 7 - "Co-op Lobby & Smoke Test"
Cohesion: 0.15 Cohesion: 0.15
Nodes (34): CoopLobby, _begin(), failed (signal), has_online_keys(), host(), host_addresses(), join(), join_address() (+26 more) Nodes (34): CoopLobby, _begin(), failed (signal), has_online_keys(), host(), host_addresses(), join(), join_address() (+26 more)
### Community 8 - "Scarecrow Defender & Fear" ### Community 8 - "Scarecrow Defender & Fear"
Cohesion: 0.06 Cohesion: 0.07
Nodes (65): Fear ability (6 m burst, 2 s flee, 12 s cooldown), The scarecrow (player defender), Step 4: Establish the scarecrow's defensive tools, User feedback: "extraordinarily easy" → 30-day scale pass, 5x enemies scale pass (up to 160 enemies; FarmSim.step 0.45 ms avg), Day/night lighting and lantern, pressed(), DayNight (+57 more) Nodes (53): Fear ability (6 m burst, 2 s flee, 12 s cooldown), The scarecrow (player defender), Step 4: Establish the scarecrow's defensive tools, pressed(), add_partner(), set_local(), FollowCamera, _apply() (+45 more)
### Community 9 - "Loot & Theft Events" ### Community 9 - "Loot & Theft Events"
Cohesion: 0.14 Cohesion: 0.16
Nodes (28): place(), record_event(), LootSystem, animal_home(), animal_strays(), claim(), _claim_home(), drop() (+20 more) Nodes (25): place(), record_event(), LootSystem, animal_home(), animal_strays(), claim(), drop(), _empty_sack() (+17 more)
### Community 10 - "Settings, Input & UI Theme" ### Community 10 - "Settings, Input & UI Theme"
Cohesion: 0.16 Cohesion: 0.12
Nodes (19): _open_settings(), SettingsMenu, _apply_value(), _bindings(), changed (signal), close(), closed (signal), describe_keys() (+11 more) Nodes (26): Menus, pause, and settings (user://settings.cfg), GameSettings, apply(), load_from(), save_to(), _on_settings_changed(), _open_settings(), _remember_name() (+18 more)
### Community 11 - "Main Scene & Title Menu" ### Community 11 - "Main Scene & Title Menu"
Cohesion: 0.13 Cohesion: 0.33
Nodes (29): ended (signal), partner_left (signal), stop(), _ask_new_vacation(), continue_vacation(), _host_coop(), _leave_as_partner(), MainMenu (+21 more) Nodes (9): _ask_new_vacation(), continue_vacation(), _host_coop(), open(), new_vacation(), show_main_menu(), Loaded, read() (+1 more)
### Community 12 - "Farm Zones & Layout Tests" ### Community 12 - "Farm Zones & Layout Tests"
Cohesion: 0.07 Cohesion: 0.07
Nodes (74): Harvest Season — farm layout, Animal Pen zone, Crop Field zone, Crop units (30 row segments in 6 plots), The farm's edge (random enemy arrivals and carrier escapes), Farm zones (FarmZone rectangles under Zones/), Farmers' return route and staging points, Fence gaps (GapNorth, GapDriveway, GapEast) (+66 more) Nodes (60): Harvest Season — farm layout, Crop Field zone, Crop units (30 row segments in 6 plots), The farm's edge (random enemy arrivals and carrier escapes), Farm zones (FarmZone rectangles under Zones/), Farmers' return route and staging points, Fence gaps (GapNorth, GapDriveway, GapEast), Gather points (GatherNode) (+52 more)
### Community 13 - "Enemy System & Theft Tests" ### Community 13 - "Enemy System & Theft Tests"
Cohesion: 0.16 Cohesion: 0.17
Nodes (23): clear(), release(), EnemySystem, apply_hit_handle(), clear(), commit_removals(), enemy_removed (signal), _load_types() (+15 more) Nodes (14): clear(), release(), EnemySystem, apply_hit_handle(), clear(), commit_removals(), enemy_removed (signal), _load_types() (+6 more)
### Community 14 - "Co-op Session Host/Client" ### Community 14 - "Co-op Session Host/Client"
Cohesion: 0.14 Cohesion: 0.17
Nodes (33): reader(), send(), CoopSession, _apply_avatar(), _apply_event(), _apply_foes(), _apply_snap(), _apply_state() (+25 more) Nodes (26): reader(), CoopSession, _apply_avatar(), _apply_event(), _apply_foes(), _apply_snap(), _apply_state(), _client_message() (+18 more)
### Community 15 - "Rules of the Vacation" ### Community 15 - "Rules of the Vacation"
Cohesion: 0.05 Cohesion: 0.05
Nodes (58): KayKit Character Animations license (CC0), KayKit: Character Animations 1.1 (Kay Lousberg), Prototype Kit license (CC0, Rgsdev), Prototype Kit (Raphael Gonçalves / Rgsdev), MultiMesh batching for birds and bullets, Simulation tick profile at 2,000 birds (steering, motion+collision, flow-field slice, grid), GDScript simulation is the bottleneck, not rendering, Co-op fall rule (out until morning; Game Over only when both are down) (+50 more) Nodes (54): KayKit Character Animations license (CC0), KayKit: Character Animations 1.1 (Kay Lousberg), Prototype Kit license (CC0, Rgsdev), Prototype Kit (Raphael Gonçalves / Rgsdev), MultiMesh batching for birds and bullets, Simulation tick profile at 2,000 birds (steering, motion+collision, flow-field slice, grid), GDScript simulation is the bottleneck, not rendering, Co-op fall rule (out until morning; Game Over only when both are down) (+46 more)
### Community 16 - "Game Flow, Save & Pause" ### Community 16 - "Game Flow, Save & Pause"
Cohesion: 0.28 Cohesion: 0.31
Nodes (17): ConfirmBox, close(), _yes(), Main, SaveGame, _audio(), _continue_and_new(), _coop_quit_to_menu() (+9 more) Nodes (18): ConfirmBox, close(), _yes(), Main, SaveGame, check(), _audio(), _continue_and_new() (+10 more)
### Community 17 - "Farm Navigation Flow Fields" ### Community 17 - "Farm Navigation Flow Fields"
Cohesion: 0.07 Cohesion: 0.07
Nodes (64): Alerts (labeled edge arrows, priority, grouping), AlertManager, _alert(), _arrow(), cap(), collect(), _draw(), _escalation() (+56 more) Nodes (64): Alerts (labeled edge arrows, priority, grouping), AlertManager, _alert(), _arrow(), cap(), collect(), _draw(), _escalation() (+56 more)
### Community 18 - "Resource Economy & Upgrades" ### Community 18 - "Resource Economy & Upgrades"
Cohesion: 0.12 Cohesion: 0.13
Nodes (20): Harvest Season — audio credits, Kenney Digital Audio pack, Kenney Impact Sounds pack, Kenney Interface Sounds pack, Kenney Music Jingles pack (pizzicato set), Kenney RPG Audio pack, Kenney UI Audio (UI SFX Set) pack, "On the Farm" (music track) (+12 more) Nodes (22): Ground thief (enemy), Day/night lighting and lantern, DayNight, add_lantern(), _apply(), _mix(), _process(), setup() (+14 more)
### Community 19 - "Animal System" ### Community 19 - "Animal System"
Cohesion: 0.17 Cohesion: 0.13
Nodes (18): AnimalSystem, _apply_visuals(), _follow(), _move(), position(), _record_trail(), replica_record(), start_following() (+10 more) Nodes (22): Animal Pen zone, Finding: a broken pen gate is the costliest event, Animals and the pen (open pen, loose animals, leading home), Thief (enemy type), AnimalSystem, _apply_visuals(), _follow(), _move() (+14 more)
### Community 20 - "Test Runner & Farm Targets" ### Community 20 - "Test Runner & Farm Targets"
Cohesion: 0.20 Cohesion: 0.16
Nodes (10): PlayerCharacter, can_sprint(), die(), _follow_net(), _move_direction(), _physics_process(), reset_sprint(), revive() (+2 more) Nodes (16): ActionEdges, note(), BuildHud, _process(), BuildMode, dismantled (signal), message (signal), refused (signal) (+8 more)
### Community 21 - "Co-op Docs & GD-Sync Link" ### Community 21 - "Co-op Docs & GD-Sync Link"
Cohesion: 0.09 Cohesion: 0.15
Nodes (27): Harvest Season — co-op, GD-Sync API keys (keys.cfg), GD-Sync data allowance budget (22 MB per vacation, ~12 KB/s), Unreliable message size limit (under 1,100 bytes; GD-Sync splits at 1,200), Dead reckoning for enemies (25 cm error threshold), Harvest Season patches to GD-Sync (4), Host-authoritative simulation with partner replica (FarmSim.replica), LAN join by address (+19 more) Nodes (13): Host-authoritative simulation with partner replica (FarmSim.replica), Partner panel, name tags, and edge arrow, Avatar, CoopHud, _draw(), _measure_ping(), _process(), setup() (+5 more)
### Community 22 - "Enemy Roster & Construction Plan" ### Community 22 - "Enemy Roster & Construction Plan"
Cohesion: 0.14 Cohesion: 0.15
Nodes (19): Alert priorities, grouping, and cap, Automated defense (buildable), Crow (enemy), Enemy type table (GameConfig.enemy_types), Fence (buildable), Fence breaker (enemy), Flying rule (fences, gates, traps ignore flyers), Gameplay is 2-D on the XZ plane (+11 more) Nodes (17): Alert priorities, grouping, and cap, Automated defense (buildable), Crow (enemy), Enemy type table (GameConfig.enemy_types), Fence (buildable), Fence breaker (enemy), Flying rule (fences, gates, traps ignore flyers), Gameplay is 2-D on the XZ plane (+9 more)
### Community 23 - "Playtest Notes & Scaling" ### Community 23 - "Playtest Notes & Scaling"
Cohesion: 0.11 Cohesion: 0.19
Nodes (30): enemies_line(), materials_line(), of(), _process(), show_assessment(), show_failure(), _totals_text(), PhaseHud (+22 more) Nodes (13): of(), campaign_ended (signal), new_campaign(), EndPanel, hide_panel(), menu_requested (signal), _on_ended(), _process() (+5 more)
### Community 24 - "Farm Sim Setup Wiring" ### Community 24 - "Farm Sim Setup Wiring"
Cohesion: 0.19 Cohesion: 0.26
Nodes (13): find_animals(), pen_changed (signal), setup(), update_pen_open(), arrival_message(), _count_removal(), _on_night_ending(), _on_phase_changed() (+5 more) Nodes (17): stream_of(), FarmersReturn, _build_overlay(), clear(), _finish(), finished (signal), _follow_camera(), _frame_yard() (+9 more)
### Community 25 - "Co-op Link Transport" ### Community 25 - "Co-op Link Transport"
Cohesion: 0.13 Cohesion: 0.16
Nodes (27): CoopLink, close(), _deliver(), get_angle(), get_cm(), get_text(), get_time(), get_v3() (+19 more) Nodes (20): CoopLink, close(), _deliver(), get_angle(), get_cm(), get_text(), get_time(), get_v3() (+12 more)
### Community 26 - "Thief Behavior AI" ### Community 26 - "Thief Behavior AI"
Cohesion: 0.22 Cohesion: 0.11
Nodes (9): Farmers' return ending, Five-night farm vacation (core loop), Step 10: The five-night progression, Planned 30-night campaign, Wave count and spacing scaling, Step 10: Build the five-night progression, Night plans (NightPlan night_1..5), Scarecrow weapons: pitchfork, corn shooter, pumpkin bombs (+1 more) Nodes (21): Step 10: The five-night progression, Step 10: Build the five-night progression, FarmState, asset_counts(), create(), from_dict(), is_valid(), log_night() (+13 more)
### Community 27 - "Soak Night & Benchmarks" ### Community 27 - "Soak Night & Benchmarks"
Cohesion: 0.38 Cohesion: 0.24
Nodes (12): _attack(), _build_tick(), _cycles(), _gather_day(), _gather_tick(), _guard(), _quit(), _run() (+4 more) Nodes (16): Labeled stress benchmark presets (25–2,000 birds, compact/enlarged layouts), run(), run_benchmarks.sh script, Scripted scarecrow bot (soak_night, perfect aim), _attack(), _build_tick(), _cycles(), _gather_day() (+8 more)
### Community 28 - "Co-op Tests" ### Community 28 - "Co-op Tests"
Cohesion: 0.53 Cohesion: 0.27
Nodes (6): GDSync (GD-Sync plugin autoload), net_receive(), start_voice(), GDSyncLink, _on_joined(), _on_partner_arrived() Nodes (10): GDSync (GD-Sync plugin autoload), net_receive(), set_microphone(), start_voice(), GDSyncLink, _on_joined(), _on_partner_arrived(), pause() (+2 more)
### Community 29 - "Player Character Movement" ### Community 29 - "Player Character Movement"
Cohesion: 0.17 Cohesion: 0.21
Nodes (21): _process(), pay(), structure(), show_state(), _process(), describe(), pay(), _ground_y() (+13 more) Nodes (15): _process(), pay(), structure(), show_state(), _process(), describe(), pay(), built (signal) (+7 more)
### Community 30 - "Farm Layout Doc" ### Community 30 - "Farm Layout Doc"
Cohesion: 0.17 Cohesion: 0.27
Nodes (15): Pen gate breach (gate as start structure), Supply bundles (sacks from the most-stocked material), Step 8: Expand to all three farm targets, Three farm targets: crops, animals, supplies, Shed stock piles (ShedStock), Supply Shed zone, Finding: a broken pen gate is the costliest event, Animals and the pen (open pen, loose animals, leading home) (+7 more) Nodes (10): Shed stock piles (ShedStock), Supply theft and shed stock rules, _claim_home(), most_stocked(), ShedStock, _process(), props_for(), refresh() (+2 more)
### Community 31 - "Co-op Voice Chat" ### Community 31 - "Co-op Voice Chat"
Cohesion: 0.29 Cohesion: 0.29
@ -294,19 +307,23 @@ Nodes (19): 1. With losses permanent, the density decides when the farm is empty
### Community 33 - "Interactions & Gathering" ### Community 33 - "Interactions & Gathering"
Cohesion: 0.50 Cohesion: 0.50
Nodes (4): Farm occupancy grid with one flow field per goal set, Deferred from version 1 (farming sim, multiplayer, tech trees), Prototype scope boundaries, Shared octile flow field toward the player Nodes (4): Farm occupancy grid with one flow field per goal set, Structures are expensive-to-cross cells, not walls, Deferred from version 1 (farming sim, multiplayer, tech trees), Prototype scope boundaries
### Community 34 - "Shed Stock & Supply Targets" ### Community 34 - "Shed Stock & Supply Targets"
Cohesion: 0.29 Cohesion: 0.33
Nodes (16): SKY, _crowd(), _enemies_match(), _fall_rule(), _join(), _leaving(), _night(), _partner_moves_and_gathers() (+8 more) Nodes (15): _crowd(), _enemies_match(), _fall_rule(), _join(), _leaving(), _night(), _partner_moves_and_gathers(), _partner_shoots() (+7 more)
### Community 35 - "ResourceStore"
Cohesion: 0.33
Nodes (13): GatherNode, ResourceHud, _process(), ResourceStore, Workbench, _deposit_and_night(), _gathering(), _layout() (+5 more)
### Community 36 - "Farm Projectiles" ### Community 36 - "Farm Projectiles"
Cohesion: 0.17 Cohesion: 0.16
Nodes (9): _release_slot(), sweep_hit(), FarmProjectiles, fire(), hit (signal), _release(), _resolve_segment(), step() (+1 more) Nodes (10): _release_slot(), sweep_hit(), FarmProjectiles, fire(), hit (signal), _release(), _resolve_segment(), step() (+2 more)
### Community 37 - "Alert Manager" ### Community 37 - "Alert Manager"
Cohesion: 0.23 Cohesion: 0.33
Nodes (13): _breaker_goals(), _start_field_rebuild(), can_afford(), missing(), blocks(), corners(), _distance_to_outline(), footprint() (+5 more) Nodes (9): _breaker_goals(), _start_field_rebuild(), blocks(), corners(), _distance_to_outline(), footprint(), layout_changed (signal), structure_near() (+1 more)
### Community 38 - "Net Budget Tool" ### Community 38 - "Net Budget Tool"
Cohesion: 0.31 Cohesion: 0.31
@ -317,32 +334,60 @@ Cohesion: 0.15
Nodes (12): #23 [pop-ups] Remove the zone banner and the message feed, #24 [30] Nights by count, per-night enemy speed and HP, #25 [30] Arrivals wait for a free character, #26 [30] Upgrade tiers and timed shed stock, #27 [30] The thirty nights, #28 [30] Thirty-night soak, pool sizes, and a balance report, Decisions (the user's, 2026-10-06), Defaults (assumed; flip any of these on request) (+4 more) Nodes (12): #23 [pop-ups] Remove the zone banner and the message feed, #24 [30] Nights by count, per-night enemy speed and HP, #25 [30] Arrivals wait for a free character, #26 [30] Upgrade tiers and timed shed stock, #27 [30] The thirty nights, #28 [30] Thirty-night soak, pool sizes, and a balance report, Decisions (the user's, 2026-10-06), Defaults (assumed; flip any of these on request) (+4 more)
### Community 40 - "Co-op Menu UI" ### Community 40 - "Co-op Menu UI"
Cohesion: 0.38 Cohesion: 0.21
Nodes (11): CoopMenu, back_requested (signal), host_requested (signal), join_address_requested (signal), join_requested (signal), open(), _ready(), search_requested (signal) (+3 more) Nodes (22): CoopMenu, back_requested (signal), host_requested (signal), join_address_requested (signal), join_requested (signal), open(), _ready(), search_requested (signal) (+14 more)
### Community 41 - "Harvest Season — co-op"
Cohesion: 0.18
Nodes (14): Harvest Season — co-op, GD-Sync API keys (keys.cfg), GD-Sync data allowance budget (22 MB per vacation, ~12 KB/s), Unreliable message size limit (under 1,100 bytes; GD-Sync splits at 1,200), Dead reckoning for enemies (25 cm error threshold), Harvest Season patches to GD-Sync (4), LAN join by address, Same-network LAN play (GD-Sync local mode, peer to peer) (+6 more)
### Community 42 - "Snapshot Decoding" ### Community 42 - "Snapshot Decoding"
Cohesion: 0.15 Cohesion: 0.15
Nodes (12): Alien overhaul — follow-ups (outside docs/tasks.md scope), Crop fields (#13), Docs sweep after renames/rebalances, Housekeeping, Loose animals (#12), Playtest after #11 (player-built pen), Post-overhaul fix batch (#16–#22, 2026-10-06), Spec items from the review with no task (+4 more) Nodes (12): Alien overhaul — follow-ups (outside docs/tasks.md scope), Crop fields (#13), Docs sweep after renames/rebalances, Housekeeping, Loose animals (#12), Playtest after #11 (player-built pen), Post-overhaul fix batch (#16–#22, 2026-10-06), Spec items from the review with no task (+4 more)
### Community 43 - "Enemy Characters & Hits" ### Community 43 - "Enemy Characters & Hits"
Cohesion: 0.18 Cohesion: 0.38
Nodes (16): EnemyCharacters, acquire(), _animate(), hit(), _process(), spawn(), visual_position(), EDGE (+8 more) Nodes (9): EDGE, _alerts(), _breakers(), _characters(), _crows(), run(), _scenarios(), _table() (+1 more)
### Community 44 - "send"
Cohesion: 0.22
Nodes (14): put_angle(), put_cm(), put_text(), put_time(), put_v3(), send(), _close_menu_if_needed(), _host_tick() (+6 more)
### Community 45 - "Interactions"
Cohesion: 0.27
Nodes (14): Interactions, _blocker(), cancel(), charges(), deposited (signal), _finish_gather(), gathered (signal), message (signal) (+6 more)
### Community 46 - "Upgrades"
Cohesion: 0.24
Nodes (14): can_afford(), missing(), _overlap(), _overlaps_rect(), trap_slow_time(), validate(), _world_blocked(), Upgrades (+6 more)
### Community 47 - "Prop Collision Builder" ### Community 47 - "Prop Collision Builder"
Cohesion: 0.42 Cohesion: 0.31
Nodes (8): _band_points(), _build(), _faces(), _fit(), _initialize(), _kind(), _process_prefab(), _restore_uids() Nodes (10): _band_points(), _build(), _faces(), _fit(), _initialize(), _kind(), _process_prefab(), _restore_uids() (+2 more)
### Community 48 - "Horde Performance Report" ### Community 48 - "Horde Performance Report"
Cohesion: 0.13 Cohesion: 0.18
Nodes (16): Performance report (prototype horde benchmarks), First shot / first hit stutter check (no first-use stutter), Largest tested passing population: 2,000 birds, 10-minute headless 1,000-bird recycle soak (flat memory), Start-up hitches (10–36 ms frames in the first second), Labeled stress benchmark presets (25–2,000 birds, compact/enlarged layouts), VSync-on ~1 s stalls (compositor throttling of hidden windows), run() (+8 more) Nodes (12): Performance report (prototype horde benchmarks), First shot / first hit stutter check (no first-use stutter), Largest tested passing population: 2,000 birds, 10-minute headless 1,000-bird recycle soak (flat memory), Start-up hitches (10–36 ms frames in the first second), VSync-on ~1 s stalls (compositor throttling of hidden windows), Headless tooling constraints (editor closed, restore UIDs), Performance measurement goals (p95 <= 16.67 ms) (+4 more)
### Community 49 - "test_weapons.gd"
Cohesion: 0.29
Nodes (12): WeaponModels, _add(), mesh_of(), _bombs(), _hud(), _offhand(), _pitchfork(), run() (+4 more)
### Community 50 - "GameConfig"
Cohesion: 0.38
Nodes (11): Assessment, GameConfig, _assessment(), _autosave(), _bad_saves(), busy_state(), _migration(), _round_trip() (+3 more)
### Community 51 - "Co-op Send Path" ### Community 51 - "Co-op Send Path"
Cohesion: 0.29 Cohesion: 0.29
Nodes (6): Decisions (resolved), Harvest Season — alien overhaul: review, decisions, and task plan, Headline finding from the review, Open assumptions (flagged, not yet confirmed), Suggested starting order, Task breakdown (mirrors Task tool `#1`–`#15`) Nodes (6): Decisions (resolved), Harvest Season — alien overhaul: review, decisions, and task plan, Headline finding from the review, Open assumptions (flagged, not yet confirmed), Suggested starting order, Task breakdown (mirrors Task tool `#1`–`#15`)
### Community 52 - "Pause Menu Signals" ### Community 52 - "Pause Menu Signals"
Cohesion: 0.52 Cohesion: 0.24
Nodes (7): PauseMenu, menu_requested (signal), quit_requested (signal), _ready(), restart_requested (signal), resume_requested (signal), settings_requested (signal) Nodes (10): Prototype Kit texture (8x8 RGB color palette swatch atlas for flat-shaded prototype pieces), PumpkinBomb_texture (11x11 Material-style color palette swatch grid for PumpkinBomb.glb), PumpkinBombs, _burst(), burst (signal), _flash(), _new_mesh(), step() (+2 more)
### Community 53 - "Tutorial"
Cohesion: 0.29
Nodes (12): phase_changed (signal), _on_phase_changed(), setup(), Tutorial, _check_done(), _enemies_near(), _finish(), _on_phase() (+4 more)
### Community 54 - "GD-Sync Sync Icons" ### Community 54 - "GD-Sync Sync Icons"
Cohesion: 0.50 Cohesion: 0.50
@ -353,20 +398,20 @@ Cohesion: 0.40
Nodes (5): Leaf_Pine_C solid dark-green pine foliage silhouette, Leaf_Pine white alpha silhouette of a pine foliage cluster, Leaves_GiantPine_C solid green rounded foliage blob shapes, Leaves sprite sheet with colorful painted leaf shapes, ferns, clovers, Leaves_NormalTree white alpha silhouettes of normal tree leaf clusters Nodes (5): Leaf_Pine_C solid dark-green pine foliage silhouette, Leaf_Pine white alpha silhouette of a pine foliage cluster, Leaves_GiantPine_C solid green rounded foliage blob shapes, Leaves sprite sheet with colorful painted leaf shapes, ferns, clovers, Leaves_NormalTree white alpha silhouettes of normal tree leaf clusters
### Community 56 - "Campaign Experience (Step 11)" ### Community 56 - "Campaign Experience (Step 11)"
Cohesion: 0.22 Cohesion: 0.12
Nodes (9): D9: Retry from the failed night's morning, One authoritative FarmState, Step 11: The complete campaign experience, Step 11: Add the complete campaign experience, Farm audio cues and buses (FarmAudio), Kenney CC0 audio packs, Morning autosave and save migration (SaveGame), Morning review and nightly results (+1 more) Nodes (21): First complete version — five-night vacation build steps, Farmers' return ending, Five-night farm vacation (core loop), D1: Starting the night early (allow_early_night, off by default), M3 First loop (first major milestone), Step 11: The complete campaign experience, Step 1: Rules of the vacation, Step 2: Organize the map into a playable farm (+13 more)
### Community 57 - "Overview Render Tool" ### Community 57 - "Overview Render Tool"
Cohesion: 0.31 Cohesion: 0.43
Nodes (10): start_channel(), stop_channel(), UpgradePanel, bought (signal), _buy(), close(), message (signal), open() (+2 more) Nodes (8): start_channel(), UpgradePanel, bought (signal), _buy(), message (signal), open(), refresh(), setup()
### Community 58 - "Prototype Round Lifecycle" ### Community 58 - "Prototype Round Lifecycle"
Cohesion: 0.27 Cohesion: 0.42
Nodes (10): Menus, pause, and settings (user://settings.cfg), set_microphone(), GameSettings, apply(), load_from(), save_to(), _on_settings_changed(), pause() (+2 more) Nodes (10): lose_crops(), make_campaign(), run_phase(), run_until(), _early_night(), _five_nights(), _night_log(), _order_and_timers() (+2 more)
### Community 59 - "Grid Design & Scope Limits" ### Community 59 - "Grid Design & Scope Limits"
Cohesion: 0.19 Cohesion: 0.24
Nodes (17): AssetHud, GameTestRunner, _initialize(), _main(), _animal_theft(), _breach(), _bundle_limits(), _fallback() (+9 more) Nodes (17): GameTestRunner, _initialize(), _main(), SKY, _animal_theft(), _breach(), _bundle_limits(), _fallback() (+9 more)
### Community 60 - "GD-Sync Physics/Voice Icons" ### Community 60 - "GD-Sync Physics/Voice Icons"
Cohesion: 0.67 Cohesion: 0.67
@ -392,6 +437,26 @@ Nodes (3): PathRocks_Diffuse (mossy grey stepping-stone UV atlas diffuse, Pebble
Cohesion: 0.18 Cohesion: 0.18
Nodes (10): Alien overhaul — task list, Dependent, Independent, Post-overhaul fix batch (2026-10-06), Thirty nights — task list (2026-10-06), Wave 1, Wave 1, Wave 2 (+2 more) Nodes (10): Alien overhaul — task list, Dependent, Independent, Post-overhaul fix batch (2026-10-06), Thirty nights — task list (2026-10-06), Wave 1, Wave 1, Wave 2 (+2 more)
### Community 81 - "test_theft.gd"
Cohesion: 0.42
Nodes (10): _combat_input(), _consistent(), _escape(), _night_arrivals(), _retry(), run(), _shots(), _stale_handles() (+2 more)
### Community 84 - "equip"
Cohesion: 0.27
Nodes (10): cycle(), equip(), _set_offhand(), setup(), show_weapon(), switched (signal), tick(), setup() (+2 more)
### Community 85 - "stop"
Cohesion: 0.29
Nodes (8): ended (signal), partner_left (signal), stop(), _leave_as_partner(), _on_other_left(), _on_session_ended(), quit_game(), to_menu()
### Community 86 - "MainMenu"
Cohesion: 0.52
Nodes (7): MainMenu, continue_requested (signal), coop_requested (signal), new_requested (signal), quit_requested (signal), _ready(), settings_requested (signal)
### Community 87 - "step"
Cohesion: 0.50
Nodes (5): _finish_field_rebuild(), step(), _step_replica(), _update_hunt(), can_shoot()
## Ambiguous Edges - Review These ## Ambiguous Edges - Review These
- `KayKit Rig_Medium animation libraries (CombatMelee, CombatRanged, General, Movement, Simulation, Special, Tools)` → `Final assessment (weighted share kept, 0–100 points, ratings)` [AMBIGUOUS] - `KayKit Rig_Medium animation libraries (CombatMelee, CombatRanged, General, Movement, Simulation, Special, Tools)` → `Final assessment (weighted share kept, 0–100 points, ratings)` [AMBIGUOUS]
game/RULES.md · relation: conceptually_related_to game/RULES.md · relation: conceptually_related_to
@ -406,12 +471,12 @@ _Questions this graph is uniquely positioned to answer:_
- **What is the exact relationship between `KayKit Rig_Medium animation libraries (CombatMelee, CombatRanged, General, Movement, Simulation, Special, Tools)` and `Final assessment (weighted share kept, 0–100 points, ratings)`?** - **What is the exact relationship between `KayKit Rig_Medium animation libraries (CombatMelee, CombatRanged, General, Movement, Simulation, Special, Tools)` and `Final assessment (weighted share kept, 0–100 points, ratings)`?**
_Edge tagged AMBIGUOUS (relation: conceptually_related_to) - confidence is low._ _Edge tagged AMBIGUOUS (relation: conceptually_related_to) - confidence is low._
- **Why does `CoopSession` connect `Co-op Session Host/Client` to `Campaign Controller & Farm State`, `Structures & Build Mode`, `Shed Stock & Supply Targets`, `Scarecrow Weapons & Bombs`, `Net Budget Tool`, `Co-op Lobby & Smoke Test`, `Scarecrow Defender & Fear`, `Main Scene & Title Menu`, `Farm Zones & Layout Tests`, `Enemy System & Theft Tests`, `Game Flow, Save & Pause`, `Co-op Docs & GD-Sync Link`, `Co-op Link Transport`, `Prototype Round Lifecycle`, `Co-op Tests`, `Player Character Movement`, `Co-op Voice Chat`?** - **Why does `CampaignController` connect `Campaign Controller & Farm State` to `Structures & Build Mode`, `Audio & Farmers Return Ending`, `Scarecrow Weapons & Bombs`, `Waves, Night Plans & Review`, `First Game Plan & Milestones`, `Horde Prototype (README)`, `Co-op Lobby & Smoke Test`, `Scarecrow Defender & Fear`, `Loot & Theft Events`, `Farm Zones & Layout Tests`, `Co-op Session Host/Client`, `Rules of the Vacation`, `Game Flow, Save & Pause`, `Farm Navigation Flow Fields`, `Resource Economy & Upgrades`, `Animal System`, `Test Runner & Farm Targets`, `Playtest Notes & Scaling`, `Farm Sim Setup Wiring`, `Thief Behavior AI`, `Soak Night & Benchmarks`, `Farm Layout Doc`, `Shed Stock & Supply Targets`, `ResourceStore`, `Net Budget Tool`, `Co-op Menu UI`, `Enemy Characters & Hits`, `Interactions`, `Upgrades`, `GameConfig`, `Tutorial`, `Overview Render Tool`, `Prototype Round Lifecycle`, `Grid Design & Scope Limits`, `test_theft.gd`, `step`?**
_High betweenness centrality (0.119) - this node is a cross-community bridge._
- **Why does `CoopSession` connect `Co-op Session Host/Client` to `Campaign Controller & Farm State`, `Structures & Build Mode`, `Scarecrow Weapons & Bombs`, `Waves, Night Plans & Review`, `Co-op Lobby & Smoke Test`, `Enemy System & Theft Tests`, `Game Flow, Save & Pause`, `Co-op Docs & GD-Sync Link`, `Co-op Link Transport`, `Thief Behavior AI`, `Co-op Tests`, `Co-op Voice Chat`, `Shed Stock & Supply Targets`, `ResourceStore`, `Net Budget Tool`, `Harvest Season — co-op`, `send`, `Upgrades`, `stop`?**
_High betweenness centrality (0.116) - this node is a cross-community bridge._ _High betweenness centrality (0.116) - this node is a cross-community bridge._
- **Why does `CampaignController` connect `Campaign Controller & Farm State` to `Structures & Build Mode`, `Audio & Farmers Return Ending`, `Scarecrow Weapons & Bombs`, `Waves, Night Plans & Review`, `First Game Plan & Milestones`, `Horde Prototype (README)`, `Co-op Lobby & Smoke Test`, `Scarecrow Defender & Fear`, `Loot & Theft Events`, `Farm Zones & Layout Tests`, `Enemy System & Theft Tests`, `Co-op Session Host/Client`, `Rules of the Vacation`, `Game Flow, Save & Pause`, `Farm Navigation Flow Fields`, `Animal System`, `Test Runner & Farm Targets`, `Playtest Notes & Scaling`, `Farm Sim Setup Wiring`, `Soak Night & Benchmarks`, `Player Character Movement`, `Farm Layout Doc`, `Shed Stock & Supply Targets`, `Alert Manager`, `Net Budget Tool`, `Enemy Characters & Hits`, `Pause Menu Signals`, `Overview Render Tool`, `Grid Design & Scope Limits`?** - **Why does `FarmSim` connect `Waves, Night Plans & Review` to `Campaign Controller & Farm State`, `Structures & Build Mode`, `Audio & Farmers Return Ending`, `Scarecrow Weapons & Bombs`, `Horde Prototype (README)`, `Scarecrow Defender & Fear`, `Loot & Theft Events`, `Farm Zones & Layout Tests`, `Enemy System & Theft Tests`, `Co-op Session Host/Client`, `Rules of the Vacation`, `Game Flow, Save & Pause`, `Farm Navigation Flow Fields`, `Resource Economy & Upgrades`, `Animal System`, `Test Runner & Farm Targets`, `Co-op Docs & GD-Sync Link`, `Playtest Notes & Scaling`, `Farm Sim Setup Wiring`, `Soak Night & Benchmarks`, `Farm Layout Doc`, `Shed Stock & Supply Targets`, `ResourceStore`, `Farm Projectiles`, `Alert Manager`, `Net Budget Tool`, `Enemy Characters & Hits`, `Interactions`, `test_weapons.gd`, `GameConfig`, `Pause Menu Signals`, `Tutorial`, `Overview Render Tool`, `Grid Design & Scope Limits`, `test_theft.gd`, `step`?**
_High betweenness centrality (0.113) - this node is a cross-community bridge._ _High betweenness centrality (0.113) - this node is a cross-community bridge._
- **Why does `FarmSim` connect `Scarecrow Defender & Fear` to `Campaign Controller & Farm State`, `Structures & Build Mode`, `Audio & Farmers Return Ending`, `Scarecrow Weapons & Bombs`, `Waves, Night Plans & Review`, `Horde Prototype (README)`, `Loot & Theft Events`, `Farm Zones & Layout Tests`, `Enemy System & Theft Tests`, `Co-op Session Host/Client`, `Rules of the Vacation`, `Game Flow, Save & Pause`, `Farm Navigation Flow Fields`, `Animal System`, `Test Runner & Farm Targets`, `Co-op Docs & GD-Sync Link`, `Playtest Notes & Scaling`, `Farm Sim Setup Wiring`, `Soak Night & Benchmarks`, `Farm Layout Doc`, `Shed Stock & Supply Targets`, `Farm Projectiles`, `Alert Manager`, `Net Budget Tool`, `Enemy Characters & Hits`, `Overview Render Tool`, `Grid Design & Scope Limits`?**
_High betweenness centrality (0.112) - this node is a cross-community bridge._
- **Are the 12 inferred relationships involving `CampaignController` (e.g. with `Outcome evaluator check_outcome` and `_night_log()`) actually correct?** - **Are the 12 inferred relationships involving `CampaignController` (e.g. with `Outcome evaluator check_outcome` and `_night_log()`) actually correct?**
_`CampaignController` has 12 INFERRED edges - model-reasoned connections that need verification._ _`CampaignController` has 12 INFERRED edges - model-reasoned connections that need verification._
- **Are the 13 inferred relationships involving `EnemySystem` (e.g. with `AlertManager` and `_describe()`) actually correct?** - **Are the 13 inferred relationships involving `EnemySystem` (e.g. with `AlertManager` and `_describe()`) actually correct?**

View file

@ -1 +1 @@
1791310282.9681008 1791391041.240062

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -110,8 +110,8 @@
"semantic_hash": "6a47d64fcc136324ca395065a707ef76" "semantic_hash": "6a47d64fcc136324ca395065a707ef76"
}, },
"README.md": { "README.md": {
"mtime": 1791319855.6108074, "mtime": 1791393501.969425,
"ast_hash": "817e7811314f52285f6b1859f2da7da1", "ast_hash": "90978ad6c28b7cfbfb405ad9c53e44fc",
"semantic_hash": "" "semantic_hash": ""
}, },
"assets/audio/CREDITS.md": { "assets/audio/CREDITS.md": {
@ -1008,5 +1008,15 @@
"mtime": 1791324224.559026, "mtime": 1791324224.559026,
"ast_hash": "a9155ff99382d4e465863ed464d27c87", "ast_hash": "a9155ff99382d4e465863ed464d27c87",
"semantic_hash": "" "semantic_hash": ""
},
"assets/fonts/OFL.txt": {
"mtime": 1791391447.5754592,
"ast_hash": "f276c5fb92536732b115e5d848d89ed4",
"semantic_hash": ""
},
"assets/pictures/screens/splash.png": {
"mtime": 1791388644.636634,
"ast_hash": "0076d8ae11b1245bda7b3ce2c92d96e1",
"semantic_hash": ""
} }
} }

View file

@ -8,11 +8,16 @@
config_version=5 config_version=5
[GD-Sync]
version="1.0.2"
[application] [application]
config/name="Harvest-Season" config/name="Harvest-Season"
run/main_scene="res://game/scenes/main.tscn" run/main_scene="res://game/scenes/main.tscn"
config/features=PackedStringArray("4.7", "Mobile") config/features=PackedStringArray("4.7", "Forward Plus")
boot_splash/image="uid://cfgcs7r67fcis"
config/icon="res://icon.svg" config/icon="res://icon.svg"
[audio] [audio]
@ -28,6 +33,7 @@ GDSync="*res://addons/GD-Sync/MultiplayerClient.gd"
window/size/viewport_width=1920 window/size/viewport_width=1920
window/size/viewport_height=1080 window/size/viewport_height=1080
window/size/mode=3
window/stretch/mode="canvas_items" window/stretch/mode="canvas_items"
window/stretch/aspect="expand" window/stretch/aspect="expand"
@ -221,6 +227,32 @@ offhand={
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":4,"axis_value":1.0,"script":null) , Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":4,"axis_value":1.0,"script":null)
]) ])
} }
weapon_3={
"deadzone": 0.5,
"events": Array[InputEvent]([Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":51,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
])
}
weapon_4={
"deadzone": 0.5,
"events": Array[InputEvent]([Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":52,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
])
}
weapon_5={
"deadzone": 0.5,
"events": Array[InputEvent]([Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":53,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
])
}
weapon_6={
"deadzone": 0.5,
"events": Array[InputEvent]([Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":54,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
])
}
pouch={
"deadzone": 0.5,
"events": Array[InputEvent]([Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":73,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":8,"pressure":0.0,"pressed":false,"script":null)
])
}
[layer_names] [layer_names]
@ -236,5 +268,4 @@ common/physics_interpolation=true
[rendering] [rendering]
rendering_device/driver.windows="d3d12" rendering_device/driver.windows="d3d12"
renderer/rendering_method="mobile"
anti_aliasing/quality/msaa_3d=1 anti_aliasing/quality/msaa_3d=1

View file

@ -11,14 +11,14 @@ func _initialize() -> void:
"display/window/size/viewport_height": 1080, "display/window/size/viewport_height": 1080,
"physics/common/physics_ticks_per_second": 60, "physics/common/physics_ticks_per_second": 60,
"physics/common/physics_interpolation": true, "physics/common/physics_interpolation": true,
"rendering/renderer/rendering_method": "mobile", "rendering/renderer/rendering_method": "forward_plus", # the game's pixel outlines need it
"rendering/anti_aliasing/quality/msaa_3d": 1, "rendering/anti_aliasing/quality/msaa_3d": 1,
"layer_names/3d_physics/layer_1": "world", "layer_names/3d_physics/layer_1": "world",
"layer_names/3d_physics/layer_2": "player", "layer_names/3d_physics/layer_2": "player",
} }
for key: String in s: for key: String in s:
ProjectSettings.set_setting(key, s[key]) ProjectSettings.set_setting(key, s[key])
ProjectSettings.set_setting("application/config/features", PackedStringArray(["4.7", "Mobile"])) ProjectSettings.set_setting("application/config/features", PackedStringArray(["4.7", "Forward Plus"]))
_action("move_left", 0.2, [_key(KEY_A), _key(KEY_LEFT), _axis(JOY_AXIS_LEFT_X, -1.0)]) _action("move_left", 0.2, [_key(KEY_A), _key(KEY_LEFT), _axis(JOY_AXIS_LEFT_X, -1.0)])
_action("move_right", 0.2, [_key(KEY_D), _key(KEY_RIGHT), _axis(JOY_AXIS_LEFT_X, 1.0)]) _action("move_right", 0.2, [_key(KEY_D), _key(KEY_RIGHT), _axis(JOY_AXIS_LEFT_X, 1.0)])