conforms file names to consistant standard
This commit is contained in:
25
scripts/resources/cassette.gd
Normal file
25
scripts/resources/cassette.gd
Normal file
@@ -0,0 +1,25 @@
|
||||
class_name Cassette
|
||||
extends Item
|
||||
|
||||
enum Role {
|
||||
GENERIC = 0,
|
||||
ENGINEER = 1,
|
||||
MAGE = 2,
|
||||
}
|
||||
|
||||
@export var cost: int
|
||||
@export var rarity: Data.Rarity
|
||||
@export var role: Role
|
||||
@export var turret_scene: PackedScene
|
||||
@export var weapon_scene: PackedScene
|
||||
@export var weapon_stats: CassetteText
|
||||
@export var tower_stats: CassetteText
|
||||
@export var tags: Array[Data.cassetteTags]
|
||||
|
||||
|
||||
static func get_role_cassettes(role: Cassette.Role, cassettes: Array[Cassette] = Data.cassettes) -> Array[Cassette]:
|
||||
var valid_cassettes: Array[Cassette] = []
|
||||
for cassette: Cassette in Data.cassettes:
|
||||
if cassette.role == role:
|
||||
valid_cassettes.append(cassette)
|
||||
return valid_cassettes
|
||||
1
scripts/resources/cassette.gd.uid
Normal file
1
scripts/resources/cassette.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://d40isem6w5d8
|
||||
40
scripts/resources/cassette_text.gd
Normal file
40
scripts/resources/cassette_text.gd
Normal file
@@ -0,0 +1,40 @@
|
||||
class_name CassetteText
|
||||
extends Resource
|
||||
|
||||
@export var target_type: Array[Data.TargetType]
|
||||
@export var energy_type: Data.EnergyType
|
||||
@export var attributes: Dictionary[String, float]
|
||||
@export var features: Array[Feature]
|
||||
@export_multiline var text: String
|
||||
|
||||
|
||||
func get_attribute(attribute: String) -> float:
|
||||
if attributes.has(attribute):
|
||||
return attributes[attribute]
|
||||
return 0.0
|
||||
|
||||
|
||||
func set_attribute(attribute: String, value: float) -> void:
|
||||
attributes[attribute] = value
|
||||
|
||||
|
||||
func get_duplicate() -> CassetteText:
|
||||
var cassette_text: CassetteText = self.duplicate()
|
||||
cassette_text.target_type = target_type.duplicate()
|
||||
cassette_text.attributes = attributes.duplicate()
|
||||
cassette_text.features = features.duplicate()
|
||||
return cassette_text
|
||||
|
||||
|
||||
func tower_features_applied() -> CassetteText:
|
||||
var cassette_text: CassetteText = get_duplicate()
|
||||
for feature: Feature in features:
|
||||
feature.attach_to_tower(cassette_text)
|
||||
return cassette_text
|
||||
|
||||
|
||||
func weapon_features_applied() -> CassetteText:
|
||||
var cassette_text: CassetteText = get_duplicate()
|
||||
for feature: Feature in features:
|
||||
feature.attach_to_weapon(cassette_text)
|
||||
return cassette_text
|
||||
1
scripts/resources/cassette_text.gd.uid
Normal file
1
scripts/resources/cassette_text.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dg7gxxqfqxcmc
|
||||
15
scripts/resources/enemy.gd
Normal file
15
scripts/resources/enemy.gd
Normal file
@@ -0,0 +1,15 @@
|
||||
class_name Enemy
|
||||
extends Resource
|
||||
|
||||
@export var title: String = "enemy name goes here"
|
||||
@export var description: String = "enemy description goes here"
|
||||
@export var target_type: Data.EnemyType
|
||||
@export var icon: Texture
|
||||
@export var scene: PackedScene
|
||||
@export var death_sprite: Texture
|
||||
@export var spawn_power: int = 10
|
||||
@export var group_size: int = 5
|
||||
@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
scripts/resources/enemy.gd.uid
Normal file
1
scripts/resources/enemy.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cbwxa2a4hfcy4
|
||||
17
scripts/resources/feature.gd
Normal file
17
scripts/resources/feature.gd
Normal file
@@ -0,0 +1,17 @@
|
||||
class_name Feature
|
||||
extends Resource
|
||||
|
||||
@export var display_name: String
|
||||
@export var description: String
|
||||
@export var icon: Texture2D
|
||||
@export var strength: float
|
||||
|
||||
|
||||
@warning_ignore("unused_parameter")
|
||||
func attach_to_tower(tower_stats: CassetteText) -> void:
|
||||
pass
|
||||
|
||||
|
||||
@warning_ignore("unused_parameter")
|
||||
func attach_to_weapon(weapon_stats: CassetteText) -> void:
|
||||
pass
|
||||
1
scripts/resources/feature.gd.uid
Normal file
1
scripts/resources/feature.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bsuinotkvh7eu
|
||||
7
scripts/resources/hero_class.gd
Normal file
7
scripts/resources/hero_class.gd
Normal file
@@ -0,0 +1,7 @@
|
||||
class_name HeroClass
|
||||
extends Resource
|
||||
|
||||
@export var hero_name: String = "Default"
|
||||
@export var deck: Array[Cassette]
|
||||
@export var role: Cassette.Role
|
||||
@export var podium: PackedScene
|
||||
1
scripts/resources/hero_class.gd.uid
Normal file
1
scripts/resources/hero_class.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dcwtg2gev3uia
|
||||
5
scripts/resources/item.gd
Normal file
5
scripts/resources/item.gd
Normal file
@@ -0,0 +1,5 @@
|
||||
class_name Item
|
||||
extends Resource
|
||||
|
||||
@export var display_name: String
|
||||
@export var icon: Texture
|
||||
1
scripts/resources/item.gd.uid
Normal file
1
scripts/resources/item.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://uomjb4sj4enc
|
||||
11
scripts/resources/level_config.gd
Normal file
11
scripts/resources/level_config.gd
Normal file
@@ -0,0 +1,11 @@
|
||||
class_name LevelConfig
|
||||
extends Resource
|
||||
|
||||
@export var author: String
|
||||
@export var display_title: String
|
||||
@export var game_seed: int
|
||||
@export var hero_class: HeroClass
|
||||
@export var allowed_cassettes: Array[Cassette]
|
||||
@export var waves: Array[WaveConfig]
|
||||
@export var points_blocked: Array[int]
|
||||
@export var zone: ZoneConfig
|
||||
1
scripts/resources/level_config.gd.uid
Normal file
1
scripts/resources/level_config.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dalgif6huggwg
|
||||
22
scripts/resources/player_audio_settings.gd
Normal file
22
scripts/resources/player_audio_settings.gd
Normal file
@@ -0,0 +1,22 @@
|
||||
class_name PlayerAudioSettings
|
||||
extends Resource
|
||||
|
||||
const SAVE_PATH: String = "user://audio_settings.tres"
|
||||
|
||||
@export var master: float = 100.0
|
||||
@export var music: float = 100.0
|
||||
@export var sfx: float = 100.0
|
||||
|
||||
|
||||
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() -> void:
|
||||
ResourceSaver.save(self, SAVE_PATH)
|
||||
static func load_profile_from_disk() -> PlayerAudioSettings:
|
||||
if ResourceLoader.exists(SAVE_PATH):
|
||||
return ResourceLoader.load(SAVE_PATH)
|
||||
return PlayerAudioSettings.new()
|
||||
1
scripts/resources/player_audio_settings.gd.uid
Normal file
1
scripts/resources/player_audio_settings.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ctwk3deywlswg
|
||||
43
scripts/resources/player_graphics_settings.gd
Normal file
43
scripts/resources/player_graphics_settings.gd
Normal file
@@ -0,0 +1,43 @@
|
||||
class_name PlayerGraphicsSettings
|
||||
extends Resource
|
||||
|
||||
const SAVE_PATH: String = "user://graphics_settings.tres"
|
||||
|
||||
@export var hfov: float = 100.0
|
||||
@export var vsync_mode: int = 1
|
||||
@export var aa_mode: int = 0
|
||||
@export var windowed_mode: int = 0
|
||||
@export var vertex_jitter: float = 0.2
|
||||
@export var affine_warping: float = 1.0
|
||||
@export var resolution_scaling: float = 1.0
|
||||
|
||||
|
||||
func apply_graphical_settings(viewport: Viewport) -> void:
|
||||
#DisplayServer.window_set_vsync_mode(vsync_mode)
|
||||
match aa_mode:
|
||||
0:
|
||||
viewport.use_taa = false
|
||||
viewport.screen_space_aa = Viewport.SCREEN_SPACE_AA_DISABLED
|
||||
1:
|
||||
viewport.use_taa = false
|
||||
viewport.screen_space_aa = Viewport.SCREEN_SPACE_AA_FXAA
|
||||
2:
|
||||
viewport.use_taa = true
|
||||
viewport.screen_space_aa = Viewport.SCREEN_SPACE_AA_DISABLED
|
||||
match windowed_mode:
|
||||
0:
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
|
||||
1:
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
|
||||
2:
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN)
|
||||
RenderingServer.global_shader_parameter_set("vertex_jitter", vertex_jitter)
|
||||
RenderingServer.global_shader_parameter_set("affine_amount", affine_warping)
|
||||
|
||||
|
||||
func save_profile_to_disk() -> void:
|
||||
ResourceSaver.save(self, SAVE_PATH)
|
||||
static func load_profile_from_disk() -> PlayerGraphicsSettings:
|
||||
if ResourceLoader.exists(SAVE_PATH):
|
||||
return ResourceLoader.load(SAVE_PATH)
|
||||
return PlayerGraphicsSettings.new()
|
||||
1
scripts/resources/player_graphics_settings.gd.uid
Normal file
1
scripts/resources/player_graphics_settings.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bte0pj6bwedb0
|
||||
23
scripts/resources/player_preferences.gd
Normal file
23
scripts/resources/player_preferences.gd
Normal file
@@ -0,0 +1,23 @@
|
||||
class_name PlayerPreferences
|
||||
extends Resource
|
||||
|
||||
const SAVE_PATH: String = "user://preferences.tres"
|
||||
|
||||
@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
|
||||
@export var always_show_shield_ui: bool = false
|
||||
|
||||
|
||||
func save_profile_to_disk() -> void:
|
||||
ResourceSaver.save(self, SAVE_PATH)
|
||||
static func load_profile_from_disk() -> PlayerPreferences:
|
||||
if ResourceLoader.exists(SAVE_PATH):
|
||||
return ResourceLoader.load(SAVE_PATH)
|
||||
return PlayerPreferences.new()
|
||||
1
scripts/resources/player_preferences.gd.uid
Normal file
1
scripts/resources/player_preferences.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c78bl6r5qlday
|
||||
47
scripts/resources/player_profile.gd
Normal file
47
scripts/resources/player_profile.gd
Normal file
@@ -0,0 +1,47 @@
|
||||
class_name PlayerProfile
|
||||
extends Resource
|
||||
|
||||
signal display_name_changed(old_name: String, new_name: String)
|
||||
signal preferred_class_changed(old_class: int, new_class: int)
|
||||
|
||||
const SAVE_PATH: String = "user://profile.tres"
|
||||
|
||||
@export var display_name: String = "Charlie"
|
||||
@export var preferred_class: int = 0
|
||||
|
||||
func to_dict() -> Dictionary:
|
||||
var dict: Dictionary = {}
|
||||
dict["display_name"] = display_name
|
||||
dict["preferred_class"] = preferred_class
|
||||
return dict
|
||||
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: String) -> void:
|
||||
if new_display_name == display_name:
|
||||
return
|
||||
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: int) -> void:
|
||||
if new_preferred_class == preferred_class:
|
||||
return
|
||||
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() -> void:
|
||||
ResourceSaver.save(self, SAVE_PATH)
|
||||
static func load_profile_from_disk() -> PlayerProfile:
|
||||
if ResourceLoader.exists(SAVE_PATH):
|
||||
return ResourceLoader.load(SAVE_PATH)
|
||||
return PlayerProfile.new()
|
||||
1
scripts/resources/player_profile.gd.uid
Normal file
1
scripts/resources/player_profile.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b1s4nrql8i1sm
|
||||
136
scripts/resources/save_data.gd
Normal file
136
scripts/resources/save_data.gd
Normal file
@@ -0,0 +1,136 @@
|
||||
class_name SaveData
|
||||
extends RefCounted
|
||||
|
||||
var save_slot: int = 0
|
||||
|
||||
#Game History
|
||||
var twenty_game_history: Array[bool] = []
|
||||
var wins: int = 0
|
||||
var losses: int = 0
|
||||
var winrate: int :
|
||||
get():
|
||||
return int((float(twenty_game_history.count(true)) / float(twenty_game_history.size())) * 100.0)
|
||||
set(_value):
|
||||
return
|
||||
|
||||
|
||||
var level_high_scores: Dictionary = {}
|
||||
var endless_high_scores: Dictionary = {}
|
||||
|
||||
#Engineer
|
||||
var engineer_cassettes_bought: int = 0
|
||||
|
||||
|
||||
#Unlocking the mage
|
||||
var mage_cassette_seen_in_shop: bool = false
|
||||
var mage_cassettes_bought: int = 0
|
||||
var mage_unlocked: bool = 0
|
||||
|
||||
|
||||
func get_unlocked_classes() -> Array[HeroClass]:
|
||||
var arr: Array[HeroClass] = []
|
||||
for character: HeroClass in Data.characters:
|
||||
if character.role == Cassette.Role.ENGINEER:
|
||||
arr.append(Data.characters)
|
||||
#TODO: When mage cassettes are good to show up in the shop, replace false with mage_unlocked
|
||||
if false and character.role == Cassette.Role.MAGE:
|
||||
arr.append(Data.characters)
|
||||
return arr
|
||||
|
||||
|
||||
func check_high_score(level_title: String, wave_reached: int, endless: bool) -> void:
|
||||
if !endless_high_scores.has(level_title):
|
||||
endless_high_scores[level_title] = 0
|
||||
if !level_high_scores.has(level_title):
|
||||
level_high_scores[level_title] = 0
|
||||
if endless and endless_high_scores[level_title] < wave_reached:
|
||||
endless_high_scores[level_title] = wave_reached
|
||||
elif level_high_scores[level_title] < wave_reached:
|
||||
level_high_scores[level_title] = wave_reached
|
||||
|
||||
|
||||
func add_game_outcome(outcome: bool) -> void:
|
||||
if outcome:
|
||||
wins += 1
|
||||
else:
|
||||
losses += 1
|
||||
twenty_game_history.push_back(outcome)
|
||||
if twenty_game_history.size() > 20:
|
||||
twenty_game_history.pop_front()
|
||||
|
||||
|
||||
func unlock_all_content() -> void:
|
||||
mage_unlocked = true
|
||||
|
||||
|
||||
func lock_all_content() -> void:
|
||||
mage_unlocked = false
|
||||
|
||||
|
||||
func bought_engineer_cassette() -> void:
|
||||
engineer_cassettes_bought += 1
|
||||
|
||||
|
||||
func saw_mage_cassette_in_shop() -> void:
|
||||
mage_cassette_seen_in_shop = true
|
||||
save_to_disc()
|
||||
|
||||
|
||||
func bought_mage_cassette() -> void:
|
||||
mage_cassettes_bought += 1
|
||||
if mage_cassettes_bought >= 10:
|
||||
mage_unlocked = true
|
||||
save_to_disc()
|
||||
|
||||
|
||||
func save_to_disc() -> void:
|
||||
var dir: DirAccess = DirAccess.open("user://")
|
||||
if !dir.dir_exists("saves"):
|
||||
dir.make_dir("saves")
|
||||
dir.change_dir("saves")
|
||||
var save_file: FileAccess = FileAccess.open("user://saves/slot" + str(save_slot), FileAccess.WRITE)
|
||||
var dict: Dictionary = {
|
||||
"wins" = wins,
|
||||
"losses" = losses,
|
||||
"twenty_game_history" = twenty_game_history,
|
||||
"engineer_cassettes_bought" = engineer_cassettes_bought,
|
||||
"mage_cassette_seen_in_shop" = mage_cassette_seen_in_shop,
|
||||
"mage_cassettes_bought" = mage_cassettes_bought,
|
||||
"mage_unlocked" = mage_unlocked,
|
||||
"level_high_scores" = level_high_scores,
|
||||
"endless_high_scores" = endless_high_scores
|
||||
}
|
||||
var json_string: String = JSON.stringify(dict)
|
||||
save_file.store_line(json_string)
|
||||
|
||||
|
||||
static func load_from_disk(slot: int) -> SaveData:
|
||||
if FileAccess.file_exists("user://saves/slot" + str(slot)):
|
||||
var save_file: FileAccess = FileAccess.open("user://saves/slot" + str(slot), FileAccess.READ)
|
||||
var json_string: String = save_file.get_line()
|
||||
var json: JSON = JSON.new()
|
||||
var parse_result: Error = json.parse(json_string)
|
||||
if parse_result == OK:
|
||||
var dict: Dictionary = json.data
|
||||
var stats: SaveData = SaveData.new()
|
||||
stats.save_slot = slot
|
||||
if dict.has("wins"):
|
||||
stats.wins = dict["wins"]
|
||||
if dict.has("losses"):
|
||||
stats.losses = dict["losses"]
|
||||
if dict.has("twenty_game_history"):
|
||||
stats.twenty_game_history.append_array(dict["twenty_game_history"])
|
||||
if dict.has("engineer_cassettes_bought"):
|
||||
stats.engineer_cassettes_bought = dict["engineer_cassettes_bought"]
|
||||
if dict.has("mage_cassette_seen_in_shop"):
|
||||
stats.mage_cassette_seen_in_shop = dict["mage_cassette_seen_in_shop"]
|
||||
if dict.has("mage_cassettes_bought"):
|
||||
stats.mage_cassettes_bought = dict["mage_cassettes_bought"]
|
||||
if dict.has("mage_unlocked"):
|
||||
stats.mage_unlocked = dict["mage_unlocked"]
|
||||
if dict.has("level_high_scores"):
|
||||
stats.level_high_scores = dict["level_high_scores"]
|
||||
if dict.has("endless_high_scores"):
|
||||
stats.endless_high_scores = dict["endless_high_scores"]
|
||||
return stats
|
||||
return SaveData.new()
|
||||
1
scripts/resources/save_data.gd.uid
Normal file
1
scripts/resources/save_data.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://6tvi4ox481cp
|
||||
5
scripts/resources/stat_attribute.gd
Normal file
5
scripts/resources/stat_attribute.gd
Normal file
@@ -0,0 +1,5 @@
|
||||
class_name StatAttribute
|
||||
extends Resource
|
||||
|
||||
@export var key: String
|
||||
@export var value: float
|
||||
1
scripts/resources/stat_attribute.gd.uid
Normal file
1
scripts/resources/stat_attribute.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://yjb0uv6og430
|
||||
9
scripts/resources/status_stats.gd
Normal file
9
scripts/resources/status_stats.gd
Normal file
@@ -0,0 +1,9 @@
|
||||
class_name StatusStats
|
||||
extends Resource
|
||||
|
||||
@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
|
||||
1
scripts/resources/status_stats.gd.uid
Normal file
1
scripts/resources/status_stats.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bq6jp8bwub6je
|
||||
Reference in New Issue
Block a user