Skip to content

Commit

Permalink
finished part 11
Browse files Browse the repository at this point in the history
  • Loading branch information
SelinaDev committed Aug 16, 2024
1 parent 77f497a commit 44ad274
Show file tree
Hide file tree
Showing 48 changed files with 712 additions and 61 deletions.
10 changes: 10 additions & 0 deletions project/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,16 @@ pause={
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":6,"pressure":0.0,"pressed":false,"script":null)
]
}
stairs={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":60,"unicode":60,"location":0,"echo":false,"script":null)
]
}
character={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":80,"physical_keycode":0,"key_label":0,"unicode":112,"location":0,"echo":false,"script":null)
]
}

[rendering]

Expand Down
9 changes: 7 additions & 2 deletions project/resources/Entities/Actors/goblin.tres
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="Entity" load_steps=13 format=3 uid="uid://bdaryf1h2fgfo"]
[gd_resource type="Resource" script_class="Entity" load_steps=15 format=3 uid="uid://bdaryf1h2fgfo"]

[ext_resource type="Script" path="res://src/Entity/entity.gd" id="1_71i23"]
[ext_resource type="Script" path="res://src/Entity/Component/DrawableComponent/drawable_component.gd" id="1_ad45g"]
Expand All @@ -7,6 +7,7 @@
[ext_resource type="Texture2D" uid="uid://cl5u3naxm2fy" path="res://assets/urizen_onebit_tileset__v1d0.png" id="2_fo3nt"]
[ext_resource type="Script" path="res://src/Entity/Component/durability_component.gd" id="3_1gaep"]
[ext_resource type="Resource" uid="uid://cr15gc6rayc4v" path="res://resources/Entities/Actors/Templates/creature_template.tres" id="4_jkxms"]
[ext_resource type="Script" path="res://src/Entity/Component/xp_component.gd" id="6_6cfnt"]
[ext_resource type="Script" path="res://src/Entity/entity_template.gd" id="7_wyj2n"]

[sub_resource type="AtlasTexture" id="AtlasTexture_d711m"]
Expand Down Expand Up @@ -37,10 +38,14 @@ death_z_index = 1
death_removes_movement_blocker = true
death_removes_visibility_blocker = true

[sub_resource type="Resource" id="Resource_llwwi"]
script = ExtResource("6_6cfnt")
xp = 10

[resource]
script = ExtResource("1_71i23")
name = "Goblin"
is_proper_name = false
templates = Array[ExtResource("7_wyj2n")]([ExtResource("4_jkxms")])
initial_components = Array[ExtResource("1_f6mlm")]([SubResource("Resource_wv305"), SubResource("Resource_j5qmc")])
initial_components = Array[ExtResource("1_f6mlm")]([SubResource("Resource_wv305"), SubResource("Resource_j5qmc"), SubResource("Resource_llwwi")])
_components = {}
9 changes: 7 additions & 2 deletions project/resources/Entities/Actors/orc.tres
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="Entity" load_steps=13 format=3 uid="uid://b44koamww3qdl"]
[gd_resource type="Resource" script_class="Entity" load_steps=15 format=3 uid="uid://b44koamww3qdl"]

[ext_resource type="Script" path="res://src/Entity/Component/component.gd" id="1_cyk4p"]
[ext_resource type="Script" path="res://src/Entity/entity.gd" id="1_emt5n"]
Expand All @@ -7,6 +7,7 @@
[ext_resource type="Texture2D" uid="uid://cl5u3naxm2fy" path="res://assets/urizen_onebit_tileset__v1d0.png" id="2_f1yj4"]
[ext_resource type="Script" path="res://src/Entity/Component/durability_component.gd" id="3_r1iu2"]
[ext_resource type="Resource" uid="uid://cr15gc6rayc4v" path="res://resources/Entities/Actors/Templates/creature_template.tres" id="4_smwea"]
[ext_resource type="Script" path="res://src/Entity/Component/xp_component.gd" id="6_nlap5"]
[ext_resource type="Script" path="res://src/Entity/entity_template.gd" id="7_8aesf"]

[sub_resource type="AtlasTexture" id="AtlasTexture_kd78y"]
Expand Down Expand Up @@ -37,10 +38,14 @@ death_z_index = 1
death_removes_movement_blocker = true
death_removes_visibility_blocker = true

[sub_resource type="Resource" id="Resource_ongov"]
script = ExtResource("6_nlap5")
xp = 30

