ajout de la porte et équilibrage des mutations
This commit is contained in:
@@ -12,6 +12,9 @@
|
||||
[ext_resource type="PackedScene" uid="uid://b8m537op75gib" path="res://entities/interactables/door/door.tscn" id="8_2f6js"]
|
||||
[ext_resource type="PackedScene" uid="uid://dj7gp3crtg2yt" path="res://entities/camera/camera.tscn" id="8_fwgig"]
|
||||
[ext_resource type="Texture2D" uid="uid://rdrhi3r11ey6" path="res://common/icons/square-rounded.svg" id="10_ktnx3"]
|
||||
[ext_resource type="Texture2D" uid="uid://b752eqq4cm7ve" path="res://common/icons/building-factory-2.svg" id="11_fwgig"]
|
||||
[ext_resource type="Texture2D" uid="uid://dg00xnpp6ixls" path="res://common/icons/server-2.svg" id="12_mlppq"]
|
||||
[ext_resource type="Texture2D" uid="uid://1ynlp05wj0hm" path="res://common/icons/rocket.svg" id="13_r4e5h"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_qdnee"]
|
||||
shader = ExtResource("2_ktnx3")
|
||||
@@ -135,8 +138,7 @@ position = Vector2(-405, -151)
|
||||
[node name="AstraDoor" parent="Entities" unique_id=2053096538 instance=ExtResource("8_2f6js")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
modulate = Color(1, 0, 0, 1)
|
||||
available = false
|
||||
icon = ExtResource("11_fwgig")
|
||||
default_info_title = "ASTRA_FACTORY"
|
||||
default_info_desc = "ASTRA_FACTORY_TEXT"
|
||||
|
||||
@@ -145,18 +147,19 @@ unique_name_in_owner = true
|
||||
visible = false
|
||||
position = Vector2(91, -177)
|
||||
to_scene_id = "BOREA"
|
||||
icon = ExtResource("12_mlppq")
|
||||
default_interact_text = "ENTER"
|
||||
available = true
|
||||
default_info_title = "BOREA_BASE"
|
||||
default_info_desc = "BOREA_BASE_DESC_TEXT"
|
||||
|
||||
[node name="ShipGarageDoor" parent="Entities" unique_id=1073871193 instance=ExtResource("8_2f6js")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
modulate = Color(1, 0, 0, 1)
|
||||
position = Vector2(91, -177)
|
||||
to_scene_id = "GARAGE"
|
||||
icon = ExtResource("13_r4e5h")
|
||||
default_interact_text = "ENTER"
|
||||
available = false
|
||||
default_info_title = "MYSTERIOUS_DOOR"
|
||||
default_info_desc = "MYSTERIOUS_DOOR_TEXT"
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ func _ready():
|
||||
if e is Plant:
|
||||
data.add_plant_data(e.data, false)
|
||||
|
||||
%AstraDoor.global_position = data.player_spawn
|
||||
%AstraDoor.global_position = data.player_spawn + Vector2.UP * 100
|
||||
player.global_position = data.player_position
|
||||
|
||||
setup_flagged_properties()
|
||||
@@ -153,14 +153,14 @@ func save():
|
||||
data.player_position = player.global_position
|
||||
GameInfo.save_game_data()
|
||||
|
||||
func spawn_object_random_move(object : Node2D):
|
||||
func spawn_object_random_move(object : Node2D, offset : Vector2 = Vector2.ZERO):
|
||||
var rng := RandomNumberGenerator.new()
|
||||
rng.seed = data.region_seed + object.name.hash()
|
||||
|
||||
object.position = Vector2(
|
||||
rng.randf_range(-SPAWN_OBJECT_RANDOM_MOVEMENT,+SPAWN_OBJECT_RANDOM_MOVEMENT),
|
||||
rng.randf_range(-SPAWN_OBJECT_RANDOM_MOVEMENT,SPAWN_OBJECT_RANDOM_MOVEMENT)
|
||||
)
|
||||
) + offset
|
||||
|
||||
func setup_flagged_properties():
|
||||
|
||||
@@ -177,6 +177,7 @@ func setup_flagged_properties():
|
||||
%ShipGarageDoor.available = data.state == RegionData.State.SUCCEEDED
|
||||
%Tutorial.succeded.connect(
|
||||
func ():
|
||||
await get_tree().create_timer(1.).timeout
|
||||
%ShipGarageDoor.available = true
|
||||
)
|
||||
"borea":
|
||||
@@ -230,7 +231,6 @@ func get_chunk_for_coord(tile_coord : Vector2i) -> Chunk:
|
||||
if chunk.is_generated:
|
||||
var local_coord = TilesDiffData.get_local_coord(tile_coord, chunk.chunk_coord)
|
||||
if chunk.is_tile_in_chunk(local_coord):
|
||||
print(chunk.chunk_coord)
|
||||
return chunk
|
||||
return null
|
||||
|
||||
@@ -266,4 +266,15 @@ func loot_talion(coord : Vector2i):
|
||||
10
|
||||
)
|
||||
|
||||
func decontaminate(tiles_coords : Array[Vector2i], save_tiles_diff := true):
|
||||
if save_tiles_diff :
|
||||
data.decontamination_tiles_data.update_tiles_diff(tiles_coords, TilesDiffData.TileDiff.PRESENT)
|
||||
|
||||
for coord in tiles_coords:
|
||||
var chunk : Chunk = get_chunk_for_coord(coord)
|
||||
if chunk:
|
||||
var local_coord := TilesDiffData.get_local_coord(coord, chunk.chunk_coord)
|
||||
|
||||
chunk.decontamination_layer.place_decontamination(local_coord)
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -9,76 +9,75 @@ var player : Player
|
||||
|
||||
|
||||
func instantiate_entity(s: PackedScene, entity_position : Vector2):
|
||||
var entity = s.instantiate() as Node2D
|
||||
var entity = s.instantiate() as Node2D
|
||||
|
||||
add_entity(entity, entity_position)
|
||||
add_entity(entity, entity_position)
|
||||
|
||||
entity.global_position = entity_position
|
||||
entity.global_position = entity_position
|
||||
|
||||
func add_entity(entity : Node2D, entity_global_position : Vector2 = Vector2.ZERO, container : Node2D = entity_container):
|
||||
if entity.get_parent():
|
||||
if entity.get_parent().get_parent() is Terrain:
|
||||
entity.get_parent().get_parent().remove_entity(entity)
|
||||
else:
|
||||
entity.get_parent().remove_child(entity)
|
||||
if entity.get_parent():
|
||||
if entity.get_parent().get_parent() is Terrain:
|
||||
entity.get_parent().get_parent().remove_entity(entity)
|
||||
else:
|
||||
entity.get_parent().remove_child(entity)
|
||||
|
||||
enroll_entity(entity)
|
||||
enroll_entity(entity)
|
||||
|
||||
container.add_child(entity)
|
||||
entity.global_position = entity_global_position
|
||||
container.add_child(entity)
|
||||
entity.global_position = entity_global_position
|
||||
|
||||
func enroll_entity(entity : Node2D):
|
||||
if "terrain" in entity:
|
||||
entity.terrain = self
|
||||
if "terrain" in entity:
|
||||
entity.terrain = self
|
||||
|
||||
if entity is Player:
|
||||
player = entity
|
||||
if entity is Player:
|
||||
player = entity
|
||||
|
||||
|
||||
func save_entities() -> Array[EntityData]:
|
||||
var saved_entities_data : Array[EntityData] = []
|
||||
for e in entity_container.get_children():
|
||||
if e is Entity:
|
||||
var saved_data : EntityData = e.save()
|
||||
if saved_data:
|
||||
saved_entities_data.append(saved_data)
|
||||
return saved_entities_data
|
||||
var saved_entities_data : Array[EntityData] = []
|
||||
for e in entity_container.get_children():
|
||||
if e is Entity:
|
||||
var saved_data : EntityData = e.save()
|
||||
if saved_data:
|
||||
saved_entities_data.append(saved_data)
|
||||
return saved_entities_data
|
||||
|
||||
func load_entities(saved_entities_data : Array[EntityData]):
|
||||
for static_entity in entity_container.get_children():
|
||||
enroll_entity(static_entity)
|
||||
for static_entity in entity_container.get_children():
|
||||
enroll_entity(static_entity)
|
||||
|
||||
for save_data in saved_entities_data:
|
||||
var entity = save_data.load_entity()
|
||||
if entity:
|
||||
add_entity(entity, save_data.position)
|
||||
for save_data in saved_entities_data:
|
||||
var entity = save_data.load_entity()
|
||||
if entity:
|
||||
add_entity(entity, save_data.position)
|
||||
|
||||
func remove_entity(e : Node2D, container : Node2D = entity_container):
|
||||
if e.get_parent() == entity_container:
|
||||
container.remove_child(e)
|
||||
if e.get_parent() == entity_container:
|
||||
container.remove_child(e)
|
||||
|
||||
func create_entity_container() -> Node2D:
|
||||
var container = Node2D.new()
|
||||
container.y_sort_enabled = true
|
||||
var container = Node2D.new()
|
||||
container.y_sort_enabled = true
|
||||
|
||||
add_child(container)
|
||||
add_child(container)
|
||||
|
||||
return container
|
||||
return container
|
||||
|
||||
func drop_item(item: Item, item_position : Vector2, random_displacement_factor = 0) -> ItemObject:
|
||||
var item_object = ItemObject.new(item)
|
||||
add_entity(item_object, item_position)
|
||||
var item_object = ItemObject.new(item)
|
||||
add_entity(item_object, item_position)
|
||||
|
||||
if random_displacement_factor:
|
||||
var displacement_direction = randf_range(0,2*PI)
|
||||
var displacement = Vector2.ONE.rotated(displacement_direction) * randf_range(0, random_displacement_factor)
|
||||
var tween : Tween = get_tree().create_tween()
|
||||
tween.tween_property(
|
||||
item_object,
|
||||
"position",
|
||||
item_object.position + displacement,
|
||||
0.2
|
||||
)
|
||||
|
||||
return item_object
|
||||
if random_displacement_factor:
|
||||
var displacement_direction = randf_range(0,2*PI)
|
||||
var displacement = Vector2.ONE.rotated(displacement_direction) * randf_range(0, random_displacement_factor)
|
||||
var tween : Tween = get_tree().create_tween()
|
||||
tween.tween_property(
|
||||
item_object,
|
||||
"position",
|
||||
item_object.position + displacement,
|
||||
0.2
|
||||
)
|
||||
|
||||
return item_object
|
||||
|
||||
Reference in New Issue
Block a user