summaryrefslogtreecommitdiff
path: root/addons/escoria-core/game/core-scripts/resources
diff options
context:
space:
mode:
authorRadio <radiohotline@disroot.org>2026-06-04 15:15:11 +0300
committerRadio <radiohotline@disroot.org>2026-06-04 15:15:11 +0300
commit9d74b49ab62908d4acf53dde444413886b8b28e5 (patch)
tree0cb785267ea7e239b19d88684c0d64b9bd5d52f0 /addons/escoria-core/game/core-scripts/resources
parent2c85d452ad02a5f89cd43bad7f9de31d0e4fa0c1 (diff)
escoria setup and old branch archives
Diffstat (limited to 'addons/escoria-core/game/core-scripts/resources')
-rw-r--r--addons/escoria-core/game/core-scripts/resources/esc_animationname.gd10
-rw-r--r--addons/escoria-core/game/core-scripts/resources/esc_animationname.gd.uid1
-rw-r--r--addons/escoria-core/game/core-scripts/resources/esc_animationresource.gd120
-rw-r--r--addons/escoria-core/game/core-scripts/resources/esc_animationresource.gd.uid1
-rw-r--r--addons/escoria-core/game/core-scripts/resources/esc_directionangle.gd10
-rw-r--r--addons/escoria-core/game/core-scripts/resources/esc_directionangle.gd.uid1
-rw-r--r--addons/escoria-core/game/core-scripts/resources/esc_resource_descriptor.gd25
-rw-r--r--addons/escoria-core/game/core-scripts/resources/esc_resource_descriptor.gd.uid1
8 files changed, 169 insertions, 0 deletions
diff --git a/addons/escoria-core/game/core-scripts/resources/esc_animationname.gd b/addons/escoria-core/game/core-scripts/resources/esc_animationname.gd
new file mode 100644
index 0000000..482695f
--- /dev/null
+++ b/addons/escoria-core/game/core-scripts/resources/esc_animationname.gd
@@ -0,0 +1,10 @@
+@tool
+## Class defining an animation to use for an angle.
+extends Resource
+class_name ESCAnimationName
+
+## Name of the animation
+@export var animation: String
+
+## Animation mirror (false is no mirror, true is mirrored)
+@export var mirrored: bool
diff --git a/addons/escoria-core/game/core-scripts/resources/esc_animationname.gd.uid b/addons/escoria-core/game/core-scripts/resources/esc_animationname.gd.uid
new file mode 100644
index 0000000..96467ed
--- /dev/null
+++ b/addons/escoria-core/game/core-scripts/resources/esc_animationname.gd.uid
@@ -0,0 +1 @@
+uid://clixil1u5exq7
diff --git a/addons/escoria-core/game/core-scripts/resources/esc_animationresource.gd b/addons/escoria-core/game/core-scripts/resources/esc_animationresource.gd
new file mode 100644
index 0000000..337013e
--- /dev/null
+++ b/addons/escoria-core/game/core-scripts/resources/esc_animationresource.gd
@@ -0,0 +1,120 @@
+@tool
+## Resource containing all defined animations and angles for character
+## movement.[br]
+extends Resource
+class_name ESCAnimationResource
+
+## Array containing the different angles available for animations.[br]
+## Each angle is defined by an array [start_angle, angle_size].
+## start_angle must be between 0 and 360.[br]
+## Angles 0 and 360 are the same and correspond to UP/NORTH, 90 is RIGHT/EAST,
+## 180 is DOWN/SOUTH, 270 is LEFT/WEST etc.
+@export var dir_angles: Array[ESCDirectionAngle] = []: set = set_dir_angles
+
+## Array of animations for each direction, from UP to RIGHT_UP clockwise.[br]
+## Each entry is [animation_name, scale]. The scale parameter can be set to -1 to
+## mirror the animation.
+@export var directions: Array[ESCAnimationName] = []: set = set_directions
+
+## Array containing the idle animations for each direction (in the order defined
+## by dir_angles).[br]
+## The scale parameter can be set to -1 to mirror the animation.
+@export var idles: Array[ESCAnimationName] = []: set = set_idles
+
+## Array containing the speak animations for each direction (in the order defined
+## by dir_angles).[br]
+## The scale parameter can be set to -1 to mirror the animation.
+@export var speaks: Array[ESCAnimationName] = []: set = set_speaks
+
+## Sets the dir_angles property.[br]
+## [br]
+## #### Parameters[br]
+## [br]
+## | Name | Type | Description | Required? |[br]
+## |:-----|:-----|:------------|:----------|[br]
+## |p_dir_angles|`Array`|Array of direction angle resources to set.|yes|[br]
+## [br]
+## #### Returns[br]
+## [br]
+## Returns nothing.
+func set_dir_angles(p_dir_angles: Array[ESCDirectionAngle]) -> void:
+ dir_angles = p_dir_angles
+ emit_changed()
+
+## Sets the directions property.[br]
+## [br]
+## #### Parameters[br]
+## [br]
+## | Name | Type | Description | Required? |[br]
+## |:-----|:-----|:------------|:----------|[br]
+## |p_set_directions|`Array`|Array of direction resources to set.|yes|[br]
+## [br]
+## #### Returns[br]
+## [br]
+## Returns nothing.
+func set_directions(p_set_directions: Array[ESCAnimationName]) -> void:
+ directions = p_set_directions
+ emit_changed()
+
+## Sets the idles property.[br]
+## [br]
+## #### Parameters[br]
+## [br]
+## | Name | Type | Description | Required? |[br]
+## |:-----|:-----|:------------|:----------|[br]
+## |p_set_idles|`Array`|Array of idle resources to set.|yes|[br]
+## [br]
+## #### Returns[br]
+## [br]
+## Returns nothing.
+func set_idles(p_set_idles: Array[ESCAnimationName]) -> void:
+ idles = p_set_idles
+ emit_changed()
+
+## Sets the speaks property.[br]
+## [br]
+## #### Parameters[br]
+## [br]
+## | Name | Type | Description | Required? |[br]
+## |:-----|:-----|:------------|:----------|[br]
+## |p_set_speaks|`Array`|Array of speak resources to set.|yes|[br]
+## [br]
+## #### Returns[br]
+## [br]
+## Returns nothing.
+func set_speaks(p_set_speaks: Array[ESCAnimationName]) -> void:
+ speaks = p_set_speaks
+ emit_changed()
+
+## The direction id from an animation name. 1 if not found.[br]
+## [br]
+## #### Parameters[br]
+## [br]
+## | Name | Type | Description | Required? |[br]
+## |:-----|:-----|:------------|:----------|[br]
+## |p_animation_name|`String`|The animation name.|yes|[br]
+## [br]
+## #### Returns[br]
+## [br]
+## Returns the direction id from an animation name. 1 if not found. (`int`)
+func get_direction_id_from_animation_name(p_animation_name: String) -> int:
+ var founds_array = []
+
+ for directions_anim_resource in directions:
+ if (directions_anim_resource as ESCAnimationName).animation == p_animation_name:
+ founds_array.push_back(directions.find(directions_anim_resource))
+ for idles_anim_resource in idles:
+ if (idles_anim_resource as ESCAnimationName).animation == p_animation_name:
+ founds_array.push_back(idles.find(idles_anim_resource))
+ for speaks_anim_resource in speaks:
+ if (speaks_anim_resource as ESCAnimationName).animation == p_animation_name:
+ founds_array.push_back(speaks.find(speaks_anim_resource))
+
+ if founds_array.size() > 1:
+ escoria.logger.warn(
+ self,
+ "Multiple animations found for name %s. Returning first direction found." % p_animation_name
+ )
+ elif founds_array.size() == 0:
+ return -1
+ return founds_array[0]
diff --git a/addons/escoria-core/game/core-scripts/resources/esc_animationresource.gd.uid b/addons/escoria-core/game/core-scripts/resources/esc_animationresource.gd.uid
new file mode 100644
index 0000000..cfa2154
--- /dev/null
+++ b/addons/escoria-core/game/core-scripts/resources/esc_animationresource.gd.uid
@@ -0,0 +1 @@
+uid://sksvt0n8gle2
diff --git a/addons/escoria-core/game/core-scripts/resources/esc_directionangle.gd b/addons/escoria-core/game/core-scripts/resources/esc_directionangle.gd
new file mode 100644
index 0000000..0050dc4
--- /dev/null
+++ b/addons/escoria-core/game/core-scripts/resources/esc_directionangle.gd
@@ -0,0 +1,10 @@
+@tool
+## Class defining an angle, with a start angle (between 0 and 360) and a size.
+extends Resource
+class_name ESCDirectionAngle
+
+## Start angle of the directional angle.
+@export var angle_start: int
+
+## Size of the angle.
+@export var angle_size: int
diff --git a/addons/escoria-core/game/core-scripts/resources/esc_directionangle.gd.uid b/addons/escoria-core/game/core-scripts/resources/esc_directionangle.gd.uid
new file mode 100644
index 0000000..c164811
--- /dev/null
+++ b/addons/escoria-core/game/core-scripts/resources/esc_directionangle.gd.uid
@@ -0,0 +1 @@
+uid://bxc3dll30x8tl
diff --git a/addons/escoria-core/game/core-scripts/resources/esc_resource_descriptor.gd b/addons/escoria-core/game/core-scripts/resources/esc_resource_descriptor.gd
new file mode 100644
index 0000000..72e2cce
--- /dev/null
+++ b/addons/escoria-core/game/core-scripts/resources/esc_resource_descriptor.gd
@@ -0,0 +1,25 @@
+## Describes a resource for use in the resource cache.
+extends Resource
+class_name ESCResourceDescriptor
+
+## The resource being described.
+var res
+
+## Whether the resource is permanent.
+var permanent: bool
+
+## Constructor for ESCResourceDescriptor. Sets the resource and permanence flag.[br]
+## [br]
+## #### Parameters[br]
+## [br]
+## | Name | Type | Description | Required? |[br]
+## |:-----|:-----|:------------|:----------|[br]
+## |res_in|`Variant`|The resource to describe.|yes|[br]
+## |permanent_in|`bool`|Whether the resource is permanent.|yes|[br]
+## [br]
+## #### Returns[br]
+## [br]
+## Returns nothing.
+func _init(res_in, permanent_in: bool) -> void:
+ res = res_in
+ permanent = permanent_in
diff --git a/addons/escoria-core/game/core-scripts/resources/esc_resource_descriptor.gd.uid b/addons/escoria-core/game/core-scripts/resources/esc_resource_descriptor.gd.uid
new file mode 100644
index 0000000..770f7e0
--- /dev/null
+++ b/addons/escoria-core/game/core-scripts/resources/esc_resource_descriptor.gd.uid
@@ -0,0 +1 @@
+uid://20ixn175cd6c