[resource]
script = ExtResource("1_emt5n")
name = "Orc"
is_proper_name = false
templates = Array[ExtResource("7_8aesf")]([ExtResource("4_smwea")])
initial_components = Array[ExtResource("1_cyk4p")]([SubResource("Resource_lihad"), SubResource("Resource_kba1c")])
initial_components = Array[ExtResource("1_cyk4p")]([SubResource("Resource_lihad"), SubResource("Resource_kba1c"), SubResource("Resource_ongov")])
_components = {}
17 changes: 15 additions & 2 deletions project/resources/Entities/Actors/player.tres
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="Entity" load_steps=27 format=3 uid="uid://08un78dx64fi"]
[gd_resource type="Resource" script_class="Entity" load_steps=31 format=3 uid="uid://08un78dx64fi"]

[ext_resource type="Script" path="res://src/Entity/Component/component.gd" id="1_5seo2"]
[ext_resource type="Script" path="res://src/Entity/entity.gd" id="1_ge48h"]
Expand All @@ -15,6 +15,8 @@
[ext_resource type="Script" path="res://src/Entity/entity_template.gd" id="11_l0emg"]
[ext_resource type="Script" path="res://src/Entity/Component/faction_component.gd" id="12_b1s0l"]
[ext_resource type="Script" path="res://src/Entity/Component/StatusEffects/status_effects_component.gd" id="13_lvm21"]
[ext_resource type="Script" path="res://src/Entity/Component/level_component.gd" id="14_71xcd"]
[ext_resource type="Script" path="res://src/Entity/Component/resistance_component.gd" id="15_0oxg0"]

[sub_resource type="Resource" id="Resource_yntj7"]
script = ExtResource("1_paibh")
Expand Down Expand Up @@ -72,10 +74,21 @@ faction = 1
script = ExtResource("13_lvm21")
effects = {}

[sub_resource type="Resource" id="Resource_pi4ht"]
script = ExtResource("14_71xcd")
current_level = 1
current_xp = 0
level_up_base = 200
level_up_factor = 150

[sub_resource type="Resource" id="Resource_slbl7"]
script = ExtResource("15_0oxg0")
defense = 0

[resource]
script = ExtResource("1_ge48h")
name = "Player"
is_proper_name = true
templates = Array[ExtResource("11_l0emg")]([ExtResource("3_kx7dw")])
initial_components = Array[ExtResource("1_5seo2")]([SubResource("Resource_yntj7"), SubResource("Resource_qlvlf"), SubResource("Resource_merbi"), SubResource("Resource_bihn8"), SubResource("Resource_n76u1"), SubResource("Resource_foi8v"), SubResource("Resource_gpmxi"), SubResource("Resource_o14as"), SubResource("Resource_u8cb1")])
initial_components = Array[ExtResource("1_5seo2")]([SubResource("Resource_yntj7"), SubResource("Resource_qlvlf"), SubResource("Resource_merbi"), SubResource("Resource_bihn8"), SubResource("Resource_n76u1"), SubResource("Resource_foi8v"), SubResource("Resource_gpmxi"), SubResource("Resource_o14as"), SubResource("Resource_u8cb1"), SubResource("Resource_pi4ht"), SubResource("Resource_slbl7")])
_components = {}
42 changes: 42 additions & 0 deletions project/resources/Entities/Environment/stairs_down.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[gd_resource type="Resource" script_class="Entity" load_steps=13 format=3 uid="uid://wm7jwgulk3qw"]

[ext_resource type="Script" path="res://src/Entity/Component/component.gd" id="1_i4e47"]
[ext_resource type="Script" path="res://src/Entity/entity.gd" id="2_5wqww"]
[ext_resource type="Script" path="res://src/Entity/Component/DrawableComponent/DrawableEffects/drawable_effect.gd" id="2_akf0l"]
[ext_resource type="Script" path="res://src/Entity/Component/DrawableComponent/drawable_component.gd" id="3_nhg5v"]
[ext_resource type="Script" path="res://src/Entity/entity_template.gd" id="3_rin70"]
[ext_resource type="Texture2D" uid="uid://cl5u3naxm2fy" path="res://assets/urizen_onebit_tileset__v1d0.png" id="4_iubcv"]
[ext_resource type="Script" path="res://src/Entity/Component/rememberable_component.gd" id="5_rnsd8"]
[ext_resource type="Script" path="res://src/Entity/Component/stairs_component.gd" id="6_slrol"]

[sub_resource type="AtlasTexture" id="AtlasTexture_eotiq"]
atlas = ExtResource("4_iubcv")
region = Rect2(300, 14, 12, 12)

