added remix support for weapon tracks

This commit is contained in:
2025-10-20 21:29:17 +11:00
parent 1494026aac
commit 28b2172bc8
7 changed files with 192 additions and 53 deletions

View File

@@ -10,7 +10,6 @@
[resource]
script = ExtResource("1_yqa4b")
cost = 2
rarity = 0
faction = 1
turret_scene = ExtResource("4_5nu32")
weapon_scene = ExtResource("4_m52ff")

View File

@@ -378,6 +378,7 @@ func equip_weapon(slot: int = 0) -> void:
#if !inventory.contents.has(cards[slot]):
#decrement_selected()
weapons[slot] = cards[slot].weapon_scene.instantiate()
weapons[slot].stats = cards[slot].weapon_stats
weapons[slot].name = str(weapons_spawn_count)
weapons[slot].duration = 1
networked_equip_weapon.rpc(Data.cards.find(cards[slot]), 0, weapons_spawn_count)

View File

@@ -28,6 +28,7 @@ var duration: int = 0
func _ready() -> void:
recharge_timer.wait_time = Data.weapon_recharge_delay
stats = stats.weapon_features_applied()
time_between_shots = stats.get_attribute("Fire Delay")
damage = int(stats.get_attribute("Damage"))
#energy_cost = stats.get_attribute("Energy")

View File

@@ -8,8 +8,6 @@
[sub_resource type="Resource" id="Resource_c6gqc"]
script = ExtResource("3_75shm")
damage = 0
status_effects = Array[ExtResource("4_lkplr")]([])
[node name="DirectAffectTower" instance=ExtResource("1_cn3qe")]
stats = ExtResource("2_gg1gn")

View File

