-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
315 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[gd_resource type="Resource" script_class="Hero" load_steps=2 format=3 uid="uid://dehs0xqbalevx"] | ||
|
||
[ext_resource type="Script" path="res://actors/heroes/hero.gd" id="1_6aguh"] | ||
|
||
[resource] | ||
script = ExtResource("1_6aguh") | ||
name = "Vex 'Quantum' Cygnus" | ||
bounty_target = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[gd_resource type="Resource" script_class="Hero" load_steps=2 format=3 uid="uid://qlbnowlag2dr"] | ||
|
||
[ext_resource type="Script" path="res://actors/heroes/hero.gd" id="1_5sbmg"] | ||
|
||
[resource] | ||
script = ExtResource("1_5sbmg") | ||
name = "Zora 'Starshiv' Blackburn" | ||
bounty_target = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
extends Resource | ||
class_name Hero | ||
|
||
## A "hero" is any named NPC. | ||
## | ||
## These are often used as a target or escort in missions. | ||
|
||
## The name of the hero. | ||
@export var name: String | ||
|
||
## Whether this hero is eligible to be targeted in bounty missions. | ||
@export var bounty_target: bool = false | ||
|
||
## Fires when this hero is killed in combat. | ||
signal killed(hero: Hero) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
extends Node3D | ||
class_name HeroRoster | ||
|
||
## Maintains a list of [Hero]s that are alive in the game. | ||
|
||
## Current heroes. | ||
## | ||
## NOTE: This array must not be mutated at runtime from outside this class! | ||
@export var heroes: Array[Hero] = []: | ||
set(value): | ||
if value == heroes: | ||
return | ||
|
||
self._unsubscribe_from_heroes() | ||
heroes = value.duplicate() | ||
self._subscribe_to_heroes() | ||
|
||
func _subscribe_to_heroes() -> void: | ||
for hero in self.heroes: | ||
hero.killed.connect(_on_hero_killed) | ||
|
||
func _unsubscribe_from_heroes() -> void: | ||
for hero in self.heroes: | ||
hero.killed.disconnect(_on_hero_killed) | ||
|
||
func _on_hero_killed(hero: Hero) -> void: | ||
self.heroes.erase(hero) | ||
|
||
## Randomly picks a hero that is eligible to have a bounty, or returns null if none are available. | ||
func pick_random_bounty() -> Hero: | ||
var eligible := self.heroes.filter(func(hero: Hero) -> bool: return hero.bounty_target) | ||
if not eligible: | ||
return null | ||
|
||
return eligible.pick_random() | ||
|
||
## See [SaveGame]. | ||
func save_to_dict() -> Dictionary: | ||
var result := {} | ||
result["heroes"] = SaveGame.serialize_array_of_resources(self.heroes) | ||
return result | ||
|
||
## See [SaveGame]. | ||
func load_from_dict(dict: Dictionary) -> void: | ||
var heroes_array: Array = dict["heroes"] | ||
self.heroes = SaveGame.deserialize_array_of_resources(heroes_array) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,47 @@ | ||
[gd_scene load_steps=6 format=3 uid="uid://cghdtnx2qen2u"] | ||
[gd_scene load_steps=13 format=3 uid="uid://cghdtnx2qen2u"] | ||
|
||
[ext_resource type="Resource" uid="uid://shiglva7yxl0" path="res://galaxy/star_system/star_systems/barnard's_star.tres" id="2_y4tl8"] | ||
[ext_resource type="PackedScene" uid="uid://d27pdcik2lwf1" path="res://stars/main_sequence/star_class_m.tscn" id="3_cqasn"] | ||
[ext_resource type="Resource" uid="uid://qlbnowlag2dr" path="res://actors/heroes/bounties/Zora 'Starshiv' Blackburn.tres" id="5_lj2ck"] | ||
[ext_resource type="PackedScene" uid="uid://ccdkamqw03rk7" path="res://fx/asteroids/multi_asteroid_field.tscn" id="5_x1i1i"] | ||
[ext_resource type="Script" path="res://mechanics/combat/hull.gd" id="6_084xj"] | ||
[ext_resource type="Script" path="res://mechanics/combat/shield.gd" id="7_tt2dl"] | ||
[ext_resource type="Script" path="res://mechanics/power/battery.gd" id="8_qba8t"] | ||
[ext_resource type="PackedScene" uid="uid://culoat6jnbwc8" path="res://actors/ai/pirate_frigate.tscn" id="9_xdjbl"] | ||
[ext_resource type="PackedScene" uid="uid://fxemun7o6rix" path="res://galaxy/star_system/star_system_instance.tscn" id="star_system_instance"] | ||
|
||
[sub_resource type="Resource" id="Resource_nv5hr"] | ||
resource_local_to_scene = true | ||
script = ExtResource("6_084xj") | ||
max_integrity = 100.0 | ||
integrity = 100.0 | ||
|
||
[sub_resource type="Resource" id="Resource_q3lvv"] | ||
resource_local_to_scene = true | ||
script = ExtResource("7_tt2dl") | ||
max_integrity = 100.0 | ||
integrity = 100.0 | ||
recharge_rate = 10.0 | ||
power_efficiency = 1.0 | ||
only_recharge_above = 0.2 | ||
|
||
[sub_resource type="Resource" id="Resource_vl342"] | ||
resource_local_to_scene = true | ||
script = ExtResource("8_qba8t") | ||
max_power = 300.0 | ||
power = 300.0 | ||
|
||
[node name="Barnard\'s Star" instance=ExtResource("star_system_instance")] | ||
star_system = ExtResource("2_y4tl8") | ||
|
||
[node name="Star Class M" parent="." index="0" instance=ExtResource("3_cqasn")] | ||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.65429, 2.08165e-12, 11.1402) | ||
|
||
[node name="PirateFrigate" parent="." index="1" instance=ExtResource("9_xdjbl")] | ||
[node name="Zora" parent="." index="1" instance=ExtResource("9_xdjbl")] | ||
transform = Transform3D(0.866897, -1.28496e-16, 0.498488, 3.48787e-16, 1, -3.48787e-16, -0.498488, 4.76228e-16, 0.866897, -8.39, 2.08165e-12, 1.15) | ||
hero = ExtResource("5_lj2ck") | ||
hull = SubResource("Resource_nv5hr") | ||
shield = SubResource("Resource_q3lvv") | ||
battery = SubResource("Resource_vl342") | ||
|
||
[node name="AsteroidField" parent="." index="2" instance=ExtResource("5_x1i1i")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.