[sub_resource type="Resource" id="Resource_i53o7"]
script = ExtResource("3_nhg5v")
texture = SubResource("AtlasTexture_eotiq")
render_order = 2
color = Color(1, 1, 1, 1)
modulate = Color(1, 1, 1, 1)
visible = true
position = Vector2i(0, 0)
drawable_effects = Array[ExtResource("2_akf0l")]([])
_active_drawable_effects = {}

[sub_resource type="Resource" id="Resource_ljg01"]
script = ExtResource("5_rnsd8")
not_in_view_color = Color(1, 1, 1, 1)

[sub_resource type="Resource" id="Resource_vuvas"]
script = ExtResource("6_slrol")
target_map_index = 0
use_verb = "descends"

[resource]
script = ExtResource("2_5wqww")
name = "Stairs (Down)"
is_proper_name = false
templates = Array[ExtResource("3_rin70")]([])
initial_components = Array[ExtResource("1_i4e47")]([SubResource("Resource_i53o7"), SubResource("Resource_ljg01"), SubResource("Resource_vuvas")])
_components = {}
42 changes: 42 additions & 0 deletions project/resources/Entities/Environment/stairs_up.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[gd_resource type="Resource" script_class="Entity" load_steps=13 format=3 uid="uid://mk0fsop75a3g"]

[ext_resource type="Script" path="res://src/Entity/Component/component.gd" id="1_mawj2"]
[ext_resource type="Script" path="res://src/Entity/Component/DrawableComponent/DrawableEffects/drawable_effect.gd" id="2_vv4yp"]
[ext_resource type="Script" path="res://src/Entity/Component/DrawableComponent/drawable_component.gd" id="3_s0b70"]
[ext_resource type="Texture2D" uid="uid://cl5u3naxm2fy" path="res://assets/urizen_onebit_tileset__v1d0.png" id="4_1iwii"]
[ext_resource type="Script" path="res://src/Entity/Component/rememberable_component.gd" id="5_etnwx"]
[ext_resource type="Script" path="res://src/Entity/Component/stairs_component.gd" id="6_8vshh"]
[ext_resource type="Script" path="res://src/Entity/entity.gd" id="7_0xedi"]
[ext_resource type="Script" path="res://src/Entity/entity_template.gd" id="8_uu8ya"]

[sub_resource type="AtlasTexture" id="AtlasTexture_hxywt"]
atlas = ExtResource("4_1iwii")
region = Rect2(313, 14, 12, 12)

[sub_resource type="Resource" id="Resource_7uarv"]
script = ExtResource("3_s0b70")
texture = SubResource("AtlasTexture_hxywt")
render_order = 0
color = Color(1, 1, 1, 1)
modulate = Color(1, 1, 1, 1)
visible = true
position = Vector2i(0, 0)
drawable_effects = Array[ExtResource("2_vv4yp")]([])
_active_drawable_effects = {}

[sub_resource type="Resource" id="Resource_eumk6"]
script = ExtResource("5_etnwx")
not_in_view_color = Color(1, 1, 1, 1)

[sub_resource type="Resource" id="Resource_nm6ar"]
script = ExtResource("6_8vshh")
target_map_index = 0
use_verb = "climbss"

[resource]
script = ExtResource("7_0xedi")
name = "Stairs (Up)"
is_proper_name = false
templates = Array[ExtResource("8_uu8ya")]([])
initial_components = Array[ExtResource("1_mawj2")]([SubResource("Resource_7uarv"), SubResource("Resource_eumk6"), SubResource("Resource_nm6ar")])
_components = {}
2 changes: 1 addition & 1 deletion project/resources/Entities/Items/scroll_lightning.tres
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ _active_drawable_effects = {}

[sub_resource type="Resource" id="Resource_1p5nc"]
script = ExtResource("6_qdb5l")
amount = 3
amount = 10
verb = "damaged"

[sub_resource type="AtlasTexture" id="AtlasTexture_uiwjw"]
Expand Down
23 changes: 23 additions & 0 deletions project/resources/MapGeneration/world_config.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[gd_resource type="Resource" script_class="WorldConfig" load_steps=6 format=3 uid="uid://crh05juyhbrvy"]

[ext_resource type="Script" path="res://src/Map/map_config.gd" id="1_nsr08"]
[ext_resource type="Resource" uid="uid://c3pn25g7s1xse" path="res://resources/Tiles/Variations/dungeon_floor_variation.tres" id="2_klk6a"]
[ext_resource type="Script" path="res://src/Map/World/WorldGenerator/world_config.gd" id="2_toqqe"]
[ext_resource type="Resource" uid="uid://bueuip5l015ph" path="res://resources/Tiles/Variations/dungeon_wall_variation.tres" id="3_h53sn"]

