enabled enforced static typing
This commit is contained in:
@ -1,11 +1,10 @@
|
||||
extends Item
|
||||
class_name Card
|
||||
class_name Card extends Item
|
||||
|
||||
enum Faction {GENERIC = 0}
|
||||
|
||||
@export var rarity : Data.Rarity
|
||||
@export var faction : Faction
|
||||
@export var turret_scene : PackedScene
|
||||
@export var weapon_scene : PackedScene
|
||||
@export var weapon_stats : CardText
|
||||
@export var tower_stats : CardText
|
||||
@export var rarity: Data.Rarity
|
||||
@export var faction: Faction
|
||||
@export var turret_scene: PackedScene
|
||||
@export var weapon_scene: PackedScene
|
||||
@export var weapon_stats: CardText
|
||||
@export var tower_stats: CardText
|
||||
|
@ -1,13 +1,12 @@
|
||||
extends Resource
|
||||
class_name CardText
|
||||
class_name CardText extends Resource
|
||||
|
||||
@export var target_type : Data.TargetType
|
||||
@export var attributes : Array[StatAttribute]
|
||||
@export_multiline var text : String
|
||||
@export var target_type: Data.TargetType
|
||||
@export var attributes: Array[StatAttribute]
|
||||
@export_multiline var text: String
|
||||
|
||||
|
||||
func get_attribute(attribute : String) -> float:
|
||||
for stat in attributes:
|
||||
func get_attribute(attribute: String) -> float:
|
||||
for stat: StatAttribute in attributes:
|
||||
if stat.key == attribute:
|
||||
return stat.value
|
||||
return 0.0
|
||||
|
@ -1,13 +1,12 @@
|
||||
extends Resource
|
||||
class_name Enemy
|
||||
class_name Enemy extends Resource
|
||||
|
||||
@export var title := "dog"
|
||||
@export var title: String = "dog"
|
||||
@export var target_type: Data.EnemyType
|
||||
@export var icon: Texture
|
||||
@export var death_sprite: Texture
|
||||
@export var sprite: AtlasTexture
|
||||
@export var spawn_power:= 10
|
||||
@export var health := 100
|
||||
@export var penalty := 10
|
||||
@export var movement_speed := 0.5
|
||||
@export var spawn_cooldown := 1.0
|
||||
@export var spawn_power: int = 10
|
||||
@export var health: int = 100
|
||||
@export var penalty: int = 10
|
||||
@export var movement_speed: float = 0.5
|
||||
@export var spawn_cooldown: float = 1.0
|
||||
|
@ -1,7 +1,6 @@
|
||||
extends Resource
|
||||
class_name HeroClass
|
||||
class_name HeroClass extends Resource
|
||||
|
||||
@export var hero_name : String = "Default"
|
||||
@export var texture : Texture
|
||||
@export var hand_texture : Texture
|
||||
@export var deck : Array[Card]
|
||||
@export var hero_name: String = "Default"
|
||||
@export var texture: Texture
|
||||
@export var hand_texture: Texture
|
||||
@export var deck: Array[Card]
|
||||
|
@ -1,5 +1,4 @@
|
||||
extends Resource
|
||||
class_name Item
|
||||
class_name Item extends Resource
|
||||
|
||||
@export var display_name : String
|
||||
@export var icon : Texture
|
||||
@export var display_name: String
|
||||
@export var icon: Texture
|
||||
|
@ -1,20 +1,19 @@
|
||||
extends Resource
|
||||
class_name PlayerAudioSettings
|
||||
class_name PlayerAudioSettings extends Resource
|
||||
|
||||
const SAVE_PATH := "user://audio_settings.tres"
|
||||
const SAVE_PATH: String = "user://audio_settings.tres"
|
||||
|
||||
@export var master := 100.0
|
||||
@export var music := 100.0
|
||||
@export var sfx := 100.0
|
||||
@export var master: float = 100.0
|
||||
@export var music: float = 100.0
|
||||
@export var sfx: float = 100.0
|
||||
|
||||
|
||||
func apply_audio_settings():
|
||||
func apply_audio_settings() -> void:
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), linear_to_db(master / 100.0))
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Music"), linear_to_db(music / 100.0))
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("SFX"), linear_to_db(sfx / 100.0))
|
||||
|
||||
|
||||
func save_profile_to_disk():
|
||||
func save_profile_to_disk() -> void:
|
||||
ResourceSaver.save(self, SAVE_PATH)
|
||||
static func load_profile_from_disk() -> PlayerAudioSettings:
|
||||
if ResourceLoader.exists(SAVE_PATH):
|
||||
|
@ -1,15 +1,14 @@
|
||||
extends Resource
|
||||
class_name PlayerGraphicsSettings
|
||||
class_name PlayerGraphicsSettings extends Resource
|
||||
|
||||
const SAVE_PATH := "user://graphics_settings.tres"
|
||||
const SAVE_PATH: String = "user://graphics_settings.tres"
|
||||
|
||||
@export var hfov := 100.0
|
||||
@export var vsync_mode := 1
|
||||
@export var aa_mode := 0
|
||||
@export var windowed_mode := 0
|
||||
@export var hfov: float = 100.0
|
||||
@export var vsync_mode: int = 1
|
||||
@export var aa_mode: int = 0
|
||||
@export var windowed_mode: int = 0
|
||||
|
||||
|
||||
func apply_graphical_settings(viewport):
|
||||
func apply_graphical_settings(viewport: Viewport) -> void:
|
||||
DisplayServer.window_set_vsync_mode(vsync_mode)
|
||||
match aa_mode:
|
||||
0:
|
||||
@ -30,7 +29,7 @@ func apply_graphical_settings(viewport):
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN)
|
||||
|
||||
|
||||
func save_profile_to_disk():
|
||||
func save_profile_to_disk() -> void:
|
||||
ResourceSaver.save(self, SAVE_PATH)
|
||||
static func load_profile_from_disk() -> PlayerGraphicsSettings:
|
||||
if ResourceLoader.exists(SAVE_PATH):
|
||||
|
@ -1,60 +1,173 @@
|
||||
extends Resource
|
||||
class_name PlayerKeymap
|
||||
class_name PlayerKeymap extends Resource
|
||||
|
||||
const SAVE_PATH := "user://keymap.tres"
|
||||
const SAVE_PATH: String = "user://keymap.tres"
|
||||
|
||||
@export var title : String
|
||||
@export var title: String
|
||||
|
||||
@export var move_forward : InputEventKey
|
||||
@export var move_backward : InputEventKey
|
||||
@export var move_left : InputEventKey
|
||||
@export var move_right : InputEventKey
|
||||
@export var jump : InputEventKey
|
||||
@export var sprint : InputEventKey
|
||||
@export var interact : InputEventKey
|
||||
@export var open_text_chat : InputEventKey
|
||||
@export var ready : InputEventKey
|
||||
@export var pause : InputEventKey
|
||||
@export var equip_card_in_gauntlet : InputEventKey
|
||||
@export var view_map : InputEventKey
|
||||
@export_category("Primary Bindings")
|
||||
@export var move_forward: InputEvent
|
||||
@export var move_backward: InputEvent
|
||||
@export var move_left: InputEvent
|
||||
@export var move_right: InputEvent
|
||||
@export var jump: InputEvent
|
||||
@export var sprint: InputEvent
|
||||
@export var interact: InputEvent
|
||||
@export var open_text_chat: InputEvent
|
||||
@export var ready: InputEvent
|
||||
@export var pause: InputEvent
|
||||
@export var equip_card_in_gauntlet: InputEvent
|
||||
@export var view_map: InputEvent
|
||||
@export var fire1: InputEvent
|
||||
@export var fire2: InputEvent
|
||||
@export var select_next_card: InputEvent
|
||||
@export var select_prev_card: InputEvent
|
||||
|
||||
@export_category("Secondary Bindings")
|
||||
@export var secondary_move_forward: InputEvent
|
||||
@export var secondary_move_backward: InputEvent
|
||||
@export var secondary_move_left: InputEvent
|
||||
@export var secondary_move_right: InputEvent
|
||||
@export var secondary_jump: InputEvent
|
||||
@export var secondary_sprint: InputEvent
|
||||
@export var secondary_interact: InputEvent
|
||||
@export var secondary_open_text_chat: InputEvent
|
||||
@export var secondary_ready: InputEvent
|
||||
@export var secondary_pause: InputEvent
|
||||
@export var secondary_equip_card_in_gauntlet: InputEvent
|
||||
@export var secondary_view_map: InputEvent
|
||||
@export var secondary_fire1: InputEvent
|
||||
@export var secondary_fire2: InputEvent
|
||||
@export var secondary_select_next_card: InputEvent
|
||||
@export var secondary_select_prev_card: InputEvent
|
||||
|
||||
|
||||
func apply():
|
||||
replace_action_event("Move Forward", move_forward)
|
||||
replace_action_event("Move Backward", move_backward)
|
||||
replace_action_event("Move Left", move_left)
|
||||
replace_action_event("Move Right", move_right)
|
||||
replace_action_event("Jump", jump)
|
||||
replace_action_event("Sprint", sprint)
|
||||
replace_action_event("Interact", interact)
|
||||
replace_action_event("Open Text Chat", open_text_chat)
|
||||
replace_action_event("Ready", ready)
|
||||
replace_action_event("Pause", pause)
|
||||
replace_action_event("Equip In Gauntlet", equip_card_in_gauntlet)
|
||||
replace_action_event("View Map", view_map)
|
||||
func apply() -> void:
|
||||
replace_action_event("Move Forward", move_forward, secondary_move_forward)
|
||||
replace_action_event("Move Backward", move_backward, secondary_move_backward)
|
||||
replace_action_event("Move Left", move_left, secondary_move_left)
|
||||
replace_action_event("Move Right", move_right, secondary_move_right)
|
||||
replace_action_event("Jump", jump, secondary_jump)
|
||||
replace_action_event("Sprint", sprint, secondary_sprint)
|
||||
replace_action_event("Interact", interact, secondary_interact)
|
||||
replace_action_event("Open Text Chat", open_text_chat, secondary_open_text_chat)
|
||||
replace_action_event("Ready", ready, secondary_ready)
|
||||
replace_action_event("Pause", pause, secondary_pause)
|
||||
replace_action_event("Equip In Gauntlet", equip_card_in_gauntlet, secondary_equip_card_in_gauntlet)
|
||||
replace_action_event("View Map", view_map, secondary_view_map)
|
||||
replace_action_event("Primary Fire", fire1, secondary_fire1)
|
||||
replace_action_event("Secondary Fire", fire2, secondary_fire2)
|
||||
replace_action_event("Select Next Card", select_next_card, secondary_select_next_card)
|
||||
replace_action_event("Select Previous Card", select_prev_card, secondary_select_prev_card)
|
||||
|
||||
|
||||
func replace_action_event(action_string, event):
|
||||
func replace_action_event(action_string: String, event: InputEvent, secondary_event: InputEvent) -> void:
|
||||
InputMap.action_erase_events(action_string)
|
||||
InputMap.action_add_event(action_string, event)
|
||||
if event:
|
||||
InputMap.action_add_event(action_string, event)
|
||||
if secondary_event:
|
||||
InputMap.action_add_event(action_string, secondary_event)
|
||||
|
||||
|
||||
func get_current_input_map():
|
||||
func set_primary_action_event(action_string: String, event: InputEvent) -> void:
|
||||
var secondary_event: InputEvent
|
||||
if InputMap.action_get_events(action_string).size() > 1:
|
||||
secondary_event = InputMap.action_get_events(action_string)[1]
|
||||
replace_action_event(action_string, event, secondary_event)
|
||||
|
||||
|
||||
func set_secondary_action_event(action_string: String, event: InputEvent) -> void:
|
||||
var primary_event: InputEvent
|
||||
if InputMap.action_get_events(action_string).size() > 0:
|
||||
primary_event = InputMap.action_get_events(action_string)[0]
|
||||
replace_action_event(action_string, primary_event, event)
|
||||
|
||||
|
||||
func append_input_map() -> void:
|
||||
InputMap.action_add_event("Move Forward", move_forward)
|
||||
InputMap.action_add_event("Move Backward", move_backward)
|
||||
InputMap.action_add_event("Move Left", move_left)
|
||||
InputMap.action_add_event("Move Right", move_right)
|
||||
InputMap.action_add_event("Jump", jump)
|
||||
InputMap.action_add_event("Sprint", sprint)
|
||||
InputMap.action_add_event("Interact", interact)
|
||||
InputMap.action_add_event("Open Text Chat", open_text_chat)
|
||||
InputMap.action_add_event("Ready", ready)
|
||||
InputMap.action_add_event("Pause", pause)
|
||||
InputMap.action_add_event("Equip In Gauntlet", equip_card_in_gauntlet)
|
||||
InputMap.action_add_event("View Map", view_map)
|
||||
InputMap.action_add_event("Primary Fire", fire1)
|
||||
InputMap.action_add_event("Secondary Fire", fire2)
|
||||
InputMap.action_add_event("Select Next Card", select_next_card)
|
||||
InputMap.action_add_event("Select Previous Card", select_prev_card)
|
||||
|
||||
|
||||
func get_current_input_map() -> void:
|
||||
move_forward = InputMap.action_get_events("Move Forward")[0]
|
||||
if InputMap.action_get_events("Move Forward").size() > 1:
|
||||
secondary_move_forward = InputMap.action_get_events("Move Forward")[1]
|
||||
|
||||
move_backward = InputMap.action_get_events("Move Backward")[0]
|
||||
if InputMap.action_get_events("Move Backward").size() > 1:
|
||||
secondary_move_backward = InputMap.action_get_events("Move Backward")[1]
|
||||
|
||||
move_left = InputMap.action_get_events("Move Left")[0]
|
||||
if InputMap.action_get_events("Move Left").size() > 1:
|
||||
secondary_move_left = InputMap.action_get_events("Move Left")[1]
|
||||
|
||||
move_right = InputMap.action_get_events("Move Right")[0]
|
||||
if InputMap.action_get_events("Move Right").size() > 1:
|
||||
secondary_move_right = InputMap.action_get_events("Move Right")[1]
|
||||
|
||||
jump = InputMap.action_get_events("Jump")[0]
|
||||
if InputMap.action_get_events("Jump").size() > 1:
|
||||
secondary_jump = InputMap.action_get_events("Jump")[1]
|
||||
|
||||
sprint = InputMap.action_get_events("Sprint")[0]
|
||||
if InputMap.action_get_events("Sprint").size() > 1:
|
||||
secondary_sprint = InputMap.action_get_events("Sprint")[1]
|
||||
|
||||
interact = InputMap.action_get_events("Interact")[0]
|
||||
if InputMap.action_get_events("Interact").size() > 1:
|
||||
secondary_interact = InputMap.action_get_events("Interact")[1]
|
||||
|
||||
open_text_chat = InputMap.action_get_events("Open Text Chat")[0]
|
||||
if InputMap.action_get_events("Open Text Chat").size() > 1:
|
||||
secondary_open_text_chat = InputMap.action_get_events("Open Text Chat")[1]
|
||||
|
||||
ready = InputMap.action_get_events("Ready")[0]
|
||||
if InputMap.action_get_events("Ready").size() > 1:
|
||||
secondary_ready = InputMap.action_get_events("Ready")[1]
|
||||
|
||||
pause = InputMap.action_get_events("Pause")[0]
|
||||
if InputMap.action_get_events("Pause").size() > 1:
|
||||
secondary_pause = InputMap.action_get_events("Pause")[1]
|
||||
|
||||
equip_card_in_gauntlet = InputMap.action_get_events("Equip In Gauntlet")[0]
|
||||
if InputMap.action_get_events("Equip In Gauntlet").size() > 1:
|
||||
secondary_equip_card_in_gauntlet = InputMap.action_get_events("Equip In Gauntlet")[1]
|
||||
|
||||
view_map = InputMap.action_get_events("View Map")[0]
|
||||
if InputMap.action_get_events("View Map").size() > 1:
|
||||
secondary_view_map = InputMap.action_get_events("View Map")[1]
|
||||
|
||||
fire1 = InputMap.action_get_events("Primary Fire")[0]
|
||||
if InputMap.action_get_events("Primary Fire").size() > 1:
|
||||
secondary_fire1 = InputMap.action_get_events("Primary Fire")[1]
|
||||
|
||||
fire2 = InputMap.action_get_events("Secondary Fire")[0]
|
||||
if InputMap.action_get_events("Secondary Fire").size() > 1:
|
||||
secondary_fire2 = InputMap.action_get_events("Secondary Fire")[1]
|
||||
|
||||
select_next_card = InputMap.action_get_events("Select Next Card")[0]
|
||||
if InputMap.action_get_events("Select Next Card").size() > 1:
|
||||
secondary_select_next_card = InputMap.action_get_events("Select Next Card")[1]
|
||||
|
||||
select_prev_card = InputMap.action_get_events("Select Previous Card")[0]
|
||||
if InputMap.action_get_events("Select Previous Card").size() > 1:
|
||||
secondary_select_prev_card = InputMap.action_get_events("Select Previous Card")[1]
|
||||
|
||||
|
||||
func save_profile_to_disk():
|
||||
func save_profile_to_disk() -> void:
|
||||
get_current_input_map()
|
||||
ResourceSaver.save(self, SAVE_PATH)
|
||||
static func load_profile_from_disk() -> PlayerKeymap:
|
||||
|
@ -1,20 +1,19 @@
|
||||
extends Resource
|
||||
class_name PlayerPreferences
|
||||
class_name PlayerPreferences extends Resource
|
||||
|
||||
const SAVE_PATH := "user://preferences.tres"
|
||||
const SAVE_PATH: String = "user://preferences.tres"
|
||||
|
||||
@export var mouse_sens := 28.0
|
||||
@export var invert_lookY := false
|
||||
@export var invert_lookX := false
|
||||
@export var toggle_sprint := false
|
||||
@export var fixed_minimap := false
|
||||
@export var display_tower_damage_indicators := true
|
||||
@export var display_self_damage_indicators := true
|
||||
@export var display_party_damage_indicators := true
|
||||
@export var display_status_effect_damage_indicators := true
|
||||
@export var mouse_sens: float = 28.0
|
||||
@export var invert_lookY: bool = false
|
||||
@export var invert_lookX: bool = false
|
||||
@export var toggle_sprint: bool = false
|
||||
@export var fixed_minimap: bool = false
|
||||
@export var display_tower_damage_indicators: bool = true
|
||||
@export var display_self_damage_indicators: bool = true
|
||||
@export var display_party_damage_indicators: bool = true
|
||||
@export var display_status_effect_damage_indicators: bool = true
|
||||
|
||||
|
||||
func save_profile_to_disk():
|
||||
func save_profile_to_disk() -> void:
|
||||
ResourceSaver.save(self, SAVE_PATH)
|
||||
static func load_profile_from_disk() -> PlayerPreferences:
|
||||
if ResourceLoader.exists(SAVE_PATH):
|
||||
|
@ -1,45 +1,44 @@
|
||||
extends Resource
|
||||
class_name PlayerProfile
|
||||
class_name PlayerProfile extends Resource
|
||||
|
||||
signal display_name_changed(old_name, new_name)
|
||||
signal preferred_class_changed(old_class, new_class)
|
||||
signal display_name_changed(old_name: String, new_name: String)
|
||||
signal preferred_class_changed(old_class: int, new_class: int)
|
||||
|
||||
const SAVE_PATH := "user://profile.tres"
|
||||
const SAVE_PATH: String = "user://profile.tres"
|
||||
|
||||
@export var display_name := "Charlie"
|
||||
@export var preferred_class := 0
|
||||
@export var display_name: String = "Charlie"
|
||||
@export var preferred_class: int = 0
|
||||
|
||||
func to_dict() -> Dictionary:
|
||||
var dict = {}
|
||||
var dict: Dictionary = {}
|
||||
dict["display_name"] = display_name
|
||||
dict["preferred_class"] = preferred_class
|
||||
return dict
|
||||
static func from_dict(dict) -> PlayerProfile:
|
||||
var output = PlayerProfile.new()
|
||||
static func from_dict(dict: Dictionary) -> PlayerProfile:
|
||||
var output: PlayerProfile = PlayerProfile.new()
|
||||
output.display_name = dict["display_name"]
|
||||
output.preferred_class = dict["preferred_class"]
|
||||
return output
|
||||
|
||||
func set_display_name(new_display_name):
|
||||
func set_display_name(new_display_name: String) -> void:
|
||||
if new_display_name == display_name:
|
||||
return
|
||||
var old_name = display_name
|
||||
var old_name: String = display_name
|
||||
display_name = new_display_name
|
||||
save_profile_to_disk()
|
||||
display_name_changed.emit(old_name, display_name)
|
||||
func get_display_name() -> String:
|
||||
return display_name
|
||||
|
||||
func set_preferred_class(new_preferred_class):
|
||||
func set_preferred_class(new_preferred_class: int) -> void:
|
||||
if new_preferred_class == preferred_class:
|
||||
return
|
||||
var old_class = preferred_class
|
||||
var old_class: int = preferred_class
|
||||
preferred_class = new_preferred_class
|
||||
preferred_class_changed.emit(old_class, preferred_class)
|
||||
func get_preferred_class() -> int:
|
||||
return preferred_class
|
||||
|
||||
func save_profile_to_disk():
|
||||
func save_profile_to_disk() -> void:
|
||||
ResourceSaver.save(self, SAVE_PATH)
|
||||
static func load_profile_from_disk() -> PlayerProfile:
|
||||
if ResourceLoader.exists(SAVE_PATH):
|
||||
|
@ -1,7 +1,6 @@
|
||||
extends Resource
|
||||
class_name SaveStats
|
||||
class_name SaveStats extends Resource
|
||||
|
||||
const SAVE_PATH := "user://save_stats.tres"
|
||||
const SAVE_PATH: String = "user://save_stats.tres"
|
||||
|
||||
@export var wins: int
|
||||
@export var losses: int
|
||||
@ -18,7 +17,7 @@ func add_game_outcome(outcome: bool) -> void:
|
||||
twenty_game_history.pop_front()
|
||||
|
||||
|
||||
func save_profile_to_disk():
|
||||
func save_profile_to_disk() -> void:
|
||||
ResourceSaver.save(self, SAVE_PATH)
|
||||
static func load_profile_from_disk() -> SaveStats:
|
||||
if ResourceLoader.exists(SAVE_PATH):
|
||||
|
@ -1,5 +1,4 @@
|
||||
extends Resource
|
||||
class_name StatAttribute
|
||||
class_name StatAttribute extends Resource
|
||||
|
||||
@export var key : String
|
||||
@export var value : float
|
||||
@export var key: String
|
||||
@export var value: float
|
||||
|
@ -1,9 +1,8 @@
|
||||
extends Resource
|
||||
class_name StatusStats
|
||||
class_name StatusStats extends Resource
|
||||
|
||||
@export var name : String
|
||||
@export var max_stacks := 0
|
||||
@export var proc_cd := 0.0
|
||||
@export var duration := 1.0
|
||||
@export var potency := 1.0
|
||||
@export var icon : Texture
|
||||
@export var name: String
|
||||
@export var max_stacks: int = 0
|
||||
@export var proc_cd: float = 0.0
|
||||
@export var duration: float = 1.0
|
||||
@export var potency: float = 1.0
|
||||
@export var icon: Texture
|
||||
|
Reference in New Issue
Block a user