proto3 initial commit

This commit is contained in:
Segey Lapin
2020-04-13 12:45:25 +03:00
parent 69410badf6
commit 1084b6d5c3
1588 changed files with 368852 additions and 23 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://scenes/maps/door-outside.escn" type="PackedScene" id=1]
[node name="door-outside" instance=ExtResource( 1 )]

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,67 @@
extends Spatial
var e1_hotlist = []
var e2_hotlist = []
var teleport = []
enum {DOOR_OPEN, DOOR_CLOSE}
var state = DOOR_CLOSE
func _ready():
var e = $e1.connect("body_entered", self, "e1_enter")
assert(e == OK)
e = $e1.connect("body_exited", self, "e1_exit")
assert(e == OK)
e = $e2.connect("body_entered", self, "e2_enter")
assert(e == OK)
e = $e2.connect("body_exited", self, "e2_exit")
assert(e == OK)
func e1_enter(body):
if !body.is_in_group("characters"):
return
if body in e1_hotlist:
return
var pv1 = body.global_transform.basis[2]
var pv2 = -($e2.global_transform.origin - $e1.global_transform.origin).normalized()
if (pv1 - pv2).length() > 0.8:
return
e2_hotlist.push_back(body)
if body.is_in_group("npc"):
teleport.push_back([body, $e2.global_transform.origin])
if state == DOOR_CLOSE:
if body.is_in_group("npc"):
$doorway/door/AnimationPlayer.play("door-open")
else:
$doorway/door/AnimationPlayer.play("door-openning")
state = DOOR_OPEN
else:
$doorway/door/AnimationPlayer.play("door-open")
func e1_exit(body):
if body in e1_hotlist:
e1_hotlist.erase(body)
func e2_enter(body):
if !body.is_in_group("characters"):
return
if body in e2_hotlist:
return
var pv1 = body.global_transform.basis[2]
var pv2 = -($e1.global_transform.origin - $e2.global_transform.origin).normalized()
if (pv1 - pv2).length() > 0.8:
return
e1_hotlist.push_back(body)
if body.is_in_group("npc"):
teleport.push_back([body, $e1.global_transform.origin])
if state == DOOR_CLOSE:
if body.is_in_group("npc"):
$doorway/door/AnimationPlayer.play("door-open")
else:
$doorway/door/AnimationPlayer.play("door-openning")
state = DOOR_OPEN
else:
$doorway/door/AnimationPlayer.play("door-open")
func e2_exit(body):
if body in e2_hotlist:
e2_hotlist.erase(body)
func _physics_process(_delta):
while teleport.size() > 0:
var item = teleport.pop_front()
item[0].global_transform.origin = item[1]

View File

@@ -0,0 +1,40 @@
[gd_scene load_steps=6 format=2]
[ext_resource path="res://scenes/maps/door.escn" type="PackedScene" id=1]
[ext_resource path="res://scenes/maps/door.gd" type="Script" id=2]
[sub_resource type="BoxShape" id=1]
extents = Vector3( 0.624412, 1, 0.154277 )
[sub_resource type="BoxShape" id=2]
extents = Vector3( 0.759575, 1, 0.129466 )
[sub_resource type="Curve3D" id=3]
_data = {
"points": PoolVector3Array( 0, 0, 0, 0, 0, 0, -0.0495787, 0, -0.21919, 0, 0, 0, 0, 0, 0, -0.0704541, 0, -0.380973, 0, 0, 0, 0, 0, 0, -0.0704541, 0, -0.584507, 0, 0, 0, 0, 0, 0, -0.0652351, 0, -0.735852, 0, 0, 0, 0, 0, 0, -0.0495787, 0, -0.866322, 0, 0, 0, 0, 0, 0, -0.0130467, 0, -1.00201, 0, 0, 0, 0, 0, 0, -0.0495787, 0, 0.140908, 0, 0, 0, 0, 0, 0, 0.211361, 0, 0.302691, 0, 0, 0, 0, 0, 0, 0.440989, 0, 0.427942, 0, 0, 0, 0, 0, 0, 0.61321, 0, 0.652351, 0, 0, 0, 0, 0, 0, 0.623647, 0, 0.808915, 0, 0, 0, 0, 0, 0, 0.545365, 0, 0.923729, 0, 0, 0, 0, 0, 0, 0.48274, 0, 1.10117, 0, 0, 0, 0, 0, 0, 0.237456, 0, 1.22642, 0, 0, 0, 0, 0, 0, -0.0861101, 0, 1.25251 ),
"tilts": PoolRealArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
}
[node name="door" groups=[
"entry",
] instance=ExtResource( 1 )]
script = ExtResource( 2 )
[node name="e1" type="Area" parent="." index="1"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.51951 )
[node name="CollisionShape" type="CollisionShape" parent="e1" index="0"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.237402 )
shape = SubResource( 1 )
[node name="e2" type="Area" parent="." index="2"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.579454 )
[node name="CollisionShape" type="CollisionShape" parent="e2" index="0"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.738471, 0, -0.331513 )
shape = SubResource( 2 )
[node name="door_path" type="Path" parent="." index="3" groups=[
"path",
]]
curve = SubResource( 3 )

View File