[sub_resource type="Resource" id="Resource_2jf63"]
script = ExtResource("1_nsr08")
map_width = 100
map_height = 100
max_rooms = 20
max_tries = 1000
max_enemies_per_room = 2
max_items_per_room = 1
floor_variation = ExtResource("2_klk6a")
wall_variation = ExtResource("3_h53sn")
map_type = 0
room_pack = "dungeon"

[resource]
script = ExtResource("2_toqqe")
map_configs = Array[ExtResource("1_nsr08")]([SubResource("Resource_2jf63"), SubResource("Resource_2jf63"), SubResource("Resource_2jf63")])
1 change: 1 addition & 0 deletions project/resources/PCG/Corpora/descriptions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ quiet
realistic
reassuring
reclusive
relentless
reliable
reluctant
resentful
Expand Down
8 changes: 6 additions & 2 deletions project/resources/ResourceDBs/Entity_db.tres
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
[gd_resource type="Resource" script_class="ResourceDB" load_steps=11 format=3 uid="uid://c786ivrv1akyg"]
[gd_resource type="Resource" script_class="ResourceDB" load_steps=13 format=3 uid="uid://c786ivrv1akyg"]

[ext_resource type="Resource" uid="uid://bdaryf1h2fgfo" path="res://resources/Entities/Actors/goblin.tres" id="1_xbgdx"]
[ext_resource type="Script" path="res://addons/resource_dbs/resource_db.gd" id="2_1cunx"]
[ext_resource type="Resource" uid="uid://b44koamww3qdl" path="res://resources/Entities/Actors/orc.tres" id="2_pdipy"]
[ext_resource type="Resource" uid="uid://08un78dx64fi" path="res://resources/Entities/Actors/player.tres" id="3_s1q16"]
[ext_resource type="Resource" uid="uid://t85rri7mf6hh" path="res://resources/Entities/Environment/door.tres" id="4_myg1p"]
[ext_resource type="Resource" uid="uid://wm7jwgulk3qw" path="res://resources/Entities/Environment/stairs_down.tres" id="5_jdpyr"]
[ext_resource type="Resource" uid="uid://m776b4mfjdd0" path="res://resources/Entities/Items/potion_health.tres" id="5_ky6cc"]
[ext_resource type="Resource" uid="uid://c86h58eyxtx5a" path="res://resources/Entities/Items/scroll_lightning.tres" id="6_j5310"]
[ext_resource type="Resource" uid="uid://dlbgi257q4ogf" path="res://resources/Entities/Items/scroll_fireball.tres" id="6_rr635"]
[ext_resource type="Resource" uid="uid://mk0fsop75a3g" path="res://resources/Entities/Environment/stairs_up.tres" id="6_txyad"]
[ext_resource type="Resource" uid="uid://nbv1upmnd3i8" path="res://resources/Entities/Items/scroll_confusion.tres" id="6_xwhso"]
[ext_resource type="Resource" uid="uid://dbtvrl1v78std" path="res://resources/Entities/Items/scroll_magic_missile.tres" id="7_llvtj"]

Expand All @@ -22,5 +24,7 @@ entries = {
"scroll_confusion": ExtResource("6_xwhso"),
"scroll_fireball": ExtResource("6_rr635"),
"scroll_lightning": ExtResource("6_j5310"),
"scroll_magic_missile": ExtResource("7_llvtj")
"scroll_magic_missile": ExtResource("7_llvtj"),
"stairs_down": ExtResource("5_jdpyr"),
"stairs_up": ExtResource("6_txyad")
}
21 changes: 19 additions & 2 deletions project/resources/default_theme.tres
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_resource type="Theme" load_steps=9 format=3 uid="uid://d1ihrcds1upna"]
[gd_resource type="Theme" load_steps=11 format=3 uid="uid://d1ihrcds1upna"]

[ext_resource type="Texture2D" uid="uid://c4kkuxc3bxqpw" path="res://assets/kenney_fantasy-ui-borders/PNG/Default/Border/panel-border-005.png" id="1_fn5dc"]
[ext_resource type="FontFile" uid="uid://bnh85awwk8xuj" path="res://assets/kenney_kenney-fonts/Fonts/Kenney Pixel.ttf" id="2_yvh8i"]
Expand All @@ -22,6 +22,18 @@ texture_margin_right = 16.0
texture_margin_bottom = 16.0
region_rect = Rect2(0, 0, 48, 48)

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_f7wec"]
draw_center = false
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color(1, 1, 1, 1)
corner_detail = 1

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_7c57f"]
bg_color = Color(1, 1, 1, 1)

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ocwhg"]
bg_color = Color(1, 1, 1, 1)

