From cc9d1eeba6cdd308dda3c37ed5f8d66aadf50a6d Mon Sep 17 00:00:00 2001 From: juliohq Date: Mon, 4 Sep 2023 11:08:51 -0300 Subject: [PATCH] Rename `Faction` class to `FactionData` --- Assets/Player/Player.gd | 2 +- Assets/UI/InfoWidgets/CityInfo.gd | 2 +- Assets/World/Factions/Black.tres | 6 +++--- Assets/World/Factions/Blue.tres | 6 +++--- Assets/World/Factions/Bordeaux.tres | 6 +++--- Assets/World/Factions/Cyan.tres | 6 +++--- Assets/World/Factions/DarkGreen.tres | 6 +++--- Assets/World/Factions/{Faction.gd => FactionData.gd} | 2 +- Assets/World/Factions/Gray.tres | 6 +++--- Assets/World/Factions/Lime.tres | 6 +++--- Assets/World/Factions/Magenta.tres | 6 +++--- Assets/World/Factions/None.tres | 6 +++--- Assets/World/Factions/Orange.tres | 6 +++--- Assets/World/Factions/Purple.tres | 6 +++--- Assets/World/Factions/Red.tres | 6 +++--- Assets/World/Factions/Teal.tres | 6 +++--- Assets/World/Factions/White.tres | 6 +++--- Assets/World/Factions/Yellow.tres | 6 +++--- Assets/World/Units/Unit.gd | 2 +- Assets/World/World.gd | 4 ++-- 20 files changed, 51 insertions(+), 51 deletions(-) rename Assets/World/Factions/{Faction.gd => FactionData.gd} (80%) diff --git a/Assets/Player/Player.gd b/Assets/Player/Player.gd index ef606abc..31d5c842 100644 --- a/Assets/Player/Player.gd +++ b/Assets/Player/Player.gd @@ -1,7 +1,7 @@ extends Control class_name Player -var faction = Global.FACTION.NONE +var faction = Global.Faction.NONE var settlements = [] var ships = [] diff --git a/Assets/UI/InfoWidgets/CityInfo.gd b/Assets/UI/InfoWidgets/CityInfo.gd index 7c99584b..7837a840 100644 --- a/Assets/UI/InfoWidgets/CityInfo.gd +++ b/Assets/UI/InfoWidgets/CityInfo.gd @@ -24,7 +24,7 @@ const _FACTION_SETTLEMENT = [ ] ## Determines which faction color to be shown. -@export var faction: Global.FACTION = 0 : set = set_faction +@export var faction: Global.Faction = 0 : set = set_faction @export var _debug_cycle_factions := false : set = _debug_set_cycle_factions @onready var _faction_settlement := $SettlementName/FactionSettlement as TextureRect diff --git a/Assets/World/Factions/Black.tres b/Assets/World/Factions/Black.tres index b79a39e7..8c5c7336 100644 --- a/Assets/World/Factions/Black.tres +++ b/Assets/World/Factions/Black.tres @@ -1,10 +1,10 @@ -[gd_resource type="Resource" script_class="Faction" load_steps=3 format=3 uid="uid://byroyj0ef881s"] +[gd_resource type="Resource" script_class="FactionData" load_steps=3 format=3 uid="uid://byroyj0ef881s"] [ext_resource type="Texture2D" uid="uid://bcortca0u8ykt" path="res://Assets/UI/Images/TabWidget/Emblems/emblem_black.png" id="1_kgd32"] -[ext_resource type="Script" path="res://Assets/World/Factions/Faction.gd" id="2_m8t5b"] +[ext_resource type="Script" path="res://Assets/World/Factions/FactionData.gd" id="2_bvxfe"] [resource] -script = ExtResource("2_m8t5b") +script = ExtResource("2_bvxfe") name = "Black" emblem = ExtResource("1_kgd32") color = Color(0, 0, 0, 1) diff --git a/Assets/World/Factions/Blue.tres b/Assets/World/Factions/Blue.tres index a875d4e6..bd1d4cf2 100644 --- a/Assets/World/Factions/Blue.tres +++ b/Assets/World/Factions/Blue.tres @@ -1,10 +1,10 @@ -[gd_resource type="Resource" script_class="Faction" load_steps=3 format=3 uid="uid://ioxxr8upvcd5"] +[gd_resource type="Resource" script_class="FactionData" load_steps=3 format=3 uid="uid://ioxxr8upvcd5"] [ext_resource type="Texture2D" uid="uid://deo6bohl0lo5m" path="res://Assets/UI/Images/TabWidget/Emblems/emblem_blue.png" id="1_8fyae"] -[ext_resource type="Script" path="res://Assets/World/Factions/Faction.gd" id="2_u5saj"] +[ext_resource type="Script" path="res://Assets/World/Factions/FactionData.gd" id="2_vvew0"] [resource] -script = ExtResource("2_u5saj") +script = ExtResource("2_vvew0") name = "Blue" emblem = ExtResource("1_8fyae") color = Color(0, 0.278431, 0.709804, 1) diff --git a/Assets/World/Factions/Bordeaux.tres b/Assets/World/Factions/Bordeaux.tres index 87d9f955..96398ce8 100644 --- a/Assets/World/Factions/Bordeaux.tres +++ b/Assets/World/Factions/Bordeaux.tres @@ -1,10 +1,10 @@ -[gd_resource type="Resource" script_class="Faction" load_steps=3 format=3 uid="uid://bcj6dsnxrm1j4"] +[gd_resource type="Resource" script_class="FactionData" load_steps=3 format=3 uid="uid://bcj6dsnxrm1j4"] [ext_resource type="Texture2D" uid="uid://dxfegp0js32rs" path="res://Assets/UI/Images/TabWidget/Emblems/emblem_bordeaux.png" id="1_fndhj"] -[ext_resource type="Script" path="res://Assets/World/Factions/Faction.gd" id="2_d8xlq"] +[ext_resource type="Script" path="res://Assets/World/Factions/FactionData.gd" id="2_xlfxc"] [resource] -script = ExtResource("2_d8xlq") +script = ExtResource("2_xlfxc") name = "Bordeaux" emblem = ExtResource("1_fndhj") color = Color(0.588235, 0.0196078, 0.160784, 1) diff --git a/Assets/World/Factions/Cyan.tres b/Assets/World/Factions/Cyan.tres index 19e65960..116562d1 100644 --- a/Assets/World/Factions/Cyan.tres +++ b/Assets/World/Factions/Cyan.tres @@ -1,10 +1,10 @@ -[gd_resource type="Resource" script_class="Faction" load_steps=3 format=3 uid="uid://bdrykhu6m2mf3"] +[gd_resource type="Resource" script_class="FactionData" load_steps=3 format=3 uid="uid://bdrykhu6m2mf3"] [ext_resource type="Texture2D" uid="uid://ifwoahknmsvh" path="res://Assets/UI/Images/TabWidget/Emblems/emblem_cyan.png" id="1_avalm"] -[ext_resource type="Script" path="res://Assets/World/Factions/Faction.gd" id="2_cp8rn"] +[ext_resource type="Script" path="res://Assets/World/Factions/FactionData.gd" id="2_wn412"] [resource] -script = ExtResource("2_cp8rn") +script = ExtResource("2_wn412") name = "Cyan" emblem = ExtResource("1_avalm") color = Color(0, 1, 1, 1) diff --git a/Assets/World/Factions/DarkGreen.tres b/Assets/World/Factions/DarkGreen.tres index 2411fff2..c601d5e5 100644 --- a/Assets/World/Factions/DarkGreen.tres +++ b/Assets/World/Factions/DarkGreen.tres @@ -1,10 +1,10 @@ -[gd_resource type="Resource" script_class="Faction" load_steps=3 format=3 uid="uid://nyv0c200hui5"] +[gd_resource type="Resource" script_class="FactionData" load_steps=3 format=3 uid="uid://nyv0c200hui5"] [ext_resource type="Texture2D" uid="uid://efpx6xwxpvrl" path="res://Assets/UI/Images/TabWidget/Emblems/emblem_dark_green.png" id="1_ha5yc"] -[ext_resource type="Script" path="res://Assets/World/Factions/Faction.gd" id="2_n3elj"] +[ext_resource type="Script" path="res://Assets/World/Factions/FactionData.gd" id="2_e0jff"] [resource] -script = ExtResource("2_n3elj") +script = ExtResource("2_e0jff") name = "Dark Green" emblem = ExtResource("1_ha5yc") color = Color(0, 0.619608, 0.0901961, 1) diff --git a/Assets/World/Factions/Faction.gd b/Assets/World/Factions/FactionData.gd similarity index 80% rename from Assets/World/Factions/Faction.gd rename to Assets/World/Factions/FactionData.gd index f8459821..0e7f2995 100644 --- a/Assets/World/Factions/Faction.gd +++ b/Assets/World/Factions/FactionData.gd @@ -1,5 +1,5 @@ extends Resource -class_name Faction +class_name FactionData @export var name: String @export var emblem: Texture2D diff --git a/Assets/World/Factions/Gray.tres b/Assets/World/Factions/Gray.tres index 6dd97e20..345354e1 100644 --- a/Assets/World/Factions/Gray.tres +++ b/Assets/World/Factions/Gray.tres @@ -1,10 +1,10 @@ -[gd_resource type="Resource" script_class="Faction" load_steps=3 format=3 uid="uid://c1c1ct71ifi3r"] +[gd_resource type="Resource" script_class="FactionData" load_steps=3 format=3 uid="uid://c1c1ct71ifi3r"] [ext_resource type="Texture2D" uid="uid://dvld4fj3lq5xs" path="res://Assets/UI/Images/TabWidget/Emblems/emblem_gray.png" id="1_q17nn"] -[ext_resource type="Script" path="res://Assets/World/Factions/Faction.gd" id="2_qpgo1"] +[ext_resource type="Script" path="res://Assets/World/Factions/FactionData.gd" id="2_5f74a"] [resource] -script = ExtResource("2_qpgo1") +script = ExtResource("2_5f74a") name = "Gray" emblem = ExtResource("1_q17nn") color = Color(0.501961, 0.501961, 0.501961, 1) diff --git a/Assets/World/Factions/Lime.tres b/Assets/World/Factions/Lime.tres index a381a478..f0d19f9d 100644 --- a/Assets/World/Factions/Lime.tres +++ b/Assets/World/Factions/Lime.tres @@ -1,10 +1,10 @@ -[gd_resource type="Resource" script_class="Faction" load_steps=3 format=3 uid="uid://bsm0256bhk4fm"] +[gd_resource type="Resource" script_class="FactionData" load_steps=3 format=3 uid="uid://bsm0256bhk4fm"] [ext_resource type="Texture2D" uid="uid://c5jntrmwtwijo" path="res://Assets/UI/Images/TabWidget/Emblems/emblem_lime_green.png" id="1_wnfcc"] -[ext_resource type="Script" path="res://Assets/World/Factions/Faction.gd" id="2_mjg4i"] +[ext_resource type="Script" path="res://Assets/World/Factions/FactionData.gd" id="2_vvqak"] [resource] -script = ExtResource("2_mjg4i") +script = ExtResource("2_vvqak") name = "Lime Green" emblem = ExtResource("1_wnfcc") color = Color(0, 1, 0, 1) diff --git a/Assets/World/Factions/Magenta.tres b/Assets/World/Factions/Magenta.tres index 1f840d26..4ae62b19 100644 --- a/Assets/World/Factions/Magenta.tres +++ b/Assets/World/Factions/Magenta.tres @@ -1,10 +1,10 @@ -[gd_resource type="Resource" script_class="Faction" load_steps=3 format=3 uid="uid://hbwgh4qp77d7"] +[gd_resource type="Resource" script_class="FactionData" load_steps=3 format=3 uid="uid://hbwgh4qp77d7"] [ext_resource type="Texture2D" uid="uid://dvamp0o0sdsyh" path="res://Assets/UI/Images/TabWidget/Emblems/emblem_pink.png" id="1_1hwxn"] -[ext_resource type="Script" path="res://Assets/World/Factions/Faction.gd" id="2_htyta"] +[ext_resource type="Script" path="res://Assets/World/Factions/FactionData.gd" id="2_otv4d"] [resource] -script = ExtResource("2_htyta") +script = ExtResource("2_otv4d") name = "Pink" emblem = ExtResource("1_1hwxn") color = Color(1, 0, 1, 1) diff --git a/Assets/World/Factions/None.tres b/Assets/World/Factions/None.tres index 17d2cbbb..20f5ccb3 100644 --- a/Assets/World/Factions/None.tres +++ b/Assets/World/Factions/None.tres @@ -1,10 +1,10 @@ -[gd_resource type="Resource" script_class="Faction" load_steps=3 format=3 uid="uid://cgggd6g0sdwvu"] +[gd_resource type="Resource" script_class="FactionData" load_steps=3 format=3 uid="uid://cgggd6g0sdwvu"] [ext_resource type="Texture2D" uid="uid://e4knd13xcgao" path="res://Assets/UI/Images/TabWidget/Emblems/emblem_no_player.png" id="1_wg7t3"] -[ext_resource type="Script" path="res://Assets/World/Factions/Faction.gd" id="2_fj6ho"] +[ext_resource type="Script" path="res://Assets/World/Factions/FactionData.gd" id="2_bfg22"] [resource] -script = ExtResource("2_fj6ho") +script = ExtResource("2_bfg22") name = "None" emblem = ExtResource("1_wg7t3") color = Color(0, 0, 0, 0) diff --git a/Assets/World/Factions/Orange.tres b/Assets/World/Factions/Orange.tres index 6674e9fc..afa0be05 100644 --- a/Assets/World/Factions/Orange.tres +++ b/Assets/World/Factions/Orange.tres @@ -1,10 +1,10 @@ -[gd_resource type="Resource" script_class="Faction" load_steps=3 format=3 uid="uid://blghtverl22rf"] +[gd_resource type="Resource" script_class="FactionData" load_steps=3 format=3 uid="uid://blghtverl22rf"] [ext_resource type="Texture2D" uid="uid://d1lyhy8qooo8n" path="res://Assets/UI/Images/TabWidget/Emblems/emblem_orange.png" id="1_8vwxm"] -[ext_resource type="Script" path="res://Assets/World/Factions/Faction.gd" id="2_27yel"] +[ext_resource type="Script" path="res://Assets/World/Factions/FactionData.gd" id="2_lkf7g"] [resource] -script = ExtResource("2_27yel") +script = ExtResource("2_lkf7g") name = "Orange" emblem = ExtResource("1_8vwxm") color = Color(0.878431, 0.4, 0, 1) diff --git a/Assets/World/Factions/Purple.tres b/Assets/World/Factions/Purple.tres index 7196c25c..6e10f044 100644 --- a/Assets/World/Factions/Purple.tres +++ b/Assets/World/Factions/Purple.tres @@ -1,10 +1,10 @@ -[gd_resource type="Resource" script_class="Faction" load_steps=3 format=3 uid="uid://bc1hbkb060dov"] +[gd_resource type="Resource" script_class="FactionData" load_steps=3 format=3 uid="uid://bc1hbkb060dov"] [ext_resource type="Texture2D" uid="uid://djl0psvlm5a4m" path="res://Assets/UI/Images/TabWidget/Emblems/emblem_purple.png" id="1_t71b6"] -[ext_resource type="Script" path="res://Assets/World/Factions/Faction.gd" id="2_4n4xg"] +[ext_resource type="Script" path="res://Assets/World/Factions/FactionData.gd" id="2_ftyla"] [resource] -script = ExtResource("2_4n4xg") +script = ExtResource("2_ftyla") name = "Purple" emblem = ExtResource("1_t71b6") color = Color(0.501961, 0, 0.501961, 1) diff --git a/Assets/World/Factions/Red.tres b/Assets/World/Factions/Red.tres index e1c7110a..77a4872f 100644 --- a/Assets/World/Factions/Red.tres +++ b/Assets/World/Factions/Red.tres @@ -1,10 +1,10 @@ -[gd_resource type="Resource" script_class="Faction" load_steps=3 format=3 uid="uid://dx1momqk6ij0k"] +[gd_resource type="Resource" script_class="FactionData" load_steps=3 format=3 uid="uid://dx1momqk6ij0k"] [ext_resource type="Texture2D" uid="uid://bgyonk7toefi1" path="res://Assets/UI/Images/TabWidget/Emblems/emblem_red.png" id="1_3a7n1"] -[ext_resource type="Script" path="res://Assets/World/Factions/Faction.gd" id="2_p7rur"] +[ext_resource type="Script" path="res://Assets/World/Factions/FactionData.gd" id="2_qjukx"] [resource] -script = ExtResource("2_p7rur") +script = ExtResource("2_qjukx") name = "Red" emblem = ExtResource("1_3a7n1") color = Color(0.980392, 0.0392157, 0.0392157, 1) diff --git a/Assets/World/Factions/Teal.tres b/Assets/World/Factions/Teal.tres index db2402e8..a5052409 100644 --- a/Assets/World/Factions/Teal.tres +++ b/Assets/World/Factions/Teal.tres @@ -1,10 +1,10 @@ -[gd_resource type="Resource" script_class="Faction" load_steps=3 format=3 uid="uid://dpyb5112r5jd7"] +[gd_resource type="Resource" script_class="FactionData" load_steps=3 format=3 uid="uid://dpyb5112r5jd7"] [ext_resource type="Texture2D" uid="uid://blnx8imlxs7ca" path="res://Assets/UI/Images/TabWidget/Emblems/emblem_teal.png" id="1_ab6ue"] -[ext_resource type="Script" path="res://Assets/World/Factions/Faction.gd" id="2_marwk"] +[ext_resource type="Script" path="res://Assets/World/Factions/FactionData.gd" id="2_n40fg"] [resource] -script = ExtResource("2_marwk") +script = ExtResource("2_n40fg") name = "Teal" emblem = ExtResource("1_ab6ue") color = Color(0, 0.568627, 0.54902, 1) diff --git a/Assets/World/Factions/White.tres b/Assets/World/Factions/White.tres index 9f08f708..8d60a8dc 100644 --- a/Assets/World/Factions/White.tres +++ b/Assets/World/Factions/White.tres @@ -1,10 +1,10 @@ -[gd_resource type="Resource" script_class="Faction" load_steps=3 format=3 uid="uid://d5fg7gfefl5s"] +[gd_resource type="Resource" script_class="FactionData" load_steps=3 format=3 uid="uid://d5fg7gfefl5s"] [ext_resource type="Texture2D" uid="uid://dq3alu7x7pcmh" path="res://Assets/UI/Images/TabWidget/Emblems/emblem_white.png" id="1_8j3lj"] -[ext_resource type="Script" path="res://Assets/World/Factions/Faction.gd" id="2_ri60c"] +[ext_resource type="Script" path="res://Assets/World/Factions/FactionData.gd" id="2_n6ium"] [resource] -script = ExtResource("2_ri60c") +script = ExtResource("2_n6ium") name = "White" emblem = ExtResource("1_8j3lj") color = Color(1, 1, 1, 1) diff --git a/Assets/World/Factions/Yellow.tres b/Assets/World/Factions/Yellow.tres index 9e5356ff..132eb58d 100644 --- a/Assets/World/Factions/Yellow.tres +++ b/Assets/World/Factions/Yellow.tres @@ -1,10 +1,10 @@ -[gd_resource type="Resource" script_class="Faction" load_steps=3 format=3 uid="uid://dihc0x5bluhku"] +[gd_resource type="Resource" script_class="FactionData" load_steps=3 format=3 uid="uid://dihc0x5bluhku"] [ext_resource type="Texture2D" uid="uid://mwy8eit5qknk" path="res://Assets/UI/Images/TabWidget/Emblems/emblem_yellow.png" id="1_i7to4"] -[ext_resource type="Script" path="res://Assets/World/Factions/Faction.gd" id="2_cxccn"] +[ext_resource type="Script" path="res://Assets/World/Factions/FactionData.gd" id="2_ny0by"] [resource] -script = ExtResource("2_cxccn") +script = ExtResource("2_ny0by") name = "Yellow" emblem = ExtResource("1_i7to4") color = Color(1, 0.839216, 0, 1) diff --git a/Assets/World/Units/Unit.gd b/Assets/World/Units/Unit.gd index 568f026b..451c692f 100644 --- a/Assets/World/Units/Unit.gd +++ b/Assets/World/Units/Unit.gd @@ -35,7 +35,7 @@ const DIRECTION = [ # Generic properties @export var unit_name = "Untitled" # user defined name for the unit -@export var faction: Global.FACTION = 0 : set = set_faction +@export var faction: Global.Faction = 0 : set = set_faction var health = -1 # health must be set or it won't auto destroy itself # Pathfinding diff --git a/Assets/World/World.gd b/Assets/World/World.gd index 99f9ddfe..fcef533e 100644 --- a/Assets/World/World.gd +++ b/Assets/World/World.gd @@ -76,14 +76,14 @@ func start_game() -> void: factions.remove_at(factions.find(ai_players[ai_player])) # Remove occupied faction from array. for ship in ships: - if ship.faction == Global.FACTION.NONE: + if ship.faction == Global.Faction.NONE: ship.faction = ai_players[ai_player] printt(ai_players[ai_player], ship.name) break # Remove any ships left over for ship in ships: - if ship.faction == Global.FACTION.NONE: + if ship.faction == Global.Faction.NONE: ship.queue_free() # Traders