@@ -1,11 +1,11 @@
[gd_resource type="Resource" script_class="CardText" load_steps=3 format=3 uid="uid://smctw4ogm4rx"]
[gd_resource type="Resource" script_class="CardText" load_steps=4 format=3 uid="uid://smctw4ogm4rx"]
[ext_resource type="Script" uid="uid://bsuinotkvh7eu" path="res://Scripts/Resources/feature.gd" id="1_vqq5l"]
[ext_resource type="Script" uid="uid://dg7gxxqfqxcmc" path="res://Scripts/Resources/card_text.gd" id="2_k26ta"]
[ext_resource type="Resource" uid="uid://dfup264h2pun7" path="res://Scripts/Features/HeavyRounds/heavy_rounds_feature.tres" id="2_prves"]
[resource]
script = ExtResource("2_k26ta")
target_type = Array[int]([])
energy_type = 2
attributes = Dictionary[String, float]({
"Damage": 3.0,
@@ -13,5 +13,5 @@ attributes = Dictionary[String, float]({
"Fire Delay": 0.2,
"Range": 15.0
})
features = Array[ExtResource("1_vqq5l")]([])
features = Array[ExtResource("1_vqq5l")]([ExtResource("2_prves")])
text = "DESC_WEAPON_BASIC_GUN"

View File

@@ -6,18 +6,23 @@ signal cards_remixed(cards_consumed: Array[Card], cards_created: Array[Card])
@export var drag_feature: FeatureUI
@export var sample_library: VBoxContainer
@export var feature_scene: PackedScene
@export var parts: HBoxContainer
@export var tower_parts: HBoxContainer
@export var weapon_parts: HBoxContainer
@export var drop_down: OptionButton
@export var card_desc: CardDescriptionUI
@export var check_button: CheckButton
const FEATURE_SLOTS: int = 6
var dragging: bool = false
var hovered_feature: Feature
var hovered_drop_slot: int = -2
var feature_uis: Array[FeatureUI]
var hovered_drop_track: int = 0
var tower_feature_uis: Array[FeatureUI]
var weapon_feature_uis: Array[FeatureUI]
var features_list: Array[Feature]
var slots: Array[VBoxContainer]
var tower_slots: Array[VBoxContainer]
var weapon_slots: Array[VBoxContainer]
var cards: Array[Card]
var card_selected: Card
var temp_card: Card
@@ -27,8 +32,10 @@ func _ready() -> void:
#populate_sample_library()
#populate_feature_slots()
card_desc.hide_features()
parts.mouse_entered.connect(set_hovered_drop_slot.bind(-1))
parts.mouse_exited.connect(unset_hovered_drop_slot)
tower_parts.mouse_entered.connect(set_hovered_drop_slot.bind(-1, 0))
weapon_parts.mouse_entered.connect(set_hovered_drop_slot.bind(-1, 1))
tower_parts.mouse_exited.connect(unset_hovered_drop_slot)
weapon_parts.mouse_exited.connect(unset_hovered_drop_slot)
func _process(_delta: float) -> void:
@@ -45,16 +52,21 @@ func _input(event: InputEvent) -> void:
func select_card(option: int) -> void:
for feature_ui: FeatureUI in feature_uis:
for feature_ui: FeatureUI in tower_feature_uis:
feature_ui.queue_free()
feature_uis = []
tower_feature_uis = []
for feature_ui: FeatureUI in weapon_feature_uis:
feature_ui.queue_free()
weapon_feature_uis = []
card_selected = cards[option]
temp_card = card_selected.duplicate()
temp_card.tower_stats = temp_card.tower_stats.get_duplicate()
temp_card.weapon_stats = temp_card.weapon_stats.get_duplicate()
card_desc.set_card(temp_card, true)
card_desc.set_card(temp_card, check_button.button_pressed)
for feature: Feature in temp_card.tower_stats.features:
add_feature(feature, false)
add_feature(feature, 0, false)
for feature: Feature in temp_card.weapon_stats.features:
add_feature(feature, 1, false)
func add_option(card_options: Array[Card]) -> void:
@@ -95,43 +107,56 @@ func populate_sample_library() -> void:
func populate_feature_slots() -> void:
for x: int in FEATURE_SLOTS:
var vbox: VBoxContainer = VBoxContainer.new()
var label: Label = Label.new()
match slots.size():
0: label.text = tr("SLOT_FIRST")
1: label.text = tr("SLOT_SECOND")
2: label.text = tr("SLOT_THIRD")
3: label.text = tr("SLOT_FOURTH")
4: label.text = tr("SLOT_FIFTH")
5: label.text = tr("SLOT_SIXTH")
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
vbox.add_child(label)
vbox.size_flags_horizontal = Control.SIZE_EXPAND_FILL
vbox.mouse_filter = Control.MOUSE_FILTER_STOP
vbox.mouse_entered.connect(set_hovered_drop_slot.bind(slots.size()))
vbox.mouse_entered.connect(set_hovered_drop_slot.bind(tower_slots.size(), 0))
vbox.mouse_exited.connect(unset_hovered_drop_slot)
parts.add_child(vbox)
slots.append(vbox)
tower_parts.add_child(vbox)
tower_slots.append(vbox)
for x: int in FEATURE_SLOTS:
var vbox: VBoxContainer = VBoxContainer.new()
vbox.size_flags_horizontal = Control.SIZE_EXPAND_FILL
vbox.mouse_filter = Control.MOUSE_FILTER_STOP
vbox.mouse_entered.connect(set_hovered_drop_slot.bind(weapon_slots.size(), 1))
vbox.mouse_exited.connect(unset_hovered_drop_slot)
weapon_parts.add_child(vbox)
weapon_slots.append(vbox)
func add_feature(feature: Feature, modify_resource: bool = true) -> void:
if hovered_drop_slot >= 0 and hovered_drop_slot < feature_uis.size():
change_feature(feature_uis[hovered_drop_slot], feature)
elif feature_uis.size() < FEATURE_SLOTS:
func add_feature(feature: Feature, track: int, modify_resource: bool = true) -> void:
if track == 0:
if hovered_drop_slot >= 0 and hovered_drop_slot < tower_feature_uis.size():
change_feature(tower_feature_uis[hovered_drop_slot], feature, 0)
elif tower_feature_uis.size() < FEATURE_SLOTS:
var feature_visual: FeatureUI = feature_scene.instantiate()
feature_visual.set_feature(feature)
slots[feature_uis.size()].add_child(feature_visual)
feature_uis.append(feature_visual)
tower_slots[tower_feature_uis.size()].add_child(feature_visual)
tower_feature_uis.append(feature_visual)
if modify_resource:
temp_card.tower_stats.features.append(feature)
card_desc.set_card(temp_card, true)
card_desc.set_card(temp_card, check_button.button_pressed)
elif track == 1:
if hovered_drop_slot >= 0 and hovered_drop_slot < weapon_feature_uis.size():
change_feature(weapon_feature_uis[hovered_drop_slot], feature, 1)
elif weapon_feature_uis.size() < FEATURE_SLOTS:
var feature_visual: FeatureUI = feature_scene.instantiate()
feature_visual.set_feature(feature)
weapon_slots[weapon_feature_uis.size()].add_child(feature_visual)
weapon_feature_uis.append(feature_visual)
if modify_resource:
temp_card.weapon_stats.features.append(feature)
card_desc.set_card(temp_card, check_button.button_pressed)
func change_feature(existing_feature: FeatureUI, new_feature: Feature) -> void:
func change_feature(existing_feature: FeatureUI, new_feature: Feature, track: int) -> void:
existing_feature.set_feature(new_feature)
var i: int = feature_uis.find(existing_feature)
if track == 0:
var i: int = tower_feature_uis.find(existing_feature)
temp_card.tower_stats.features[i] = new_feature
card_desc.set_card(temp_card, true)
elif track == 1:
var i: int = weapon_feature_uis.find(existing_feature)
temp_card.weapon_stats.features[i] = new_feature
card_desc.set_card(temp_card, check_button.button_pressed)
func attach_feat_to_mouse(feature: Feature) -> void:
@@ -143,7 +168,7 @@ func attach_feat_to_mouse(feature: Feature) -> void:
func detach_feat_from_mouse() -> void:
drag_feature.visible = false
if hovered_drop_slot >= -1 and dragging == true:
add_feature(drag_feature.feature)
add_feature(drag_feature.feature, hovered_drop_track)
dragging = false
@@ -155,12 +180,14 @@ func unset_hovered_feature() -> void:
hovered_feature = null
func set_hovered_drop_slot(slot: int = -2) -> void:
func set_hovered_drop_slot(slot: int = -2, track: int = 0) -> void:
hovered_drop_slot = slot
hovered_drop_track = track
func unset_hovered_drop_slot() -> void:
hovered_drop_slot = -2
hovered_drop_track = -1
func _on_cancel_button_pressed() -> void:
@@ -177,3 +204,7 @@ func _on_confirm_button_pressed() -> void:
cards_to_add.append(temp_card)
cards_remixed.emit(cards_to_remove, cards_to_add)
queue_free()
func _on_check_button_toggled(toggled_on: bool) -> void:
card_desc.set_card(temp_card, toggled_on)

View File

@@ -4,7 +4,7 @@
[ext_resource type="Script" uid="uid://mrv5vrlxfc13" path="res://track_editor.gd" id="1_yrnbk"]
[ext_resource type="PackedScene" uid="uid://cmlpmr78tmo6p" path="res://card_description_ui.tscn" id="3_q6wwl"]
[node name="Control" type="Control" node_paths=PackedStringArray("drag_feature", "sample_library", "parts", "drop_down", "card_desc")]
[node name="Control" type="Control" node_paths=PackedStringArray("drag_feature", "sample_library", "tower_parts", "weapon_parts", "drop_down", "card_desc", "check_button")]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
@@ -15,9 +15,11 @@ script = ExtResource("1_yrnbk")
drag_feature = NodePath("FeatureUI")
sample_library = NodePath("PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2/SamplePanel/ScrollContainer/SampleLibrary")
feature_scene = ExtResource("1_y6tpq")
parts = NodePath("PanelContainer/VBoxContainer/VBoxContainer/SourceCartridge/Parts")
tower_parts = NodePath("PanelContainer/VBoxContainer/VBoxContainer/TowerTrack/TowerParts")
weapon_parts = NodePath("PanelContainer/VBoxContainer/VBoxContainer/WeaponTrack/WeaponParts")
drop_down = NodePath("PanelContainer/VBoxContainer/VBoxContainer/SourceCartridge/CassetteSelector/OptionButton")
card_desc = NodePath("PanelContainer/VBoxContainer/InfoPanel/DescriptionVBox")
card_desc = NodePath("PanelContainer/VBoxContainer/InfoPanel/VBoxContainer/DescriptionVBox")
check_button = NodePath("PanelContainer/VBoxContainer/InfoPanel/VBoxContainer/CheckButton")
[node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 1
@@ -46,6 +48,10 @@ size_flags_vertical = 3
layout_mode = 2
size_flags_vertical = 3
[node name="MarginContainer2" type="MarginContainer" parent="PanelContainer/VBoxContainer/VBoxContainer/SourceCartridge"]
layout_mode = 2
size_flags_horizontal = 3
[node name="CassetteSelector" type="VBoxContainer" parent="PanelContainer/VBoxContainer/VBoxContainer/SourceCartridge"]
layout_mode = 2
size_flags_horizontal = 3
@@ -60,11 +66,103 @@ vertical_alignment = 1
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
alignment = 1
[node name="Parts" type="HBoxContainer" parent="PanelContainer/VBoxContainer/VBoxContainer/SourceCartridge"]
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/VBoxContainer/VBoxContainer/SourceCartridge"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 3.0
[node name="SourceCartridge2" type="HBoxContainer" parent="PanelContainer/VBoxContainer/VBoxContainer"]
layout_mode = 2
[node name="MarginContainer2" type="MarginContainer" parent="PanelContainer/VBoxContainer/VBoxContainer/SourceCartridge2"]
layout_mode = 2
size_flags_horizontal = 3
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/VBoxContainer/VBoxContainer/SourceCartridge2"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 4.0
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/VBoxContainer/SourceCartridge2/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "SLOT_FIRST"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Label2" type="Label" parent="PanelContainer/VBoxContainer/VBoxContainer/SourceCartridge2/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "SLOT_SECOND"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Label3" type="Label" parent="PanelContainer/VBoxContainer/VBoxContainer/SourceCartridge2/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "SLOT_THIRD"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Label4" type="Label" parent="PanelContainer/VBoxContainer/VBoxContainer/SourceCartridge2/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "SLOT_FOURTH"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Label5" type="Label" parent="PanelContainer/VBoxContainer/VBoxContainer/SourceCartridge2/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "SLOT_FIFTH"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Label6" type="Label" parent="PanelContainer/VBoxContainer/VBoxContainer/SourceCartridge2/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "SLOT_SIXTH"
horizontal_alignment = 1
vertical_alignment = 1
[node name="TowerTrack" type="HBoxContainer" parent="PanelContainer/VBoxContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/VBoxContainer/TowerTrack"]
layout_mode = 2
size_flags_horizontal = 3
text = "LABEL_TOWER_TRACK"
horizontal_alignment = 1
vertical_alignment = 1
[node name="TowerParts" type="HBoxContainer" parent="PanelContainer/VBoxContainer/VBoxContainer/TowerTrack"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
size_flags_stretch_ratio = 4.0
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/VBoxContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_top = 10
[node name="WeaponTrack" type="HBoxContainer" parent="PanelContainer/VBoxContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
[node name="Label2" type="Label" parent="PanelContainer/VBoxContainer/VBoxContainer/WeaponTrack"]
layout_mode = 2
size_flags_horizontal = 3
text = "LABEL_WEAPON_TRACK"
horizontal_alignment = 1
vertical_alignment = 1
[node name="WeaponParts" type="HBoxContainer" parent="PanelContainer/VBoxContainer/VBoxContainer/WeaponTrack"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
size_flags_stretch_ratio = 4.0
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/VBoxContainer"]
layout_mode = 2
@@ -74,10 +172,20 @@ size_flags_stretch_ratio = 0.1
[node name="InfoPanel" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
size_flags_stretch_ratio = 5.0
size_flags_stretch_ratio = 2.0
[node name="DescriptionVBox" parent="PanelContainer/VBoxContainer/InfoPanel" instance=ExtResource("3_q6wwl")]
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/VBoxContainer/InfoPanel"]
layout_mode = 2
size_flags_horizontal = 3
[node name="CheckButton" type="CheckButton" parent="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
button_pressed = true
[node name="DescriptionVBox" parent="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer" instance=ExtResource("3_q6wwl")]
layout_mode = 2
size_flags_vertical = 3
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/VBoxContainer/InfoPanel"]
layout_mode = 2
@@ -130,5 +238,6 @@ grow_vertical = 1
mouse_filter = 2
[connection signal="item_selected" from="PanelContainer/VBoxContainer/VBoxContainer/SourceCartridge/CassetteSelector/OptionButton" to="." method="select_card"]
[connection signal="toggled" from="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer/CheckButton" to="." method="_on_check_button_toggled"]
[connection signal="pressed" from="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2/Controls/CancelButton" to="." method="_on_cancel_button_pressed"]
[connection signal="pressed" from="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2/Controls/ConfirmButton" to="." method="_on_confirm_button_pressed"]