Expand All @@ -31,7 +43,7 @@ vertical = true

[resource]
default_font = ExtResource("2_yvh8i")
default_font_size = 32
default_font_size = 16
Button/font_sizes/font_size = 16
Button/styles/disabled = SubResource("StyleBoxEmpty_3lgdo")
Button/styles/focus = SubResource("StyleBoxFlat_77bbi")
Expand All @@ -45,6 +57,11 @@ Label/colors/font_color = Color(1, 1, 1, 1)
Label/colors/font_outline_color = Color(0, 0, 0, 1)
Label/constants/outline_size = 1
PanelContainer/styles/panel = SubResource("StyleBoxTexture_akykc")
ProgressBar/colors/font_color = Color(1, 1, 1, 1)
ProgressBar/colors/font_outline_color = Color(0, 0, 0, 1)
ProgressBar/constants/outline_size = 4
ProgressBar/styles/background = SubResource("StyleBoxFlat_f7wec")
ProgressBar/styles/fill = SubResource("StyleBoxFlat_7c57f")
VBoxContainer/constants/separation = 2
VScrollBar/styles/grabber = SubResource("StyleBoxFlat_ocwhg")
VScrollBar/styles/grabber_highlight = SubResource("StyleBoxFlat_ocwhg")
Expand Down
4 changes: 4 additions & 0 deletions project/src/Entity/Action/interact_action.gd
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ func perform() -> Result:
if not grab_targets.is_empty():
return PickupAction.new(_performing_entity, offset).perform()

var stairs_targets := targets.filter(func(e: Entity) -> bool: return e.has_component(Component.Type.Stairs))
if not stairs_targets.is_empty():
return StairsAction.new(_performing_entity).perform()

var open_targets := targets.filter(func(e: Entity) -> bool: return e.has_component(Component.Type.Door))
if not open_targets.is_empty():
return OpenAction.new(_performing_entity, offset).perform()
Expand Down
33 changes: 33 additions & 0 deletions project/src/Entity/Action/stairs_action.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
class_name StairsAction
extends Action

func perform() -> Result:
var is_player := _performing_entity.has_component(Component.Type.Player)
assert(_performing_entity.has_component(Component.Type.Player))
var position := PositionComponent.get_entity_position(_performing_entity)
var stairs_array := _performing_entity.map_data.get_entities_at(position).filter(
func(e: Entity) -> bool: return e.has_component(Component.Type.Stairs)
)
if stairs_array.is_empty():
if is_player:
Log.send_log(
"There are not stairs at %s's position" % _performing_entity.get_entity_name(),
Log.COLOR_IMPOSSIBLE
)
return Action.Result.NoAction
var stairs: Entity = stairs_array.front()
var stairs_component: StairsComponent = stairs.get_component(Component.Type.Stairs)
WorldManager.get_world().move_player_to_map(_performing_entity, stairs_component.target_map_index)
if is_player:
Log.send_log(
"%s %s %s" % [
_performing_entity.get_entity_name(),
stairs_component.use_verb,
stairs.get_entity_name()
]
)
return Action.Result.FreeAction


func can_use_stairs() -> bool:
return true
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ func reactivate() -> void:
SignalBus.player_took_turn.connect(_on_player_took_turn)


func deactivate() -> void:
if SignalBus.group_took_turn.is_connected(_on_group_took_turn):
SignalBus.group_took_turn.disconnect(_on_group_took_turn)
if SignalBus.player_took_turn.is_connected(_on_player_took_turn):
SignalBus.player_took_turn.disconnect(_on_player_took_turn)


func _on_group_took_turn() -> void:
if turn_syncher.check_group_turn():
_take_turn()
Expand All @@ -44,6 +51,8 @@ func process_message_precalculate(message: Message) -> void:
match message.type:
"get_action":
var player_entity: Entity = turn_syncher.get_synched_player()
if player_entity and player_entity.map_data.id != _parent_entity.map_data.id:
return
for ai_component: AiComponent in ai_components:
message.get_array("proposed_actions").append_array(ai_component.get_proposed_actions(_parent_entity, player_entity))

Expand All @@ -61,7 +70,3 @@ func process_message_execute(message: Message) -> void:
return tested_action if tested_action.score > action.score else action
)
_queued_action = proposed_action.action
"enter_map":
turn_syncher.setup(_parent_entity)
SignalBus.group_took_turn.connect(_on_group_took_turn)
SignalBus.player_took_turn.connect(_on_player_took_turn)
Loading

0 comments on commit 44ad274

Please sign in to comment.