Added stairs (can't climb yet).
This commit is contained in:
@@ -123,12 +123,16 @@ var state = 0
|
||||
func _ready():
|
||||
pass
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
var furniture_nodes = []
|
||||
var dungeon_ids = []
|
||||
func _process(_delta):
|
||||
match(state):
|
||||
0:
|
||||
global.load_game()
|
||||
if global.save_data.has("dungeon"):
|
||||
dungeon_save = global.save_data.dungeon
|
||||
state = 1
|
||||
1:
|
||||
dungeon.resize(floors * size_x * size_y)
|
||||
for k in range(floors):
|
||||
for i in range(size_x):
|
||||
@@ -140,16 +144,25 @@ func _process(_delta):
|
||||
ri.translation.z = j * h - size_y / 2 * h
|
||||
dungeon[k * size_x * size_y + j * size_x + i] = ri
|
||||
if dungeon_save.empty():
|
||||
state = 1
|
||||
state = 20
|
||||
else:
|
||||
state = 2
|
||||
1:
|
||||
state = 30
|
||||
20:
|
||||
build_rooms()
|
||||
state = 21
|
||||
21:
|
||||
build_special_rooms()
|
||||
|
||||
state = 22
|
||||
22:
|
||||
for r in dungeon:
|
||||
r.create_rooms()
|
||||
for k in get_tree().get_nodes_in_group("furniture"):
|
||||
state = 23
|
||||
23:
|
||||
furniture_nodes = get_tree().get_nodes_in_group("furniture")
|
||||
state = 24
|
||||
24:
|
||||
if furniture_nodes.size() > 0:
|
||||
var k = furniture_nodes.pop_front()
|
||||
if k.name.begins_with("fc"):
|
||||
if randf() > 0.5 && !k.get_parent().has_meta("kitchen_room"):
|
||||
var bed_i = bed.instance()
|
||||
@@ -167,16 +180,22 @@ func _process(_delta):
|
||||
closet_i.set_meta("save_path", "res://scenes/furniture/closet.tscn")
|
||||
k.add_child(closet_i)
|
||||
k.rotate_y(randf() * PI / 24.0)
|
||||
save()
|
||||
state = 3
|
||||
2:
|
||||
for k in range(dungeon.size()):
|
||||
else:
|
||||
save()
|
||||
state = 40
|
||||
30:
|
||||
dungeon_ids = range(dungeon.size())
|
||||
state = 31
|
||||
31:
|
||||
if dungeon_ids.size() > 0:
|
||||
var k = dungeon_ids.pop_front()
|
||||
dungeon[k].save_data = dungeon_save[str(k)]
|
||||
dungeon[k].restore()
|
||||
state = 3
|
||||
3:
|
||||
else:
|
||||
state = 40
|
||||
40:
|
||||
print("loaded")
|
||||
state = 4
|
||||
state = 50
|
||||
prepared = true
|
||||
emit_signal("prepared")
|
||||
_:
|
||||
|
||||
@@ -14,6 +14,7 @@ var door = preload("res://scenes/maps/door.tscn")
|
||||
var jail_door = preload("res://scenes/maps/jail-door.tscn")
|
||||
var window = preload("res://scenes/maps/window.tscn")
|
||||
var outside_door = preload("res://scenes/maps/window.tscn")
|
||||
var stairs = preload("res://scenes/maps/stairs.tscn")
|
||||
var outside_door_placed = false
|
||||
var tw2d
|
||||
var te2d
|
||||
@@ -230,6 +231,11 @@ func create_rooms():
|
||||
master_room()
|
||||
elif has_meta("stairs"):
|
||||
master_room()
|
||||
var stairs_i = stairs.instance()
|
||||
add_child(stairs_i)
|
||||
for e in get_children():
|
||||
if e.is_in_group("furniture"):
|
||||
e.queue_free()
|
||||
if get_meta("stairs") > 0:
|
||||
$c_modular/floor.queue_free()
|
||||
elif exits.size() == 1:
|
||||
|
||||
697
proto3/godot/scenes/maps/stairs.escn
Normal file
697
proto3/godot/scenes/maps/stairs.escn
Normal file
File diff suppressed because one or more lines are too long
1063
proto3/godot/scenes/maps/stairs.escn.import
Normal file
1063
proto3/godot/scenes/maps/stairs.escn.import
Normal file
File diff suppressed because it is too large
Load Diff
5
proto3/godot/scenes/maps/stairs.tscn
Normal file
5
proto3/godot/scenes/maps/stairs.tscn
Normal file
@@ -0,0 +1,5 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/maps/stairs.escn" type="PackedScene" id=1]
|
||||
|
||||
[node name="stairs" instance=ExtResource( 1 )]
|
||||
Reference in New Issue
Block a user