@@ -0,0 +1,56 @@
extends Spatial
var e1_hotlist = []
var e2_hotlist = []
var teleport = []
export var door: NodePath
func _ready():
var e = $e1.connect("body_entered", self, "e1_enter")
assert(e == OK)
e = $e1.connect("body_exited", self, "e1_exit")
assert(e == OK)
e = $e2.connect("body_entered", self, "e2_enter")
assert(e == OK)
e = $e2.connect("body_exited", self, "e2_exit")
assert(e == OK)
func e1_enter(body):
if !body.is_in_group("characters"):
return
if body in e1_hotlist:
return
var pv1 = body.global_transform.basis[2]
var pv2 = -($e2.global_transform.origin - $e1.global_transform.origin).normalized()
if (pv1 - pv2).length() > 0.8:
return
if door:
var door_obj = get_node(door)
if door_obj.rotation.y <= 0.0:
door_obj.rotation.y = PI / 2.0
e2_hotlist.push_back(body)
teleport.push_back([body, $e2.global_transform.origin])
func e1_exit(body):
if body in e1_hotlist:
e1_hotlist.erase(body)
func e2_enter(body):
if !body.is_in_group("characters"):
return
if body in e2_hotlist:
return
var pv1 = body.global_transform.basis[2]
var pv2 = -($e1.global_transform.origin - $e2.global_transform.origin).normalized()
if (pv1 - pv2).length() > 0.8:
return
e1_hotlist.push_back(body)
if door:
var door_obj = get_node(door)
if door_obj.rotation.y <= 0.0:
door_obj.rotation.y = PI / 2.0
teleport.push_back([body, $e1.global_transform.origin])
func e2_exit(body):
if body in e2_hotlist:
e2_hotlist.erase(body)
func _physics_process(_delta):
while teleport.size() > 0:
var item = teleport.pop_front()
item[0].global_transform.origin = item[1]

View File

@@ -0,0 +1,184 @@
extends Spatial
signal prepared
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
var room = preload("res://scenes/maps/interior2.tscn")
var bed = preload("res://scenes/furniture/bed.tscn")
var table_chairs = preload("res://scenes/furniture/table_chairs.tscn")
var closet = preload("res://scenes/furniture/closet.tscn")
var size_x = 4
var size_y = 5
var floors = 5
var w = 10
var h = 8
var dungeon = []
var dungeon_save = {}
var spawn_save = {}
var prepared = false
func save():
global.save_characters()
for k in range(dungeon.size()):
dungeon[k].save()
dungeon_save[str(k)] = dungeon[k].save_data
global.save_data.dungeon = dungeon_save
global.save_game()
var window_rooms = []
func build_rooms():
print("build_rooms")
var stairs_x = randi() % size_x
var stairs_y = randi() % size_y
for k in range(floors):
var cur_x = stairs_x
var cur_y = stairs_y
var cur_room = dungeon[k * size_x * size_y + cur_y * size_x + cur_x]
cur_room.set_meta("stairs", k)
var visited = []
while cur_room:
var choice = randi() % 4
match(choice):
0:
if cur_x > 0:
cur_room.open_path(cur_room.OPEN_LEFT)
cur_x -= 1
1:
if cur_x < size_x - 1:
cur_room.open_path(cur_room.OPEN_RIGHT)
cur_x += 1
2:
if cur_y > 0:
cur_room.open_path(cur_room.OPEN_UP)
cur_y -= 1
3:
if cur_y < size_y - 1:
cur_room.open_path(cur_room.OPEN_DOWN)
cur_y += 1
if !cur_room in visited:
visited.push_back(cur_room)
cur_room = dungeon[k * size_x * size_y + cur_y * size_x + cur_x]
match(choice):
0:
cur_room.open_path(cur_room.OPEN_RIGHT)
1:
cur_room.open_path(cur_room.OPEN_LEFT)
2:
cur_room.open_path(cur_room.OPEN_DOWN)
3:
cur_room.open_path(cur_room.OPEN_UP)
# print(cur_x, " ", cur_y)
if visited.size() == size_x * size_y:
break
print("base rooms done")
for fl in range(floors):
for k in range(size_x):
var up = fl * size_x * size_y + k
var down = fl * size_x * size_y + (size_y - 1) * size_x + k
dungeon[up].open_window(dungeon[up].OPEN_UP)
dungeon[down].open_window(dungeon[down].OPEN_DOWN)
window_rooms.push_back(up)
window_rooms.push_back(down)
for k in range(size_y):
var left = fl * size_x * size_y + k * size_x
var right = fl * size_x * size_y + k * size_x + size_x - 1
dungeon[left].open_window(dungeon[left].OPEN_LEFT)
dungeon[right].open_window(dungeon[right].OPEN_RIGHT)
window_rooms.push_back(left)
window_rooms.push_back(right)
print("rooms build complete")
func build_special_rooms():
print("build_special_rooms")
var special_rooms = []
var p_id = window_rooms[randi() % window_rooms.size()]
special_rooms.push_back(p_id)
# var e_id = -1
# while true:
# e_id = window_rooms[randi() % (size_x * size_]
# if !e_id in special_rooms:
# break
# special_rooms.push_back(e_id)
while special_rooms.size() < 3:
var r_id = randi() % dungeon.size()
if !r_id in special_rooms:
special_rooms.push_back(r_id)
var j_id = special_rooms[1]
var k_id = special_rooms[2]
dungeon[p_id].set_meta("master_room", true)
dungeon[j_id].set_meta("jail_room", true)
dungeon[k_id].set_meta("kitchen_room", true)
# dungeon[e_id].set_meta("exit_room", true)
var player_spawn = Spatial.new()
dungeon[p_id].add_child(player_spawn)
player_spawn.name = "player-spawn"
player_spawn.add_to_group("spawn")
var state = 0
func _ready():
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
match(state):
0:
global.load_game()
if global.save_data.has("dungeon"):
dungeon_save = global.save_data.dungeon
dungeon.resize(floors * size_x * size_y)
for k in range(floors):
for i in range(size_x):
for j in range(size_y):
var ri = room.instance()
add_child(ri)
ri.translation.x = i * w - size_x / 2 * w
ri.translation.y = 3.0 * float(k)
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
else:
state = 2
1:
build_rooms()
build_special_rooms()
for r in dungeon:
r.create_rooms()
for k in get_tree().get_nodes_in_group("furniture"):
if k.name.begins_with("fc"):
if randf() > 0.5 && !k.get_parent().has_meta("kitchen_room"):
var bed_i = bed.instance()
bed_i.set_meta("save_path", "res://scenes/furniture/bed.tscn")
k.add_child(bed_i)
k.rotate_y(randf() * PI / 8.0)
elif !k.get_parent().has_meta("master_room") && !k.get_parent().has_meta("jail_room"):
var table_i = table_chairs.instance()
table_i.set_meta("save_path", "res://scenes/furniture/table_chairs.tscn")
k.add_child(table_i)
k.rotate_y(randf() * PI / 8.0)
elif k.name.begins_with("fwb"):
if !k.get_parent().has_meta("master_room") && !k.get_parent().has_meta("jail_room"):
var closet_i = closet.instance()
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()):
dungeon[k].save_data = dungeon_save[str(k)]
dungeon[k].restore()
state = 3
3:
print("loaded")
state = 4
prepared = true
emit_signal("prepared")
_:
if Input.is_action_just_pressed("save_game"):
save()

