Compare commits
10 Commits
c9860ae759
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d6f2fc79b | ||
|
|
72452dcb4c | ||
|
|
585a9bdae1 | ||
|
|
153878d792 | ||
|
|
b7a9e2e0b2 | ||
|
|
4e3135559f | ||
|
|
32c5212209 | ||
|
|
078cc47b91 | ||
|
|
7706ba0edf | ||
|
|
88e8359f64 |
@@ -1,11 +1,54 @@
|
||||
extends Node
|
||||
signal new_day
|
||||
|
||||
var raycasts_count = 100
|
||||
var raycast_queue = []
|
||||
var astar: AStar
|
||||
|
||||
var interior
|
||||
|
||||
func _ready():
|
||||
set_save_slot(0)
|
||||
|
||||
enum periods {MORNING, DAY, EVENING, NIGHT}
|
||||
var game_day: int = 0
|
||||
var day_period: int = periods.MORNING
|
||||
var game_hour: int = 0
|
||||
var game_minute: int = 0
|
||||
|
||||
var acc_time:float = 0.0
|
||||
var time_active = false
|
||||
|
||||
func _process(delta):
|
||||
if time_active:
|
||||
update_time(delta)
|
||||
|
||||
func update_time(delta):
|
||||
acc_time += delta
|
||||
if acc_time >= 1.0:
|
||||
game_minute += 1
|
||||
acc_time -= 1.0
|
||||
if game_minute == 60:
|
||||
game_minute = 0
|
||||
game_hour += 1
|
||||
if game_hour == 24:
|
||||
game_hour = 0
|
||||
game_day += 1
|
||||
emit_signal("new_day")
|
||||
match(game_hour):
|
||||
23,0,1,2,3:
|
||||
day_period = periods.NIGHT
|
||||
4,5,6,7,8,9,10,11:
|
||||
day_period = periods.MORNING
|
||||
12,13,14,15,16:
|
||||
day_period = periods.DAY
|
||||
17,18,19,20,21,22:
|
||||
day_period = periods.EVENING
|
||||
func start_time():
|
||||
time_active = true
|
||||
func stop_time():
|
||||
time_active = false
|
||||
|
||||
func visibility_check(ch1, ch2):
|
||||
var direction: Vector3 = -ch1.global_transform.basis[2].normalized()
|
||||
var to_ch2: Vector3 = (ch2.global_transform.origin - ch1.global_transform.origin).normalized()
|
||||
@@ -38,6 +81,10 @@ func save_characters():
|
||||
spawner.set_meta("stats", stats)
|
||||
|
||||
func save_game():
|
||||
print("save game")
|
||||
save_data.game_day = game_day
|
||||
save_data.game_hour = game_hour
|
||||
save_data.day_period = day_period
|
||||
assert(save_slot.length() > 0)
|
||||
var fd = File.new()
|
||||
fd.open(save_slot, File.WRITE)
|
||||
@@ -51,4 +98,7 @@ func load_game():
|
||||
var data = fd.get_as_text()
|
||||
var parse: = JSON.parse(data)
|
||||
save_data = parse.result
|
||||
game_day = save_data.game_day
|
||||
game_hour = save_data.game_hour
|
||||
day_period = save_data.day_period
|
||||
fd.close()
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
extends Node
|
||||
|
||||
enum {STATE_INIT, STATE_SIM, STATE_PAUSE}
|
||||
|
||||
var state = STATE_INIT
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
var bone_ids = []
|
||||
|
||||
#func _physics_process(delta):
|
||||
# match(state):
|
||||
# STATE_INIT:
|
||||
# for k in get_tree().get_nodes_in_group("female"):
|
||||
# if !k.is_in_group("characters"):
|
||||
# continue
|
||||
# var sk: Skeleton = k.get_skeleton()
|
||||
# if bone_ids.size() == 0:
|
||||
# for c in range(sk.get_bone_count()):
|
||||
# var bn = sk.get_bone_name(c)
|
||||
# if bn.begins_with("skirt"):
|
||||
# var pose = sk.get_bone_global_pose(c)
|
||||
# sk.set_bone_global_pose_override(c, pose, 1.0)
|
||||
# bone_ids.push_back(c)
|
||||
# if bone_ids.size() > 0:
|
||||
# state = STATE_SIM
|
||||
# STATE_SIM:
|
||||
# for k in get_tree().get_nodes_in_group("female"):
|
||||
# if !k.is_in_group("characters"):
|
||||
# continue
|
||||
# var sk: Skeleton = k.get_skeleton()
|
||||
# for c in bone_ids:
|
||||
# var pose = sk.get_bone_global_pose(c)
|
||||
# pose.origin.y -= 200.0 * delta
|
||||
# sk.set_bone_global_pose_override(c, pose,1.0)
|
||||
# state = STATE_PAUSE
|
||||
# STATE_PAUSE:
|
||||
# yield(get_tree().create_timer(0.1), "timeout")
|
||||
# state = STATE_SIM
|
||||
235
proto3/godot/autoloads/quests.gd
Normal file
235
proto3/godot/autoloads/quests.gd
Normal file
@@ -0,0 +1,235 @@
|
||||
extends Node
|
||||
|
||||
signal new_quest
|
||||
|
||||
var quests = []
|
||||
|
||||
func save():
|
||||
var data = []
|
||||
for k in quests:
|
||||
data.push_back(k.save())
|
||||
global.save_data.quests = data
|
||||
func restore_quest(d):
|
||||
var q = Quest.new(d.title, d.desc)
|
||||
func restore():
|
||||
for k in global.save_data.quests:
|
||||
quests.push_back(restore_quest(k))
|
||||
|
||||
|
||||
var quest_triggers = [
|
||||
{
|
||||
"title": "Something is not right.",
|
||||
"desc": "You wake up from noise. Explore the building to find the source.",
|
||||
"trigger": ["once", 0, 0, 10],
|
||||
"objectives": [
|
||||
["walkto_room", "Check enterance.", "Check enterance room.", "exit_room", 8.0],
|
||||
["walkto_exit", "Check enteranc edoor is ok.", "Check the door.", 3.0]
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
class QuestObjective extends Reference:
|
||||
var _title
|
||||
var _desc
|
||||
var quest
|
||||
var complete = false
|
||||
var active = false
|
||||
func update():
|
||||
pass
|
||||
func activate():
|
||||
active = true
|
||||
func finish():
|
||||
active = false
|
||||
func set_quest(q):
|
||||
quest = q
|
||||
func _init(title, desc):
|
||||
_title = title
|
||||
_desc = desc
|
||||
func save():
|
||||
var save_data = {}
|
||||
save_data.create = ["obj", _desc, _title]
|
||||
save_data.active = active
|
||||
save_data.complete = complete
|
||||
return save_data
|
||||
|
||||
class Quest extends Reference:
|
||||
signal quest_complete
|
||||
var _title
|
||||
var _description
|
||||
var objectives = []
|
||||
var children = []
|
||||
var complete = false
|
||||
var cur_objective: int = -1
|
||||
func _init(title, desc):
|
||||
_title = title
|
||||
_description = desc
|
||||
func add_objective(obj):
|
||||
objectives.push_back(obj)
|
||||
|
||||
func remove_objective(obj):
|
||||
objectives.erase(obj)
|
||||
func add_child(obj):
|
||||
children.push_back(obj)
|
||||
func remove_child(obj: Quest):
|
||||
children.erase(obj)
|
||||
func save():
|
||||
var save_data = {}
|
||||
save_data.title = _title
|
||||
save_data.desc = _description
|
||||
return save_data
|
||||
func update():
|
||||
for k in children:
|
||||
k.update()
|
||||
for k in objectives:
|
||||
k.update()
|
||||
var old_objective:int = cur_objective
|
||||
complete = true
|
||||
for k in range(objectives.size()):
|
||||
if !objectives[k].complete:
|
||||
cur_objective = k
|
||||
complete = false
|
||||
break
|
||||
for k in children:
|
||||
if !k.complete:
|
||||
complete = false
|
||||
if complete:
|
||||
emit_signal("quest_complete", self)
|
||||
if cur_objective != old_objective:
|
||||
if old_objective >= 0:
|
||||
objectives[old_objective].finish()
|
||||
objectives[cur_objective].activate()
|
||||
func get_title():
|
||||
return _title
|
||||
func get_description():
|
||||
return _title
|
||||
class ObjectiveWalkto extends QuestObjective:
|
||||
var where = Vector3()
|
||||
var radius = 0.0
|
||||
var indicator = preload("res://ui/quest_indicator.tscn")
|
||||
var ind_i: Node2D
|
||||
var old_pos = Vector3()
|
||||
func _init(t, d, w, r).(t, d):
|
||||
where = w
|
||||
radius = r
|
||||
func activate():
|
||||
active = true
|
||||
ind_i = indicator.instance()
|
||||
var player_pos: Vector3 = global.player.global_transform.origin
|
||||
var base = global.astar.get_closest_point(player_pos)
|
||||
var tgt = global.astar.get_closest_point(where)
|
||||
var path = global.astar.get_point_path(base, tgt)
|
||||
if path.size() > 1:
|
||||
ind_i.target = path[1] + Vector3(0, 1, 0) * 0.3
|
||||
else:
|
||||
ind_i.target = where + Vector3(0, 1, 0) * 0.3
|
||||
global.get_viewport().add_child(ind_i)
|
||||
print(_title, "ACTIVATED")
|
||||
old_pos = player_pos
|
||||
func finish():
|
||||
active = false
|
||||
ind_i.queue_free()
|
||||
print(_title, " FINISHED")
|
||||
func update():
|
||||
if !active:
|
||||
return
|
||||
var player_pos: Vector3 = global.player.global_transform.origin
|
||||
if old_pos.distance_to(player_pos) > 0.5:
|
||||
var base = global.astar.get_closest_point(player_pos)
|
||||
var tgt = global.astar.get_closest_point(where)
|
||||
var path = global.astar.get_point_path(base, tgt)
|
||||
if path.size() > 1:
|
||||
var ind = 0
|
||||
var pt = path[ind]
|
||||
while ind < path.size() - 1:
|
||||
pt = path[ind]
|
||||
if pt.distance_to(player_pos) > 2.0:
|
||||
ind_i.target = pt + Vector3(0, 1, 0) * 0.3
|
||||
break
|
||||
ind += 1
|
||||
else:
|
||||
ind_i.target = where + Vector3(0, 1, 0) * 0.3
|
||||
old_pos = player_pos
|
||||
if old_pos.distance_to(where) < radius:
|
||||
complete = true
|
||||
func save():
|
||||
var save_data = {}
|
||||
save_data.create = ["walkto_room", _title, _desc, where, radius]
|
||||
save_data.active = active
|
||||
save_data.complete = complete
|
||||
return save_data
|
||||
|
||||
func _ready():
|
||||
set_process(false)
|
||||
|
||||
|
||||
func check_trigger(t):
|
||||
var t_type = t[0]
|
||||
match(t_type):
|
||||
"once":
|
||||
var t_day = t[1]
|
||||
var t_hour = t[2]
|
||||
var t_minute = t[3]
|
||||
if global.game_day != t_day:
|
||||
return false
|
||||
if global.game_hour != t_hour:
|
||||
return false
|
||||
if int(global.game_minute / 10) != int(t_minute / 10):
|
||||
return false
|
||||
return true
|
||||
return false
|
||||
func create_objective(v):
|
||||
var o_type = v[0]
|
||||
match(o_type):
|
||||
"walkto_room":
|
||||
var o_title = v[1]
|
||||
var o_desc = v[2]
|
||||
var o_meta = v[3]
|
||||
var o_radius = v[4]
|
||||
var where = Vector3()
|
||||
var rooms = global.get_tree().get_nodes_in_group("room")
|
||||
var room_set = false
|
||||
for e in rooms:
|
||||
print(e.name)
|
||||
if e.has_meta(o_meta):
|
||||
where = e.global_transform.origin
|
||||
room_set = true
|
||||
break
|
||||
assert(room_set == true)
|
||||
var obj = ObjectiveWalkto.new(o_title, o_desc, where, o_radius)
|
||||
return obj
|
||||
"walkto_exit":
|
||||
var o_title = v[1]
|
||||
var o_desc = v[2]
|
||||
var o_radius = v[3]
|
||||
var where = global.interior.exit_doors[0].global_transform.origin
|
||||
var obj = ObjectiveWalkto.new(o_title, o_desc, where, o_radius)
|
||||
return obj
|
||||
return null
|
||||
|
||||
var up_time = 0.0
|
||||
var state: int = 0
|
||||
func activate():
|
||||
set_process(true)
|
||||
func _process(delta):
|
||||
up_time += delta
|
||||
if up_time > 1000.0:
|
||||
up_time = 0.0
|
||||
if int(up_time * 10.0) % 10 == 1:
|
||||
var processed = []
|
||||
while quest_triggers.size() > 0:
|
||||
var k = quest_triggers.pop_front()
|
||||
if check_trigger(k.trigger):
|
||||
print("quest triggered: ", k.title)
|
||||
var q = Quest.new(k.title, k.desc)
|
||||
quests.push_back(q)
|
||||
for r in k.objectives:
|
||||
var obj = create_objective(r)
|
||||
if obj:
|
||||
q.add_objective(obj)
|
||||
emit_signal("new_quest", q)
|
||||
else:
|
||||
processed.push_back(k)
|
||||
quest_triggers = processed
|
||||
for k in quests:
|
||||
k.update()
|
||||
|
||||
22
proto3/godot/autoloads/world.gd
Normal file
22
proto3/godot/autoloads/world.gd
Normal file
@@ -0,0 +1,22 @@
|
||||
extends Node
|
||||
signal level_up
|
||||
signal new_quest
|
||||
|
||||
var money: int = 2000
|
||||
var master_node
|
||||
var current_room
|
||||
var team = {}
|
||||
var line = {}
|
||||
var training = false
|
||||
# warning-ignore:unused_class_variable
|
||||
var quests : = []
|
||||
# warning-ignore:unused_class_variable
|
||||
var team_train_count : = 0
|
||||
# warning-ignore:unused_class_variable
|
||||
var arrow: Spatial
|
||||
# warning-ignore:unused_class_variable
|
||||
var next_scene: String
|
||||
var player_visual = {
|
||||
"gender": "male"
|
||||
}
|
||||
|
||||
817
proto3/godot/city/building.gd
Normal file
817
proto3/godot/city/building.gd
Normal file
@@ -0,0 +1,817 @@
|
||||
extends Spatial
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
var wall = preload("res://scenes/maps/wall.escn")
|
||||
var window = preload("res://scenes/maps/window.tscn")
|
||||
var door = preload("res://scenes/maps/door.tscn")
|
||||
var entry = preload("res://scenes/maps/door-outside.tscn")
|
||||
var fl = preload("res://scenes/maps/floor.escn")
|
||||
var stairs = preload("res://scenes/maps/stairs-small.escn")
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
var rnd: RandomNumberGenerator
|
||||
var contour = [
|
||||
Vector2(-10, -10), Vector2(10, -10),
|
||||
Vector2(10, 10), Vector2(-10, 10)
|
||||
]
|
||||
|
||||
var spaces = [
|
||||
"entry",
|
||||
"window",
|
||||
"corridoor"
|
||||
]
|
||||
#var adj = {
|
||||
# "entry": ["hall"],
|
||||
# "hall": ["hall1", "kitchen", "toilet1", "bathroom1", "hall2"],
|
||||
#}
|
||||
class Floor extends Reference:
|
||||
const FLAG_WALL_LEFT = (1 << 0)
|
||||
const FLAG_WALL_UP = (1 << 1)
|
||||
const FLAG_WALL_RIGHT = (1 << 2)
|
||||
const FLAG_WALL_DOWN = (1 << 3)
|
||||
const FLAG_FLOOR = (1 << 4)
|
||||
const FLAG_ENTRY_LEFT = (1 << 5)
|
||||
const FLAG_ENTRY_UP = (1 << 6)
|
||||
const FLAG_ENTRY_RIGHT = (1 << 7)
|
||||
const FLAG_ENTRY_DOWN = (1 << 8)
|
||||
const FLAG_WINDOW_LEFT = (1 << 9)
|
||||
const FLAG_WINDOW_UP = (1 << 10)
|
||||
const FLAG_WINDOW_RIGHT = (1 << 11)
|
||||
const FLAG_WINDOW_DOWN = (1 << 12)
|
||||
const FLAG_DOOR_LEFT = (1 << 13)
|
||||
const FLAG_DOOR_UP = (1 << 14)
|
||||
const FLAG_DOOR_RIGHT = (1 << 15)
|
||||
const FLAG_DOOR_DOWN = (1 << 16)
|
||||
const FLAG_STAIRS = (1 << 17)
|
||||
const FLAG_WALL_MASK = (FLAG_WALL_LEFT | FLAG_WALL_UP | FLAG_WALL_RIGHT | FLAG_WALL_DOWN)
|
||||
const FLAG_ENTRY_MASK = (FLAG_ENTRY_LEFT | FLAG_ENTRY_UP | FLAG_ENTRY_RIGHT | FLAG_ENTRY_DOWN)
|
||||
const FLAG_WINDOW_MASK = (FLAG_WINDOW_LEFT | FLAG_WINDOW_UP | FLAG_WINDOW_RIGHT | FLAG_WINDOW_DOWN)
|
||||
const FLAG_DOOR_MASK = (FLAG_DOOR_LEFT | FLAG_DOOR_UP | FLAG_DOOR_RIGHT | FLAG_DOOR_DOWN)
|
||||
const FLAG_LEFT_MASK = (FLAG_WALL_LEFT | FLAG_ENTRY_LEFT | FLAG_WINDOW_LEFT | FLAG_DOOR_LEFT)
|
||||
const FLAG_UP_MASK = (FLAG_WALL_UP | FLAG_ENTRY_UP | FLAG_WINDOW_UP | FLAG_DOOR_UP)
|
||||
const FLAG_RIGHT_MASK = (FLAG_WALL_RIGHT | FLAG_ENTRY_RIGHT | FLAG_WINDOW_RIGHT | FLAG_DOOR_RIGHT)
|
||||
const FLAG_DOWN_MASK = (FLAG_WALL_DOWN | FLAG_ENTRY_DOWN | FLAG_WINDOW_DOWN | FLAG_DOOR_DOWN)
|
||||
var wall_length = 2.0
|
||||
var grid_areas = []
|
||||
var grid_walls = []
|
||||
var grid_rect: = Rect2()
|
||||
var grid_size = 2.0
|
||||
var size_x:int = 0
|
||||
var size_y:int = 0
|
||||
var windows = []
|
||||
var walls_tiles = []
|
||||
var enterance
|
||||
var enterance_tile = -1
|
||||
var stairs_pos: Vector2
|
||||
var stairs_tile: int
|
||||
const big_stairs_w = 10
|
||||
const big_stairs_h = 8
|
||||
const small_stairs_w = 4
|
||||
const small_stairs_h = 4
|
||||
func copy():
|
||||
var ret = Floor.new()
|
||||
ret.wall_length = wall_length
|
||||
ret.grid_areas = grid_areas.duplicate()
|
||||
ret.grid_walls = grid_walls.duplicate()
|
||||
ret.grid_rect = grid_rect
|
||||
ret.grid_size = grid_size
|
||||
ret.size_x = size_x
|
||||
ret.size_y = size_y
|
||||
ret.windows = windows.duplicate()
|
||||
ret.walls_tiles = walls_tiles.duplicate()
|
||||
ret.enterance = enterance
|
||||
ret.enterance_tile = enterance_tile
|
||||
ret.stairs_pos = stairs_pos
|
||||
ret.stairs_tile = stairs_tile
|
||||
return ret
|
||||
func init_grid(contour):
|
||||
for k in range(contour.size()):
|
||||
var p1 = contour[k]
|
||||
var p2 = contour[(k + 1) % contour.size()]
|
||||
for x in contour:
|
||||
grid_rect = grid_rect.expand(x)
|
||||
size_x = grid_rect.size.x / grid_size + 2
|
||||
size_y = grid_rect.size.y / grid_size + 2
|
||||
grid_areas.resize(size_x * size_y)
|
||||
grid_walls.resize(size_x * size_y)
|
||||
for t in range(size_x * size_y):
|
||||
grid_areas[t] = 0
|
||||
grid_walls[t] = 0
|
||||
func init_walls(contour):
|
||||
for y in range(size_y):
|
||||
for x in range(size_x):
|
||||
var point_flags = 0
|
||||
var px = float(x) * grid_size + grid_rect.position.x - grid_size
|
||||
var py = float(y) * grid_size + grid_rect.position.y - grid_size
|
||||
var p0 = Vector2(px - 0.1, py - 0.1)
|
||||
var p1 = Vector2(px - 0.1 + grid_size + 0.1, py)
|
||||
var p2 = Vector2(px + grid_size + 0.1, py + grid_size + 0.1)
|
||||
var p3 = Vector2(px - 0.1, py + grid_size + 0.1)
|
||||
var p4 = p0 + Vector2(grid_size * 0.5, grid_size * 0.5) + Vector2(0.1, 0.1)
|
||||
var p01 = p0.linear_interpolate(p1, 0.5)
|
||||
var p12 = p1.linear_interpolate(p2, 0.5)
|
||||
var p23 = p2.linear_interpolate(p3, 0.5)
|
||||
var p30 = p3.linear_interpolate(p0, 0.5)
|
||||
if Geometry.is_point_in_polygon(p0, PoolVector2Array(contour)):
|
||||
point_flags |= 1
|
||||
if Geometry.is_point_in_polygon(p1, PoolVector2Array(contour)):
|
||||
point_flags |= 2
|
||||
if Geometry.is_point_in_polygon(p2, PoolVector2Array(contour)):
|
||||
point_flags |= 4
|
||||
if Geometry.is_point_in_polygon(p3, PoolVector2Array(contour)):
|
||||
point_flags |= 8
|
||||
if Geometry.is_point_in_polygon(p4, PoolVector2Array(contour)):
|
||||
point_flags |= 16
|
||||
if Geometry.is_point_in_polygon(p01, PoolVector2Array(contour)):
|
||||
point_flags |= 32
|
||||
if Geometry.is_point_in_polygon(p12, PoolVector2Array(contour)):
|
||||
point_flags |= 64
|
||||
if Geometry.is_point_in_polygon(p23, PoolVector2Array(contour)):
|
||||
point_flags |= 128
|
||||
if Geometry.is_point_in_polygon(p30, PoolVector2Array(contour)):
|
||||
point_flags |= 256
|
||||
if point_flags == 0:
|
||||
grid_areas[y * size_x + x] = 0xffff
|
||||
else:
|
||||
grid_areas[y * size_x + x] = 0
|
||||
grid_walls[y * size_x + x] = point_flags
|
||||
func grid2pos(x: int, y: int):
|
||||
var px = float(x) * grid_size + grid_rect.position.x - grid_size
|
||||
var py = float(y) * grid_size + grid_rect.position.y - grid_size
|
||||
return Vector2(px, py)
|
||||
func convert_walls():
|
||||
for y in range(size_y):
|
||||
for x in range(size_x):
|
||||
var left = false
|
||||
var right = false
|
||||
var up = false
|
||||
var down = false
|
||||
var f = false
|
||||
var point_flags = grid_walls[y * size_x + x]
|
||||
var px = float(x) * grid_size + grid_rect.position.x - grid_size
|
||||
var py = float(y) * grid_size + grid_rect.position.y - grid_size
|
||||
var p0 = Vector2(px, py)
|
||||
var p1 = Vector2(px + grid_size, py)
|
||||
var p2 = Vector2(px + grid_size, py + grid_size)
|
||||
var p3 = Vector2(px, py + grid_size)
|
||||
match(point_flags):
|
||||
0x1ff:
|
||||
f = true
|
||||
0x01, 0x02, 0x4, 0x08, 0x108, 0x84, 0x8c, 0x88, 0x0, 0x22, 0x23, 0x21, 0x046:
|
||||
f = false
|
||||
0x109, 0x101, 0x12b, 0x18d, 0x042, 0x06, 0xe4, 0x67, 0x40, 0x64, 0xc6:
|
||||
f = false
|
||||
0x80, 0xc, 0x1ce, 0x100, 0x1a9, 0x9, 0x161, 0x3, 0x20:
|
||||
f = false
|
||||
0xd6, 0xde:
|
||||
f = true
|
||||
up = true
|
||||
left = true
|
||||
0x19c, 0x1de, 0x1df, 0x1da:
|
||||
f = true
|
||||
up = true
|
||||
0x19a, 0x19b, 0x198:
|
||||
f = true
|
||||
up = true
|
||||
right = true
|
||||
0xf4, 0xf6, 0xf7, 0xff, 0xfe, 0x1fe:
|
||||
f = true
|
||||
left = true
|
||||
0x1b3, 0x1bb, 0x1bf, 0x199, 0x1bd, 0x1b9:
|
||||
f = true
|
||||
right = true
|
||||
0x1fd, 0x1fb, 0x1f7, 0x1f6:
|
||||
f = true
|
||||
0x72, 0x76:
|
||||
f = true
|
||||
left = true
|
||||
down = true
|
||||
0x73, 0x152, 0x173, 0x17b, 0x177, 0x172, 0x17f:
|
||||
f = true
|
||||
down = true
|
||||
0x131, 0x133, 0x139:
|
||||
f = true
|
||||
right = true
|
||||
down = true
|
||||
0x52, 0x56:
|
||||
f = true
|
||||
down = true
|
||||
up = true
|
||||
left = true
|
||||
0x96:
|
||||
f = true
|
||||
left = true
|
||||
right = true
|
||||
up = true
|
||||
0x11a, 0x110:
|
||||
f = true
|
||||
up = true
|
||||
right = true
|
||||
down = true
|
||||
0x33:
|
||||
f = true
|
||||
left = true
|
||||
right = true
|
||||
down = true
|
||||
_:
|
||||
if point_flags & 0x10 != 0:
|
||||
print("%03x" % (point_flags))
|
||||
else:
|
||||
print("skip %03x" % (point_flags))
|
||||
if up:
|
||||
if y > 0:
|
||||
if grid_walls[(y - 1) * size_x + x] & 16 != 0:
|
||||
up = false
|
||||
if down:
|
||||
if y < size_y - 1:
|
||||
if grid_walls[(y + 1) * size_x + x] & 16 != 0:
|
||||
down = false
|
||||
if left:
|
||||
if x > 0:
|
||||
if grid_walls[y * size_x + x - 1] & 16 != 0:
|
||||
left = false
|
||||
if right:
|
||||
if x < size_x - 1:
|
||||
if grid_walls[y * size_x + x + 1] & 16 != 0:
|
||||
right = false
|
||||
if !up && f:
|
||||
if y > 0:
|
||||
if grid_walls[(y - 1) * size_x + x] & 16 == 0:
|
||||
up = true
|
||||
if !down && f:
|
||||
if y < size_y - 1:
|
||||
if grid_walls[(y + 1) * size_x + x] & 16 == 0:
|
||||
down = true
|
||||
if !left && f:
|
||||
if x > 0:
|
||||
if grid_walls[y * size_x + x - 1] & 16 == 0:
|
||||
left = true
|
||||
if !right && f:
|
||||
if x < size_x - 1:
|
||||
if grid_walls[y * size_x + x + 1] & 16 == 0:
|
||||
right = true
|
||||
point_flags = 0
|
||||
if left:
|
||||
point_flags |= 1
|
||||
if up:
|
||||
point_flags |= 2
|
||||
if right:
|
||||
point_flags |= 4
|
||||
if down:
|
||||
point_flags |= 8
|
||||
if f:
|
||||
point_flags |= 16
|
||||
grid_walls[y * size_x + x] = point_flags
|
||||
if point_flags & 0xf != 0:
|
||||
walls_tiles.push_back(y * size_x + x)
|
||||
func create_entry_door(rnd):
|
||||
var tile = walls_tiles[rnd.randi() % walls_tiles.size()]
|
||||
var point_flags = grid_walls[tile]
|
||||
var flags = [
|
||||
[FLAG_WALL_LEFT, FLAG_ENTRY_LEFT],
|
||||
[FLAG_WALL_UP, FLAG_ENTRY_UP],
|
||||
[FLAG_WALL_RIGHT, FLAG_ENTRY_RIGHT],
|
||||
[FLAG_WALL_DOWN, FLAG_ENTRY_DOWN]
|
||||
]
|
||||
var rflags = []
|
||||
for p in flags:
|
||||
if point_flags & p[0] != 0:
|
||||
rflags.push_back(p)
|
||||
var f = rflags[rnd.randi() % rflags.size()]
|
||||
point_flags &= ~f[0]
|
||||
point_flags |= f[1]
|
||||
grid_walls[tile] = point_flags
|
||||
enterance_tile = tile
|
||||
func allocate_stairs(area_code: int):
|
||||
var stairs_w = small_stairs_w
|
||||
var stairs_h = small_stairs_h
|
||||
var stairs_grid_w = int((stairs_w + grid_size * 0.5) / grid_size)
|
||||
var stairs_grid_h = int((stairs_h + grid_size * 0.5) / grid_size)
|
||||
print("size_x ", size_x)
|
||||
print("size_y ", size_y)
|
||||
print("stairs grid size: ", stairs_grid_w, " ", stairs_grid_h)
|
||||
var candidates = []
|
||||
var candidates_tile = []
|
||||
for i in range(size_y - stairs_grid_h):
|
||||
for j in range(size_x - stairs_grid_w):
|
||||
var ok = true
|
||||
for ii in range(stairs_grid_h):
|
||||
for jj in range(stairs_grid_w):
|
||||
if grid_walls[(i + ii) * size_x + j + jj] != FLAG_FLOOR:
|
||||
ok = false
|
||||
break
|
||||
if grid_areas[(i + ii) * size_x + j + jj] != 0:
|
||||
ok = false
|
||||
break
|
||||
if ok:
|
||||
candidates_tile.push_back(i * size_x + j)
|
||||
var pos = grid2pos(j, i) + Vector2(stairs_w, stairs_h) * 0.5
|
||||
print("stairs tile: ", i * size_x +j, " pos: ", pos)
|
||||
candidates.push_back(pos)
|
||||
assert(candidates_tile.size() > 0)
|
||||
var pos = 0
|
||||
for xpos in range(1, candidates_tile.size(), 1):
|
||||
if abs(enterance_tile - candidates_tile[xpos]) < abs(enterance_tile - candidates_tile[pos]):
|
||||
pos = xpos
|
||||
stairs_tile = candidates_tile[pos]
|
||||
stairs_pos = candidates[pos]
|
||||
print("result: tile: ", stairs_tile, " pos: ", stairs_pos)
|
||||
for i in range(stairs_grid_h):
|
||||
for j in range(stairs_grid_w):
|
||||
grid_areas[stairs_tile + i * size_x + j] = area_code
|
||||
grid_walls[stairs_tile + i * size_x + j] |= FLAG_STAIRS
|
||||
func remove_stairs_floor():
|
||||
var stairs_w = small_stairs_w
|
||||
var stairs_h = small_stairs_h
|
||||
var stairs_grid_w = int((stairs_w + grid_size * 0.5) / grid_size)
|
||||
var stairs_grid_h = int((stairs_h + grid_size * 0.5) / grid_size)
|
||||
for i in range(stairs_grid_h):
|
||||
for j in range(stairs_grid_w):
|
||||
grid_walls[stairs_tile + i * size_x + j] &= ~FLAG_FLOOR
|
||||
|
||||
func clear_entry_door():
|
||||
if enterance_tile < 0:
|
||||
return
|
||||
var point_flags = grid_walls[enterance_tile]
|
||||
var flags = [
|
||||
[FLAG_ENTRY_LEFT, FLAG_WALL_LEFT, FLAG_WINDOW_LEFT],
|
||||
[FLAG_ENTRY_UP, FLAG_WALL_UP, FLAG_WINDOW_UP],
|
||||
[FLAG_ENTRY_RIGHT, FLAG_WALL_RIGHT, FLAG_WINDOW_RIGHT],
|
||||
[FLAG_ENTRY_DOWN, FLAG_WALL_DOWN, FLAG_WINDOW_DOWN]
|
||||
]
|
||||
var rflags = []
|
||||
for p in flags:
|
||||
if point_flags & p[0] != 0:
|
||||
rflags.push_back(p)
|
||||
for f in rflags:
|
||||
point_flags &= ~f[0]
|
||||
point_flags |= f[1]
|
||||
grid_walls[enterance_tile] = point_flags
|
||||
enterance_tile = -1
|
||||
|
||||
func create_windows(rnd, pwindow: float):
|
||||
for tile in walls_tiles:
|
||||
var point_flags = grid_walls[tile]
|
||||
var flags = [
|
||||
[1, 512],
|
||||
[2, 1024],
|
||||
[4, 2048],
|
||||
[8, 4096]
|
||||
]
|
||||
var rflags = []
|
||||
for p in flags:
|
||||
if point_flags & p[0] != 0:
|
||||
if rnd.randf() > 1.0 - pwindow:
|
||||
rflags.push_back(p)
|
||||
for f in rflags:
|
||||
point_flags &= ~f[0]
|
||||
point_flags |= f[1]
|
||||
grid_walls[tile] = point_flags
|
||||
func tile_distance(tile1: int, tile2: int):
|
||||
var last_x = tile1 % size_x
|
||||
var last_y = int(tile1 / size_x)
|
||||
var cur_x = tile2 % size_x
|
||||
var cur_y = int(tile2 / size_x)
|
||||
var dst = Vector2(cur_x - last_x, cur_y - last_y).length()
|
||||
return int(dst)
|
||||
func init_areas():
|
||||
for t in range(grid_walls.size()):
|
||||
if grid_walls[t] & FLAG_FLOOR:
|
||||
grid_areas[t] = 0x0
|
||||
else:
|
||||
grid_areas[t] = 0xffff
|
||||
func create_areas(min_d: int = 4, start_code: int = 1) -> int:
|
||||
var created_roots = []
|
||||
var area_code: int = start_code
|
||||
for t in [FLAG_ENTRY_MASK, FLAG_WINDOW_MASK]:
|
||||
var p = walls_tiles.duplicate()
|
||||
while p.size() > 0:
|
||||
var tile = p.pop_front()
|
||||
var point_flags = grid_walls[tile]
|
||||
if point_flags & FLAG_STAIRS != 0:
|
||||
continue
|
||||
if (point_flags & t != 0):
|
||||
if t == FLAG_ENTRY_MASK:
|
||||
print("entry")
|
||||
if created_roots.empty():
|
||||
grid_areas[tile] = area_code
|
||||
if t == FLAG_ENTRY_MASK:
|
||||
enterance = area_code
|
||||
area_code += 1
|
||||
created_roots.push_back(tile)
|
||||
else:
|
||||
var mdst = 1000000000
|
||||
for e in created_roots:
|
||||
var dst = tile_distance(e, tile)
|
||||
if mdst > dst:
|
||||
mdst = dst
|
||||
print(mdst)
|
||||
if mdst >= min_d:
|
||||
grid_areas[tile] = area_code
|
||||
if t == FLAG_ENTRY_MASK:
|
||||
enterance = area_code
|
||||
area_code += 1
|
||||
created_roots.push_back(tile)
|
||||
assert(enterance != null)
|
||||
return area_code
|
||||
func grow_areas_left():
|
||||
var count = 0
|
||||
for tile in range(grid_areas.size()):
|
||||
var code = grid_areas[tile]
|
||||
var point_flags = grid_walls[tile]
|
||||
if code == 0xffff:
|
||||
continue
|
||||
if (point_flags & FLAG_FLOOR) == 0:
|
||||
continue
|
||||
var x = tile % size_x
|
||||
var y = int(tile / size_x)
|
||||
if x > 0:
|
||||
var code_left = grid_areas[tile - 1]
|
||||
if code_left == 0:
|
||||
grid_areas[tile - 1] = code
|
||||
count += 1
|
||||
return false if count == 0 else true
|
||||
func grow_areas_right():
|
||||
var count = 0
|
||||
for tile in range(grid_areas.size()):
|
||||
var code = grid_areas[tile]
|
||||
var point_flags = grid_walls[tile]
|
||||
if code == 0xffff:
|
||||
continue
|
||||
if (point_flags & FLAG_FLOOR) == 0:
|
||||
continue
|
||||
var x = tile % size_x
|
||||
var y = int(tile / size_x)
|
||||
if x < size_x - 1:
|
||||
var code_right = grid_areas[tile + 1]
|
||||
if code_right == 0:
|
||||
grid_areas[tile + 1] = code
|
||||
count += 1
|
||||
return false if count == 0 else true
|
||||
func grow_areas_up():
|
||||
var count = 0
|
||||
for tile in range(grid_areas.size()):
|
||||
var code = grid_areas[tile]
|
||||
var point_flags = grid_walls[tile]
|
||||
if code == 0xffff:
|
||||
continue
|
||||
if (point_flags & FLAG_FLOOR) == 0:
|
||||
continue
|
||||
var x = tile % size_x
|
||||
var y = int(tile / size_x)
|
||||
if y > 0:
|
||||
var code_up = grid_areas[tile - size_x]
|
||||
if code_up == 0:
|
||||
grid_areas[tile - size_x] = code
|
||||
count += 1
|
||||
return false if count == 0 else true
|
||||
func grow_areas_down():
|
||||
var count = 0
|
||||
for tile in range(grid_areas.size()):
|
||||
var code = grid_areas[tile]
|
||||
var point_flags = grid_walls[tile]
|
||||
if code == 0xffff:
|
||||
continue
|
||||
if (point_flags & FLAG_FLOOR) == 0:
|
||||
continue
|
||||
var x = tile % size_x
|
||||
var y = int(tile / size_x)
|
||||
if y < size_y - 1:
|
||||
var code_down = grid_areas[tile + size_x]
|
||||
if code_down == 0:
|
||||
grid_areas[tile + size_x] = code
|
||||
count += 1
|
||||
print(grid_areas)
|
||||
print(grid_walls)
|
||||
return false if count == 0 else true
|
||||
func add_adj(adj, ncode, ncode2, ntile, ntile2, adj_type):
|
||||
print("add_adj ", ncode)
|
||||
if adj.has(ncode):
|
||||
if adj[ncode].has(ncode2):
|
||||
adj[ncode][ncode2].push_back([ntile, ntile2, adj_type])
|
||||
else:
|
||||
adj[ncode][ncode2] = [[ntile, ntile2, adj_type]]
|
||||
else:
|
||||
adj[ncode] = {}
|
||||
adj[ncode][ncode2] = [[ntile, ntile2, adj_type]]
|
||||
|
||||
func build_area_adj():
|
||||
var adj = {}
|
||||
for tile in range(grid_areas.size()):
|
||||
var code = grid_areas[tile]
|
||||
var point_flags = grid_walls[tile]
|
||||
if code == 0xffff:
|
||||
continue
|
||||
if (point_flags & FLAG_FLOOR) == 0:
|
||||
continue
|
||||
var x = tile % size_x
|
||||
var y = int(tile / size_x)
|
||||
print(tile, " ", code, " ", point_flags)
|
||||
if x > 0:
|
||||
var code_left = grid_areas[tile - 1]
|
||||
if code_left != code && code_left != 0xffff:
|
||||
add_adj(adj, code, code_left, tile, tile - 1, FLAG_DOOR_LEFT)
|
||||
if x < size_x - 1:
|
||||
var code_right = grid_areas[tile + 1]
|
||||
if code_right != code && code_right != 0xffff:
|
||||
add_adj(adj, code, code_right, tile, tile + 1, FLAG_DOOR_RIGHT)
|
||||
if y > 0:
|
||||
var code_up = grid_areas[tile - size_x]
|
||||
if code_up != code && code_up != 0xffff:
|
||||
add_adj(adj, code, code_up, tile, tile - size_x, FLAG_DOOR_UP)
|
||||
if y < size_y - 1:
|
||||
var code_down = grid_areas[tile + size_x]
|
||||
if code_down != code && code_down != 0xffff:
|
||||
add_adj(adj, code, code_down, tile, tile + size_x, FLAG_DOOR_DOWN)
|
||||
assert(!adj.empty())
|
||||
return adj
|
||||
func build_area_walls():
|
||||
for tile in range(grid_areas.size()):
|
||||
var code = grid_areas[tile]
|
||||
var point_flags = grid_walls[tile]
|
||||
var old_point_flags = point_flags
|
||||
if code == 0xffff:
|
||||
continue
|
||||
if (point_flags & FLAG_FLOOR) == 0:
|
||||
continue
|
||||
var x = tile % size_x
|
||||
var y = int(tile / size_x)
|
||||
var leftm = point_flags & FLAG_LEFT_MASK
|
||||
var rightm = point_flags & FLAG_RIGHT_MASK
|
||||
var upm = point_flags & FLAG_UP_MASK
|
||||
var downm = point_flags & FLAG_DOWN_MASK
|
||||
if (leftm == 0) && x > 0:
|
||||
var left_code = grid_areas[tile - 1]
|
||||
if code != left_code:
|
||||
var left_flags = grid_walls[tile - 1]
|
||||
if (point_flags & FLAG_LEFT_MASK == 0) && (left_flags & FLAG_RIGHT_MASK == 0):
|
||||
point_flags |= FLAG_WALL_LEFT
|
||||
if (rightm == 0) && x < size_x - 1:
|
||||
var right_code = grid_areas[tile + 1]
|
||||
if code != right_code:
|
||||
var right_flags = grid_walls[tile + 1]
|
||||
if (point_flags & FLAG_RIGHT_MASK == 0) && (right_flags & FLAG_LEFT_MASK == 0):
|
||||
point_flags |= FLAG_WALL_RIGHT
|
||||
if upm == 0 && y > 0:
|
||||
var up_code = grid_areas[tile - size_x]
|
||||
if code != up_code:
|
||||
var up_flags = grid_walls[tile - size_x]
|
||||
if (point_flags & FLAG_UP_MASK == 0) && (up_flags & FLAG_DOWN_MASK == 0):
|
||||
point_flags |= FLAG_WALL_UP
|
||||
if downm == 0 && y < size_y - 1:
|
||||
var down_code = grid_areas[tile + size_x]
|
||||
if code != down_code:
|
||||
var down_flags = grid_walls[tile + size_x]
|
||||
if (point_flags & FLAG_DOWN_MASK == 0) && (down_flags & FLAG_UP_MASK == 0):
|
||||
point_flags |= FLAG_WALL_DOWN
|
||||
# if old_point_flags != point_flags:
|
||||
# print("point flags %04x" % (old_point_flags), " after %04x" % (point_flags))
|
||||
grid_walls[tile] = point_flags
|
||||
func make_door_graph():
|
||||
var adj = build_area_adj()
|
||||
var unreached = []
|
||||
var reached = []
|
||||
var pairs = {}
|
||||
var spanning_tree = {}
|
||||
for k in adj.keys():
|
||||
for l in adj[k].keys():
|
||||
if pairs.has(k):
|
||||
if !l in pairs[k]:
|
||||
pairs[k].push_back(l)
|
||||
else:
|
||||
pairs[k] = [l]
|
||||
if !k in unreached:
|
||||
unreached.push_back(k)
|
||||
if !l in unreached:
|
||||
unreached.push_back(l)
|
||||
var vstart = enterance
|
||||
reached.push_back(vstart)
|
||||
unreached.erase(vstart)
|
||||
while unreached.size() > 0:
|
||||
var record = 100000
|
||||
var rindex = -1
|
||||
var uindex = -1
|
||||
for ri in range(reached.size()):
|
||||
for ui in range(unreached.size()):
|
||||
var rval = reached[ri]
|
||||
var dist = 1 if unreached[ui] in pairs[rval] else 10000
|
||||
if dist < record:
|
||||
record = dist
|
||||
rindex = ri
|
||||
uindex = ui
|
||||
if uindex >= 0:
|
||||
var rvalue = reached[rindex]
|
||||
var uvalue = unreached[uindex]
|
||||
if spanning_tree.has(rvalue):
|
||||
if !uvalue in spanning_tree[rvalue]:
|
||||
spanning_tree[rvalue].push_back(uvalue)
|
||||
else:
|
||||
spanning_tree[rvalue] = [uvalue]
|
||||
reached.push_back(unreached[uindex])
|
||||
unreached.remove(uindex)
|
||||
else:
|
||||
assert(false)
|
||||
pairs = {}
|
||||
for k in spanning_tree.keys():
|
||||
for l in spanning_tree[k]:
|
||||
if pairs.has(k):
|
||||
pairs[k].push_back(l)
|
||||
else:
|
||||
pairs[k] = [l]
|
||||
if pairs.has(l):
|
||||
pairs[l].push_back(k)
|
||||
else:
|
||||
pairs[l] = [k]
|
||||
var new_adj = {}
|
||||
for k in adj.keys():
|
||||
for l in adj[k].keys():
|
||||
if pairs.has(k) && l in pairs[k]:
|
||||
if !new_adj.has(k):
|
||||
new_adj[k] = {}
|
||||
new_adj[k][l] = adj[k][l]
|
||||
print("new adj: ", new_adj)
|
||||
return new_adj
|
||||
func build_doors():
|
||||
var adj = make_door_graph()
|
||||
var queue = [enterance]
|
||||
var seen = []
|
||||
while queue.size() > 0:
|
||||
var item = queue.pop_front()
|
||||
if item in seen:
|
||||
continue
|
||||
seen.push_back(item)
|
||||
for e in adj[item].keys():
|
||||
var data = adj[item][e][0]
|
||||
var tile = data[0]
|
||||
var point_flags = grid_walls[tile]
|
||||
var rtype = data[2]
|
||||
match(rtype):
|
||||
FLAG_DOOR_LEFT:
|
||||
point_flags &= ~FLAG_LEFT_MASK
|
||||
FLAG_DOOR_UP:
|
||||
point_flags &= ~FLAG_UP_MASK
|
||||
FLAG_DOOR_RIGHT:
|
||||
point_flags &= ~FLAG_RIGHT_MASK
|
||||
FLAG_DOOR_DOWN:
|
||||
point_flags &= ~FLAG_DOWN_MASK
|
||||
point_flags |= rtype
|
||||
grid_walls[tile] = point_flags
|
||||
if !e in seen:
|
||||
queue.push_back(e)
|
||||
|
||||
func instance_wall(base: Spatial, what, p0, p1):
|
||||
var obj = what.instance()
|
||||
base.add_child(obj)
|
||||
var v = p1 - p0
|
||||
var xform = Transform().rotated(Vector3(0, 1, 0), -v.angle())
|
||||
var p = p0 + v * 0.5
|
||||
xform.origin = Vector3(p.x, 0, p.y)
|
||||
obj.transform = xform
|
||||
func display_walls(base: Spatial, objdata: Dictionary):
|
||||
for y in range(size_y):
|
||||
for x in range(size_x):
|
||||
var point_flags = grid_walls[y * size_x + x]
|
||||
var px = float(x) * grid_size + grid_rect.position.x - grid_size
|
||||
var py = float(y) * grid_size + grid_rect.position.y - grid_size
|
||||
var p0 = Vector2(px, py)
|
||||
var p1 = Vector2(px + grid_size, py)
|
||||
var p2 = Vector2(px + grid_size, py + grid_size)
|
||||
var p3 = Vector2(px, py + grid_size)
|
||||
var obje
|
||||
var objects = {
|
||||
FLAG_WALL_MASK: objdata.wall,
|
||||
FLAG_ENTRY_MASK: objdata.entry,
|
||||
FLAG_WINDOW_MASK: objdata.window,
|
||||
FLAG_DOOR_MASK: objdata.door
|
||||
}
|
||||
for k in objects.keys():
|
||||
if point_flags & k != 0:
|
||||
obje = objects[k]
|
||||
if point_flags & (k & FLAG_LEFT_MASK) != 0:
|
||||
instance_wall(base, obje, p3, p0)
|
||||
if point_flags & (k & FLAG_UP_MASK) != 0:
|
||||
instance_wall(base, obje, p0, p1)
|
||||
if point_flags & (k & FLAG_RIGHT_MASK) != 0:
|
||||
instance_wall(base, obje, p1, p2)
|
||||
if point_flags & (k & FLAG_DOWN_MASK) != 0:
|
||||
instance_wall(base, obje, p2, p3)
|
||||
|
||||
if point_flags & FLAG_FLOOR != 0:
|
||||
var fd = objdata.floor.instance()
|
||||
base.add_child(fd)
|
||||
var xform = Transform()
|
||||
var p = p0
|
||||
xform.origin = Vector3(p.x, 0, p.y)
|
||||
fd.transform = xform
|
||||
assert(stairs_pos != null)
|
||||
if stairs_pos:
|
||||
var fd = objdata.stairs.instance()
|
||||
base.add_child(fd)
|
||||
var xform = Transform()
|
||||
var p = stairs_pos
|
||||
xform.origin = Vector3(p.x, 0, p.y)
|
||||
fd.transform = xform
|
||||
func debug_contour():
|
||||
$debug.begin(Mesh.PRIMITIVE_LINES)
|
||||
for k in range(contour.size()):
|
||||
var p1 = contour[k]
|
||||
var p2 = contour[(k + 1) % contour.size()]
|
||||
$debug.add_vertex(Vector3(p1.x, 3.0, p1.y))
|
||||
$debug.add_vertex(Vector3(p2.x, 3.0, p2.y))
|
||||
$debug.end()
|
||||
#onready var building_floor = Floor.new()
|
||||
|
||||
var cur_pos: = Vector2()
|
||||
func debug_walls(fl):
|
||||
$debug.begin(Mesh.PRIMITIVE_LINES)
|
||||
for y in range(fl.size_y):
|
||||
for x in range(fl.size_x):
|
||||
var gpos = fl.grid2pos(x, y)
|
||||
var px = gpos.x
|
||||
var py = gpos.y
|
||||
var p0 = Vector2(px, py)
|
||||
var p1 = Vector2(px + fl.grid_size, py)
|
||||
var p2 = Vector2(px + fl.grid_size, py + fl.grid_size)
|
||||
var p3 = Vector2(px, py + fl.grid_size)
|
||||
$debug.add_vertex(Vector3(p0.x, 0.1, p0.y))
|
||||
$debug.add_vertex(Vector3(p1.x, 0.1, p1.y))
|
||||
$debug.add_vertex(Vector3(p1.x, 0.1, p1.y))
|
||||
$debug.add_vertex(Vector3(p2.x, 0.1, p2.y))
|
||||
$debug.add_vertex(Vector3(p2.x, 0.1, p2.y))
|
||||
$debug.add_vertex(Vector3(p3.x, 0.1, p3.y))
|
||||
$debug.add_vertex(Vector3(p3.x, 0.1, p3.y))
|
||||
$debug.add_vertex(Vector3(p0.x, 0.1, p0.y))
|
||||
$debug.end()
|
||||
|
||||
func _ready():
|
||||
rnd = RandomNumberGenerator.new()
|
||||
rnd.seed = OS.get_unix_time()
|
||||
|
||||
var state = 0
|
||||
var objd = {
|
||||
"wall": wall,
|
||||
"window": window,
|
||||
"door": door,
|
||||
"floor": fl,
|
||||
"entry": entry,
|
||||
"stairs": stairs
|
||||
}
|
||||
var floors = []
|
||||
var nfloors = 40
|
||||
var floor_bases = []
|
||||
var area_code = 1
|
||||
func _process(delta):
|
||||
match(state):
|
||||
0:
|
||||
for k in range(nfloors):
|
||||
floors.push_back(Floor.new())
|
||||
var b = Spatial.new()
|
||||
add_child(b)
|
||||
b.translation.y = 3.0 * float(k)
|
||||
floor_bases.push_back(b)
|
||||
floors[0].init_grid(contour)
|
||||
floors[0].init_walls(contour)
|
||||
floors[0].convert_walls()
|
||||
floors[0].create_entry_door(rnd)
|
||||
floors[0].create_windows(rnd, 0.6)
|
||||
floors[0].init_areas()
|
||||
floors[0].allocate_stairs(area_code)
|
||||
area_code += 1
|
||||
for k in range(0, nfloors, 1):
|
||||
if k > 0:
|
||||
floors[k] = floors[0].copy()
|
||||
floors[k].clear_entry_door()
|
||||
area_code = floors[k].create_areas(4, area_code)
|
||||
state = 1
|
||||
1:
|
||||
var b1 = false
|
||||
var b2 = false
|
||||
var b3 = false
|
||||
var b4 = false
|
||||
for k in range(nfloors):
|
||||
var tb1 = floors[k].grow_areas_left()
|
||||
if tb1:
|
||||
b1 = true
|
||||
var tb2 = floors[k].grow_areas_up()
|
||||
if tb2:
|
||||
b2 = true
|
||||
var tb3 = floors[k].grow_areas_right()
|
||||
if tb3:
|
||||
b3 = true
|
||||
var tb4 = floors[k].grow_areas_down()
|
||||
if tb4:
|
||||
b4 = true
|
||||
if !b1 && !b2 && !b3 && !b4:
|
||||
state = 2
|
||||
2:
|
||||
for k in range(nfloors):
|
||||
floors[k].build_doors()
|
||||
floors[k].build_area_walls()
|
||||
floors[k].remove_stairs_floor()
|
||||
floors[k].display_walls(floor_bases[k], objd)
|
||||
state = 3
|
||||
19
proto3/godot/city/cam.gd
Normal file
19
proto3/godot/city/cam.gd
Normal file
@@ -0,0 +1,19 @@
|
||||
extends Camera
|
||||
|
||||
|
||||
# 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"):
|
||||
global_translate(Vector3(0, 0, -1) * 10.0 * delta)
|
||||
if Input.is_action_pressed("walk_back"):
|
||||
global_translate(Vector3(0, 0, 1) * 10.0 * delta)
|
||||
38
proto3/godot/city/contour_building_gen.tscn
Normal file
38
proto3/godot/city/contour_building_gen.tscn
Normal file
@@ -0,0 +1,38 @@
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://city/building.gd" type="Script" id=1]
|
||||
[ext_resource path="res://city/cam.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=1]
|
||||
albedo_color = Color( 0.180392, 0.737255, 0.490196, 1 )
|
||||
|
||||
[sub_resource type="PlaneMesh" id=2]
|
||||
material = SubResource( 1 )
|
||||
size = Vector2( 200, 200 )
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=3]
|
||||
flags_unshaded = true
|
||||
flags_vertex_lighting = true
|
||||
vertex_color_use_as_albedo = true
|
||||
params_line_width = 3.0
|
||||
params_point_size = 3.0
|
||||
|
||||
[node name="contour_building_gen" type="Spatial"]
|
||||
|
||||
[node name="cam" type="Camera" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, 10, 10 )
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.843487, 0 )
|
||||
mesh = SubResource( 2 )
|
||||
material/0 = null
|
||||
|
||||
[node name="building" type="Spatial" parent="."]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="debug" type="ImmediateGeometry" parent="building"]
|
||||
material_override = SubResource( 3 )
|
||||
|
||||
[node name="DirectionalLight" type="DirectionalLight" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 0.866025, 0.5, 0, -0.5, 0.866025, 0, 20, 0 )
|
||||
21
proto3/godot/city/spaces_building_gen.gd
Normal file
21
proto3/godot/city/spaces_building_gen.gd
Normal file
@@ -0,0 +1,21 @@
|
||||
extends Spatial
|
||||
|
||||
|
||||
var graph = {
|
||||
"entry": ["corridoor", "stairs"],
|
||||
"corridoor": ["corridoor", "flat-door"]
|
||||
}
|
||||
|
||||
# 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):
|
||||
# pass
|
||||
6
proto3/godot/city/spaces_building_gen.tscn
Normal file
6
proto3/godot/city/spaces_building_gen.tscn
Normal file
@@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://city/spaces_building_gen.gd" type="Script" id=1]
|
||||
|
||||
[node name="spaces_building_gen" type="Spatial"]
|
||||
script = ExtResource( 1 )
|
||||
35
proto3/godot/city/spaces_building_gen_2d.gd
Normal file
35
proto3/godot/city/spaces_building_gen_2d.gd
Normal file
@@ -0,0 +1,35 @@
|
||||
extends Node2D
|
||||
|
||||
var graph = {
|
||||
"entry": ["corridoor", "stairs"],
|
||||
"corridoor": ["corridoor", "flat-door"]
|
||||
}
|
||||
|
||||
var grid = []
|
||||
|
||||
var spaces = []
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
var space_color = []
|
||||
var xdim = 10
|
||||
var ydim = 10
|
||||
func _ready():
|
||||
$Camera2D.current = true
|
||||
grid.resize(10 * 10)
|
||||
for e in graph.keys():
|
||||
for k in [e] + graph[e]:
|
||||
if !k in spaces:
|
||||
spaces.push_back(k)
|
||||
space_color.push_back(Color(randf(), randf(), randf(), 1))
|
||||
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta):
|
||||
# pass
|
||||
|
||||
func _draw():
|
||||
draw_rect(Rect2(-10, -10, 20, 20), Color(1, 0, 0, 1))
|
||||
8
proto3/godot/city/spaces_building_gen_2d.tscn
Normal file
8
proto3/godot/city/spaces_building_gen_2d.tscn
Normal file
@@ -0,0 +1,8 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://city/spaces_building_gen_2d.gd" type="Script" id=1]
|
||||
|
||||
[node name="spaces_building_gen_2d" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
@@ -217,7 +217,7 @@ grabbing="*res://autoloads/grabbing.gd"
|
||||
global="*res://autoloads/global.gd"
|
||||
rpg="*res://autoloads/rpg.gd"
|
||||
combat="*res://autoloads/combat.gd"
|
||||
phy_bones="*res://autoloads/phy_bones.gd"
|
||||
quests="*res://autoloads/quests.gd"
|
||||
|
||||
[input]
|
||||
|
||||
|
||||
@@ -1,430 +1,430 @@
|
||||
[gd_resource type="AnimationNodeBlendTree" load_steps=98 format=2]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=98]
|
||||
[sub_resource type="AnimationNodeAnimation" id=1]
|
||||
animation = "hang-grab_a-loop"
|
||||
|
||||
[sub_resource type="AnimationNodeOneShot" id=99]
|
||||
[sub_resource type="AnimationNodeOneShot" id=2]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=100]
|
||||
[sub_resource type="AnimationNodeAnimation" id=3]
|
||||
animation = "climb-low-obstacle"
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=101]
|
||||
[sub_resource type="AnimationNodeTimeScale" id=4]
|
||||
|
||||
[sub_resource type="AnimationNodeTransition" id=102]
|
||||
[sub_resource type="AnimationNodeTransition" id=5]
|
||||
input_count = 2
|
||||
input_0/name = "free"
|
||||
input_0/auto_advance = false
|
||||
input_1/name = "grabbed"
|
||||
input_1/auto_advance = false
|
||||
|
||||
[sub_resource type="AnimationNodeBlend2" id=103]
|
||||
[sub_resource type="AnimationNodeBlend2" id=6]
|
||||
filter_enabled = true
|
||||
filters = [ ".:clavicle_L", ".:finger1-1_L", ".:finger1-2_L", ".:finger1-3_L", ".:finger2-1_L", ".:finger2-2_L", ".:finger2-3_L", ".:finger3-1_L", ".:finger3-2_L", ".:finger3-3_L", ".:finger4-1_L", ".:finger4-2_L", ".:finger4-3_L", ".:finger5-1_L", ".:finger5-2_L", ".:finger5-3_L", ".:grabber_L", ".:lowerarm01_L", ".:metacarpal1_L", ".:metacarpal2_L", ".:metacarpal3_L", ".:metacarpal4_L", ".:shoulder01_L", ".:spine01", ".:spine02", ".:spine03", ".:spine04", ".:spine05", ".:upperarm01_L", ".:upperarm02_L", ".:wrist_L" ]
|
||||
|
||||
[sub_resource type="AnimationNodeOneShot" id=104]
|
||||
[sub_resource type="AnimationNodeOneShot" id=7]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=105]
|
||||
[sub_resource type="AnimationNodeAnimation" id=8]
|
||||
animation = "hang-grab_attack_a"
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=106]
|
||||
[sub_resource type="AnimationNodeTimeScale" id=9]
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=107]
|
||||
[sub_resource type="AnimationNodeTimeScale" id=10]
|
||||
|
||||
[sub_resource type="AnimationNodeTimeSeek" id=108]
|
||||
[sub_resource type="AnimationNodeTimeSeek" id=11]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=109]
|
||||
[sub_resource type="AnimationNodeAnimation" id=12]
|
||||
animation = "hang-grab_b-loop"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=110]
|
||||
[sub_resource type="AnimationNodeAnimation" id=13]
|
||||
animation = "hang-grab_attack_b"
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=111]
|
||||
[sub_resource type="AnimationNodeTimeScale" id=14]
|
||||
|
||||
[sub_resource type="AnimationNodeOneShot" id=112]
|
||||
[sub_resource type="AnimationNodeOneShot" id=15]
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=113]
|
||||
[sub_resource type="AnimationNodeTimeScale" id=16]
|
||||
|
||||
[sub_resource type="AnimationNodeTimeSeek" id=114]
|
||||
[sub_resource type="AnimationNodeTimeSeek" id=17]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=93]
|
||||
[sub_resource type="AnimationNodeAnimation" id=18]
|
||||
animation = "kneeling-loop"
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=94]
|
||||
[sub_resource type="AnimationNodeTimeScale" id=19]
|
||||
|
||||
[sub_resource type="AnimationNodeBlendTree" id=95]
|
||||
nodes/kneel_animation/node = SubResource( 93 )
|
||||
[sub_resource type="AnimationNodeBlendTree" id=20]
|
||||
nodes/kneel_animation/node = SubResource( 18 )
|
||||
nodes/kneel_animation/position = Vector2( 180, 120 )
|
||||
nodes/kneel_speed/node = SubResource( 94 )
|
||||
nodes/kneel_speed/node = SubResource( 19 )
|
||||
nodes/kneel_speed/position = Vector2( 500, 120 )
|
||||
nodes/output/position = Vector2( 740, 120 )
|
||||
node_connections = [ "output", 0, "kneel_speed", "kneel_speed", 0, "kneel_animation" ]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=18]
|
||||
[sub_resource type="AnimationNodeAnimation" id=21]
|
||||
animation = "stand-to-walk"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=19]
|
||||
[sub_resource type="AnimationNodeAnimation" id=22]
|
||||
animation = "stand"
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=20]
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=21]
|
||||
|
||||
[sub_resource type="AnimationNodeBlendTree" id=22]
|
||||
nodes/Animation/node = SubResource( 19 )
|
||||
nodes/Animation/position = Vector2( 240, 100 )
|
||||
nodes/output/position = Vector2( 1000, 100 )
|
||||
nodes/speed/node = SubResource( 20 )
|
||||
nodes/speed/position = Vector2( 800, 100 )
|
||||
nodes/stand_speed/node = SubResource( 21 )
|
||||
nodes/stand_speed/position = Vector2( 520, 100 )
|
||||
node_connections = [ "speed", 0, "stand_speed", "output", 0, "speed", "stand_speed", 0, "Animation" ]
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=23]
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=24]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=25]
|
||||
[sub_resource type="AnimationNodeBlendTree" id=25]
|
||||
nodes/Animation/node = SubResource( 22 )
|
||||
nodes/Animation/position = Vector2( 240, 100 )
|
||||
nodes/output/position = Vector2( 1000, 100 )
|
||||
nodes/speed/node = SubResource( 23 )
|
||||
nodes/speed/position = Vector2( 800, 100 )
|
||||
nodes/stand_speed/node = SubResource( 24 )
|
||||
nodes/stand_speed/position = Vector2( 520, 100 )
|
||||
node_connections = [ "speed", 0, "stand_speed", "output", 0, "speed", "stand_speed", 0, "Animation" ]
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=26]
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=27]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=28]
|
||||
animation = "walk-loop"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=26]
|
||||
[sub_resource type="AnimationNodeAnimation" id=29]
|
||||
animation = "walk2-loop"
|
||||
|
||||
[sub_resource type="AnimationNodeBlendSpace1D" id=27]
|
||||
blend_point_0/node = SubResource( 25 )
|
||||
[sub_resource type="AnimationNodeBlendSpace1D" id=30]
|
||||
blend_point_0/node = SubResource( 28 )
|
||||
blend_point_0/pos = 0.0
|
||||
blend_point_1/node = SubResource( 26 )
|
||||
blend_point_1/node = SubResource( 29 )
|
||||
blend_point_1/pos = 1.0
|
||||
|
||||
[sub_resource type="AnimationNodeBlendTree" id=28]
|
||||
[sub_resource type="AnimationNodeBlendTree" id=31]
|
||||
graph_offset = Vector2( 0, 133.5 )
|
||||
nodes/output/position = Vector2( 1000, 140 )
|
||||
nodes/speed/node = SubResource( 23 )
|
||||
nodes/speed/node = SubResource( 26 )
|
||||
nodes/speed/position = Vector2( 760, 140 )
|
||||
nodes/walk_speed/node = SubResource( 24 )
|
||||
nodes/walk_speed/node = SubResource( 27 )
|
||||
nodes/walk_speed/position = Vector2( 480, 140 )
|
||||
nodes/walking/node = SubResource( 27 )
|
||||
nodes/walking/node = SubResource( 30 )
|
||||
nodes/walking/position = Vector2( 120, 260 )
|
||||
node_connections = [ "speed", 0, "walk_speed", "output", 0, "speed", "walk_speed", 0, "walking" ]
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=29]
|
||||
[sub_resource type="AnimationNodeTimeScale" id=32]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=30]
|
||||
[sub_resource type="AnimationNodeAnimation" id=33]
|
||||
animation = "wash-floor-loop"
|
||||
|
||||
[sub_resource type="AnimationNodeBlendTree" id=31]
|
||||
[sub_resource type="AnimationNodeBlendTree" id=34]
|
||||
graph_offset = Vector2( 0, -251 )
|
||||
nodes/TimeScale/node = SubResource( 29 )
|
||||
nodes/TimeScale/node = SubResource( 32 )
|
||||
nodes/TimeScale/position = Vector2( 460, 160 )
|
||||
nodes/output/position = Vector2( 700, 160 )
|
||||
nodes/wash_floor_animation/node = SubResource( 30 )
|
||||
nodes/wash_floor_animation/node = SubResource( 33 )
|
||||
nodes/wash_floor_animation/position = Vector2( 140, 160 )
|
||||
node_connections = [ "output", 0, "TimeScale", "TimeScale", 0, "wash_floor_animation" ]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=32]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=33]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=34]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=35]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=36]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=96]
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=37]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=97]
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=38]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id=37]
|
||||
states/kneel/node = SubResource( 95 )
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=39]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=40]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=41]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id=42]
|
||||
states/kneel/node = SubResource( 20 )
|
||||
states/kneel/position = Vector2( 459, 358 )
|
||||
states/stand/node = SubResource( 22 )
|
||||
states/stand/node = SubResource( 25 )
|
||||
states/stand/position = Vector2( 222, 87 )
|
||||
states/stand-to-walk/node = SubResource( 18 )
|
||||
states/stand-to-walk/node = SubResource( 21 )
|
||||
states/stand-to-walk/position = Vector2( 605, 71 )
|
||||
states/walk/node = SubResource( 28 )
|
||||
states/walk/node = SubResource( 31 )
|
||||
states/walk/position = Vector2( 647, 210 )
|
||||
states/wash_floor/node = SubResource( 31 )
|
||||
states/wash_floor/node = SubResource( 34 )
|
||||
states/wash_floor/position = Vector2( 140, 268 )
|
||||
transitions = [ "stand", "stand-to-walk", SubResource( 32 ), "stand-to-walk", "walk", SubResource( 33 ), "walk", "stand", SubResource( 34 ), "stand", "wash_floor", SubResource( 35 ), "wash_floor", "stand", SubResource( 36 ), "stand", "kneel", SubResource( 96 ), "kneel", "stand", SubResource( 97 ) ]
|
||||
transitions = [ "stand", "stand-to-walk", SubResource( 35 ), "stand-to-walk", "walk", SubResource( 36 ), "walk", "stand", SubResource( 37 ), "stand", "wash_floor", SubResource( 38 ), "wash_floor", "stand", SubResource( 39 ), "stand", "kneel", SubResource( 40 ), "kneel", "stand", SubResource( 41 ) ]
|
||||
start_node = "stand"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=115]
|
||||
[sub_resource type="AnimationNodeAnimation" id=43]
|
||||
animation = "bed_torture_beating_b-loop"
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=116]
|
||||
[sub_resource type="AnimationNodeTimeScale" id=44]
|
||||
|
||||
[sub_resource type="AnimationNodeBlendTree" id=117]
|
||||
nodes/Animation/node = SubResource( 115 )
|
||||
[sub_resource type="AnimationNodeBlendTree" id=45]
|
||||
nodes/Animation/node = SubResource( 43 )
|
||||
nodes/Animation/position = Vector2( 97, 97 )
|
||||
nodes/beating_speed/node = SubResource( 116 )
|
||||
nodes/beating_speed/node = SubResource( 44 )
|
||||
nodes/beating_speed/position = Vector2( 420, 100 )
|
||||
nodes/output/position = Vector2( 700, 120 )
|
||||
node_connections = [ "output", 0, "beating_speed", "beating_speed", 0, "Animation" ]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=118]
|
||||
[sub_resource type="AnimationNodeAnimation" id=46]
|
||||
animation = "bed_torture_beating_a-loop"
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=119]
|
||||
[sub_resource type="AnimationNodeTimeScale" id=47]
|
||||
|
||||
[sub_resource type="AnimationNodeBlendTree" id=120]
|
||||
[sub_resource type="AnimationNodeBlendTree" id=48]
|
||||
graph_offset = Vector2( 0, -251 )
|
||||
nodes/Animation/node = SubResource( 118 )
|
||||
nodes/Animation/node = SubResource( 46 )
|
||||
nodes/Animation/position = Vector2( 80, 100 )
|
||||
nodes/beating_m_speed/node = SubResource( 119 )
|
||||
nodes/beating_m_speed/node = SubResource( 47 )
|
||||
nodes/beating_m_speed/position = Vector2( 560, 100 )
|
||||
nodes/output/position = Vector2( 960, 140 )
|
||||
node_connections = [ "output", 0, "beating_m_speed", "beating_m_speed", 0, "Animation" ]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=121]
|
||||
[sub_resource type="AnimationNodeAnimation" id=49]
|
||||
animation = "lying-on-back-arms-tied-loop"
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=122]
|
||||
[sub_resource type="AnimationNodeTimeScale" id=50]
|
||||
|
||||
[sub_resource type="AnimationNodeBlendTree" id=123]
|
||||
nodes/Animation/node = SubResource( 121 )
|
||||
[sub_resource type="AnimationNodeBlendTree" id=51]
|
||||
nodes/Animation/node = SubResource( 49 )
|
||||
nodes/Animation/position = Vector2( 60, 80 )
|
||||
nodes/TimeScale/node = SubResource( 122 )
|
||||
nodes/TimeScale/node = SubResource( 50 )
|
||||
nodes/TimeScale/position = Vector2( 480, 80 )
|
||||
nodes/output/position = Vector2( 720, 80 )
|
||||
node_connections = [ "output", 0, "TimeScale", "TimeScale", 0, "Animation" ]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=124]
|
||||
[sub_resource type="AnimationNodeAnimation" id=52]
|
||||
animation = "bed_torture_start_b"
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=125]
|
||||
[sub_resource type="AnimationNodeTimeScale" id=53]
|
||||
|
||||
[sub_resource type="AnimationNodeBlendTree" id=126]
|
||||
nodes/Animation/node = SubResource( 124 )
|
||||
[sub_resource type="AnimationNodeBlendTree" id=54]
|
||||
nodes/Animation/node = SubResource( 52 )
|
||||
nodes/Animation/position = Vector2( 80, 80 )
|
||||
nodes/bed_start_speed/node = SubResource( 125 )
|
||||
nodes/bed_start_speed/node = SubResource( 53 )
|
||||
nodes/bed_start_speed/position = Vector2( 380, 80 )
|
||||
nodes/output/position = Vector2( 620, 80 )
|
||||
node_connections = [ "output", 0, "bed_start_speed", "bed_start_speed", 0, "Animation" ]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=127]
|
||||
[sub_resource type="AnimationNodeAnimation" id=55]
|
||||
animation = "bed_torture_start_a"
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=128]
|
||||
[sub_resource type="AnimationNodeTimeScale" id=56]
|
||||
|
||||
[sub_resource type="AnimationNodeBlendTree" id=129]
|
||||
[sub_resource type="AnimationNodeBlendTree" id=57]
|
||||
graph_offset = Vector2( 0, 15.75 )
|
||||
nodes/Animation/node = SubResource( 127 )
|
||||
nodes/Animation/node = SubResource( 55 )
|
||||
nodes/Animation/position = Vector2( 69, 94 )
|
||||
nodes/bed_start_m_speed/node = SubResource( 128 )
|
||||
nodes/bed_start_m_speed/node = SubResource( 56 )
|
||||
nodes/bed_start_m_speed/position = Vector2( 360, 80 )
|
||||
nodes/output/position = Vector2( 660, 80 )
|
||||
node_connections = [ "output", 0, "bed_start_m_speed", "bed_start_m_speed", 0, "Animation" ]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=130]
|
||||
[sub_resource type="AnimationNodeAnimation" id=58]
|
||||
animation = "bed_torture_forcing_b"
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=131]
|
||||
[sub_resource type="AnimationNodeTimeScale" id=59]
|
||||
|
||||
[sub_resource type="AnimationNodeBlendTree" id=132]
|
||||
[sub_resource type="AnimationNodeBlendTree" id=60]
|
||||
graph_offset = Vector2( 0, -55 )
|
||||
nodes/forcing_animation/node = SubResource( 130 )
|
||||
nodes/forcing_animation/node = SubResource( 58 )
|
||||
nodes/forcing_animation/position = Vector2( 159, 121 )
|
||||
nodes/forcing_speed/node = SubResource( 131 )
|
||||
nodes/forcing_speed/node = SubResource( 59 )
|
||||
nodes/forcing_speed/position = Vector2( 460, 100 )
|
||||
nodes/output/position = Vector2( 740, 100 )
|
||||
node_connections = [ "output", 0, "forcing_speed", "forcing_speed", 0, "forcing_animation" ]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=133]
|
||||
[sub_resource type="AnimationNodeAnimation" id=61]
|
||||
animation = "bed_torture_forcing_a"
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=134]
|
||||
[sub_resource type="AnimationNodeTimeScale" id=62]
|
||||
|
||||
[sub_resource type="AnimationNodeBlendTree" id=135]
|
||||
nodes/forcing_m_animation/node = SubResource( 133 )
|
||||
[sub_resource type="AnimationNodeBlendTree" id=63]
|
||||
nodes/forcing_m_animation/node = SubResource( 61 )
|
||||
nodes/forcing_m_animation/position = Vector2( 102, 110 )
|
||||
nodes/forcing_m_speed/node = SubResource( 134 )
|
||||
nodes/forcing_m_speed/node = SubResource( 62 )
|
||||
nodes/forcing_m_speed/position = Vector2( 442, 120 )
|
||||
nodes/output/position = Vector2( 740, 120 )
|
||||
node_connections = [ "output", 0, "forcing_m_speed", "forcing_m_speed", 0, "forcing_m_animation" ]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=136]
|
||||
[sub_resource type="AnimationNodeAnimation" id=64]
|
||||
animation = "bed_torture_forcing_s1_b-loop"
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=137]
|
||||
[sub_resource type="AnimationNodeTimeScale" id=65]
|
||||
|
||||
[sub_resource type="AnimationNodeBlendTree" id=138]
|
||||
nodes/forcing_s1_animation/node = SubResource( 136 )
|
||||
[sub_resource type="AnimationNodeBlendTree" id=66]
|
||||
nodes/forcing_s1_animation/node = SubResource( 64 )
|
||||
nodes/forcing_s1_animation/position = Vector2( 160, 140 )
|
||||
nodes/forcing_s1_speed/node = SubResource( 137 )
|
||||
nodes/forcing_s1_speed/node = SubResource( 65 )
|
||||
nodes/forcing_s1_speed/position = Vector2( 640, 160 )
|
||||
nodes/output/position = Vector2( 920, 160 )
|
||||
node_connections = [ "output", 0, "forcing_s1_speed", "forcing_s1_speed", 0, "forcing_s1_animation" ]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=139]
|
||||
[sub_resource type="AnimationNodeAnimation" id=67]
|
||||
animation = "bed_torture_forcing_s1_a-loop"
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=140]
|
||||
[sub_resource type="AnimationNodeTimeScale" id=68]
|
||||
|
||||
[sub_resource type="AnimationNodeBlendTree" id=141]
|
||||
nodes/forcing_s1_animation/node = SubResource( 139 )
|
||||
[sub_resource type="AnimationNodeBlendTree" id=69]
|
||||
nodes/forcing_s1_animation/node = SubResource( 67 )
|
||||
nodes/forcing_s1_animation/position = Vector2( 300, 260 )
|
||||
nodes/forcing_s1_speed/node = SubResource( 140 )
|
||||
nodes/forcing_s1_speed/node = SubResource( 68 )
|
||||
nodes/forcing_s1_speed/position = Vector2( 680, 260 )
|
||||
nodes/output/position = Vector2( 980, 280 )
|
||||
node_connections = [ "output", 0, "forcing_s1_speed", "forcing_s1_speed", 0, "forcing_s1_animation" ]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=142]
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=70]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=143]
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=71]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=144]
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=72]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=145]
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=73]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=146]
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=74]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=147]
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=75]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=148]
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=76]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=149]
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=77]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id=150]
|
||||
states/beating/node = SubResource( 117 )
|
||||
[sub_resource type="AnimationNodeStateMachine" id=78]
|
||||
states/beating/node = SubResource( 45 )
|
||||
states/beating/position = Vector2( 421, 244 )
|
||||
states/beating_m/node = SubResource( 120 )
|
||||
states/beating_m/node = SubResource( 48 )
|
||||
states/beating_m/position = Vector2( 225, 283 )
|
||||
states/bed_facing_up/node = SubResource( 123 )
|
||||
states/bed_facing_up/node = SubResource( 51 )
|
||||
states/bed_facing_up/position = Vector2( 189, 53 )
|
||||
states/bed_start/node = SubResource( 126 )
|
||||
states/bed_start/node = SubResource( 54 )
|
||||
states/bed_start/position = Vector2( 299, 138 )
|
||||
states/bed_start_m/node = SubResource( 129 )
|
||||
states/bed_start_m/node = SubResource( 57 )
|
||||
states/bed_start_m/position = Vector2( 201, 203 )
|
||||
states/forcing/node = SubResource( 132 )
|
||||
states/forcing/node = SubResource( 60 )
|
||||
states/forcing/position = Vector2( 429, 330 )
|
||||
states/forcing_m/node = SubResource( 135 )
|
||||
states/forcing_m/node = SubResource( 63 )
|
||||
states/forcing_m/position = Vector2( 247, 390 )
|
||||
states/forcing_s1/node = SubResource( 138 )
|
||||
states/forcing_s1/node = SubResource( 66 )
|
||||
states/forcing_s1/position = Vector2( 533, 428 )
|
||||
states/forcing_s1_m/node = SubResource( 141 )
|
||||
states/forcing_s1_m/node = SubResource( 69 )
|
||||
states/forcing_s1_m/position = Vector2( 247, 544 )
|
||||
transitions = [ "bed_facing_up", "bed_start", SubResource( 142 ), "bed_facing_up", "bed_start_m", SubResource( 143 ), "bed_start_m", "beating_m", SubResource( 144 ), "bed_start", "beating", SubResource( 145 ), "beating_m", "forcing_m", SubResource( 146 ), "beating", "forcing", SubResource( 147 ), "forcing_m", "forcing_s1_m", SubResource( 148 ), "forcing", "forcing_s1", SubResource( 149 ) ]
|
||||
transitions = [ "bed_facing_up", "bed_start", SubResource( 70 ), "bed_facing_up", "bed_start_m", SubResource( 71 ), "bed_start_m", "beating_m", SubResource( 72 ), "bed_start", "beating", SubResource( 73 ), "beating_m", "forcing_m", SubResource( 74 ), "beating", "forcing", SubResource( 75 ), "forcing_m", "forcing_s1_m", SubResource( 76 ), "forcing", "forcing_s1", SubResource( 77 ) ]
|
||||
start_node = "bed_facing_up"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id=151]
|
||||
states/bed/node = SubResource( 150 )
|
||||
[sub_resource type="AnimationNodeStateMachine" id=79]
|
||||
states/bed/node = SubResource( 78 )
|
||||
states/bed/position = Vector2( 251, 82 )
|
||||
start_node = "bed"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=152]
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=80]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=153]
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=81]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id=154]
|
||||
states/Motion/node = SubResource( 37 )
|
||||
[sub_resource type="AnimationNodeStateMachine" id=82]
|
||||
states/Motion/node = SubResource( 42 )
|
||||
states/Motion/position = Vector2( 188, 65 )
|
||||
states/SmartObject/node = SubResource( 151 )
|
||||
states/SmartObject/node = SubResource( 79 )
|
||||
states/SmartObject/position = Vector2( 250, 140 )
|
||||
transitions = [ "Motion", "SmartObject", SubResource( 152 ), "SmartObject", "Motion", SubResource( 153 ) ]
|
||||
transitions = [ "Motion", "SmartObject", SubResource( 80 ), "SmartObject", "Motion", SubResource( 81 ) ]
|
||||
start_node = "Motion"
|
||||
|
||||
[sub_resource type="AnimationNodeOneShot" id=155]
|
||||
[sub_resource type="AnimationNodeOneShot" id=83]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=156]
|
||||
[sub_resource type="AnimationNodeAnimation" id=84]
|
||||
animation = "throw"
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=157]
|
||||
[sub_resource type="AnimationNodeTimeScale" id=85]
|
||||
|
||||
[sub_resource type="AnimationNodeOneShot" id=158]
|
||||
[sub_resource type="AnimationNodeOneShot" id=86]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=159]
|
||||
[sub_resource type="AnimationNodeAnimation" id=87]
|
||||
animation = "small_turn_left"
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=160]
|
||||
[sub_resource type="AnimationNodeTimeScale" id=88]
|
||||
|
||||
[sub_resource type="AnimationNodeOneShot" id=161]
|
||||
[sub_resource type="AnimationNodeOneShot" id=89]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=162]
|
||||
[sub_resource type="AnimationNodeAnimation" id=90]
|
||||
animation = "small_turn_right"
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=163]
|
||||
[sub_resource type="AnimationNodeTimeScale" id=91]
|
||||
|
||||
[sub_resource type="AnimationNodeOneShot" id=164]
|
||||
[sub_resource type="AnimationNodeOneShot" id=92]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=165]
|
||||
[sub_resource type="AnimationNodeAnimation" id=93]
|
||||
animation = "unstuck1"
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=166]
|
||||
[sub_resource type="AnimationNodeTimeScale" id=94]
|
||||
|
||||
[sub_resource type="AnimationNodeOneShot" id=167]
|
||||
[sub_resource type="AnimationNodeOneShot" id=95]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=168]
|
||||
[sub_resource type="AnimationNodeAnimation" id=96]
|
||||
animation = "unstuck2"
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id=169]
|
||||
[sub_resource type="AnimationNodeTimeScale" id=97]
|
||||
|
||||
[resource]
|
||||
graph_offset = Vector2( -227.051, -544.846 )
|
||||
nodes/Animation/node = SubResource( 98 )
|
||||
nodes/Animation/node = SubResource( 1 )
|
||||
nodes/Animation/position = Vector2( 120, -200 )
|
||||
nodes/climb_low_obstacle/node = SubResource( 99 )
|
||||
nodes/climb_low_obstacle/node = SubResource( 2 )
|
||||
nodes/climb_low_obstacle/position = Vector2( 2340, -380 )
|
||||
nodes/climb_low_obstacle_animation/node = SubResource( 100 )
|
||||
nodes/climb_low_obstacle_animation/node = SubResource( 3 )
|
||||
nodes/climb_low_obstacle_animation/position = Vector2( 1800, 20 )
|
||||
nodes/climb_low_obstacle_speed/node = SubResource( 101 )
|
||||
nodes/climb_low_obstacle_speed/node = SubResource( 4 )
|
||||
nodes/climb_low_obstacle_speed/position = Vector2( 2120, -160 )
|
||||
nodes/free_grabbed/node = SubResource( 102 )
|
||||
nodes/free_grabbed/node = SubResource( 5 )
|
||||
nodes/free_grabbed/position = Vector2( 3500, -260 )
|
||||
nodes/grab/node = SubResource( 103 )
|
||||
nodes/grab/node = SubResource( 6 )
|
||||
nodes/grab/position = Vector2( 2640, -380 )
|
||||
nodes/grab_attack/node = SubResource( 104 )
|
||||
nodes/grab_attack/node = SubResource( 7 )
|
||||
nodes/grab_attack/position = Vector2( 600, -420 )
|
||||
nodes/grab_attack_animation/node = SubResource( 105 )
|
||||
nodes/grab_attack_animation/node = SubResource( 8 )
|
||||
nodes/grab_attack_animation/position = Vector2( 400, -40 )
|
||||
nodes/grab_attack_speed/node = SubResource( 106 )
|
||||
nodes/grab_attack_speed/node = SubResource( 9 )
|
||||
nodes/grab_attack_speed/position = Vector2( 680, -40 )
|
||||
nodes/grab_scale/node = SubResource( 107 )
|
||||
nodes/grab_scale/node = SubResource( 10 )
|
||||
nodes/grab_scale/position = Vector2( 600, -200 )
|
||||
nodes/grab_seek/node = SubResource( 108 )
|
||||
nodes/grab_seek/node = SubResource( 11 )
|
||||
nodes/grab_seek/position = Vector2( 400, -200 )
|
||||
nodes/grabbed_animation/node = SubResource( 109 )
|
||||
nodes/grabbed_animation/node = SubResource( 12 )
|
||||
nodes/grabbed_animation/position = Vector2( 2260, 160 )
|
||||
nodes/grabbed_attack_animation/node = SubResource( 110 )
|
||||
nodes/grabbed_attack_animation/node = SubResource( 13 )
|
||||
nodes/grabbed_attack_animation/position = Vector2( 2340, 340 )
|
||||
nodes/grabbed_attack_speed/node = SubResource( 111 )
|
||||
nodes/grabbed_attack_speed/node = SubResource( 14 )
|
||||
nodes/grabbed_attack_speed/position = Vector2( 2680, 340 )
|
||||
nodes/grabbed_attacked/node = SubResource( 112 )
|
||||
nodes/grabbed_attacked/node = SubResource( 15 )
|
||||
nodes/grabbed_attacked/position = Vector2( 3080, 0 )
|
||||
nodes/grabbed_scale/node = SubResource( 113 )
|
||||
nodes/grabbed_scale/node = SubResource( 16 )
|
||||
nodes/grabbed_scale/position = Vector2( 2800, 40 )
|
||||
nodes/grabbed_seek/node = SubResource( 114 )
|
||||
nodes/grabbed_seek/node = SubResource( 17 )
|
||||
nodes/grabbed_seek/position = Vector2( 2540, 40 )
|
||||
nodes/main/node = SubResource( 154 )
|
||||
nodes/main/node = SubResource( 82 )
|
||||
nodes/main/position = Vector2( 280, -360 )
|
||||
nodes/output/position = Vector2( 3740, -260 )
|
||||
nodes/throw/node = SubResource( 155 )
|
||||
nodes/throw/node = SubResource( 83 )
|
||||
nodes/throw/position = Vector2( 3000, -280 )
|
||||
nodes/throw_animation/node = SubResource( 156 )
|
||||
nodes/throw_animation/node = SubResource( 84 )
|
||||
nodes/throw_animation/position = Vector2( 2560, -160 )
|
||||
nodes/throw_speed/node = SubResource( 157 )
|
||||
nodes/throw_speed/node = SubResource( 85 )
|
||||
nodes/throw_speed/position = Vector2( 2800, -160 )
|
||||
nodes/turn_left/node = SubResource( 158 )
|
||||
nodes/turn_left/node = SubResource( 86 )
|
||||
nodes/turn_left/position = Vector2( 1200, -400 )
|
||||
nodes/turn_left_animation/node = SubResource( 159 )
|
||||
nodes/turn_left_animation/node = SubResource( 87 )
|
||||
nodes/turn_left_animation/position = Vector2( 440, 100 )
|
||||
nodes/turn_left_speed/node = SubResource( 160 )
|
||||
nodes/turn_left_speed/node = SubResource( 88 )
|
||||
nodes/turn_left_speed/position = Vector2( 680, 100 )
|
||||
nodes/turn_right/node = SubResource( 161 )
|
||||
nodes/turn_right/node = SubResource( 89 )
|
||||
nodes/turn_right/position = Vector2( 900, -400 )
|
||||
nodes/turn_right_animation/node = SubResource( 162 )
|
||||
nodes/turn_right_animation/node = SubResource( 90 )
|
||||
nodes/turn_right_animation/position = Vector2( 440, 220 )
|
||||
nodes/turn_right_speed/node = SubResource( 163 )
|
||||
nodes/turn_right_speed/node = SubResource( 91 )
|
||||
nodes/turn_right_speed/position = Vector2( 680, 220 )
|
||||
nodes/unstuck1/node = SubResource( 164 )
|
||||
nodes/unstuck1/node = SubResource( 92 )
|
||||
nodes/unstuck1/position = Vector2( 1520, -380 )
|
||||
nodes/unstuck1_animation/node = SubResource( 165 )
|
||||
nodes/unstuck1_animation/node = SubResource( 93 )
|
||||
nodes/unstuck1_animation/position = Vector2( 1180, 0 )
|
||||
nodes/unstuck1_speed/node = SubResource( 166 )
|
||||
nodes/unstuck1_speed/node = SubResource( 94 )
|
||||
nodes/unstuck1_speed/position = Vector2( 1380, -160 )
|
||||
nodes/unstuck2/node = SubResource( 167 )
|
||||
nodes/unstuck2/node = SubResource( 95 )
|
||||
nodes/unstuck2/position = Vector2( 1920, -380 )
|
||||
nodes/unstuck2_animation/node = SubResource( 168 )
|
||||
nodes/unstuck2_animation/node = SubResource( 96 )
|
||||
nodes/unstuck2_animation/position = Vector2( 1460, -20 )
|
||||
nodes/unstuck2_speed/node = SubResource( 169 )
|
||||
nodes/unstuck2_speed/node = SubResource( 97 )
|
||||
nodes/unstuck2_speed/position = Vector2( 1700, -160 )
|
||||
node_connections = [ "output", 0, "free_grabbed", "grab_seek", 0, "Animation", "climb_low_obstacle", 0, "unstuck2", "climb_low_obstacle", 1, "climb_low_obstacle_speed", "grab_scale", 0, "grab_seek", "grabbed_seek", 0, "grabbed_animation", "unstuck1", 0, "turn_left", "unstuck1", 1, "unstuck1_speed", "turn_left_speed", 0, "turn_left_animation", "throw_speed", 0, "throw_animation", "unstuck1_speed", 0, "unstuck1_animation", "grab_attack_speed", 0, "grab_attack_animation", "unstuck2", 0, "unstuck1", "unstuck2", 1, "unstuck2_speed", "turn_right", 0, "grab_attack", "turn_right", 1, "turn_right_speed", "grab", 0, "climb_low_obstacle", "grab", 1, "grab_scale", "grabbed_scale", 0, "grabbed_seek", "turn_left", 0, "turn_right", "turn_left", 1, "turn_left_speed", "grabbed_attack_speed", 0, "grabbed_attack_animation", "climb_low_obstacle_speed", 0, "climb_low_obstacle_animation", "free_grabbed", 0, "throw", "free_grabbed", 1, "grabbed_attacked", "grabbed_attacked", 0, "grabbed_scale", "grabbed_attacked", 1, "grabbed_attack_speed", "unstuck2_speed", 0, "unstuck2_animation", "throw", 0, "grab", "throw", 1, "throw_speed", "turn_right_speed", 0, "turn_right_animation", "grab_attack", 0, "main", "grab_attack", 1, "grab_attack_speed" ]
|
||||
node_connections = [ "output", 0, "free_grabbed", "grabbed_attack_speed", 0, "grabbed_attack_animation", "climb_low_obstacle_speed", 0, "climb_low_obstacle_animation", "throw_speed", 0, "throw_animation", "turn_right", 0, "grab_attack", "turn_right", 1, "turn_right_speed", "grab_seek", 0, "Animation", "free_grabbed", 0, "throw", "free_grabbed", 1, "grabbed_attacked", "grab_attack_speed", 0, "grab_attack_animation", "unstuck1_speed", 0, "unstuck1_animation", "grabbed_scale", 0, "grabbed_seek", "turn_right_speed", 0, "turn_right_animation", "turn_left_speed", 0, "turn_left_animation", "climb_low_obstacle", 0, "unstuck2", "climb_low_obstacle", 1, "climb_low_obstacle_speed", "grabbed_attacked", 0, "grabbed_scale", "grabbed_attacked", 1, "grabbed_attack_speed", "unstuck2", 0, "unstuck1", "unstuck2", 1, "unstuck2_speed", "unstuck1", 0, "turn_left", "unstuck1", 1, "unstuck1_speed", "grab", 0, "climb_low_obstacle", "grab", 1, "grab_scale", "unstuck2_speed", 0, "unstuck2_animation", "grab_scale", 0, "grab_seek", "grabbed_seek", 0, "grabbed_animation", "grab_attack", 0, "main", "grab_attack", 1, "grab_attack_speed", "turn_left", 0, "turn_right", "turn_left", 1, "turn_left_speed", "throw", 0, "grab", "throw", 1, "throw_speed" ]
|
||||
|
||||
@@ -33,7 +33,7 @@ func _physics_process(delta):
|
||||
velocity.z = h_velocity.z
|
||||
velocity.y = h_velocity.y
|
||||
if !get_meta("grabbed") && !in_smart_obj && !disable_gravity:
|
||||
velocity.y += -9.8 * delta
|
||||
velocity.y += -9.8
|
||||
velocity = move_and_slide(velocity,Vector3(0,1,0))
|
||||
orientation.origin = Vector3()
|
||||
fixup.origin = Vector3()
|
||||
|
||||
@@ -19,6 +19,8 @@ func _ready():
|
||||
orientation.origin = Vector3()
|
||||
add_to_group("characters")
|
||||
do_ungrab()
|
||||
# feet_ik_init()
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
# motion = motion.linear_interpolate(motion_target, MOTION_INTERPOLATE_SPEED * delta)
|
||||
@@ -33,7 +35,7 @@ func _physics_process(delta):
|
||||
velocity.z = h_velocity.z
|
||||
velocity.y = h_velocity.y
|
||||
if !get_meta("grabbed") && !in_smart_obj && !disable_gravity:
|
||||
velocity.y += -9.8 * delta
|
||||
velocity.y += -9.8
|
||||
velocity = move_and_slide(velocity,Vector3(0,1,0))
|
||||
orientation.origin = Vector3()
|
||||
fixup.origin = Vector3()
|
||||
@@ -46,6 +48,7 @@ func _physics_process(delta):
|
||||
if attacking >= 0.0:
|
||||
attacking -= delta
|
||||
rpg.update_stats(self)
|
||||
# feet_ik()
|
||||
var skel
|
||||
func get_skeleton():
|
||||
if skel:
|
||||
@@ -95,6 +98,89 @@ static func calc_offset(c2, bone2):
|
||||
# print("offset: ", offset)
|
||||
return offset
|
||||
|
||||
var foot_ik_l = {
|
||||
"foot": "foot_L",
|
||||
"bone1": "upperleg02_L",
|
||||
"bone2": "lowerleg01_L",
|
||||
"h": -0.3
|
||||
}
|
||||
|
||||
var foot_ik_r = {
|
||||
"foot": "foot_R",
|
||||
"bone1": "upperleg02_R",
|
||||
"bone2": "lowerleg01_R",
|
||||
"h": -0.3
|
||||
}
|
||||
func foot_ik_reset(sk: Skeleton, data: Dictionary, obj: Spatial):
|
||||
var bone1 = sk.fine_bone(data.bone1)
|
||||
var bone2 = sk.fine_bone(data.bone2)
|
||||
var foot = sk.find_bone(data.foot)
|
||||
assert(foot >= 0 && bone1 >= 0 && bone2 >= 0)
|
||||
var xf = sk.get_bone_global_pose(foot)
|
||||
var xf1 = sk.get_bone_global_pose(bone1)
|
||||
var xf2 = sk.get_bone_global_pose(bone2)
|
||||
var l1 = xf1.origin.distance_to(xf2.origin)
|
||||
var l2 = xf2.origin.distance_to(xf.origin)
|
||||
var lt = xf1.origin.distance_squared_to(xf.origin)
|
||||
var cosa = l1 * (l1 + l2 * l2 + lt) / (2 * l1 * l2)
|
||||
var v1 = xf2.origin - xf1.origin
|
||||
var v2 = xf.origin - xf1.origin
|
||||
var rot_axis = v1.cross(v2).normalized()
|
||||
var space_state = get_world().direct_space_state
|
||||
var xform = global_transform
|
||||
var f = (xform * xf).origin
|
||||
var result = space_state.intersect_ray(f, f + Vector3(0, data.h, 0), [self], 0xffff)
|
||||
if result.has("position"):
|
||||
print(data.foot, result.position)
|
||||
obj.global_transform.origin = result.position
|
||||
|
||||
func feet_ik():
|
||||
var sk: Skeleton = get_skeleton()
|
||||
var foot1 = sk.find_bone("foot_L")
|
||||
var foot2 = sk.find_bone("foot_R")
|
||||
assert(foot1 >= 0 && foot2 >= 0)
|
||||
var xf1 = sk.get_bone_global_pose(foot1)
|
||||
var xf2 = sk.get_bone_global_pose(foot2)
|
||||
var space_state = get_world().direct_space_state
|
||||
var xform = global_transform
|
||||
var f1 = (xform * xf1).origin
|
||||
var f2 = (xform * xf2).origin
|
||||
var result1 = space_state.intersect_ray(f1, f1 + Vector3(0, -0.3, 0), [self], 0xffff)
|
||||
var result2 = space_state.intersect_ray(f2, f2 + Vector3(0, -0.3, 0), [self], 0xffff)
|
||||
if result1.has("position"):
|
||||
print("L: ", result1.position)
|
||||
foot_ik_target_l.global_transform.origin = result1.position
|
||||
if result2.has("position"):
|
||||
print("R: ", result2.position)
|
||||
foot_ik_target_r.global_transform.origin = result2.position
|
||||
var foot_ik_target_l
|
||||
var foot_ik_target_r
|
||||
func feet_ik_init():
|
||||
var s1 = Spatial.new()
|
||||
var s2 = Spatial.new()
|
||||
var sk: Skeleton = get_skeleton()
|
||||
var foot1 = sk.find_bone("foot_L")
|
||||
var foot2 = sk.find_bone("foot_R")
|
||||
var xf1 = sk.get_bone_global_pose(foot1)
|
||||
var xf2 = sk.get_bone_global_pose(foot2)
|
||||
s1.transform = xf1
|
||||
s2.transform = xf2
|
||||
foot_ik_target_l = s1
|
||||
foot_ik_target_r = s2
|
||||
# var ik1 : = SkeletonIK.new()
|
||||
# ik1.root_bone = "upperleg02_L"
|
||||
# ik1.tip_bone = "foot_L"
|
||||
# ik1.target_node = get_path_to(foot_ik_target_l)
|
||||
# ik1.interpolation = 0.1
|
||||
# sk.add_child(ik1)
|
||||
# var ik2 = SkeletonIK.new()
|
||||
# ik2.root_bone = "upperleg02_R"
|
||||
# ik2.tip_bone = "foot_R"
|
||||
# ik2.target_node = get_path_to(foot_ik_target_r)
|
||||
# ik2.interpolation = 0.1
|
||||
# sk.add_child(ik2)
|
||||
# ik1.start(true)
|
||||
# ik2.start(true)
|
||||
var act = {
|
||||
"stop":[
|
||||
["travel", p1, "Motion"],
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
extends Spatial
|
||||
var loading
|
||||
|
||||
func new_quest(q):
|
||||
var title = q.get_title()
|
||||
var desc = q.get_description()
|
||||
print("title: ", title)
|
||||
print("desc: ", desc)
|
||||
func _ready():
|
||||
loading = preload("res://ui/loading.tscn").instance()
|
||||
get_tree().get_root().add_child(loading)
|
||||
@@ -12,6 +18,9 @@ func _ready():
|
||||
global.set_save_slot(0)
|
||||
e = $dungeon.connect("prepared", self, "start_ai")
|
||||
assert(e == OK)
|
||||
e = quests.connect("new_quest", self, "new_quest")
|
||||
assert(e == OK)
|
||||
global.interior = $dungeon
|
||||
|
||||
var default_meta = {
|
||||
"grabbing": false,
|
||||
@@ -31,8 +40,17 @@ var player_meta = {
|
||||
func start_ai():
|
||||
print("prepared")
|
||||
$"meta-ai".start()
|
||||
global.interior = $dungeon
|
||||
quests.activate()
|
||||
|
||||
func save():
|
||||
global.save_characters()
|
||||
$dungeon.save()
|
||||
quests.save()
|
||||
global.save_game()
|
||||
|
||||
func spawn_player(spawner):
|
||||
print("spawned player")
|
||||
loading.queue_free()
|
||||
var player_sc = load("res://scenes/characters/male.tscn")
|
||||
var player = player_sc.instance()
|
||||
@@ -49,6 +67,7 @@ func spawn_player(spawner):
|
||||
player.set_meta("spawner", spawner)
|
||||
player.add_to_group("player")
|
||||
$cam_target/cam_rot/offset/Camera.current = true
|
||||
global.start_time()
|
||||
func spawn_npc(spawner):
|
||||
var npc
|
||||
var g
|
||||
@@ -220,3 +239,5 @@ func _process(delta):
|
||||
$cam_target.rotate_y(-angle * delta)
|
||||
else:
|
||||
cam_fixup_cooldown -= delta
|
||||
if Input.is_action_just_pressed("save_game"):
|
||||
save()
|
||||
|
||||
@@ -13,27 +13,30 @@ 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 size_x = 2
|
||||
var size_y = 2
|
||||
var floors = 2
|
||||
var w = 10
|
||||
var h = 8
|
||||
var dungeon = []
|
||||
var dungeon_save = {}
|
||||
var spawn_save = {}
|
||||
var prepared = false
|
||||
var map = []
|
||||
var exit_doors = []
|
||||
var stairs_x = 0
|
||||
var stairs_y = 0
|
||||
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 = []
|
||||
var doors = {}
|
||||
func build_rooms():
|
||||
print("build_rooms")
|
||||
var stairs_x = randi() % size_x
|
||||
var stairs_y = randi() % size_y
|
||||
stairs_x = randi() % size_x
|
||||
stairs_y = randi() % size_y
|
||||
|
||||
for k in range(floors):
|
||||
var cur_x = stairs_x
|
||||
@@ -43,38 +46,23 @@ func build_rooms():
|
||||
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
|
||||
var sel = [cur_room.OPEN_LEFT, cur_room.OPEN_RIGHT, cur_room.OPEN_UP, cur_room.OPEN_DOWN]
|
||||
var rsel = [cur_room.OPEN_RIGHT, cur_room.OPEN_LEFT, cur_room.OPEN_DOWN, cur_room.OPEN_UP]
|
||||
var selx = [-1, 1, 0, 0]
|
||||
var sely = [0, 0, -1, 1]
|
||||
var nx = cur_x + selx[choice]
|
||||
var ny = cur_y + sely[choice]
|
||||
if nx >= 0 && nx < size_x && ny >= 0 && ny < size_y:
|
||||
cur_room.open_path(sel[choice])
|
||||
if !cur_room in visited:
|
||||
visited.push_back(cur_room)
|
||||
var old_room = cur_room
|
||||
cur_x = nx
|
||||
cur_y = ny
|
||||
cur_room = dungeon[k * size_x * size_y + cur_y * size_x + cur_x]
|
||||
cur_room.open_path(rsel[choice])
|
||||
if visited.size() == size_x * size_y:
|
||||
break
|
||||
print("base rooms done")
|
||||
for fl in range(floors):
|
||||
for k in range(size_x):
|
||||
@@ -91,44 +79,99 @@ func build_rooms():
|
||||
dungeon[right].open_window(dungeon[right].OPEN_RIGHT)
|
||||
window_rooms.push_back(left)
|
||||
window_rooms.push_back(right)
|
||||
|
||||
func build_exits():
|
||||
var street_exits = []
|
||||
while street_exits.size() == 0:
|
||||
var fl = 0
|
||||
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
|
||||
for h in [up, down]:
|
||||
print(h)
|
||||
if street_exits.size() < 1:
|
||||
if dungeon[h].has_meta("master_room"):
|
||||
continue
|
||||
if randf() > 0.7:
|
||||
var d = dungeon[h].OPEN_UP if h == up else dungeon[h].OPEN_DOWN
|
||||
dungeon[h].outside_doors.push_back(d)
|
||||
dungeon[h].set_meta("exit_room", true)
|
||||
print("exit room: ", h)
|
||||
street_exits.push_back(h)
|
||||
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
|
||||
for h in [left, right]:
|
||||
print(h)
|
||||
if street_exits.size() < 1:
|
||||
if dungeon[h].has_meta("master_room"):
|
||||
continue
|
||||
if randf() > 0.7:
|
||||
var d = dungeon[h].OPEN_LEFT if h == left else dungeon[h].OPEN_RIGHT
|
||||
dungeon[h].outside_doors.push_back(d)
|
||||
dungeon[h].set_meta("exit_room", true)
|
||||
print("exit room: ", h)
|
||||
street_exits.push_back(h)
|
||||
print("rooms build complete")
|
||||
var special_rooms = {
|
||||
"master_room": {
|
||||
"alloc": floors * size_x * size_y
|
||||
},
|
||||
"jail_room": {
|
||||
"alloc": floors * size_x * size_y,
|
||||
},
|
||||
"kitchen_room": {
|
||||
"alloc": size_x * size_y
|
||||
}
|
||||
}
|
||||
func alloc_special_rooms():
|
||||
var allocated = []
|
||||
for e in range(floors):
|
||||
var id = e * size_x * size_y + stairs_y * size_x + stairs_x
|
||||
allocated.push_back(id)
|
||||
dungeon[id].set_meta("stairs", e)
|
||||
for k in special_rooms.keys():
|
||||
if special_rooms[k].has("id"):
|
||||
allocated.push_back(special_rooms[k].id)
|
||||
for k in special_rooms.keys():
|
||||
if special_rooms[k].has("id"):
|
||||
continue
|
||||
while true:
|
||||
var room_id = randi() % special_rooms[k].alloc
|
||||
if !room_id in allocated:
|
||||
special_rooms[k].id = room_id
|
||||
allocated.push_back(room_id)
|
||||
break
|
||||
for k in special_rooms.keys():
|
||||
var room_id = special_rooms[k].id
|
||||
dungeon[room_id].set_meta(k, true)
|
||||
if k == "master_room":
|
||||
var player_spawn = Spatial.new()
|
||||
dungeon[room_id].add_child(player_spawn)
|
||||
player_spawn.name = "player-spawn"
|
||||
player_spawn.add_to_group("spawn")
|
||||
|
||||
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")
|
||||
alloc_special_rooms()
|
||||
|
||||
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.save_data.dungeon_seed = OS.get_unix_time()
|
||||
global.load_game()
|
||||
seed(global.save_data.dungeon_seed)
|
||||
if global.save_data.has("dungeon"):
|
||||
dungeon_save = global.save_data.dungeon
|
||||
seed(global.save_data.dungeon_seed)
|
||||
state = 1
|
||||
1:
|
||||
dungeon.resize(floors * size_x * size_y)
|
||||
for k in range(floors):
|
||||
for i in range(size_x):
|
||||
@@ -140,16 +183,34 @@ 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 = 40
|
||||
20:
|
||||
print("build rooms")
|
||||
build_rooms()
|
||||
state = 21
|
||||
21:
|
||||
print("build special rooms")
|
||||
build_special_rooms()
|
||||
|
||||
state = 31
|
||||
31:
|
||||
print("build exits")
|
||||
build_exits()
|
||||
state = 32
|
||||
32:
|
||||
print("build room nodes")
|
||||
for r in dungeon:
|
||||
r.create_rooms()
|
||||
for k in get_tree().get_nodes_in_group("furniture"):
|
||||
exit_doors = get_tree().get_nodes_in_group("exit_door")
|
||||
state = 33
|
||||
33:
|
||||
print("spawn furniture")
|
||||
furniture_nodes = get_tree().get_nodes_in_group("furniture")
|
||||
state = 34
|
||||
34:
|
||||
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,18 +228,21 @@ 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 = 50
|
||||
40:
|
||||
dungeon_ids = range(dungeon.size())
|
||||
state = 41
|
||||
41:
|
||||
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 = 50
|
||||
50:
|
||||
print("loaded")
|
||||
state = 4
|
||||
state = 60
|
||||
prepared = true
|
||||
emit_signal("prepared")
|
||||
_:
|
||||
if Input.is_action_just_pressed("save_game"):
|
||||
save()
|
||||
|
||||
140
proto3/godot/scenes/maps/floor.escn
Normal file
140
proto3/godot/scenes/maps/floor.escn
Normal file
@@ -0,0 +1,140 @@
|
||||
[gd_scene load_steps=1 format=2]
|
||||
|
||||
[sub_resource id=1 type="Shader"]
|
||||
|
||||
resource_name = "Shader Nodetree"
|
||||
code = "shader_type spatial;
|
||||
render_mode blend_mix, depth_draw_always, cull_back, diffuse_burley, specular_schlick_ggx;
|
||||
|
||||
|
||||
|
||||
void node_bsdf_principled(vec4 color, float subsurface, vec4 subsurface_color,
|
||||
float metallic, float specular, float roughness, float clearcoat,
|
||||
float clearcoat_roughness, float anisotropy, float transmission,
|
||||
float IOR, out vec3 albedo, out float sss_strength_out,
|
||||
out float metallic_out, out float specular_out,
|
||||
out float roughness_out, out float clearcoat_out,
|
||||
out float clearcoat_gloss_out, out float anisotropy_out,
|
||||
out float transmission_out, out float ior) {
|
||||
metallic = clamp(metallic, 0.0, 1.0);
|
||||
transmission = clamp(transmission, 0.0, 1.0);
|
||||
|
||||
subsurface = subsurface * (1.0 - metallic);
|
||||
|
||||
albedo = mix(color.rgb, subsurface_color.rgb, subsurface);
|
||||
sss_strength_out = subsurface;
|
||||
metallic_out = metallic;
|
||||
specular_out = pow((IOR - 1.0)/(IOR + 1.0), 2)/0.08;
|
||||
roughness_out = roughness;
|
||||
clearcoat_out = clearcoat * (1.0 - transmission);
|
||||
clearcoat_gloss_out = 1.0 - clearcoat_roughness;
|
||||
anisotropy_out = clamp(anisotropy, 0.0, 1.0);
|
||||
transmission_out = (1.0 - transmission) * (1.0 - metallic);
|
||||
ior = IOR;
|
||||
}
|
||||
|
||||
void vertex () {
|
||||
}
|
||||
|
||||
void fragment () {
|
||||
|
||||
// node: 'Principled BSDF'
|
||||
// type: 'ShaderNodeBsdfPrincipled'
|
||||
// input sockets handling
|
||||
vec4 node0_in0_basecolor = vec4(0.06881529837846756, 0.005524288397282362,
|
||||
0.003115540137514472, 1.0);
|
||||
float node0_in1_subsurface = float(0.0);
|
||||
vec3 node0_in2_subsurfaceradius = vec3(1.0, 0.20000000298023224,
|
||||
0.10000000149011612);
|
||||
vec4 node0_in3_subsurfacecolor = vec4(0.800000011920929, 0.800000011920929,
|
||||
0.800000011920929, 1.0);
|
||||
float node0_in4_metallic = float(0.0);
|
||||
float node0_in5_specular = float(0.5);
|
||||
float node0_in6_speculartint = float(0.0);
|
||||
float node0_in7_roughness = float(0.4000000059604645);
|
||||
float node0_in8_anisotropic = float(0.0);
|
||||
float node0_in9_anisotropicrotation = float(0.0);
|
||||
float node0_in10_sheen = float(0.0);
|
||||
float node0_in11_sheentint = float(0.5);
|
||||
float node0_in12_clearcoat = float(0.0);
|
||||
float node0_in13_clearcoatroughness = float(0.029999999329447746);
|
||||
float node0_in14_ior = float(1.4500000476837158);
|
||||
float node0_in15_transmission = float(0.0);
|
||||
float node0_in16_transmissionroughness = float(0.0);
|
||||
vec4 node0_in17_emission = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
float node0_in18_alpha = float(1.0);
|
||||
vec3 node0_in19_normal = NORMAL;
|
||||
vec3 node0_in20_clearcoatnormal = vec3(0.0, 0.0, 0.0);
|
||||
vec3 node0_in21_tangent = TANGENT;
|
||||
// output sockets definitions
|
||||
vec3 node0_bsdf_out0_albedo;
|
||||
float node0_bsdf_out1_sss_strength;
|
||||
float node0_bsdf_out3_specular;
|
||||
float node0_bsdf_out2_metallic;
|
||||
float node0_bsdf_out4_roughness;
|
||||
float node0_bsdf_out5_clearcoat;
|
||||
float node0_bsdf_out6_clearcoat_gloss;
|
||||
float node0_bsdf_out7_anisotropy;
|
||||
float node0_bsdf_out8_transmission;
|
||||
float node0_bsdf_out9_ior;
|
||||
|
||||
node_bsdf_principled(node0_in0_basecolor, node0_in1_subsurface,
|
||||
node0_in3_subsurfacecolor, node0_in4_metallic, node0_in5_specular,
|
||||
node0_in7_roughness, node0_in12_clearcoat, node0_in13_clearcoatroughness,
|
||||
node0_in8_anisotropic, node0_in15_transmission, node0_in14_ior,
|
||||
node0_bsdf_out0_albedo, node0_bsdf_out1_sss_strength, node0_bsdf_out2_metallic,
|
||||
node0_bsdf_out3_specular, node0_bsdf_out4_roughness, node0_bsdf_out5_clearcoat,
|
||||
node0_bsdf_out6_clearcoat_gloss, node0_bsdf_out7_anisotropy,
|
||||
node0_bsdf_out8_transmission, node0_bsdf_out9_ior);
|
||||
|
||||
|
||||
ALBEDO = node0_bsdf_out0_albedo;
|
||||
SSS_STRENGTH = node0_bsdf_out1_sss_strength;
|
||||
SPECULAR = node0_bsdf_out3_specular;
|
||||
METALLIC = node0_bsdf_out2_metallic;
|
||||
ROUGHNESS = node0_bsdf_out4_roughness;
|
||||
CLEARCOAT = node0_bsdf_out5_clearcoat;
|
||||
CLEARCOAT_GLOSS = node0_bsdf_out6_clearcoat_gloss;
|
||||
NORMAL = node0_in19_normal;
|
||||
// uncomment it when you need it
|
||||
// TRANSMISSION = vec3(1.0, 1.0, 1.0) * node0_bsdf_out8_transmission;
|
||||
// uncomment it when you are modifing TANGENT
|
||||
// TANGENT = normalize(cross(cross(node0_in21_tangent, NORMAL), NORMAL));
|
||||
// BINORMAL = cross(TANGENT, NORMAL);
|
||||
// uncomment it when you have tangent(UV) set
|
||||
// ANISOTROPY = node0_bsdf_out7_anisotropy;
|
||||
}
|
||||
"
|
||||
|
||||
[sub_resource id=2 type="ShaderMaterial"]
|
||||
|
||||
resource_name = ""
|
||||
shader = SubResource(1)
|
||||
|
||||
[sub_resource id=3 type="ArrayMesh"]
|
||||
|
||||
resource_name = "floor"
|
||||
surfaces/0 = {
|
||||
"material":SubResource(2),
|
||||
"primitive":4,
|
||||
"arrays":[
|
||||
Vector3Array(1.99, 2.23517e-08, 0.01, 0.01, 2.23517e-08, 1.99, 0.01, 2.23517e-08, 0.01, 0.0, -0.19, 1.99, 0.0, -0.00999998, 0.01, 0.0, -0.00999998, 1.99, 1.99, -0.19, 2.0, 0.01, -0.00999998, 2.0, 1.99, -0.00999998, 2.0, 0.01, -0.2, 0.01, 1.99, -0.2, 1.99, 1.99, -0.2, 0.01, 2.0, -0.19, 0.01, 2.0, -0.00999998, 1.99, 2.0, -0.00999998, 0.01, 1.99, -0.19, 0.0, 1.99, -0.2, 0.01, 2.0, -0.19, 0.01, 1.99, 2.23517e-08, 0.01, 1.99, -0.00999998, 0.0, 2.0, -0.00999998, 0.01, 2.0, -0.19, 1.99, 1.99, -0.2, 1.99, 1.99, -0.19, 2.0, 2.0, -0.00999998, 1.99, 1.99, -0.00999998, 2.0, 1.99, 2.23517e-08, 1.99, 0.01, -0.19, 0.0, 0.0, -0.19, 0.01, 0.01, -0.2, 0.01, 0.0, -0.00999998, 0.01, 0.01, -0.00999998, 0.0, 0.01, 2.23517e-08, 0.01, 0.0, -0.19, 1.99, 0.01, -0.19, 2.0, 0.01, -0.2, 1.99, 0.01, 2.23517e-08, 1.99, 0.01, -0.00999998, 2.0, 0.0, -0.00999998, 1.99, 0.01, 2.23517e-08, 1.99, 0.0, -0.00999998, 0.01, 0.01, 2.23517e-08, 0.01, 0.01, 2.23517e-08, 0.01, 1.99, -0.00999998, 0.0, 1.99, 2.23517e-08, 0.01, 2.0, -0.00999998, 0.01, 1.99, -0.19, 0.0, 2.0, -0.19, 0.01, 0.01, -0.19, 2.0, 0.0, -0.00999998, 1.99, 0.01, -0.00999998, 2.0, 1.99, -0.00999998, 2.0, 2.0, -0.19, 1.99, 1.99, -0.19, 2.0, 0.01, -0.00999998, 0.0, 0.0, -0.19, 0.01, 0.01, -0.19, 0.0, 0.01, -0.2, 1.99, 1.99, -0.19, 2.0, 1.99, -0.2, 1.99, 1.99, -0.2, 1.99, 2.0, -0.19, 0.01, 1.99, -0.2, 0.01, 1.99, 2.23517e-08, 1.99, 0.01, -0.00999998, 2.0, 0.01, 2.23517e-08, 1.99, 0.01, -0.2, 0.01, 0.0, -0.19, 1.99, 0.01, -0.2, 1.99, 1.99, -0.2, 0.01, 0.01, -0.19, 0.0, 0.01, -0.2, 0.01, 1.99, 2.23517e-08, 0.01, 2.0, -0.00999998, 1.99, 1.99, 2.23517e-08, 1.99, 0.01, -0.19, 0.0, 1.99, -0.00999998, 0.0, 0.01, -0.00999998, 0.0, 1.99, 2.23517e-08, 1.99, 0.0, -0.19, 0.01, 0.01, -0.19, 2.0, 0.01, -0.2, 1.99, 2.0, -0.19, 1.99, 0.0, -0.00999998, 1.99, 0.01, -0.00999998, 0.0, 2.0, -0.00999998, 0.01, 1.99, -0.00999998, 0.0, 1.99, -0.19, 0.0, 0.01, -0.19, 2.0, 0.0, -0.19, 1.99, 0.0, -0.00999998, 1.99, 1.99, -0.00999998, 2.0, 2.0, -0.00999998, 1.99, 2.0, -0.19, 1.99, 0.01, -0.00999998, 0.0, 0.0, -0.00999998, 0.01, 0.0, -0.19, 0.01, 0.01, -0.2, 1.99, 0.01, -0.19, 2.0, 1.99, -0.19, 2.0, 1.99, -0.2, 1.99, 2.0, -0.19, 1.99, 2.0, -0.19, 0.01, 1.99, 2.23517e-08, 1.99, 1.99, -0.00999998, 2.0, 0.01, -0.00999998, 2.0, 0.01, -0.2, 0.01, 0.0, -0.19, 0.01, 0.0, -0.19, 1.99, 1.99, -0.19, 0.0, 2.0, -0.00999998, 0.01, 1.99, -0.19, 0.0),
|
||||
Vector3Array(0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -0.577356, 0.577353, 0.577342, -0.577356, 0.577353, 0.577342, -0.577356, 0.577353, 0.577342, -0.577354, -0.577354, 0.577343, -0.577354, -0.577354, 0.577343, -0.577354, -0.577354, 0.577343, -0.577351, 0.577361, -0.577339, -0.577351, 0.577361, -0.577339, -0.577351, 0.577361, -0.577339, -0.577351, -0.577361, -0.577339, -0.577351, -0.577361, -0.577339, -0.577351, -0.577361, -0.577339, 0.577351, 0.57735, 0.57735, 0.577351, 0.57735, 0.57735, 0.577351, 0.57735, 0.57735, 0.57735, -0.57735, 0.57735, 0.57735, -0.57735, 0.57735, 0.57735, -0.57735, 0.57735, 0.577354, 0.577342, -0.577354, 0.577354, 0.577342, -0.577354, 0.577354, 0.577342, -0.577354, 0.577354, -0.577343, -0.577354, 0.577354, -0.577343, -0.577354, 0.577354, -0.577343, -0.577354, 0.707107, -0.707107, 0.0, 0.707107, -0.707107, 0.0, 0.707107, -0.707107, 0.0, 0.0, -0.707107, 0.707107, 0.0, -0.707107, 0.707107, 0.0, -0.707107, 0.707107, -0.707107, 0.0, 0.707107, -0.707107, 0.0, 0.707107, -0.707107, 0.0, 0.707107, 0.707106, 0.0, -0.707107, 0.707106, 0.0, -0.707107, 0.707106, 0.0, -0.707107, -0.707106, 0.0, -0.707107, -0.707106, 0.0, -0.707107, -0.707106, 0.0, -0.707107, 0.707107, 0.0, 0.707107, 0.707107, 0.0, 0.707107, 0.707107, 0.0, 0.707107, 0.0, 0.707101, -0.707112, 0.0, 0.707101, -0.707112, 0.0, 0.707101, -0.707112, -0.707106, 0.707107, 0.0, -0.707106, 0.707107, 0.0, -0.707106, 0.707107, 0.0, 0.0, -0.707102, -0.707112, 0.0, -0.707102, -0.707112, 0.0, -0.707102, -0.707112, 0.707106, 0.707108, 0.0, 0.707106, 0.707108, 0.0, 0.707106, 0.707108, 0.0, 0.0, 0.707107, 0.707107, 0.0, 0.707107, 0.707107, 0.0, 0.707107, 0.707107, -0.707107, -0.707106, 0.0, -0.707107, -0.707106, 0.0, -0.707107, -0.707106, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 0.0, 0.707107, -0.707107, 0.0, 0.0, -0.707107, 0.707107, -0.707107, 0.0, 0.707107, -0.707107, 0.0, 0.707107, -0.707107, 0.0, 0.707107, 0.707106, 0.0, -0.707107, 0.707106, 0.0, -0.707107, 0.707106, 0.0, -0.707107, -0.707106, 0.0, -0.707107, -0.707106, 0.0, -0.707107, -0.707106, 0.0, -0.707107, 0.707107, 0.0, 0.707107, 0.707107, 0.0, 0.707107, 0.707107, 0.0, 0.707107, 0.0, 0.70711, -0.707104, 0.0, 0.70711, -0.707104, 0.0, 0.70711, -0.707104, -0.707108, 0.707105, 0.0, -0.707108, 0.707105, 0.0, -0.707108, 0.707105, 0.0, 0.0, -0.70711, -0.707103, 0.0, -0.70711, -0.707103, 0.0, -0.70711, -0.707103, 0.707108, 0.707106, 0.0, 0.707108, 0.707106, 0.0, 0.707108, 0.707106, 0.0, 0.0, 0.707107, 0.707107, -0.707107, -0.707106, 0.0, 0.0, 0.0, 1.0),
|
||||
FloatArray(-1.49949e-07, 0.0, 1.0, 1.0, -1.49949e-07, 0.0, 1.0, 1.0, -1.2163e-07, 0.0, 1.0, 1.0, 0.0, -1.0, -2.82773e-07, 1.0, 0.0, -1.0, -1.73203e-08, 1.0, 0.0, -1.0, -3.00093e-07, 1.0, 4.87539e-09, -1.0, 0.0, 1.0, 2.98626e-10, -1.0, 0.0, 1.0, 5.17401e-09, -1.0, 0.0, 1.0, -6.08149e-08, 0.0, -1.0, 1.0, -6.08149e-08, 0.0, -1.0, 1.0, -1.2163e-07, 0.0, -1.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 4.59712e-06, 0.707102, -0.707111, 1.0, 4.59712e-06, 0.707102, -0.707111, 1.0, 4.59712e-06, 0.707102, -0.707111, 1.0, -4.60837e-06, 0.707102, 0.707111, 1.0, -4.60837e-06, 0.707102, 0.707111, 1.0, -4.60837e-06, 0.707102, 0.707111, 1.0, -0.70711, -0.707103, -4.21548e-06, 1.0, -0.70711, -0.707103, -4.21548e-06, 1.0, -0.70711, -0.707103, -4.21548e-06, 1.0, 0.707111, -0.707103, 4.43916e-06, 1.0, 0.707111, -0.707103, 4.43916e-06, 1.0, 0.707111, -0.707103, 4.43916e-06, 1.0, -8.44653e-06, 0.707111, -0.707102, 1.0, -8.44653e-06, 0.707111, -0.707102, 1.0, -8.44653e-06, 0.707111, -0.707102, 1.0, -0.707103, -0.707111, -8.42933e-06, 1.0, -0.707103, -0.707111, -8.42933e-06, 1.0, -0.707103, -0.707111, -8.42933e-06, 1.0, 0.707102, -0.707112, 4.68611e-06, 1.0, 0.707102, -0.707112, 4.68611e-06, 1.0, 0.707102, -0.707112, 4.68611e-06, 1.0, -3.90413e-06, -0.707116, 0.707098, 1.0, -3.90413e-06, -0.707116, 0.707098, 1.0, -3.90413e-06, -0.707116, 0.707098, 1.0, -1.20532e-07, -1.20532e-07, 1.0, 1.0, -1.20416e-07, -1.20416e-07, 1.0, 1.0, -1.20415e-07, -1.20415e-07, 1.0, 1.0, 8.39109e-06, 0.707107, 0.707107, 1.0, 3.82867e-08, 0.707107, 0.707107, 1.0, 0.0, 0.707107, 0.707107, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 5.17402e-09, -1.0, -5.17401e-09, 1.0, 5.17402e-09, -1.0, -5.17401e-09, 1.0, 5.17402e-09, -1.0, -5.17401e-09, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, -0.707112, -0.707101, 1.0, 0.0, -0.707112, -0.707101, 1.0, 0.0, -0.707112, -0.707101, 1.0, -1.20414e-07, -1.20413e-07, -1.0, 1.0, -1.20414e-07, -1.20413e-07, -1.0, 1.0, -1.20414e-07, -1.20413e-07, -1.0, 1.0, -8.51452e-06, -0.707112, 0.707102, 1.0, -8.51452e-06, -0.707112, 0.707102, 1.0, -8.51452e-06, -0.707112, 0.707102, 1.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0, -1.0, 1.0, -7.73467e-08, 0.707107, -0.707107, 1.0, -1.69517e-05, 0.707107, -0.707107, 1.0, -1.7029e-05, 0.707107, -0.707107, 1.0, -1.7859e-07, 1.7859e-07, 1.0, 1.0, -1.7827e-07, 1.7827e-07, 1.0, 1.0, -1.78268e-07, 1.78268e-07, 1.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, -1.78268e-07, 0.0, 1.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, 0.0, -1.0, 1.0, 0.0, -1.0, 0.0, 1.0, -1.20533e-07, -1.20533e-07, 1.0, 1.0, 8.42937e-06, 0.707107, 0.707107, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, -0.707104, -0.70711, 1.0, 0.0, -0.707104, -0.70711, 1.0, 0.0, -0.707104, -0.70711, 1.0, -1.20347e-07, -1.20348e-07, -1.0, 1.0, -1.20347e-07, -1.20348e-07, -1.0, 1.0, -1.20347e-07, -1.20348e-07, -1.0, 1.0, -1.97563e-07, -0.707103, 0.70711, 1.0, -1.97563e-07, -0.707103, 0.70711, 1.0, -1.97563e-07, -0.707103, 0.70711, 1.0, -1.20534e-07, 1.20534e-07, -1.0, 1.0, -1.20534e-07, 1.20534e-07, -1.0, 1.0, -1.20534e-07, 1.20534e-07, -1.0, 1.0, 0.0, 0.707107, -0.707107, 1.0, -1.78592e-07, 1.78592e-07, 1.0, 1.0, 0.0, 1.0, 0.0, 1.0),
|
||||
null, ; no Vertex Colors,
|
||||
Vector2Array(0.00357143, 0.9975, 0.710714, 0.5025, 0.00357151, 0.5025, 0.782143, 0.9975, 0.717857, 0.5025, 0.717857, 0.9975, 0.853571, 0.9975, 0.789286, 0.5025, 0.789286, 0.9975, 0.710714, 0.0025, 0.00357142, 0.4975, 0.710714, 0.4975, 0.996429, 0.9975, 0.932143, 0.5025, 0.932143, 0.9975, 0.860714, 0.9975, 0.857143, 0.9975, 0.860714, 1.0, 0.00357143, 0.9975, 4.25747e-10, 0.9975, 0.00357142, 1.0, 0.996429, 0.5025, 1.0, 0.5025, 0.996429, 0.5, 0.932143, 0.5025, 0.932143, 0.5, 0.928572, 0.5025, 0.860714, 0.5025, 0.860714, 0.5, 0.857143, 0.5025, 0.717857, 0.5025, 0.717857, 0.5, 0.714286, 0.5025, 0.782143, 0.9975, 0.782143, 1.0, 0.785714, 0.9975, 0.710714, 0.5025, 0.714285, 0.5025, 0.710714, 0.5, 0.710714, 0.5025, 0.00357151, 0.5, 0.00357151, 0.5025, 0.00357151, 0.5025, 4.25747e-10, 0.9975, 0.00357143, 0.9975, 0.932143, 0.9975, 0.996429, 1.0, 0.996429, 0.9975, 0.853571, 0.5025, 0.789286, 0.5, 0.789286, 0.5025, 0.789286, 0.9975, 0.853571, 1.0, 0.853571, 0.9975, 0.925, 0.5025, 0.860714, 0.5, 0.860714, 0.5025, 0.00357154, 0.0025, 5.81859e-10, 0.4975, 0.00357142, 0.4975, 0.00357142, 0.4975, 0.710714, 0.5, 0.710714, 0.4975, 0.710714, 0.9975, 0.714285, 0.5025, 0.710714, 0.5025, 0.710714, 0.0025, 0.00357154, 0.0, 0.00357154, 0.0025, 0.710714, 0.4975, 0.714285, 0.00250006, 0.710714, 0.0025, 0.00357143, 0.9975, 0.710714, 1.0, 0.710714, 0.9975, 0.860714, 0.5025, 0.925, 0.9975, 0.925, 0.5025, 0.710714, 0.9975, 0.782143, 0.5025, 0.853571, 0.5025, 0.00357154, 0.0025, 0.996429, 0.5025, 0.710714, 0.5, 8.47237e-08, 0.5025, 0.932143, 0.9975, 0.932143, 1.0, 0.996429, 1.0, 0.853571, 0.5025, 0.853571, 0.5, 0.789286, 0.5, 0.789286, 0.9975, 0.789286, 1.0, 0.853571, 1.0, 0.925, 0.5025, 0.925, 0.5, 0.860714, 0.5, 0.00357154, 0.0025, 1.1579e-07, 0.0025, 5.81859e-10, 0.4975, 0.00357142, 0.4975, 0.00357142, 0.5, 0.710714, 0.5, 0.710714, 0.9975, 0.714285, 0.9975, 0.714285, 0.5025, 0.710714, 0.0025, 0.710714, 5.96046e-08, 0.00357154, 0.0, 0.714285, 0.4975, 0.00357142, 1.0, 0.860714, 0.9975),
|
||||
null, ; No UV2,
|
||||
null, ; No Bones,
|
||||
null, ; No Weights,
|
||||
IntArray(0, 2, 1, 3, 5, 4, 6, 8, 7, 9, 11, 10, 12, 14, 13, 15, 17, 16, 18, 20, 19, 21, 23, 22, 24, 26, 25, 27, 29, 28, 30, 32, 31, 33, 35, 34, 36, 38, 37, 39, 41, 40, 42, 44, 43, 45, 47, 46, 48, 50, 49, 51, 53, 52, 54, 56, 55, 57, 59, 58, 60, 62, 61, 63, 65, 64, 66, 68, 67, 69, 71, 70, 72, 74, 73, 75, 77, 76, 0, 1, 78, 3, 4, 79, 6, 7, 80, 9, 10, 81, 12, 13, 82, 39, 40, 83, 42, 43, 84, 85, 87, 86, 88, 90, 89, 91, 93, 92, 94, 96, 95, 97, 99, 98, 100, 102, 101, 103, 105, 104, 106, 108, 107, 69, 70, 109, 72, 73, 110, 75, 76, 111)
|
||||
],
|
||||
"morph_arrays":[]
|
||||
}
|
||||
|
||||
[node type="Spatial" name="Scene"]
|
||||
|
||||
[node name="floor-col" type="MeshInstance" parent="."]
|
||||
|
||||
mesh = SubResource(3)
|
||||
visible = true
|
||||
transform = Transform(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0)
|
||||
1063
proto3/godot/scenes/maps/floor.escn.import
Normal file
1063
proto3/godot/scenes/maps/floor.escn.import
Normal file
File diff suppressed because it is too large
Load Diff
@@ -9,11 +9,13 @@ const BITLEFT = (1 << 2)
|
||||
const BITRIGHT = (1 << 3)
|
||||
var exits = []
|
||||
var windows = []
|
||||
var outside_doors = []
|
||||
|
||||
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 = preload("res://scenes/maps/door-outside.tscn")
|
||||
var stairs = preload("res://scenes/maps/stairs.tscn")
|
||||
var outside_door_placed = false
|
||||
var tw2d
|
||||
var te2d
|
||||
@@ -126,31 +128,46 @@ func _ready():
|
||||
te2d = $c_modular/e2d.transform
|
||||
tn2d = $c_modular/n2d.transform
|
||||
ts2d = $c_modular/s2d.transform
|
||||
var open_paths = {
|
||||
OPEN_UP: {
|
||||
"rm_walls": ["n2d", "iw4d"],
|
||||
"rm": ["fc4"],
|
||||
"bit": BITUP
|
||||
},
|
||||
OPEN_DOWN: {
|
||||
"rm_walls": ["s2d", "iw11d"],
|
||||
"rm": ["fc5"],
|
||||
"bit": BITDOWN
|
||||
},
|
||||
OPEN_LEFT: {
|
||||
"rm_walls": ["w2d", "iw17d"],
|
||||
"rm": ["fc2"],
|
||||
"bit": BITLEFT
|
||||
},
|
||||
OPEN_RIGHT: {
|
||||
"rm_walls": ["e2d", "iw22d"],
|
||||
"rm": ["fc3"],
|
||||
"bit": BITRIGHT
|
||||
},
|
||||
}
|
||||
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()
|
||||
var kf = open_paths[flag]
|
||||
bitflags |= kf.bit
|
||||
exits.push_back(flag)
|
||||
for e in kf.rm:
|
||||
if get_node(e):
|
||||
get_node(e).queue_free()
|
||||
func create_paths():
|
||||
for flag in exits:
|
||||
var kf = open_paths[flag]
|
||||
for e in kf.rm_walls:
|
||||
$c_modular.get_node(e).queue_free()
|
||||
for e in kf.rm:
|
||||
if get_node(e):
|
||||
get_node(e).queue_free()
|
||||
if exits.size() == 1 && !has_meta("master_room"):
|
||||
$fc1.queue_free()
|
||||
func open_window(flag):
|
||||
if !flag in windows:
|
||||
windows.push_back(flag)
|
||||
@@ -201,37 +218,85 @@ func master_room():
|
||||
func wall2door(n):
|
||||
var door_xform = n.transform
|
||||
var door_i
|
||||
for e in get_tree().get_nodes_in_group("door"):
|
||||
var xpos = e.global_transform.origin
|
||||
var ypos = n.global_transform.origin
|
||||
if xpos.distance_to(ypos) < 1.3:
|
||||
n.queue_free()
|
||||
return
|
||||
if has_meta("jail_room"):
|
||||
door_i = jail_door.instance()
|
||||
else:
|
||||
door_i = door.instance()
|
||||
add_child(door_i)
|
||||
door_i.transform = door_xform
|
||||
door_i.add_to_group("door")
|
||||
n.queue_free()
|
||||
func exit_door(n):
|
||||
var xn = n.name
|
||||
var exit_door_xform = n.transform
|
||||
var xdoor_i = outside_door.instance()
|
||||
add_child(xdoor_i)
|
||||
xdoor_i.transform = exit_door_xform
|
||||
xdoor_i.name = xn
|
||||
n.queue_free()
|
||||
xdoor_i.add_to_group("exit_door")
|
||||
func wall2window(n):
|
||||
var window_xform = n.transform
|
||||
var xn = n.name
|
||||
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()
|
||||
window_i = window.instance()
|
||||
add_child(window_i)
|
||||
window_i.name = xn
|
||||
window_i.transform = window_xform
|
||||
n.queue_free()
|
||||
|
||||
var bitdata = {
|
||||
BITLEFT: {
|
||||
"doors": ["iw17d"],
|
||||
"path_remove": ["path_west"],
|
||||
"nodes_remove": ["iw1", "iw2d", "iw3", "iw8", "iw9d", "iw10"]
|
||||
},
|
||||
BITRIGHT: {
|
||||
"doors": ["iw22d"],
|
||||
"path_remove": ["path_east"],
|
||||
"nodes_remove": ["iw5", "iw6d", "iw7", "iw12", "iw13d", "iw14"]
|
||||
},
|
||||
BITUP: {
|
||||
"doors": [],
|
||||
"path_remove": ["path_north"],
|
||||
"nodes_remove": ["iw15", "iw16d", "iw23d", "iw24"]
|
||||
},
|
||||
BITDOWN: {
|
||||
"doors": [],
|
||||
"path_remove": ["path_south"],
|
||||
"nodes_remove": ["iw18d", "iw19", "iw20", "iw21d"]
|
||||
}
|
||||
}
|
||||
|
||||
var master_metas = ["master_room", "kitchen_room", "exit_room", "stairs"]
|
||||
func create_rooms():
|
||||
if has_meta("master_room"):
|
||||
assert(exits.size() > 0)
|
||||
create_paths()
|
||||
var is_master_room = false
|
||||
for m in master_metas:
|
||||
if has_meta(m):
|
||||
is_master_room = true
|
||||
if is_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()
|
||||
if has_meta("exit_room"):
|
||||
assert(windows.size() > 0)
|
||||
for e in get_children():
|
||||
if e.is_in_group("furniture"):
|
||||
e.queue_free()
|
||||
if has_meta("stairs"):
|
||||
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:
|
||||
personal_room()
|
||||
elif exits.size() == 4:
|
||||
@@ -240,49 +305,26 @@ func create_rooms():
|
||||
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)
|
||||
for e in [BITLEFT, BITRIGHT, BITUP, BITDOWN]:
|
||||
if bitflags & e == 0:
|
||||
for g in bitdata[e].doors:
|
||||
wall2door($c_modular.get_node(g))
|
||||
for g in bitdata[e].path_remove:
|
||||
get_node(g).queue_free()
|
||||
for g in bitdata[e].nodes_remove:
|
||||
$c_modular.get_node(g).queue_free()
|
||||
var external = {
|
||||
OPEN_LEFT: ["w1", "w2d", "w3"],
|
||||
OPEN_DOWN: ["s1", "s2d", "s3"],
|
||||
OPEN_RIGHT: ["e1", "e2d", "e3"],
|
||||
OPEN_UP: ["n1", "n2d", "n3"]
|
||||
}
|
||||
for p in windows:
|
||||
for q in external[p]:
|
||||
var n = $c_modular.get_node(q)
|
||||
if !p in outside_doors:
|
||||
wall2window(n)
|
||||
for p in outside_doors:
|
||||
var q = external[p][1]
|
||||
var n = $c_modular.get_node(q)
|
||||
exit_door(n)
|
||||
|
||||
@@ -57,7 +57,9 @@ _data = {
|
||||
"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 )]
|
||||
[node name="interior2" groups=[
|
||||
"room",
|
||||
] instance=ExtResource( 1 )]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="path_west" type="Path" parent="." index="1" groups=[
|
||||
|
||||
319
proto3/godot/scenes/maps/stairs-small.escn
Normal file
319
proto3/godot/scenes/maps/stairs-small.escn
Normal file
File diff suppressed because one or more lines are too long
1063
proto3/godot/scenes/maps/stairs-small.escn.import
Normal file
1063
proto3/godot/scenes/maps/stairs-small.escn.import
Normal file
File diff suppressed because it is too large
Load Diff
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
45
proto3/godot/scenes/maps/stairs.tscn
Normal file
45
proto3/godot/scenes/maps/stairs.tscn
Normal file
@@ -0,0 +1,45 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/maps/stairs.escn" type="PackedScene" id=1]
|
||||
|
||||
[sub_resource type="BoxShape" id=1]
|
||||
extents = Vector3( 1.13086, 0.0458848, 0.64188 )
|
||||
|
||||
[sub_resource type="Curve3D" id=2]
|
||||
_data = {
|
||||
"points": PoolVector3Array( 0, 0, 0, 0, 0, 0, -3.40015, 0.239252, 1.85913, 0, 0, 0, 0, 0, 0, -1.97383, 0.257656, 1.88403, 0, 0, 0, 0, 0, 0, -1.45852, 0.423293, 1.90918, 0, 0, 0, 0, 0, 0, -0.13343, 1.49073, 1.93433, 0, 0, 0, 0, 0, 0, 0.24645, 1.77444, 1.93433, 0, 0, 0, 0, 0, 0, 1.75415, 1.76855, 1.87302, 0, 0, 0, 0, 0, 0, 1.66716, 1.85563, 0.244141, 0, 0, 0, 0, 0, 0, 1.66137, 1.75269, -0.562487, 0, 0, 0, 0, 0, 0, 1.65557, 1.76514, -1.72805, 0, 0, 0, 0, 0, 0, 0.974322, 1.71509, -1.75141, 0, 0, 0, 0, 0, 0, 0.287957, 2.12817, -1.72775, 0, 0, 0, 0, 0, 0, -0.201176, 2.55396, -1.71986, 0, 0, 0, 0, 0, 0, -0.666642, 3.04525, -1.72119, 0, 0, 0, 0, 0, 0, -1.27411, 3.41605, -1.72168, 0, 0, 0, 0, 0, 0, -2.65473, 3.40816, -1.73389 ),
|
||||
"tilts": PoolRealArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
|
||||
}
|
||||
|
||||
[sub_resource type="Curve3D" id=3]
|
||||
_data = {
|
||||
"points": PoolVector3Array( 0, 0, 0, 0, 0, 0, -4.5026, 0.332731, -0.0107422, 0, 0, 0, 0, 0, 0, -3.99813, 0.375664, -0.0107422, 0, 0, 0, 0, 0, 0, -4.07327, 0.375664, -1.81396, 0, 0, 0, 0, 0, 0, -4.084, 0.36493, -2.81201, 0, 0, 0, 0, 0, 0, -3.81567, 0.375664, -3.27344, 0, 0, 0, 0, 0, 0, -1.64755, 0.343464, -3.28418, 0, 0, 0, 0, 0, 0, -0.520562, 0.407863, -3.32715, 0, 0, 0, 0, 0, 0, 0.101966, 0.482996, -3.68164, 0, 0, 0, 0, 0, 0, 0.917692, 0.440063, -3.30566, 0, 0, 0, 0, 0, 0, 1.86222, 0.504463, -3.27344, 0, 0, 0, 0, 0, 0, 3.33267, 0.547396, -3.30566, 0, 0, 0, 0, 0, 0, 3.7298, 0.504463, -3.31641, 0, 0, 0, 0, 0, 0, 3.62247, 0.515196, -2.55469, 0, 0, 0, 0, 0, 0, 3.65467, 0.568862, -1.3418, 0, 0, 0, 0, 0, 0, 3.93373, 0.622528, -0.665527, 0, 0, 0, 0, 0, 0, 4.245, 0.547396, -0.236328, 0, 0, 0, 0, 0, 0, 4.55626, 0.547396, -0.0429688, 0, 0, 0, 0, 0, 0, 4.406, 0.558129, 0.0751953, 0, 0, 0, 0, 0, 0, 4.0518, 0.525929, 1.0625, 0, 0, 0, 0, 0, 0, 3.8586, 0.504463, 2.66187, 0, 0, 0, 0, 0, 0, 3.5688, 0.504463, 3.14478, 0, 0, 0, 0, 0, 0, 2.17348, 0.515196, 3.06982, 0, 0, 0, 0, 0, 0, 0.552762, 0.407863, 3.00537, 0, 0, 0, 0, 0, 0, 0.316631, 0.42933, 3.55273, 0, 0, 0, 0, 0, 0, -0.252232, 0.42933, 2.94092, 0, 0, 0, 0, 0, 0, -1.29336, 0.375664, 2.9624, 0, 0, 0, 0, 0, 0, -3.28974, 0.386397, 3.01611, 0, 0, 0, 0, 0, 0, -3.9552, 0.418597, 2.95166, 0, 0, 0, 0, 0, 0, -4.16987, 0.354197, 2.52222, 0, 0, 0, 0, 0, 0, -4.3416, 0.375664, 1.42749, 0, 0, 0, 0, 0, 0, -4.2128, 0.289798, 0.493652 ),
|
||||
"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, 0, 0, 0, 0, 0, 0, 0, 0 )
|
||||
}
|
||||
|
||||
[node name="stairs" instance=ExtResource( 1 )]
|
||||
|
||||
[node name="StaticBody" type="StaticBody" parent="." index="4"]
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="StaticBody" index="0"]
|
||||
transform = Transform( 0.783986, -0.620779, 0, 0.620779, 0.783986, 0, 0, 0, 1, -0.718359, 0.66685, 1.91067 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="CollisionShape2" type="CollisionShape" parent="StaticBody" index="1"]
|
||||
transform = Transform( -0.768529, 0.639815, -3.25444e-07, 0.639815, 0.768529, 1.60706e-08, 2.60396e-07, -1.95874e-07, -1, -0.0615042, 2.2555, -1.95211 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Path" type="Path" parent="." index="5" groups=[
|
||||
"path",
|
||||
]]
|
||||
curve = SubResource( 2 )
|
||||
|
||||
[node name="Path2" type="Path" parent="." index="6" groups=[
|
||||
"path",
|
||||
]]
|
||||
curve = SubResource( 3 )
|
||||
|
||||
[node name="Path3" type="Path" parent="." index="7" groups=[
|
||||
"path",
|
||||
]]
|
||||
curve = SubResource( 3 )
|
||||
140
proto3/godot/scenes/maps/wall.escn
Normal file
140
proto3/godot/scenes/maps/wall.escn
Normal file
File diff suppressed because one or more lines are too long
1063
proto3/godot/scenes/maps/wall.escn.import
Normal file
1063
proto3/godot/scenes/maps/wall.escn.import
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@ extends Node
|
||||
signal spawn_player(pos)
|
||||
signal spawn_npc(xform)
|
||||
|
||||
enum states {STATE_PREINIT, STATE_INIT, STATE_EXECUTE, STATE_SLEEP}
|
||||
enum states {STATE_PREINIT, STATE_INIT, STATE_INIT_ASTAR, STATE_EXECUTE, STATE_SLEEP}
|
||||
|
||||
var state = states.STATE_PREINIT
|
||||
var astar = null
|
||||
@@ -15,6 +15,7 @@ func start():
|
||||
|
||||
func _ready():
|
||||
astar = AStar.new()
|
||||
global.astar = astar
|
||||
|
||||
func calc_visible_lists():
|
||||
for g in get_tree().get_nodes_in_group("npc"):
|
||||
@@ -113,13 +114,20 @@ func spawn_characters():
|
||||
print("npc")
|
||||
emit_signal("spawn_npc", e)
|
||||
|
||||
var path_nodes = []
|
||||
var endings = []
|
||||
var connections = {}
|
||||
func _physics_process(delta):
|
||||
match state:
|
||||
states.STATE_INIT:
|
||||
print("starting AI")
|
||||
var endings = []
|
||||
var connections = {}
|
||||
for e in get_tree().get_nodes_in_group("path"):
|
||||
path_nodes = get_tree().get_nodes_in_group("path")
|
||||
endings = []
|
||||
connections = {}
|
||||
state = states.STATE_INIT_ASTAR
|
||||
states.STATE_INIT_ASTAR:
|
||||
if path_nodes.size() > 0:
|
||||
var e = path_nodes.pop_front()
|
||||
print(e.name)
|
||||
var new_points = Array(e.curve.get_baked_points())
|
||||
var new_ids = []
|
||||
@@ -145,39 +153,25 @@ func _physics_process(delta):
|
||||
astar.connect_points(new_ids[s], new_ids[s + 1])
|
||||
connections[new_ids[s]] = new_ids[s + 1]
|
||||
connections[new_ids[s + 1]] = new_ids[s]
|
||||
print("path nodes passed")
|
||||
var space_state = get_parent().get_world().direct_space_state
|
||||
for id1 in endings:
|
||||
for id2 in endings:
|
||||
if id1 == id2:
|
||||
continue
|
||||
if astar.are_points_connected(id1, id2):
|
||||
continue
|
||||
var p0 = astar.get_point_position(id1)
|
||||
var p1 = astar.get_point_position(id2)
|
||||
var front_result = space_state.intersect_ray(p0 + Vector3(0, 0.5, 0), p1 + Vector3(0, 0.5, 0), [], 0x1)
|
||||
if !front_result.has("collider"):
|
||||
astar.connect_points(id1, id2)
|
||||
# for pk in connections.keys():
|
||||
# var id1 = pk
|
||||
# var id2 = connections[pk]
|
||||
# if astar.are_points_connected(id1, id2):
|
||||
# var p0 = astar.get_point_position(id1)
|
||||
# var p1 = astar.get_point_position(id2)
|
||||
# var front_result = space_state.intersect_ray(p0 + Vector3(0, 0.8, 0), p1 + Vector3(0, 0.8, 0), [], 0x1)
|
||||
# if front_result.has("collider"):
|
||||
# var collider = front_result.collider
|
||||
# var ok = false
|
||||
# if collider.is_in_group("furniture"):
|
||||
# ok = true
|
||||
# elif collider.is_in_group("door"):
|
||||
# ok = true
|
||||
# astar.disconnect_points(id1, id2)
|
||||
print("astar complete")
|
||||
spawn_characters()
|
||||
print("characters spawned")
|
||||
$blackboard.set("metaai", self)
|
||||
state = states.STATE_EXECUTE
|
||||
else:
|
||||
print("path nodes passed")
|
||||
var space_state = get_parent().get_world().direct_space_state
|
||||
for id1 in endings:
|
||||
for id2 in endings:
|
||||
if id1 == id2:
|
||||
continue
|
||||
if astar.are_points_connected(id1, id2):
|
||||
continue
|
||||
var p0 = astar.get_point_position(id1)
|
||||
var p1 = astar.get_point_position(id2)
|
||||
var front_result = space_state.intersect_ray(p0 + Vector3(0, 0.5, 0), p1 + Vector3(0, 0.5, 0), [], 0x1)
|
||||
if !front_result.has("collider"):
|
||||
astar.connect_points(id1, id2)
|
||||
print("astar complete")
|
||||
spawn_characters()
|
||||
print("characters spawned")
|
||||
$blackboard.set("metaai", self)
|
||||
state = states.STATE_EXECUTE
|
||||
states.STATE_EXECUTE:
|
||||
if randf() > 0.7:
|
||||
calc_visible_lists()
|
||||
@@ -227,7 +221,7 @@ func _physics_process(delta):
|
||||
for r in npc_raycasts:
|
||||
if r.has("radius"):
|
||||
var shape : = SphereShape.new()
|
||||
shape.radius
|
||||
shape.radius = r.radius
|
||||
var query = PhysicsShapeQueryParameters.new()
|
||||
query.set_shape(query)
|
||||
query.collision_mask = r.mask
|
||||
|
||||
35
proto3/godot/ui/quest_indicator.gd
Normal file
35
proto3/godot/ui/quest_indicator.gd
Normal file
@@ -0,0 +1,35 @@
|
||||
extends Node2D
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
var target: = Vector3()
|
||||
var rect: = Rect2()
|
||||
func _ready():
|
||||
pass
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
var pos = get_viewport().get_camera().unproject_position(target)
|
||||
rect = get_viewport_rect()
|
||||
rect = rect.grow(-8.0)
|
||||
if get_viewport().get_camera().is_position_behind(target):
|
||||
if visible:
|
||||
hide()
|
||||
else:
|
||||
if rect.has_point(pos):
|
||||
if !visible:
|
||||
show()
|
||||
else:
|
||||
pos.x = clamp(pos.x, rect.position.x, rect.position.x + rect.size.x)
|
||||
pos.y = clamp(pos.y, rect.position.y, rect.position.y + rect.size.y)
|
||||
if position.distance_squared_to(pos) < 480.0:
|
||||
position = position.linear_interpolate(pos, delta)
|
||||
else:
|
||||
position = pos
|
||||
|
||||
10
proto3/godot/ui/quest_indicator.tscn
Normal file
10
proto3/godot/ui/quest_indicator.tscn
Normal file
@@ -0,0 +1,10 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://ui/textures/minimapIcon_exclamationRed.png" type="Texture" id=1]
|
||||
[ext_resource path="res://ui/quest_indicator.gd" type="Script" id=2]
|
||||
|
||||
[node name="quest_indicator" type="Node2D"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
texture = ExtResource( 1 )
|
||||
Reference in New Issue
Block a user