Some fixes

Disabled feet IK, proper handling of exit room
Added quest system from proto2
This commit is contained in:
Segey Lapin
2020-04-14 16:48:35 +03:00
parent 88e8359f64
commit 7706ba0edf
9 changed files with 528 additions and 213 deletions

View File

@@ -1,430 +1,430 @@
[gd_resource type="AnimationNodeBlendTree" load_steps=98 format=2] [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" 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" 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_count = 2
input_0/name = "free" input_0/name = "free"
input_0/auto_advance = false input_0/auto_advance = false
input_1/name = "grabbed" input_1/name = "grabbed"
input_1/auto_advance = false input_1/auto_advance = false
[sub_resource type="AnimationNodeBlend2" id=103] [sub_resource type="AnimationNodeBlend2" id=6]
filter_enabled = true 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" ] 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" 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" animation = "hang-grab_b-loop"
[sub_resource type="AnimationNodeAnimation" id=110] [sub_resource type="AnimationNodeAnimation" id=13]
animation = "hang-grab_attack_b" 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" animation = "kneeling-loop"
[sub_resource type="AnimationNodeTimeScale" id=94] [sub_resource type="AnimationNodeTimeScale" id=19]
[sub_resource type="AnimationNodeBlendTree" id=95] [sub_resource type="AnimationNodeBlendTree" id=20]
nodes/kneel_animation/node = SubResource( 93 ) nodes/kneel_animation/node = SubResource( 18 )
nodes/kneel_animation/position = Vector2( 180, 120 ) 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/kneel_speed/position = Vector2( 500, 120 )
nodes/output/position = Vector2( 740, 120 ) nodes/output/position = Vector2( 740, 120 )
node_connections = [ "output", 0, "kneel_speed", "kneel_speed", 0, "kneel_animation" ] 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" animation = "stand-to-walk"
[sub_resource type="AnimationNodeAnimation" id=19] [sub_resource type="AnimationNodeAnimation" id=22]
animation = "stand" 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=23]
[sub_resource type="AnimationNodeTimeScale" id=24] [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" animation = "walk-loop"
[sub_resource type="AnimationNodeAnimation" id=26] [sub_resource type="AnimationNodeAnimation" id=29]
animation = "walk2-loop" animation = "walk2-loop"
[sub_resource type="AnimationNodeBlendSpace1D" id=27] [sub_resource type="AnimationNodeBlendSpace1D" id=30]
blend_point_0/node = SubResource( 25 ) blend_point_0/node = SubResource( 28 )
blend_point_0/pos = 0.0 blend_point_0/pos = 0.0
blend_point_1/node = SubResource( 26 ) blend_point_1/node = SubResource( 29 )
blend_point_1/pos = 1.0 blend_point_1/pos = 1.0
[sub_resource type="AnimationNodeBlendTree" id=28] [sub_resource type="AnimationNodeBlendTree" id=31]
graph_offset = Vector2( 0, 133.5 ) graph_offset = Vector2( 0, 133.5 )
nodes/output/position = Vector2( 1000, 140 ) nodes/output/position = Vector2( 1000, 140 )
nodes/speed/node = SubResource( 23 ) nodes/speed/node = SubResource( 26 )
nodes/speed/position = Vector2( 760, 140 ) 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/walk_speed/position = Vector2( 480, 140 )
nodes/walking/node = SubResource( 27 ) nodes/walking/node = SubResource( 30 )
nodes/walking/position = Vector2( 120, 260 ) nodes/walking/position = Vector2( 120, 260 )
node_connections = [ "speed", 0, "walk_speed", "output", 0, "speed", "walk_speed", 0, "walking" ] 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" animation = "wash-floor-loop"
[sub_resource type="AnimationNodeBlendTree" id=31] [sub_resource type="AnimationNodeBlendTree" id=34]
graph_offset = Vector2( 0, -251 ) graph_offset = Vector2( 0, -251 )
nodes/TimeScale/node = SubResource( 29 ) nodes/TimeScale/node = SubResource( 32 )
nodes/TimeScale/position = Vector2( 460, 160 ) nodes/TimeScale/position = Vector2( 460, 160 )
nodes/output/position = Vector2( 700, 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 ) nodes/wash_floor_animation/position = Vector2( 140, 160 )
node_connections = [ "output", 0, "TimeScale", "TimeScale", 0, "wash_floor_animation" ] 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=35]
[sub_resource type="AnimationNodeStateMachineTransition" id=36] [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] [sub_resource type="AnimationNodeStateMachineTransition" id=39]
states/kneel/node = SubResource( 95 )
[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/kneel/position = Vector2( 459, 358 )
states/stand/node = SubResource( 22 ) states/stand/node = SubResource( 25 )
states/stand/position = Vector2( 222, 87 ) 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/stand-to-walk/position = Vector2( 605, 71 )
states/walk/node = SubResource( 28 ) states/walk/node = SubResource( 31 )
states/walk/position = Vector2( 647, 210 ) 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 ) 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" start_node = "stand"
[sub_resource type="AnimationNodeAnimation" id=115] [sub_resource type="AnimationNodeAnimation" id=43]
animation = "bed_torture_beating_b-loop" animation = "bed_torture_beating_b-loop"
[sub_resource type="AnimationNodeTimeScale" id=116] [sub_resource type="AnimationNodeTimeScale" id=44]
[sub_resource type="AnimationNodeBlendTree" id=117] [sub_resource type="AnimationNodeBlendTree" id=45]
nodes/Animation/node = SubResource( 115 ) nodes/Animation/node = SubResource( 43 )
nodes/Animation/position = Vector2( 97, 97 ) 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/beating_speed/position = Vector2( 420, 100 )
nodes/output/position = Vector2( 700, 120 ) nodes/output/position = Vector2( 700, 120 )
node_connections = [ "output", 0, "beating_speed", "beating_speed", 0, "Animation" ] 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" 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 ) graph_offset = Vector2( 0, -251 )
nodes/Animation/node = SubResource( 118 ) nodes/Animation/node = SubResource( 46 )
nodes/Animation/position = Vector2( 80, 100 ) 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/beating_m_speed/position = Vector2( 560, 100 )
nodes/output/position = Vector2( 960, 140 ) nodes/output/position = Vector2( 960, 140 )
node_connections = [ "output", 0, "beating_m_speed", "beating_m_speed", 0, "Animation" ] 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" 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] [sub_resource type="AnimationNodeBlendTree" id=51]
nodes/Animation/node = SubResource( 121 ) nodes/Animation/node = SubResource( 49 )
nodes/Animation/position = Vector2( 60, 80 ) nodes/Animation/position = Vector2( 60, 80 )
nodes/TimeScale/node = SubResource( 122 ) nodes/TimeScale/node = SubResource( 50 )
nodes/TimeScale/position = Vector2( 480, 80 ) nodes/TimeScale/position = Vector2( 480, 80 )
nodes/output/position = Vector2( 720, 80 ) nodes/output/position = Vector2( 720, 80 )
node_connections = [ "output", 0, "TimeScale", "TimeScale", 0, "Animation" ] 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" animation = "bed_torture_start_b"
[sub_resource type="AnimationNodeTimeScale" id=125] [sub_resource type="AnimationNodeTimeScale" id=53]
[sub_resource type="AnimationNodeBlendTree" id=126] [sub_resource type="AnimationNodeBlendTree" id=54]
nodes/Animation/node = SubResource( 124 ) nodes/Animation/node = SubResource( 52 )
nodes/Animation/position = Vector2( 80, 80 ) 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/bed_start_speed/position = Vector2( 380, 80 )
nodes/output/position = Vector2( 620, 80 ) nodes/output/position = Vector2( 620, 80 )
node_connections = [ "output", 0, "bed_start_speed", "bed_start_speed", 0, "Animation" ] 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" 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 ) graph_offset = Vector2( 0, 15.75 )
nodes/Animation/node = SubResource( 127 ) nodes/Animation/node = SubResource( 55 )
nodes/Animation/position = Vector2( 69, 94 ) 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/bed_start_m_speed/position = Vector2( 360, 80 )
nodes/output/position = Vector2( 660, 80 ) nodes/output/position = Vector2( 660, 80 )
node_connections = [ "output", 0, "bed_start_m_speed", "bed_start_m_speed", 0, "Animation" ] 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" 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 ) 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_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/forcing_speed/position = Vector2( 460, 100 )
nodes/output/position = Vector2( 740, 100 ) nodes/output/position = Vector2( 740, 100 )
node_connections = [ "output", 0, "forcing_speed", "forcing_speed", 0, "forcing_animation" ] 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" animation = "bed_torture_forcing_a"
[sub_resource type="AnimationNodeTimeScale" id=134] [sub_resource type="AnimationNodeTimeScale" id=62]
[sub_resource type="AnimationNodeBlendTree" id=135] [sub_resource type="AnimationNodeBlendTree" id=63]
nodes/forcing_m_animation/node = SubResource( 133 ) nodes/forcing_m_animation/node = SubResource( 61 )
nodes/forcing_m_animation/position = Vector2( 102, 110 ) 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/forcing_m_speed/position = Vector2( 442, 120 )
nodes/output/position = Vector2( 740, 120 ) nodes/output/position = Vector2( 740, 120 )
node_connections = [ "output", 0, "forcing_m_speed", "forcing_m_speed", 0, "forcing_m_animation" ] 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" 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] [sub_resource type="AnimationNodeBlendTree" id=66]
nodes/forcing_s1_animation/node = SubResource( 136 ) nodes/forcing_s1_animation/node = SubResource( 64 )
nodes/forcing_s1_animation/position = Vector2( 160, 140 ) 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/forcing_s1_speed/position = Vector2( 640, 160 )
nodes/output/position = Vector2( 920, 160 ) nodes/output/position = Vector2( 920, 160 )
node_connections = [ "output", 0, "forcing_s1_speed", "forcing_s1_speed", 0, "forcing_s1_animation" ] 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" 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] [sub_resource type="AnimationNodeBlendTree" id=69]
nodes/forcing_s1_animation/node = SubResource( 139 ) nodes/forcing_s1_animation/node = SubResource( 67 )
nodes/forcing_s1_animation/position = Vector2( 300, 260 ) 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/forcing_s1_speed/position = Vector2( 680, 260 )
nodes/output/position = Vector2( 980, 280 ) nodes/output/position = Vector2( 980, 280 )
node_connections = [ "output", 0, "forcing_s1_speed", "forcing_s1_speed", 0, "forcing_s1_animation" ] 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] [sub_resource type="AnimationNodeStateMachine" id=78]
states/beating/node = SubResource( 117 ) states/beating/node = SubResource( 45 )
states/beating/position = Vector2( 421, 244 ) 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/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_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/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/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/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_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/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 ) 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" start_node = "bed_facing_up"
[sub_resource type="AnimationNodeStateMachine" id=151] [sub_resource type="AnimationNodeStateMachine" id=79]
states/bed/node = SubResource( 150 ) states/bed/node = SubResource( 78 )
states/bed/position = Vector2( 251, 82 ) states/bed/position = Vector2( 251, 82 )
start_node = "bed" 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] [sub_resource type="AnimationNodeStateMachine" id=82]
states/Motion/node = SubResource( 37 ) states/Motion/node = SubResource( 42 )
states/Motion/position = Vector2( 188, 65 ) states/Motion/position = Vector2( 188, 65 )
states/SmartObject/node = SubResource( 151 ) states/SmartObject/node = SubResource( 79 )
states/SmartObject/position = Vector2( 250, 140 ) 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" 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" 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" 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" 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" 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" animation = "unstuck2"
[sub_resource type="AnimationNodeTimeScale" id=169] [sub_resource type="AnimationNodeTimeScale" id=97]
[resource] [resource]
graph_offset = Vector2( -227.051, -544.846 ) graph_offset = Vector2( -227.051, -544.846 )
nodes/Animation/node = SubResource( 98 ) nodes/Animation/node = SubResource( 1 )
nodes/Animation/position = Vector2( 120, -200 ) 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/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_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/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/free_grabbed/position = Vector2( 3500, -260 )
nodes/grab/node = SubResource( 103 ) nodes/grab/node = SubResource( 6 )
nodes/grab/position = Vector2( 2640, -380 ) 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/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_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_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_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/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_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_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_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_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_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/grabbed_seek/position = Vector2( 2540, 40 )
nodes/main/node = SubResource( 154 ) nodes/main/node = SubResource( 82 )
nodes/main/position = Vector2( 280, -360 ) nodes/main/position = Vector2( 280, -360 )
nodes/output/position = Vector2( 3740, -260 ) nodes/output/position = Vector2( 3740, -260 )
nodes/throw/node = SubResource( 155 ) nodes/throw/node = SubResource( 83 )
nodes/throw/position = Vector2( 3000, -280 ) 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_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/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/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_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_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/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_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/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/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_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/unstuck1_speed/position = Vector2( 1380, -160 )
nodes/unstuck2/node = SubResource( 167 ) nodes/unstuck2/node = SubResource( 95 )
nodes/unstuck2/position = Vector2( 1920, -380 ) 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_animation/position = Vector2( 1460, -20 )
nodes/unstuck2_speed/node = SubResource( 169 ) nodes/unstuck2_speed/node = SubResource( 97 )
nodes/unstuck2_speed/position = Vector2( 1700, -160 ) 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" ]

