Rework player state system to use an event subscription system to avoid directly calling methods on individual state and having to worry about validity

This commit is contained in:
2026-04-01 11:11:02 -05:00
parent 7cd34cb07e
commit eabfeab91a
35 changed files with 882 additions and 2288 deletions

View File

@@ -0,0 +1,491 @@
[gd_scene format=3 uid="uid://uyl0s1e67x6s"]
[ext_resource type="Script" uid="uid://cuar23q48cbja" path="res://Entities/Characters/Player/Scripts/sprite.gd" id="1_jqxwg"]
[ext_resource type="Texture2D" uid="uid://d1mourl3rq437" path="res://Assets/Spritesheets/Player/player-full-01.png" id="2_ndjja"]
[sub_resource type="AtlasTexture" id="AtlasTexture_kg8vi"]
atlas = ExtResource("2_ndjja")
region = Rect2(0, 1472, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_eqnrc"]
atlas = ExtResource("2_ndjja")
region = Rect2(64, 1472, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_rr1pu"]
atlas = ExtResource("2_ndjja")
region = Rect2(128, 1472, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_85fw5"]
atlas = ExtResource("2_ndjja")
region = Rect2(0, 1536, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_5dpey"]
atlas = ExtResource("2_ndjja")
region = Rect2(64, 1536, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_vk7kj"]
atlas = ExtResource("2_ndjja")
region = Rect2(128, 1536, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_3ej6w"]
atlas = ExtResource("2_ndjja")
region = Rect2(0, 1600, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_j7iyf"]
atlas = ExtResource("2_ndjja")
region = Rect2(64, 1600, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_gw75a"]
atlas = ExtResource("2_ndjja")
region = Rect2(128, 1600, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_w2nd7"]
atlas = ExtResource("2_ndjja")
region = Rect2(192, 1472, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_rd4wh"]
atlas = ExtResource("2_ndjja")
region = Rect2(256, 1472, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_rwmr7"]
atlas = ExtResource("2_ndjja")
region = Rect2(320, 1472, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_na211"]
atlas = ExtResource("2_ndjja")
region = Rect2(192, 1536, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_kl0pt"]
atlas = ExtResource("2_ndjja")
region = Rect2(256, 1536, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_sdskq"]
atlas = ExtResource("2_ndjja")
region = Rect2(320, 1536, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_1dk7p"]
atlas = ExtResource("2_ndjja")
region = Rect2(192, 1600, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_5pvpc"]
atlas = ExtResource("2_ndjja")
region = Rect2(256, 1600, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_3uof2"]
atlas = ExtResource("2_ndjja")
region = Rect2(320, 1600, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_0s5vo"]
atlas = ExtResource("2_ndjja")
region = Rect2(0, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_iy4ef"]
atlas = ExtResource("2_ndjja")
region = Rect2(64, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_1l5y2"]
atlas = ExtResource("2_ndjja")
region = Rect2(128, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_tbera"]
atlas = ExtResource("2_ndjja")
region = Rect2(192, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_6giml"]
atlas = ExtResource("2_ndjja")
region = Rect2(256, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_huf5g"]
atlas = ExtResource("2_ndjja")
region = Rect2(320, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_bsgi0"]
atlas = ExtResource("2_ndjja")
region = Rect2(0, 64, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_72dk0"]
atlas = ExtResource("2_ndjja")
region = Rect2(64, 64, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_gwc2p"]
atlas = ExtResource("2_ndjja")
region = Rect2(128, 64, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_g4n6s"]
atlas = ExtResource("2_ndjja")
region = Rect2(192, 64, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_tvm7c"]
atlas = ExtResource("2_ndjja")
region = Rect2(256, 64, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_amsyc"]
atlas = ExtResource("2_ndjja")
region = Rect2(320, 64, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_ei8qf"]
atlas = ExtResource("2_ndjja")
region = Rect2(0, 128, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_3fwgt"]
atlas = ExtResource("2_ndjja")
region = Rect2(64, 128, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_83xkn"]
atlas = ExtResource("2_ndjja")
region = Rect2(128, 128, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_df3jv"]
atlas = ExtResource("2_ndjja")
region = Rect2(192, 128, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_bwglw"]
atlas = ExtResource("2_ndjja")
region = Rect2(256, 128, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_j74gm"]
atlas = ExtResource("2_ndjja")
region = Rect2(320, 128, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_e1olu"]
atlas = ExtResource("2_ndjja")
region = Rect2(0, 1280, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_jmdrl"]
atlas = ExtResource("2_ndjja")
region = Rect2(64, 1280, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_wk3mk"]
atlas = ExtResource("2_ndjja")
region = Rect2(128, 1280, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_8mpdo"]
atlas = ExtResource("2_ndjja")
region = Rect2(192, 1280, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_46inv"]
atlas = ExtResource("2_ndjja")
region = Rect2(256, 1280, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_s6rq5"]
atlas = ExtResource("2_ndjja")
region = Rect2(0, 192, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_pu3ni"]
atlas = ExtResource("2_ndjja")
region = Rect2(64, 192, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_qdlmc"]
atlas = ExtResource("2_ndjja")
region = Rect2(128, 192, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_wfvue"]
atlas = ExtResource("2_ndjja")
region = Rect2(192, 192, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_pdvtf"]
atlas = ExtResource("2_ndjja")
region = Rect2(256, 192, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_k84dj"]
atlas = ExtResource("2_ndjja")
region = Rect2(320, 192, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_thygw"]
atlas = ExtResource("2_ndjja")
region = Rect2(0, 256, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_soxdi"]
atlas = ExtResource("2_ndjja")
region = Rect2(64, 256, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_bexkr"]
atlas = ExtResource("2_ndjja")
region = Rect2(128, 256, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_7vbqj"]
atlas = ExtResource("2_ndjja")
region = Rect2(192, 256, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_xlw27"]
atlas = ExtResource("2_ndjja")
region = Rect2(256, 256, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_1unn3"]
atlas = ExtResource("2_ndjja")
region = Rect2(320, 256, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_n4kyy"]
atlas = ExtResource("2_ndjja")
region = Rect2(0, 320, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_6pm4n"]
atlas = ExtResource("2_ndjja")
region = Rect2(64, 320, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_2mqt6"]
atlas = ExtResource("2_ndjja")
region = Rect2(128, 320, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_4bosx"]
atlas = ExtResource("2_ndjja")
region = Rect2(192, 320, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_xx24f"]
atlas = ExtResource("2_ndjja")
region = Rect2(256, 320, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_fftbb"]
atlas = ExtResource("2_ndjja")
region = Rect2(320, 320, 64, 64)
[sub_resource type="SpriteFrames" id="SpriteFrames_jqxwg"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_kg8vi")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_eqnrc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_rr1pu")
}],
"loop": false,
"name": &"drawing-bow-down",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_85fw5")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_5dpey")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_vk7kj")
}],
"loop": false,
"name": &"drawing-bow-side",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_3ej6w")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_j7iyf")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gw75a")
}],
"loop": false,
"name": &"drawing-bow-up",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_w2nd7")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_rd4wh")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_rwmr7")
}],
"loop": false,
"name": &"firing-arrow-down",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_na211")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_kl0pt")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_sdskq")
}],
"loop": false,
"name": &"firing-arrow-side",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_1dk7p")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_5pvpc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_3uof2")
}],
"loop": false,
"name": &"firing-arrow-up",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_0s5vo")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_iy4ef")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_1l5y2")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_tbera")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_6giml")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_huf5g")
}],
"loop": true,
"name": &"idle-down",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_bsgi0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_72dk0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gwc2p")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_g4n6s")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_tvm7c")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_amsyc")
}],
"loop": true,
"name": &"idle-side",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_ei8qf")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_3fwgt")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_83xkn")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_df3jv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_bwglw")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_j74gm")
}],
"loop": true,
"name": &"idle-up",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_e1olu")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_jmdrl")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_wk3mk")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_8mpdo")
}, {
"duration": 8.0,
"texture": SubResource("AtlasTexture_46inv")
}],
"loop": false,
"name": &"opening-chest-down",
"speed": 8.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_s6rq5")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_pu3ni")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qdlmc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_wfvue")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_pdvtf")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_k84dj")
}],
"loop": true,
"name": &"walking-down",
"speed": 10.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_thygw")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_soxdi")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_bexkr")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_7vbqj")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_xlw27")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_1unn3")
}],
"loop": true,
"name": &"walking-side",
"speed": 10.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_n4kyy")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_6pm4n")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_2mqt6")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4bosx")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_xx24f")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fftbb")
}],
"loop": true,
"name": &"walking-up",
"speed": 10.0
}]
[node name="Sprite" type="AnimatedSprite2D" unique_id=1296959783]
sprite_frames = SubResource("SpriteFrames_jqxwg")
animation = &"opening-chest-down"
autoplay = "idle-down"
script = ExtResource("1_jqxwg")