Skip to content

Commit

Permalink
Rename Faction class to FactionData
Browse files Browse the repository at this point in the history
  • Loading branch information
juliohq committed Sep 4, 2023
1 parent 42b10e8 commit cc9d1ee
Show file tree
Hide file tree
Showing 20 changed files with 51 additions and 51 deletions.
2 changes: 1 addition & 1 deletion Assets/Player/Player.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
extends Control
class_name Player

var faction = Global.FACTION.NONE
var faction = Global.Faction.NONE

var settlements = []
var ships = []
Expand Down
2 changes: 1 addition & 1 deletion Assets/UI/InfoWidgets/CityInfo.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Assets/World/Factions/Black.tres
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 3 additions & 3 deletions Assets/World/Factions/Blue.tres
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 3 additions & 3 deletions Assets/World/Factions/Bordeaux.tres
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 3 additions & 3 deletions Assets/World/Factions/Cyan.tres
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 3 additions & 3 deletions Assets/World/Factions/DarkGreen.tres
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extends Resource
class_name Faction
class_name FactionData

@export var name: String
@export var emblem: Texture2D
Expand Down
6 changes: 3 additions & 3 deletions Assets/World/Factions/Gray.tres
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 3 additions & 3 deletions Assets/World/Factions/Lime.tres
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 3 additions & 3 deletions Assets/World/Factions/Magenta.tres
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 3 additions & 3 deletions Assets/World/Factions/None.tres
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 3 additions & 3 deletions Assets/World/Factions/Orange.tres
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 3 additions & 3 deletions Assets/World/Factions/Purple.tres
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 3 additions & 3 deletions Assets/World/Factions/Red.tres
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 3 additions & 3 deletions Assets/World/Factions/Teal.tres
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 3 additions & 3 deletions Assets/World/Factions/White.tres
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 3 additions & 3 deletions Assets/World/Factions/Yellow.tres
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion Assets/World/Units/Unit.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Assets/World/World.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cc9d1ee

Please sign in to comment.