started research skills

This commit is contained in:
2024-03-29 10:25:53 -05:00
parent f57f7f5540
commit 39157dded2
29 changed files with 1282 additions and 19 deletions

View File

@@ -1,5 +1,10 @@
extends Node
class_name Researcher
func interact() -> bool:
const RESEARCH_MENU = preload("res://scene/research_menu.tscn")
func interact(on_interaction_finished: Callable) -> bool:
var build_menu = RESEARCH_MENU.instantiate()
build_menu.research.connect(on_interaction_finished)
add_sibling(build_menu)
return true

View File

@@ -1,8 +1,9 @@
[gd_resource type="Resource" script_class="Building" load_steps=5 format=3 uid="uid://bibep1rd0jml2"]
[gd_resource type="Resource" script_class="Building" load_steps=6 format=3 uid="uid://bibep1rd0jml2"]
[ext_resource type="Texture2D" uid="uid://n806c03hgaq1" path="res://assets/scifi_tilesheet@2.png" id="1_kruad"]
[ext_resource type="Resource" uid="uid://bpjj0x7jr1k6u" path="res://data/game_resources/carbon/carbon_resource.tres" id="2_hybxl"]
[ext_resource type="Script" path="res://data/buildings/building.gd" id="3_pleu3"]
[ext_resource type="PackedScene" uid="uid://bw3j3vxpsfxst" path="res://data/buildings/basic/researcher/researcher.tscn" id="4_sugjm"]
[sub_resource type="AtlasTexture" id="AtlasTexture_n7l2d"]
atlas = ExtResource("1_kruad")
@@ -16,3 +17,4 @@ description = "Research new buildings and technologies"
cost = {
ExtResource("2_hybxl"): 6000
}
world_scene = ExtResource("4_sugjm")

View File

@@ -2,6 +2,7 @@ class_name BuildingBase
extends Node2D
var _building_data: Building
var building_data_scene
@onready var sprite_2d: Sprite2D = $Sprite2D
@@ -9,11 +10,9 @@ func initialize(data: Building, grid_location: Vector2i) -> void:
_building_data = data
position = Grid.grid_to_world_center(grid_location)
sprite_2d.texture = _building_data.atlas_texture
var building_data_scene = _building_data.world_scene.instantiate()
add_child(building_data_scene)
if _building_data.world_scene:
building_data_scene = _building_data.world_scene.instantiate()
add_child(building_data_scene)
func _ready() -> void:
_building_data.ready(self)
func interact() -> bool:
return false
func interact(on_interaction_finished: Callable) -> bool:
return building_data_scene.interact(on_interaction_finished)

View File

@@ -9,3 +9,5 @@ atlas_location = Vector2i(5, 6)
pickup_value = 10
name = "Gem"
spawn_patterns = Array[Resource("res://scripts/spawn_pattern.gd")]([ExtResource("2_n3fuo")])
storage_max = 0
skills_needed = Array[int]([0])

View File

@@ -0,0 +1,18 @@
[gd_resource type="Resource" script_class="Research" load_steps=5 format=3 uid="uid://ddsmk1qmb2ohf"]
[ext_resource type="Texture2D" uid="uid://n806c03hgaq1" path="res://assets/scifi_tilesheet@2.png" id="1_i07ie"]
[ext_resource type="Script" path="res://data/research/research.gd" id="1_swmp6"]
[ext_resource type="Resource" uid="uid://bpjj0x7jr1k6u" path="res://data/game_resources/carbon/carbon_resource.tres" id="2_gc3ag"]
[sub_resource type="AtlasTexture" id="AtlasTexture_1i8g4"]
atlas = ExtResource("1_i07ie")
region = Rect2(320, 384, 64, 64)
[resource]
script = ExtResource("1_swmp6")
atlas_texture = SubResource("AtlasTexture_1i8g4")
name = "Gems"
description = "Allows the gathering of Gems"
cost = {
ExtResource("2_gc3ag"): 10
}

View File

@@ -0,0 +1,8 @@
class_name Research
extends Resource
@export var atlas_texture: AtlasTexture
@export var name: String
@export var description: String
@export var cost: Dictionary
@export var world_scene: PackedScene