Skip to content

Commit 1a92cd4

Browse files
committed
Turn PartyMember in a standalone gdscript file
1 parent 0a09c66 commit 1a92cd4

File tree

3 files changed

+29
-24
lines changed

3 files changed

+29
-24
lines changed

godot/party/PartyMember.gd

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
extends Node2D
2+
3+
class_name PartyMember
4+
5+
onready var battler = $Battler
6+
7+
func _ready():
8+
battler.stats.reset()
9+
10+
func update_stats(stats : CharacterStats):
11+
"""
12+
Update this character's stats to match select changes
13+
that occurred during combat or through menu actions
14+
"""
15+
battler.stats = stats
16+
17+
func ready_for_combat():
18+
var copy = battler.duplicate()
19+
return copy

godot/party/PartyMember.tscn

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,12 @@
11
[gd_scene load_steps=3 format=2]
22

3-
[ext_resource path="res://combat/battlers/Battler.tscn" type="PackedScene" id=1]
4-
5-
[sub_resource type="GDScript" id=1]
6-
7-
script/source = "extends Node2D
8-
9-
onready var battler = $Battler
10-
11-
func _ready():
12-
battler.stats.reset()
13-
14-
func update_stats(stats : CharacterStats):
15-
\"\"\"
16-
Update this character's stats to match select changes
17-
that occurred during combat or through menu actions
18-
\"\"\"
19-
battler.stats = stats
20-
21-
func ready_for_combat():
22-
var copy = battler.duplicate()
23-
return copy
24-
"
3+
[ext_resource path="res://party/PartyMember.gd" type="Script" id=1]
4+
[ext_resource path="res://combat/battlers/Battler.tscn" type="PackedScene" id=2]
255

266
[node name="PartyMember" type="Node2D"]
27-
script = SubResource( 1 )
7+
script = ExtResource( 1 )
288

29-
[node name="Battler" parent="." instance=ExtResource( 1 )]
9+
[node name="Battler" parent="." instance=ExtResource( 2 )]
3010

3111

3212
[editable path="Battler"]

godot/project.godot

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ _global_script_classes=[ {
144144
"language": "GDScript",
145145
"path": "res://party/Party.gd"
146146
}, {
147+
"base": "Node2D",
148+
"class": "PartyMember",
149+
"language": "GDScript",
150+
"path": "res://party/PartyMember.gd"
151+
}, {
147152
"base": "Reference",
148153
"class": "Pathfinder",
149154
"language": "GDScript",
@@ -227,6 +232,7 @@ _global_script_class_icons={
227232
"ManaBar": "",
228233
"MapAction": "",
229234
"Party": "",
235+
"PartyMember": "",
230236
"Pathfinder": "",
231237
"Pawn": "",
232238
"PawnActor": "",

0 commit comments

Comments
 (0)