View File

@@ -19,6 +19,8 @@ func _ready():
orientation.origin = Vector3() orientation.origin = Vector3()
add_to_group("characters") add_to_group("characters")
do_ungrab() do_ungrab()
# feet_ik_init()
func _physics_process(delta): func _physics_process(delta):
# motion = motion.linear_interpolate(motion_target, MOTION_INTERPOLATE_SPEED * delta) # motion = motion.linear_interpolate(motion_target, MOTION_INTERPOLATE_SPEED * delta)
@@ -46,6 +48,7 @@ func _physics_process(delta):
if attacking >= 0.0: if attacking >= 0.0:
attacking -= delta attacking -= delta
rpg.update_stats(self) rpg.update_stats(self)
# feet_ik()
var skel var skel
func get_skeleton(): func get_skeleton():
if skel: if skel:
@@ -95,6 +98,89 @@ static func calc_offset(c2, bone2):
# print("offset: ", offset) # print("offset: ", offset)
return 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 = { var act = {
"stop":[ "stop":[
["travel", p1, "Motion"], ["travel", p1, "Motion"],

View File

@@ -92,32 +92,48 @@ func build_rooms():
window_rooms.push_back(left) window_rooms.push_back(left)
window_rooms.push_back(right) window_rooms.push_back(right)
print("rooms build complete") print("rooms build complete")
func build_special_rooms(): var special_rooms = {
print("build_special_rooms") "exit_room": {
var special_rooms = [] "alloc": size_x * size_y
var p_id = window_rooms[randi() % window_rooms.size()] },
special_rooms.push_back(p_id) "master_room": {
# var e_id = -1 "alloc": floors * size_x * size_y
# while true: },
# e_id = window_rooms[randi() % (size_x * size_] "jail_room": {
# if !e_id in special_rooms: "alloc": floors * size_x * size_y,
# break },
# special_rooms.push_back(e_id) "kitchen_room": {
while special_rooms.size() < 3: "alloc": size_x * size_y
var r_id = randi() % dungeon.size() }
if !r_id in special_rooms: }
special_rooms.push_back(r_id) func alloc_special_rooms():
var j_id = special_rooms[1] var allocated = []
var k_id = special_rooms[2] for k in special_rooms.keys():
if special_rooms[k].has("id"):
dungeon[p_id].set_meta("master_room", true) allocated.push_back(special_rooms[k].id)
dungeon[j_id].set_meta("jail_room", true) for k in special_rooms.keys():
dungeon[k_id].set_meta("kitchen_room", true) if special_rooms[k].has("id"):
# dungeon[e_id].set_meta("exit_room", true) 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() var player_spawn = Spatial.new()
dungeon[p_id].add_child(player_spawn) dungeon[room_id].add_child(player_spawn)
player_spawn.name = "player-spawn" player_spawn.name = "player-spawn"
player_spawn.add_to_group("spawn") player_spawn.add_to_group("spawn")
if k == "exit_room":
print("exit room: ", room_id)
func build_special_rooms():
print("build_special_rooms")
alloc_special_rooms()
var state = 0 var state = 0
func _ready(): func _ready():

View File

@@ -229,6 +229,10 @@ func create_rooms():
master_room() master_room()
elif has_meta("kitchen_room"): elif has_meta("kitchen_room"):
master_room() master_room()
elif has_meta("exit_room"):
for e in get_children():
if e.is_in_group("furniture"):
e.queue_free()
elif has_meta("stairs"): elif has_meta("stairs"):
master_room() master_room()
var stairs_i = stairs.instance() var stairs_i = stairs.instance()

View File

@@ -1,5 +1,18 @@
[gd_scene load_steps=2 format=2] [gd_scene load_steps=3 format=2]
[ext_resource path="res://scenes/maps/stairs.escn" type="PackedScene" id=1] [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 )
[node name="stairs" instance=ExtResource( 1 )] [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 )

View File

@@ -0,0 +1,92 @@
extends Reference
class_name Quest
signal complete
signal failed
signal started
var _objectives = []
var _children = []
var _title: String
var _description: String
var _active: bool = false
var _complete: bool = false
var _next_quest: Quest
func _init(title: String, description: String):
_title = title
_description = description
func add_child(quest: Quest):
_children.push_back(quest)
func is_complete():
return _complete
func is_active():
return _active
func update():
if !_active:
return
# var m = get_meta("quest")
# if m != null:
# for k in _objectives:
# k.set_meta("quest", m)
for k in _objectives:
k.update()
for k in _children:
k.update()
_complete = true
for k in _objectives:
if !k.is_complete():
_complete = false
break
if !_complete:
print("quest: ", _title, " objectives incomplete")
return
for k in _children:
if !k.is_complete():
_complete = false
break
if !_complete:
print("quest: ", _title, " children incomplete")
if _complete:
emit_signal("complete", self)
_active = false
quest_complete()
func quest_complete_handler(quest: Quest):
var next = quest.get_next_quest()
if next != null:
add_child(next)
next.connect("complete", self, "quest_complete_handler")
next.start()
func start():
_active = true
for k in _children:
k.connect("complete", self, "quest_complete_handler")
k.start()
emit_signal("started", self)
print("children: ", _children)
print("quest: ", _title, " started")
func get_cur_task_text():
var ret: String = "No current task"
if _active:
for p in _children:
if p.is_active():
ret = p.get_cur_task_text()
return ret
for p in _objectives:
if !p.is_complete():
return get_title() + ": " + p.get_title()
return _title
return ret
func get_title():
return _title
func get_description():
return _description
func quest_complete():
print("quest: ", _title, " complete")
func add_objective(obj: QuestObjective):
if !obj in _objectives:
_objectives.push_back(obj)
func remove_objective(obj: QuestObjective):
if obj in _objectives:
_objectives.erase(obj)
func set_next_quest(obj: Quest):
_next_quest = obj
func get_next_quest() -> Quest:
return _next_quest

View File

@@ -0,0 +1,14 @@
extends Reference
class_name QuestObjective
var _complete: bool = false
var _title: String
func _init(title: String):
_title = title
func is_complete():
return _complete
func update():
pass
func get_title():
return _title

View File

@@ -0,0 +1,29 @@
extends Quest
class_name StatsQuest
var stat_check: Dictionary
class StatsCheckObjective extends QuestObjective:
var stat_check: Dictionary
func _init(title, stats: Dictionary).(title):
stat_check = stats
func update():
_complete = true
for k in stat_check.keys():
match(k):
"player_count":
if world.team.keys().size() < stat_check[k]:
_complete = false
print("player count: ", world.team.keys().size(), " < ", stat_check[k])
"cheerleader_count":
if world.cheer_team.keys().size() < stat_check[k]:
_complete = false
"team_train_count":
if world.team_train_count < stat_check[k]:
_complete = false
_:
_complete = false
func _init(title, desc, stats: Dictionary).(title, desc):
stat_check = stats
add_objective(StatsCheckObjective.new("Comply to team stats", stat_check))

View File

@@ -0,0 +1,61 @@
extends Quest
class_name WalkQuest
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
var destination: Spatial
var quest_marker: Spatial
class WalkQuestObjective extends QuestObjective:
var dest: Spatial
var arrow: Spatial
var nav: Navigation
func _init(title, destination: Spatial).(title):
dest = destination
arrow = world.arrow
nav = world.arrow.get_node("/root/main/nav")
func update():
var org = world.master_node.global_transform.origin
var orgc = nav.get_closest_point(org)
var dst = dest.global_transform.origin
var dstc = nav.get_closest_point(dst)
var path = nav.get_simple_path(orgc, dstc)
var arrow_dir : = Vector3()
if path.size() > 1:
for e in path:
if (e - org).length() > 1.0:
arrow_dir = e - org
break
if arrow_dir.length() == 0 && arrow.visible:
arrow.hide()
elif arrow_dir.length() > 0:
if !arrow.visible:
arrow.show()
arrow_dir.y = 0
arrow.look_at(arrow.global_transform.origin + arrow_dir, Vector3.UP)
if org.distance_to(dest.global_transform.origin) < 2.5:
_complete = true
arrow.hide()
func _init(title, desc, dest).(title, desc):
destination = dest
add_objective(WalkQuestObjective.new("Walk to destination", dest))
func update():
.update()
func start():
.start()
quest_marker = load("res://markers/quest_marker.tscn").instance()
world.master_node.get_node("/root/main").add_child(quest_marker)
quest_marker.global_transform.origin = destination.global_transform.origin
print("destination: ", quest_marker.global_transform.origin)
if world.arrow:
world.arrow.show()
func quest_complete():
.quest_complete()
quest_marker.queue_free()
if world.arrow:
world.arrow.hide()