seedpackets and handlers
This commit is contained in:
parent
2a7c402cd0
commit
73a2fe42ad
16 changed files with 157 additions and 58 deletions
23
scripts/autoloads/game_registry.gd
Normal file
23
scripts/autoloads/game_registry.gd
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
extends Node
|
||||
|
||||
class_name GameRegistry
|
||||
|
||||
static func load_resources(directory : String, recursion : bool) -> Array[Resource]:
|
||||
var result : Array[Resource] = []
|
||||
var dir = DirAccess.open(directory)
|
||||
if dir == null:
|
||||
return result
|
||||
# Used to ignore last slash if it was provided in _path
|
||||
var path = dir.get_current_dir()
|
||||
if recursion:
|
||||
for subdir in dir.get_directories():
|
||||
var subdir_path = "%s/%s" % [ path, subdir ]
|
||||
result.append_array(load_resources(subdir_path,true))
|
||||
|
||||
for filename in dir.get_files():
|
||||
if !filename.ends_with('.tres'):
|
||||
continue
|
||||
var filepath = "%s/%s" % [ path, filename ]
|
||||
var res = ResourceLoader.load(filepath)
|
||||
result.append(res)
|
||||
return result
|
||||
1
scripts/autoloads/game_registry.gd.uid
Normal file
1
scripts/autoloads/game_registry.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cu3cfhesth2np
|
||||
51
scripts/autoloads/level_event_bus.gd
Normal file
51
scripts/autoloads/level_event_bus.gd
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
extends Node
|
||||
|
||||
## Event bus for levels in Liberation Of Neighborville
|
||||
|
||||
class_name LevelSignals
|
||||
|
||||
#region Field
|
||||
|
||||
## Emitted when entity is placed by player via seedpacket
|
||||
signal packet_placed(resource : SeedpacketResource)
|
||||
|
||||
#endregion
|
||||
|
||||
#region Entity
|
||||
|
||||
## Called for every entity that enters game
|
||||
signal entity_created(entity : Entity)
|
||||
## Called for every entity that exits game
|
||||
signal entity_killed(context : Entity.KilledContext)
|
||||
## Called for every entity that gets damage
|
||||
signal entity_hp_changed(context : Entity.HPChangedContext)
|
||||
|
||||
#endregion
|
||||
|
||||
#region Seedpacket manipulation
|
||||
|
||||
## Called when player selects SeedpacketResource
|
||||
signal packet_selected(resource : SeedpacketResource)
|
||||
|
||||
## Called when selected packets are updated
|
||||
signal hotbar_packets_update(selected : Array[SeedpacketResource])
|
||||
#endregion
|
||||
|
||||
#region Level Running
|
||||
## Called when huge wave is incoming, yet has not come
|
||||
signal huge_wave_coming
|
||||
|
||||
## Called when huge wave has come
|
||||
signal huge_wave
|
||||
|
||||
## Called when final wave has come
|
||||
signal final_wave
|
||||
|
||||
## Called when game is progressing through level stages
|
||||
signal state_changed(state : LevelData.LevelStates)
|
||||
|
||||
## Called when something requests state to advance
|
||||
signal state_advance_requested
|
||||
## Called when sun counter updates to value [code]to[/code]
|
||||
signal sun_count_updated(to : float)
|
||||
#endregion
|
||||
1
scripts/autoloads/level_event_bus.gd.uid
Normal file
1
scripts/autoloads/level_event_bus.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dmc03tudqcqj0
|
||||
Loading…
Add table
Add a link
Reference in a new issue