Compare commits
5 commits
9f4c9edd43
...
3cd2327edc
Author | SHA1 | Date | |
---|---|---|---|
3cd2327edc | |||
63cca5c2fb | |||
0c72afcead | |||
841b76b916 | |||
d114c5f300 |
1402 changed files with 194 additions and 32 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -16,3 +16,4 @@ data_*/
|
||||||
mono_crash.*.json
|
mono_crash.*.json
|
||||||
|
|
||||||
BUILDS
|
BUILDS
|
||||||
|
.zed/
|
||||||
|
|
|
@ -23,7 +23,7 @@ static func _blank_for_func_class(code: String) -> String:
|
||||||
var comment_line_regex = RegEx.create_from_string(r"^\s*#")
|
var comment_line_regex = RegEx.create_from_string(r"^\s*#")
|
||||||
var empty_line_regex = RegEx.create_from_string(r"^\s+$")
|
var empty_line_regex = RegEx.create_from_string(r"^\s+$")
|
||||||
var lines := code.split('\n')
|
var lines := code.split('\n')
|
||||||
var modified_lines: Array[String] = []
|
var modified_lines: PackedStringArray = []
|
||||||
|
|
||||||
for line: String in lines:
|
for line: String in lines:
|
||||||
# Spaces between functions & classes
|
# Spaces between functions & classes
|
||||||
|
|
|
@ -8,10 +8,12 @@ const TodoItem := preload("res://addons/Todo_Manager/todoItem_class.gd")
|
||||||
|
|
||||||
var _dockUI: Dock
|
var _dockUI: Dock
|
||||||
|
|
||||||
|
|
||||||
class TodoCacheValue:
|
class TodoCacheValue:
|
||||||
var todos: Array
|
var todos: Array
|
||||||
var last_modified_time: int
|
var last_modified_time: int
|
||||||
|
|
||||||
|
|
||||||
func _init(todos: Array, last_modified_time: int):
|
func _init(todos: Array, last_modified_time: int):
|
||||||
self.todos = todos
|
self.todos = todos
|
||||||
self.last_modified_time = last_modified_time
|
self.last_modified_time = last_modified_time
|
||||||
|
@ -19,7 +21,7 @@ class TodoCacheValue:
|
||||||
var todo_cache: Dictionary # { key: script_path, value: TodoCacheValue }
|
var todo_cache: Dictionary # { key: script_path, value: TodoCacheValue }
|
||||||
var remove_queue: Array
|
var remove_queue: Array
|
||||||
var combined_pattern: String
|
var combined_pattern: String
|
||||||
var cased_patterns : Array[String]
|
var cased_patterns: PackedStringArray
|
||||||
|
|
||||||
var refresh_lock := false # makes sure _on_filesystem_changed only triggers once
|
var refresh_lock := false # makes sure _on_filesystem_changed only triggers once
|
||||||
|
|
||||||
|
@ -51,7 +53,7 @@ func queue_remove(file: String):
|
||||||
_dockUI.todo_items.remove_at(i)
|
_dockUI.todo_items.remove_at(i)
|
||||||
|
|
||||||
|
|
||||||
func find_tokens_from_path(scripts: Array[String]) -> void:
|
func find_tokens_from_path(scripts: PackedStringArray) -> void:
|
||||||
for script_path in scripts:
|
for script_path in scripts:
|
||||||
var file := FileAccess.open(script_path, FileAccess.READ)
|
var file := FileAccess.open(script_path, FileAccess.READ)
|
||||||
var contents := file.get_as_text()
|
var contents := file.get_as_text()
|
||||||
|
@ -178,8 +180,8 @@ func _on_filesystem_changed() -> void:
|
||||||
rescan_files(false)
|
rescan_files(false)
|
||||||
|
|
||||||
|
|
||||||
func find_scripts() -> Array[String]:
|
func find_scripts() -> PackedStringArray:
|
||||||
var scripts : Array[String]
|
var scripts: PackedStringArray
|
||||||
var directory_queue: Array[String]
|
var directory_queue: Array[String]
|
||||||
var dir := DirAccess.open("res://")
|
var dir := DirAccess.open("res://")
|
||||||
if dir.get_open_error() == OK:
|
if dir.get_open_error() == OK:
|
||||||
|
@ -210,7 +212,8 @@ func get_cached_todos(script_path: String) -> Array:
|
||||||
return cached_value.todos
|
return cached_value.todos
|
||||||
return []
|
return []
|
||||||
|
|
||||||
func get_dir_contents(dir: DirAccess, scripts: Array[String], directory_queue: Array[String]) -> void:
|
|
||||||
|
func get_dir_contents(dir: DirAccess, scripts: PackedStringArray, directory_queue: PackedStringArray) -> void:
|
||||||
dir.include_navigational = false
|
dir.include_navigational = false
|
||||||
dir.include_hidden = false
|
dir.include_hidden = false
|
||||||
dir.list_dir_begin()
|
dir.list_dir_begin()
|
||||||
|
|
77
assetloader/assetloader.gd
Normal file
77
assetloader/assetloader.gd
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
extends Object
|
||||||
|
class_name AssetLoader
|
||||||
|
|
||||||
|
#region declaration
|
||||||
|
# === CONST ===
|
||||||
|
|
||||||
|
const DEFAULT_ASSETS_PATH = "res://mods"
|
||||||
|
|
||||||
|
## If you want to change the mod extension. Keep in mind that it's still a json under the hood
|
||||||
|
const MOD_INFOS_EXTENSION = "modinfo"
|
||||||
|
|
||||||
|
## Path to the mods folder : [param res://mods] by default
|
||||||
|
## [br]
|
||||||
|
## (is not a const but should be treated as such, so the uppercase)
|
||||||
|
var ASSETS_PATH
|
||||||
|
|
||||||
|
# === VAR ===
|
||||||
|
var dir:DirAccess
|
||||||
|
var mod_folders:PackedStringArray
|
||||||
|
var critical_error := false
|
||||||
|
|
||||||
|
var mod_paths : PackedStringArray
|
||||||
|
var mod_manifests : Dictionary[String,Dictionary]
|
||||||
|
|
||||||
|
# === SIGNALS ===
|
||||||
|
signal loading_finished
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
func _init() -> void:
|
||||||
|
print_verbose("------ MOD LOADING STARTED ------")
|
||||||
|
ASSETS_PATH = ProjectSettings.get_setting("game/mods/mod_path", DEFAULT_ASSETS_PATH)
|
||||||
|
dir = DirAccess.open(ASSETS_PATH)
|
||||||
|
if not dir:
|
||||||
|
push_error("AssetLoader: Mods folder not found at '%s'" % ASSETS_PATH)
|
||||||
|
push_error("AssetLoader:",DirAccess.get_open_error())
|
||||||
|
_show_error_popup("Mods folder not found at '%s'" % ASSETS_PATH)
|
||||||
|
critical_error = true
|
||||||
|
return
|
||||||
|
mod_folders = dir.get_directories()
|
||||||
|
if mod_folders.is_empty():
|
||||||
|
push_error("AssetLoader: Mods folder '%s' is empty — no mods to load." % ASSETS_PATH)
|
||||||
|
_show_error_popup("Mods folder '%s' is empty — no mods to load." % ASSETS_PATH)
|
||||||
|
critical_error = true
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
## This will show a native MessageBox on Windows,
|
||||||
|
## a native dialog on macOS, and GTK/QT dialog on Linux.
|
||||||
|
func _show_error_popup(message: String) -> void:
|
||||||
|
OS.alert("AssetLoader:"+message, "AssetLoader:Error")
|
||||||
|
|
||||||
|
|
||||||
|
func load_all():
|
||||||
|
load_mods()
|
||||||
|
#load_mods_content()
|
||||||
|
|
||||||
|
|
||||||
|
func load_mods():
|
||||||
|
for mod in mod_folders:
|
||||||
|
var mod_name = mod
|
||||||
|
var mod_path = ASSETS_PATH + "/" + mod_name
|
||||||
|
var manifest_path = mod_path + "/" + mod_name + "." + MOD_INFOS_EXTENSION
|
||||||
|
if FileAccess.file_exists(manifest_path):
|
||||||
|
var manifest_file := FileAccess.open(manifest_path, FileAccess.READ)
|
||||||
|
var manifest: Dictionary = JSON.parse_string(manifest_file.get_as_text())
|
||||||
|
if typeof(manifest) == TYPE_DICTIONARY: # always true ?
|
||||||
|
mod_paths.append(mod_path)
|
||||||
|
if manifest["id"]:
|
||||||
|
mod_manifests[manifest["id"]] = manifest
|
||||||
|
print_verbose("Mod loaded: %s" % manifest["name"])
|
||||||
|
else:
|
||||||
|
mod_manifests[mod_name] = manifest
|
||||||
|
print_verbose("Mod loaded: %s" % manifest["name"])
|
||||||
|
for mod in mod_manifests:
|
||||||
|
print("Mod loaded: %s" % mod)
|
1
assetloader/assetloader.gd.uid
Normal file
1
assetloader/assetloader.gd.uid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uid://qkh5uvr4st7i
|
23
autoloads/bootstrap.gd
Normal file
23
autoloads/bootstrap.gd
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
extends Node
|
||||||
|
## Should always be at the top of autoloads
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
var loader := AssetLoader.new()
|
||||||
|
# No point to load the game if no asset are loaded
|
||||||
|
if loader.critical_error:
|
||||||
|
Engine.get_main_loop().quit(1)
|
||||||
|
return
|
||||||
|
loader.load_all() # TODO: Making it async
|
||||||
|
_start_game()
|
||||||
|
|
||||||
|
|
||||||
|
## This will show a native MessageBox on Windows,
|
||||||
|
## a native dialog on macOS, and GTK/QT dialog on Linux.
|
||||||
|
func _show_error_popup(context:String, message: String) -> void:
|
||||||
|
OS.alert(context+":"+message, context+":Error")
|
||||||
|
|
||||||
|
|
||||||
|
func _start_game() -> void:
|
||||||
|
print("Game starting...")
|
||||||
|
#TODO: Load main menu or world scene
|
1
autoloads/bootstrap.gd.uid
Normal file
1
autoloads/bootstrap.gd.uid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uid://bbmtxflx0ivgp
|
|
@ -144,3 +144,11 @@ func DrawCube(Center, HalfExtents := 0.1, time := 0.0, LineColor := Color(1.0, 0
|
||||||
DrawRay(LinePointStart, Vector3(0, HalfExtents * 2.0, 0), time, LineColor)
|
DrawRay(LinePointStart, Vector3(0, HalfExtents * 2.0, 0), time, LineColor)
|
||||||
LinePointStart += Vector3(0, 0, -HalfExtents * 2.0)
|
LinePointStart += Vector3(0, 0, -HalfExtents * 2.0)
|
||||||
DrawRay(LinePointStart, Vector3(0, HalfExtents * 2.0, 0), time, LineColor)
|
DrawRay(LinePointStart, Vector3(0, HalfExtents * 2.0, 0), time, LineColor)
|
||||||
|
|
||||||
|
|
||||||
|
func DrawSphere(Position:Vector3):
|
||||||
|
var SphereShape = CSGSphere3D.new()
|
||||||
|
var node = Node3D.new()
|
||||||
|
node.add_child(SphereShape)
|
||||||
|
node.position = Position
|
||||||
|
get_tree().root.add_child(node)
|
||||||
|
|
|
@ -16,7 +16,7 @@ func _process(_delta):
|
||||||
#update_cursor(shape)
|
#update_cursor(shape)
|
||||||
|
|
||||||
|
|
||||||
func update_cursor(image: Resource, shape: Input.CursorShape = 0, hotspot: Vector2 = Vector2(0, 0)):
|
func update_cursor(image: Resource, _shape:= 0 as Input.CursorShape, hotspot: Vector2 = Vector2(0, 0)):
|
||||||
# Get the custom cursor data from the main script
|
# Get the custom cursor data from the main script
|
||||||
if image != null:
|
if image != null:
|
||||||
texture_rect.texture = image
|
texture_rect.texture = image
|
||||||
|
|
23
editor/script_templates/Object/clean_code_template.gd
Normal file
23
editor/script_templates/Object/clean_code_template.gd
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# meta-name: Clean Code Template
|
||||||
|
# meta-description: Use this format to structure your code into clear sections
|
||||||
|
# meta-default: true
|
||||||
|
# meta-space-indent: 4
|
||||||
|
extends _BASE_
|
||||||
|
|
||||||
|
#region declaration
|
||||||
|
# === CONST === # Constants and immutables, in UPPERCASE
|
||||||
|
|
||||||
|
# === STATIC === # Static variables/functions
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
# === Init === # Initialization logic, if needed
|
||||||
|
|
||||||
|
func _init() -> void:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# === PUBLIC FUNCTIONS ===
|
||||||
|
|
||||||
|
# === PRIVATE FUNCTIONS === # use _underscore() to make the difference between private and public functions
|
||||||
|
|
||||||
|
# ====================
|
|
@ -0,0 +1 @@
|
||||||
|
uid://d524ti2uyikh
|
9
mods/base_content/base_content.json
Normal file
9
mods/base_content/base_content.json
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"id": "base_content",
|
||||||
|
"name": "Core Game Elements",
|
||||||
|
"version": 1.0,
|
||||||
|
"desc": "Factions, unités, bâtiments et cartes de base.",
|
||||||
|
"author": "TonStudio",
|
||||||
|
"dependencies": [],
|
||||||
|
"tags": ["units","vehicles","buildings","textures","maps","quests"]
|
||||||
|
}
|
9
mods/base_content/base_content.modinfo
Normal file
9
mods/base_content/base_content.modinfo
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"id": "base_content",
|
||||||
|
"name": "Core Game Elements",
|
||||||
|
"version": 1.0,
|
||||||
|
"desc": "Factions, unités, bâtiments et cartes de base.",
|
||||||
|
"author": "TonStudio",
|
||||||
|
"dependencies": [],
|
||||||
|
"tags": ["units","vehicles","buildings","textures","maps","quests"]
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue