Files
claude c4beeae38f Initial commit: Transcience MVP
Top-down twin-stick bullet-hell, Godot 4.7, server-authoritative dedicated
server with client-side prediction. Clients send input only; the server
resolves every hit for both players and enemies (no PvP).

- SimWorld: whole simulation as plain RefCounted objects (no nodes, no
  physics server), ~0.24ms/tick at peak load -- runs headless for free and
  drives 78 tests in under a second
- BulletPool: struct-of-arrays bullet storage, replicated as spawn/despawn
  events rather than per-tick state
- Emitter framework (Ring/AimedSpread/WallGap/ArcSweep) shared by trash
  enemies and bosses -- a new boss is data in src/content/content.gd, no
  simulation changes
- The Warden of the Fold: stationary 4-phase boss built entirely on that
  format
- Lobby hub with a portal into on-demand dungeon instances; one process
  hosts the hub plus every concurrent dungeon
- Emergency escape: 3s server-owned channel, cancelled by damage
- tools/check.sh, test.sh (GUT), smoke.sh (real server + bot clients over
  ENet), bench.gd; git hooks wired to the same scripts
- docs/ARCHITECTURE.md, NETCODE.md, WORKFLOW.md, ROADMAP.md
2026-09-03 16:03:57 +02:00

105 lines
2.8 KiB
GDScript

var sub_menu : PopupMenu = null
var _menus = {
# name : {
# index,
# id,
# callback
# }
}
signal about
signal rerun
signal run_all
signal run_at_cursor
signal run_inner_class
signal run_script
signal run_test
signal show_gut
signal toggle_windowed
func _init():
sub_menu = PopupMenu.new()
sub_menu.index_pressed.connect(_on_sub_menu_index_pressed)
make_menu()
func _invalid_index():
print("bad menu index")
func _on_sub_menu_index_pressed(index):
var to_call : Callable = _invalid_index
for key in _menus:
if(_menus[key].index == index):
to_call = _menus[key].callback
to_call.call()
func add_menu(display_text, sig_to_emit, tooltip=''):
var index = sub_menu.item_count
_menus[sig_to_emit.get_name()] = {
index = index,
id = index,
callback = sig_to_emit.emit
}
sub_menu.add_item(display_text, index)
sub_menu.set_item_tooltip(index, tooltip)
return index
func make_menu():
# No known way to "make floating" via code with new EditorDock.
# add_menu("Toggle Windowed", toggle_windowed,
# 'Toggle GUT in the dock or a floating window')
add_menu("Show/Hide GUT", show_gut, '')
sub_menu.add_separator('Run')
add_menu("Run All", run_all,
"Run all tests")
add_menu("Run Script", run_script,
"Run the currently selected script")
add_menu("Run Inner Class", run_inner_class,
"Run the currently selected inner test class")
add_menu("Run Test", run_test,
"Run the currently selected test")
add_menu("Run At Cursor", run_at_cursor,
"Run the most specific of script/inner class/test based on cursor position")
add_menu("Rerun", rerun, "Rerun the last test(s) ran", )
sub_menu.add_separator()
add_menu("About", about, 'All about GUT')
func set_shortcut(menu_name, accel_or_input_key):
if(typeof(accel_or_input_key) == TYPE_INT):
sub_menu.set_item_accelerator(_menus[menu_name].index, accel_or_input_key)
elif(typeof(accel_or_input_key) == TYPE_OBJECT and accel_or_input_key is InputEventKey):
sub_menu.set_item_accelerator(_menus[menu_name].index, accel_or_input_key.get_keycode_with_modifiers())
func disable_menu(menu_name, disabled):
sub_menu.set_item_disabled(_menus[menu_name].index, disabled)
func apply_gut_shortcuts(shortcut_dialog):
set_shortcut("show_gut",
shortcut_dialog.scbtn_panel.get_input_event())
set_shortcut("run_all",
shortcut_dialog.scbtn_run_all.get_input_event())
set_shortcut("run_script",
shortcut_dialog.scbtn_run_current_script.get_input_event())
set_shortcut("run_inner_class",
shortcut_dialog.scbtn_run_current_inner.get_input_event())
set_shortcut("run_test",
shortcut_dialog.scbtn_run_current_test.get_input_event())
set_shortcut("run_at_cursor",
shortcut_dialog.scbtn_run_at_cursor.get_input_event())
set_shortcut("rerun",
shortcut_dialog.scbtn_rerun.get_input_event())
# set_shortcut("toggle_windowed",
# shortcut_dialog.scbtn_windowed.get_input_event())