View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://scenes/maps/dungeon.gd" type="Script" id=1]
[node name="dungeon" type="Spatial"]
script = ExtResource( 1 )

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,288 @@
extends Spatial
enum {OPEN_UP, OPEN_DOWN, OPEN_LEFT, OPEN_RIGHT}
var bitflags = 0
const BITUP = (1 << 0)
const BITDOWN = (1 << 1)
const BITLEFT = (1 << 2)
const BITRIGHT = (1 << 3)
var exits = []
var windows = []
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 outside_door_placed = false
var tw2d
var te2d
var tn2d
var ts2d
var furniture_data = {}
var save_data = {
"personal_room": false,
"kitchen_room": false,
"master_room": false,
"edit_room": false,
"jail_room": false,
"remove_iws": false,
'stairs': -1
}
func v2s(v: Vector3):
return str(v.x) + " " + str(v.y) + " " + str(v.z)
func xform2s(xform: Transform):
var v1 = xform.origin
var v2 = xform.basis[0]
var v3 = xform.basis[1]
var v4 = xform.basis[2]
var ret = ""
for v in [v1, v2, v3, v4]:
ret += v2s(v)
if v != v4:
ret += " "
return ret
func s2xform(s: String):
var vs = s.split(" ")
var fvs = []
for v in vs:
fvs.push_back(float(v))
var ret: = Transform()
ret.origin = Vector3(fvs[0], fvs[1], fvs[2])
ret.basis[0] = Vector3(fvs[3], fvs[4], fvs[5])
ret.basis[1] = Vector3(fvs[6], fvs[7], fvs[8])
ret.basis[2] = Vector3(fvs[9], fvs[10], fvs[11])
return ret
func save_furniture():
for k in get_children():
var save_data = []
for e in ["fc", "fwb"]:
if k.name.begins_with(e):
for l in k.get_children():
if l.has_meta("save_path"):
save_data.push_back({"path": l.get_meta("save_path"), "xform": xform2s(l.transform)})
furniture_data[k.name] = save_data
func save():
save_data.exits = exits
save_data.windows = windows
if has_meta("master_room"):
save_data.master_room = true
if has_meta("kitchen_room"):
save_data.kitchen_room = true
if has_meta("jail_room"):
save_data.jail_room = true
if has_meta("exit_room"):
save_data.exit_room = true
if has_meta("stairs"):
save_data.stairs = get_meta("stairs")
save_furniture()
save_data.furniture = furniture_data
var spawns = {}
for k in get_children():
var e: Spatial = k
if e.is_in_group("spawn"):
var stats = []
if e.has_meta("stats"):
stats = e.get_meta("stats")
spawns[e.name] = {"groups": e.get_groups(), "xform": xform2s(e.transform), "stats": stats}
save_data.spawns = spawns
func restore_furniture():
for k in furniture_data.keys():
var ch = get_node(k)
for d in furniture_data[k]:
var f = load(d.path).instance()
ch.add_child(f)
f.transform = s2xform(d.xform)
func restore():
for k in save_data.exits:
open_path(k)
for k in save_data.windows:
open_window(k)
if save_data.master_room:
set_meta("master_room", true)
if save_data.kitchen_room:
set_meta("kitchen_room", true)
if save_data.jail_room:
set_meta("jail_room", true)
if save_data.stairs >= 0:
set_meta("stairs", save_data.stairs)
create_rooms()
furniture_data = save_data.furniture
restore_furniture()
var spawns = save_data.spawns
for k in spawns.keys():
var e = Spatial.new()
for g in spawns[k].groups:
e.add_to_group(g)
e.transform = s2xform(spawns[k].xform)
add_child(e)
e.name = k
func _ready():
tw2d = $c_modular/w2d.transform
te2d = $c_modular/e2d.transform
tn2d = $c_modular/n2d.transform
ts2d = $c_modular/s2d.transform
func open_path(flag):
if flag == OPEN_UP:
$c_modular/n2d.queue_free()
$c_modular/iw4d.queue_free()
$fc4.queue_free()
bitflags |= BITUP
elif flag == OPEN_DOWN:
$c_modular/s2d.queue_free()
$c_modular/iw11d.queue_free()
$fc5.queue_free()
bitflags |= BITDOWN
elif flag == OPEN_LEFT:
$c_modular/w2d.queue_free()
$c_modular/iw17d.queue_free()
$fc2.queue_free()
bitflags |= BITLEFT
elif flag == OPEN_RIGHT:
$c_modular/e2d.queue_free()
$c_modular/iw22d.queue_free()
$fc3.queue_free()
bitflags |= BITRIGHT
if !flag in exits:
if exits.size() == 1 && !has_meta("master_room"):
$fc1.queue_free()
exits.push_back(flag)
func open_window(flag):
if !flag in windows:
windows.push_back(flag)
func remove_iws():
for k in $c_modular.get_children():
if k.name.begins_with("iw"):
k.queue_free()
save_data.remove_iws = true
func personal_room():
var door_xform
remove_iws()
assert(exits.size() == 1)
match(int(exits[0])):
OPEN_UP:
door_xform = tn2d
OPEN_DOWN:
door_xform = ts2d
OPEN_LEFT:
door_xform = tw2d
OPEN_RIGHT:
door_xform = te2d
_:
print(exits)
assert(false)
var door_i = door.instance()
add_child(door_i)
door_i.transform = door_xform
save_data.personal_room = true
func master_room():
remove_iws()
for k in exits:
var door_xform: Transform
match(int(k)):
OPEN_UP:
door_xform = tn2d
OPEN_DOWN:
door_xform = ts2d
OPEN_LEFT:
door_xform = tw2d
OPEN_RIGHT:
door_xform = te2d
_:
print(exits)
assert(false)
var door_i = door.instance()
add_child(door_i)
door_i.transform = door_xform
func wall2door(n):
var door_xform = n.transform
var door_i
if has_meta("jail_room"):
door_i = jail_door.instance()
else:
door_i = door.instance()
add_child(door_i)
door_i.transform = door_xform
n.queue_free()
func wall2window(n):
var window_xform = n.transform
var window_i
# if has_meta("jail_room"):
# window_i = jail_window.instance()
# else:
# window_i = door.instance()
if has_meta("exit_room") && !outside_door_placed:
window_i = outside_door.instance()
outside_door_placed = true
else:
window_i = window.instance()
add_child(window_i)
window_i.transform = window_xform
n.queue_free()
func create_rooms():
if has_meta("master_room"):
master_room()
elif has_meta("kitchen_room"):
master_room()
elif has_meta("stairs"):
master_room()
if get_meta("stairs") > 0:
$c_modular/floor.queue_free()
elif exits.size() == 1:
personal_room()
elif exits.size() == 4:
wall2door($c_modular/iw2d)
wall2door($c_modular/iw6d)
wall2door($c_modular/iw9d)
wall2door($c_modular/iw13d)
else:
if bitflags & BITLEFT == 0:
$c_modular/iw1.queue_free()
$c_modular/iw2d.queue_free()
$c_modular/iw3.queue_free()
$c_modular/iw8.queue_free()
$c_modular/iw9d.queue_free()
$c_modular/iw10.queue_free()
wall2door($c_modular/iw17d)
$path_west.queue_free()
if bitflags & BITRIGHT == 0:
$c_modular/iw5.queue_free()
$c_modular/iw6d.queue_free()
$c_modular/iw7.queue_free()
$c_modular/iw12.queue_free()
$c_modular/iw13d.queue_free()
$c_modular/iw14.queue_free()
wall2door($c_modular/iw22d)
$path_east.queue_free()
if bitflags & BITUP == 0:
$c_modular/iw15.queue_free()
$c_modular/iw16d.queue_free()
$c_modular/iw23d.queue_free()
$c_modular/iw24.queue_free()
$path_north.queue_free()
if bitflags & BITDOWN == 0:
$c_modular/iw18d.queue_free()
$c_modular/iw19.queue_free()
$c_modular/iw20.queue_free()
$c_modular/iw21d.queue_free()
$path_south.queue_free()
if OPEN_LEFT in windows:
wall2window($c_modular/w1)
wall2window($c_modular/w2d)
wall2window($c_modular/w3)
if OPEN_DOWN in windows:
wall2window($c_modular/s1)
wall2window($c_modular/s2d)
wall2window($c_modular/s3)
if OPEN_RIGHT in windows:
wall2window($c_modular/e1)
wall2window($c_modular/e2d)
wall2window($c_modular/e3)
if OPEN_UP in windows:
wall2window($c_modular/n1)
wall2window($c_modular/n2d)
wall2window($c_modular/n3)

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,209 @@
[gd_scene load_steps=11 format=2]
[ext_resource path="res://scenes/maps/interior2.escn" type="PackedScene" id=1]
[ext_resource path="res://scenes/maps/interior2.gd" type="Script" id=2]
[sub_resource type="Curve3D" id=1]
bake_interval = 0.1
_data = {
"points": PoolVector3Array( 0, 0, 0, 0, 0, 0, 0.475686, 0, 0.0241953, 0, 0, 0, 0, 0, 0, -0.12646, 0, 0.0420877, 0, 0, 0, 0, 0, 0, -0.495044, 0, 0.0322179, 0, 0, 0, 0, 0, 0, -0.743744, 0, 0.0322179, 0, 0, 0, 0, 0, 0, -1.08069, 0, 0.0161727, 0, 0, 0, 0, 0, 0, -1.62623, 0, -0.00789503, 0, 0, 0, 0, 0, 0, -2.01933, 0, -0.00789503, 0, 0, 0, 0, 0, 0, -2.34023, 0, -0.00789503, 0, 0, 0, 0, 0, 0, -2.67718, 0, 0.000127596, 0, 0, 0, 0, 0, 0, -2.8707, 0, -0.00274423, 0, 0, 0, 0, 0, 0, -3.26283, 0, -0.0239401, 0, 0, 0, 0, 0, 0, -3.55163, 0, -0.00430445, 0, 0, 0, 0, 0, 0, -3.86452, 0, -0.0319627, 0, 0, 0, 0, 0, 0, -4.13729, 0, -0.0159176, 0, 0, 0, 0, 0, 0, -4.38599, 0, -0.0239401, 0, 0, 0, 0, 0, 0, -4.64271, 0, -0.0159176, 0, 0, 0, 0, 0, 0, -4.94757, 0.000244141, -0.0159176, 0, 0, 0, 0, 0, 0, -5.18824, 0.000488281, -0.0159176, 0, 0, 0, 0, 0, 0, -5.44497, 0.000732422, -0.00789503, 0, 0, 0, 0, 0, 0, -5.69732, 0.000976562, -0.0231752 ),
"tilts": PoolRealArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
}
[sub_resource type="Curve3D" id=2]
bake_interval = 0.1
_data = {
"points": PoolVector3Array( 0, 0, 0, 0, 0, 0, -0.578618, 0, -0.000728026, 0, 0, 0, 0, 0, 0, -0.307466, 0, 0.0187862, 0, 0, 0, 0, 0, 0, 0.251054, 0, 0.0161727, 0, 0, 0, 0, 0, 0, 0.483709, 0, 0.0161727, 0, 0, 0, 0, 0, 0, 0.756476, 0, 0.00815006, 0, 0, 0, 0, 0, 0, 1.07738, 0, 0.0161727, 0, 0, 0, 0, 0, 0, 1.35817, 0, 0.00815006, 0, 0, 0, 0, 0, 0, 1.69512, 0, 0.0161727, 0, 0, 0, 0, 0, 0, 2.01602, 0, 0.0161727, 0, 0, 0, 0, 0, 0, 2.31387, 0, 0.0193275, 0, 0, 0, 0, 0, 0, 2.722, 0, 0.0161727, 0, 0, 0, 0, 0, 0, 3.01082, 0, 0.0241952, 0, 0, 0, 0, 0, 0, 3.35579, 0, 0.0161727, 0, 0, 0, 0, 0, 0, 3.63658, 0, -0.00789508, 0, 0, 0, 0, 0, 0, 3.87725, 0, -0.00789508, 0, 0, 0, 0, 0, 0, 4.05375, 0, -0.00789508, 0, 0, 0, 0, 0, 0, 4.24544, 0, -0.0159687, 0, 0, 0, 0, 0, 0, 4.52708, 0, 0.000127539, 0, 0, 0, 0, 0, 0, 4.79938, 0, -0.005609, 0, 0, 0, 0, 0, 0, 5.1093, 0.00323259, -0.0133465, 0, 0, 0, 0, 0, 0, 5.43137, 0.0065918, -0.0213871 ),
"tilts": PoolRealArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
}
[sub_resource type="Curve3D" id=3]
bake_interval = 0.1
_data = {
"points": PoolVector3Array( 0, 0, 0, 0, 0, 0, -0.0242307, 0, 0.457537, 0, 0, 0, 0, 0, 0, -0.000652216, 0, 0.203945, 0, 0, 0, 0, 0, 0, -0.00818563, 0, -0.272517, 0, 0, 0, 0, 0, 0, -0.0162084, 0, -0.561329, 0, 0, 0, 0, 0, 0, 0.00227697, 0, -0.863756, 0, 0, 0, 0, 0, 0, -0.030445, 0, -1.25541, 0, 0, 0, 0, 0, 0, 0.00229847, 0, -1.60468, 0, 0, 0, 0, 0, 0, -0.0195311, 0, -1.89937, 0, 0, 0, 0, 0, 0, -0.0195311, 0, -2.15041, 0, 0, 0, 0, 0, 0, -0.0195311, 0, -2.49968, 0, 0, 0, 0, 0, 0, -0.00861633, 0, -2.80529, 0, 0, 0, 0, 0, 0, 0.0378628, 0, -3.13283, 0, 0, 0, 0, 0, 0, 0.00229847, 0, -3.46016, 0, 0, 0, 0, 0, 0, 0.00888348, 0, -3.74139, 0, 0, 0, 0, 0, 0, 0.0149171, 0.00190897, -4.12875, 0, 0, 0, 0, 0, 0, 0.00229847, 0.00317383, -4.42065, 0, 0, 0, 0, 0, 0, -0.00861633, 0.00463867, -4.71534, 0, 0, 0, 0, 0, 0, 0.0132133, 0.00463867, -4.98821 ),
"tilts": PoolRealArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
}
[sub_resource type="Curve3D" id=4]
bake_interval = 0.1
_data = {
"points": PoolVector3Array( 0, 0, 0, 0, 0, 0, 0.0158815, 0, -0.59342, 0, 0, 0, 0, 0, 0, -0.000163555, 0, -0.296584, 0, 0, 0, 0, 0, 0, 0.0158815, 0, 0.128612, 0, 0, 0, 0, 0, 0, 0.00785923, 0, 0.321154, 0, 0, 0, 0, 0, 0, -0.000163555, 0, 0.65008, 0, 0, 0, 0, 0, 0, -0.00532711, 0, 1.01633, 0, 0, 0, 0, 0, 0, -0.00532711, 0, 1.28108, 0, 0, 0, 0, 0, 0, -0.0213727, 0, 1.51373, 0, 0, 0, 0, 0, 0, -0.0133499, 0, 1.77045, 0, 0, 0, 0, 0, 0, -0.0133499, 0, 2.08333, 0, 0, 0, 0, 0, 0, -0.0133499, 0, 2.34006, 0, 0, 0, 0, 0, 0, -0.00532711, 0, 2.63689, 0, 0, 0, 0, 0, 0, -0.0141068, 0, 2.89111, 0, 0, 0, 0, 0, 0, -0.00905108, 0, 3.22984, 0, 0, 0, 0, 0, 0, -0.0191622, 0, 3.49273, 0, 0, 0, 0, 0, 0, -0.027891, 0, 3.85768, 0, 0, 0, 0, 0, 0, -0.0396847, 0, 4.09945, 0, 0, 0, 0, 0, 0, -0.0396847, 0, 4.28815, 0, 0, 0, 0, 0, 0, -0.0337878, 0, 4.47685 ),
"tilts": PoolRealArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
}
[sub_resource type="Curve3D" id=5]
bake_interval = 0.1
_data = {
"points": PoolVector3Array( 0, 0, 0, 0, 0, 0, -2.67678, 0, -0.0223223, 0, 0, 0, 0, 0, 0, -2.93917, 0, 0.0037608, 0, 0, 0, 0, 0, 0, -3.0374, 0, -0.290935, 0, 0, 0, 0, 0, 0, -3.02649, 0, -0.705691, 0, 0, 0, 0, 0, 0, -3.01557, 0, -1.16411, 0, 0, 0, 0, 0, 0, -3.05923, 0, -2.03728, 0, 0, 0, 0, 0, 0, -3.07031, 0, -2.44797, 0, 0, 0, 0, 0, 0, -2.93666, 0, -2.8192, 0, 0, 0, 0, 0, 0, -2.60998, 0, -2.8489, 0, 0, 0, 0, 0, 0, -2.2239, 0, -2.62616, 0, 0, 0, 0, 0, 0, -1.73387, 0, -2.59646 ),
"tilts": PoolRealArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
}
[sub_resource type="Curve3D" id=6]
bake_interval = 0.1
_data = {
"points": PoolVector3Array( 0, 0, 0, 0, 0, 0, 3.65751, 0, -0.0237415, 0, 0, 0, 0, 0, 0, 3.21765, 0, -0.0198471, 0, 0, 0, 0, 0, 0, 2.95564, 0, -0.281859, 0, 0, 0, 0, 0, 0, 2.97435, 0, -0.843312, 0, 0, 0, 0, 0, 0, 2.99307, 0, -1.1334, 0, 0, 0, 0, 0, 0, 2.97435, 0, -1.52641, 0, 0, 0, 0, 0, 0, 2.94628, 0, -1.89136, 0, 0, 0, 0, 0, 0, 2.91821, 0, -2.38731, 0, 0, 0, 0, 0, 0, 2.91821, 0, -2.64932, 0, 0, 0, 0, 0, 0, 2.99307, 0, -2.99555, 0, 0, 0, 0, 0, 0, 3.37673, 0, -2.97683, 0, 0, 0, 0, 0, 0, 3.66681, 0, -2.99555, 0, 0, 0, 0, 0, 0, 3.94754, 0, -3.15463, 0, 0, 0, 0, 0, 0, 3.91011, 0, -3.36985, 0, 0, 0, 0, 0, 0, 3.50774, 0, -3.37921, 0, 0, 0, 0, 0, 0, 3.03986, 0, -3.36049, 0, 0, 0, 0, 0, 0, 2.54391, 0, -3.35113 ),
"tilts": PoolRealArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
}
[sub_resource type="Curve3D" id=7]
_data = {
"points": PoolVector3Array( 0, 0, 0, 0, 0, 0, -2.97234, 0, -0.257696, 0, 0, 0, 0, 0, 0, -2.94688, 0, 0.175153, 0, 0, 0, 0, 0, 0, -3.01053, 0, 0.72258, 0, 0, 0, 0, 0, 0, -2.98507, 0, 1.18089, 0, 0, 0, 0, 0, 0, -2.9978, 0, 1.6392, 0, 0, 0, 0, 0, 0, -3.30805, 0, 2.13115, 0, 0, 0, 0, 0, 0, -3.31607, 0, 2.47944, 0, 0, 0, 0, 0, 0, -2.89595, 0, 2.49217, 0, 0, 0, 0, 0, 0, -2.38672, 0, 2.5049, 0, 0, 0, 0, 0, 0, -2.01753, 0, 2.47944, 0, 0, 0, 0, 0, 0, -1.57195, 0, 2.46671, 0, 0, 0, 0, 0, 0, -1.50829, 0, 3.42152, 0, 0, 0, 0, 0, 0, -2.52676, 0, 3.35787, 0, 0, 0, 0, 0, 0, -3.21423, 0, 3.26875, 0, 0, 0, 0, 0, 0, -3.93988, 0, 3.29421 ),
"tilts": PoolRealArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
}
[sub_resource type="Curve3D" id=8]
_data = {
"points": PoolVector3Array( 0, 0, 0, 0, 0, 0, 2.99725, 0, -0.274681, 0, 0, 0, 0, 0, 0, 2.99725, 0, 0.0200146, 0, 0, 0, 0, 0, 0, 2.98633, 0, 0.227393, 0, 0, 0, 0, 0, 0, 2.97542, 0, 0.533003, 0, 0, 0, 0, 0, 0, 2.98633, 0, 0.904102, 0, 0, 0, 0, 0, 0, 3.01908, 0, 1.24246, 0, 0, 0, 0, 0, 0, 2.97542, 0, 1.63538, 0, 0, 0, 0, 0, 0, 3.02999, 0, 2.36667, 0, 0, 0, 0, 0, 0, 2.99725, 0, 2.96697, 0, 0, 0, 0, 0, 0, 2.98633, 0, 3.23984, 0, 0, 0, 0, 0, 0, 3.6303, 0, 3.05429, 0, 0, 0, 0, 0, 0, 3.96865, 0, 3.04337, 0, 0, 0, 0, 0, 0, 4.02323, 0, 2.79234, 0, 0, 0, 0, 0, 0, 4.02323, 0, 2.50856, 0, 0, 0, 0, 0, 0, 3.99048, 0, 2.20295, 0, 0, 0, 0, 0, 0, 4.01231, 0, 1.82093, 0, 0, 0, 0, 0, 0, 3.69579, 0, 1.78819, 0, 0, 0, 0, 0, 0, 3.44475, 0, 1.99557, 0, 0, 0, 0, 0, 0, 2.59341, 0, 1.99557, 0, 0, 0, 0, 0, 0, 2.04767, 0, 2.00648, 0, 0, 0, 0, 0, 0, 2.00401, 0, 2.39941, 0, 0, 0, 0, 0, 0, 2.00401, 0, 2.73776, 0, 0, 0, 0, 0, 0, 2.3642, 0, 3.03246 ),
"tilts": PoolRealArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
}
[node name="interior2" instance=ExtResource( 1 )]
script = ExtResource( 2 )
[node name="path_west" type="Path" parent="." index="1" groups=[
"path",
]]
curve = SubResource( 1 )
[node name="path_east" type="Path" parent="." index="2" groups=[
"path",
]]
curve = SubResource( 2 )
[node name="path_north" type="Path" parent="." index="3" groups=[
"path",
]]
curve = SubResource( 3 )
[node name="path_south" type="Path" parent="." index="4" groups=[
"path",
]]
curve = SubResource( 4 )
[node name="path_north1" type="Path" parent="." index="5" groups=[
"path",
]]
curve = SubResource( 5 )
[node name="path_north2" type="Path" parent="." index="6" groups=[
"path",
]]
curve = SubResource( 6 )
[node name="path_south1" type="Path" parent="." index="7" groups=[
"path",
]]
curve = SubResource( 7 )
[node name="path_south2" type="Path" parent="." index="8" groups=[
"path",
]]
curve = SubResource( 8 )
[node name="fc1" type="Spatial" parent="." index="9" groups=[
"furniture",
]]
[node name="fc2" type="Spatial" parent="." index="10" groups=[
"furniture",
]]
transform = Transform( -1.62921e-07, 0, 1, 0, 1, 0, -1, 0, -1.62921e-07, -3.69738, 0, 0 )
[node name="fc3" type="Spatial" parent="." index="11" groups=[
"furniture",
]]
transform = Transform( -1.62921e-07, 0, 1, 0, 1, 0, -1, 0, -1.62921e-07, 3.74333, 0, 0 )
[node name="fc4" type="Spatial" parent="." index="12" groups=[
"furniture",
]]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0459535, 0, -2.87076 )
[node name="fc5" type="Spatial" parent="." index="13" groups=[
"furniture",
]]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0459535, 0, 2.79849 )
[node name="fwb1" type="Spatial" parent="." index="14" groups=[
"furniture",
]]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -3.97409, 0, -3.70577 )
[node name="fwb2" type="Spatial" parent="." index="15" groups=[
"furniture",
]]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 3.74345, 0, -3.70577 )
[node name="fwb3" type="Spatial" parent="." index="16" groups=[
"furniture",
]]
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 3.95806, 0, 3.69026 )
[node name="fwb4" type="Spatial" parent="." index="17" groups=[
"furniture",
]]
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, -4.00475, 0, 3.69026 )
[node name="patrol1" type="Spatial" parent="." index="18" groups=[
"patrol",
]]
[node name="patrol2" type="Spatial" parent="." index="19" groups=[
"patrol",
]]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -2.52377 )
[node name="patrol3" type="Spatial" parent="." index="20" groups=[
"patrol",
]]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2.65669 )
[node name="patrol4" type="Spatial" parent="." index="21" groups=[
"patrol",
]]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -3.38838, 0, 2.65669 )
[node name="patrol5" type="Spatial" parent="." index="22" groups=[
"patrol",
]]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2.90648, 0, 2.65669 )
[node name="patrol6" type="Spatial" parent="." index="23" groups=[
"patrol",
]]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2.90648, 0, -2.31294 )
[node name="patrol7" type="Spatial" parent="." index="24" groups=[
"patrol",
]]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -3.17755, 0, -2.31294 )
[node name="patrol8" type="Spatial" parent="." index="25" groups=[
"patrol",
]]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -3.17755, 0, 0.0212815 )
[node name="patrol9" type="Spatial" parent="." index="26" groups=[
"patrol",
]]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2.92154, 0, 0.0212815 )
[node name="patrol10" type="Spatial" parent="." index="27" groups=[
"patrol",
]]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2.92154, 0, -3.25067 )
[node name="patrol11" type="Spatial" parent="." index="28" groups=[
"patrol",
]]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -3.05022, 0, -3.25067 )
[node name="patrol12" type="Spatial" parent="." index="29" groups=[
"patrol",
]]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -3.05022, 0, 3.20383 )
[node name="patrol13" type="Spatial" parent="." index="30" groups=[
"patrol",
]]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 3.02882, 0, 3.20383 )

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,39 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://scenes/maps/interior_level.escn" type="PackedScene" id=1]
[ext_resource path="res://scenes/door_control.tscn" type="PackedScene" id=2]
[node name="interior_level" instance=ExtResource( 1 )]
[node name="Light" parent="." index="0"]
transform = Transform( -0.290865, -0.771101, 0.566393, -0.0551891, 0.604525, 0.794672, -0.955171, 0.199884, -0.218392, -2.46419, 1.90386, -1.00545 )
[node name="door_control" parent="." index="54" instance=ExtResource( 2 )]
door = NodePath("../arch6/door_6")
[node name="door_control2" parent="." index="55" instance=ExtResource( 2 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -7.00811, 0, -4.05358 )
door = NodePath("../arch5/door_5")
[node name="door_control3" parent="." index="56" instance=ExtResource( 2 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 8.06753, 0, -0.0648201 )
door = NodePath("../arch5/door_5")
[node name="door_control4" parent="." index="57" instance=ExtResource( 2 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 8.06753, 0, 8.84333 )
door = NodePath("../arch5/door_5")
[node name="OmniLight" type="OmniLight" parent="." index="58"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.501574, 0, -8.0296 )
light_energy = 3.1
omni_range = 4.97358
[node name="OmniLight2" type="OmniLight" parent="." index="59"]
transform = Transform( 0.991023, 0, -0.133692, 0, 1, 0, 0.133692, 0, 0.991023, 6.9534, 0, -2.87678 )
light_energy = 5.2
omni_range = 1.71726
[node name="OmniLight3" type="OmniLight" parent="." index="60"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -4.08101, 0, 6.23873 )
light_energy = 4.23
omni_range = 3.4381

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,33 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://scenes/maps/jail-door.escn" type="PackedScene" id=1]
[ext_resource path="res://scenes/maps/door.gd" type="Script" id=2]
[sub_resource type="Curve3D" id=1]
_data = {
"points": PoolVector3Array( 0, 0, 0, 0, 0, 0, -0.0287557, 0, 0.617522, 0, 0, 0, 0, 0, 0, -0.0201283, 0, 0.341446, 0, 0, 0, 0, 0, 0, -0.0632648, 0, -0.253842, 0, 0, 0, 0, 0, 0, -0.0891471, 0, -0.6507, 0, 0, 0, 0, 0, 0, -0.0805197, 0, -0.909521 ),
"tilts": PoolRealArray( 0, 0, 0, 0, 0 )
}
[sub_resource type="BoxShape" id=2]
extents = Vector3( 0.463004, 1, 0.246545 )
[node name="jail-door" groups=[
"jail_door",
] instance=ExtResource( 1 )]
script = ExtResource( 2 )
[node name="door_path" type="Path" parent="." index="1"]
curve = SubResource( 1 )
[node name="e1" type="Area" parent="." index="2"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.172547, 0, 0.379604 )
[node name="CollisionShape" type="CollisionShape" parent="e1" index="0"]
shape = SubResource( 2 )
[node name="e2" type="Area" parent="." index="3"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.172547, 0, -0.396858 )
[node name="CollisionShape" type="CollisionShape" parent="e2" index="0"]
shape = SubResource( 2 )

View File

@@ -0,0 +1,19 @@
extends Spatial
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if Input.is_action_pressed("walk_forward"):
$Camera.translation.z -= 20.0 * delta
if Input.is_action_pressed("walk_back"):
$Camera.translation.z += 20.0 * delta

View File

@@ -0,0 +1,15 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://scenes/maps/dungeon.tscn" type="PackedScene" id=1]
[ext_resource path="res://scenes/maps/test-dungeon.gd" type="Script" id=2]
[node name="test-dungeon" type="Spatial"]
script = ExtResource( 2 )
[node name="dungeon" parent="." instance=ExtResource( 1 )]
[node name="Camera" type="Camera" parent="."]
transform = Transform( 1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, 10, 35 )
[node name="DirectionalLight" type="DirectionalLight" parent="."]
transform = Transform( 1, 0, 0, 0, 0.866025, 0.5, 0, -0.5, 0.866025, 0, 20, 0 )

View File

@@ -0,0 +1,34 @@
extends Spatial
func _ready():
var e = $Area.connect("body_entered", self, "weapon_pick")
assert(e == OK)
func weapon_pick(body):
if !body.is_in_group("npc"):
return
assert(body.has_meta("weapon"))
assert(body.has_meta("action"))
# print("weapon picked")
if !body.has_meta("action"):
return
if body.get_meta("weapon") == false:
var action = body.get_meta("action")
if action == "find_weapon":
body.set_meta("weapon", true)
# body.set_meta("action", "")
# body.remove_meta("path")
# body.remove_meta("path_valid")
# body.remove_meta("target_loc")
# body.remove_meta("target_group")
queue_free()
# if body.get_meta("weapon") == true:
# var action = body.get_meta("action")
# if action == "find_weapon":
# body.set_meta("action", "")
# body.remove_meta("path")
# body.remove_meta("path_valid")
# body.remove_meta("target_loc")
# body.remove_meta("target_group")

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://scenes/maps/window.escn" type="PackedScene" id=1]
[node name="window" instance=ExtResource( 1 )]