This commit is contained in:
iisaev committed 2026-10-18 12:41:38 +03:00
commit 5de3fd7ad8
121 files changed
+6632

No files matched your search

@@ -0,0 +1,21 @@
extends RefCounted
# Custom battle action executor: deals triple damage based on the user's Attack.
# ActionId must match the battle action ID in the character's JSON data.
# The execute method receives plain dictionaries (action/user/target) and must
# return a dictionary with any of: source_damage, source_defence, target_damage,
# target_defence, result.
func get_action_id():
return "gds.triple_attack"
func execute(action, user, target):
var damage = user["attack_value"] * 3 - target["defence_value"]
if damage < 1:
damage = 1
return {
"target_damage": damage,
"target_defence": target["defence_value"],
"result": true,
}
@@ -0,0 +1,14 @@
extends RefCounted
func get_name():
return "gds.char_welcome"
func run(ctx):
var char_type = ctx.GetParam("char_type")
if char_type == "":
ctx.LogWarning("GDS", "gds.char_welcome: missing char_type")
return
ctx.Character.AddToParty(char_type)
ctx.Character.SendNotification(char_type)
ctx.Log("GDS", "Character '" + char_type + "' added to party via GDScript")
@@ -0,0 +1,13 @@
extends RefCounted
# Custom condition with arguments: checks if a flag equals the passed value
# Usage in scenario: condition: gds.flag_equals("expected_value")
func get_condition_name():
return "gds.flag_equals"
func evaluate(flags, args):
var expected = args.get("0", "")
if expected == "":
return false
return flags.get("custom_flag", "") == expected
@@ -0,0 +1,11 @@
extends RefCounted
# Custom condition: checks if the "weather" flag equals "rain"
# Usage in scenario: condition: gds.is_rain
# Or: condition: gds.is_rain && Quest.hasTag("active")
func get_condition_name():
return "gds.is_rain"
func evaluate(flags, args):
return flags.get("weather", "") == "rain"
@@ -0,0 +1,10 @@
extends RefCounted
func get_name():
return "gds.greet"
func run(ctx):
var name = ctx.GetParam("name")
if name == "":
name = "Stranger"
ctx.Log("EVENT", "GDScript greet action: Hello, " + name + "!")
@@ -0,0 +1,21 @@
extends RefCounted
# Demonstrates inventory queries and mod presence checks from a scenario action
# Usage in scenario DSL: action gds.inventory_demo
func get_name():
return "gds.inventory_demo"
func run(ctx):
var itemId = ctx.GetParam("item_id")
if ctx.Inventory.HasItem(itemId):
var count = ctx.Inventory.CheckCount(itemId)
ctx.Log("EVENT", "Inventory has " + itemId + " x" + str(count))
else:
ctx.Log("EVENT", "Inventory does NOT have " + itemId)
if ctx.ModRegistry.IsLoaded("core"):
ctx.Log("EVENT", "Core mod is loaded")
else:
ctx.LogWarning("EVENT", "Core mod is NOT loaded")
@@ -0,0 +1,16 @@
extends RefCounted
# Custom item action: heals the character by a fixed amount when the item is used
# ID must match the ItemAction field in the item's JSON data
# The use(item) method receives a GDItem (with fields Id, Name, Description, Cost, ItemType)
# Returns true on success
func get_item_action_id():
return "gds.heal_item"
func use(item):
print("[GDS_ITEM] Using item: " + item.Name + " (id=" + item.Id + ")")
# In a real mod, perform actual healing logic here (e.g. via player stats)
# For demonstration, simply return success
return true
@@ -0,0 +1,9 @@
extends RefCounted
func get_name():
return "gds.light_reset"
func run(ctx):
ctx.Lighting.ClearDepthMap()
ctx.Lighting.SetUseTime(false)
ctx.Log("GDS", "Lighting reset via GDScript")
@@ -0,0 +1,12 @@
extends RefCounted
func get_name():
return "gds.quest_log"
func run(ctx):
var quest_id = ctx.GetParam("quest_id")
var message = ctx.GetParam("message")
if quest_id == "":
ctx.LogWarning("GDS", "gds.quest_log: missing quest_id param")
return
ctx.Log("QUEST", "[" + quest_id + "] " + message)
@@ -0,0 +1,16 @@
extends RefCounted
func get_name():
return "gds.quest_setup"
func run(ctx):
var quest_id = ctx.GetParam("quest_id")
if quest_id == "":
ctx.LogWarning("GDS", "gds.quest_setup: missing quest_id")
return
if ctx.Quests.Exists(quest_id):
ctx.Quests.SetStatus(quest_id, "Active")
ctx.Quests.AddTag(quest_id, "gds_started")
ctx.Quests.SendNotification(quest_id)
ctx.Log("GDS", "Quest '" + quest_id + "' activated by GDScript")
@@ -0,0 +1,7 @@
extends RefCounted
func on_mod_loaded(mod_id):
print("[GDS_TEST] on_mod_loaded: " + mod_id)
func on_mod_resources_ready():
print("[GDS_TEST] on_mod_resources_ready: all mods loaded")