forked from funnymemellama/funnymemellama
Initial door prototype
This commit is contained in:
parent
df31613d57
commit
034f2ab68f
5 changed files with 113 additions and 3 deletions
58
Door.gd
Normal file
58
Door.gd
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
extends AnimatableBody3D
|
||||||
|
|
||||||
|
|
||||||
|
@export_category('Door')
|
||||||
|
@export
|
||||||
|
var interactable: bool = true
|
||||||
|
@export
|
||||||
|
var autoclose_time: float = 0.0
|
||||||
|
|
||||||
|
|
||||||
|
@onready
|
||||||
|
var _door = $CollisionShape3D
|
||||||
|
@onready
|
||||||
|
var _anim = $AnimationPlayer
|
||||||
|
@onready
|
||||||
|
var _timer = $Timer
|
||||||
|
|
||||||
|
var _open = false
|
||||||
|
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
_anim.animation_finished.connect(_on_anim_finished)
|
||||||
|
_timer.timeout.connect(_on_close_timer)
|
||||||
|
|
||||||
|
|
||||||
|
func _do_open():
|
||||||
|
# Dont allow closing if the timer is running
|
||||||
|
if not _timer.is_stopped():
|
||||||
|
return
|
||||||
|
|
||||||
|
if not _open:
|
||||||
|
_anim.play('open')
|
||||||
|
if autoclose_time != 0.0:
|
||||||
|
_timer.start(autoclose_time)
|
||||||
|
print('start ', autoclose_time)
|
||||||
|
else:
|
||||||
|
_anim.play_backwards('open')
|
||||||
|
|
||||||
|
|
||||||
|
func _on_anim_finished(anim_name):
|
||||||
|
_open = !_open
|
||||||
|
|
||||||
|
|
||||||
|
func _on_close_timer():
|
||||||
|
print('timer')
|
||||||
|
if _open:
|
||||||
|
_do_open()
|
||||||
|
|
||||||
|
|
||||||
|
func open():
|
||||||
|
_do_open()
|
||||||
|
|
||||||
|
|
||||||
|
func interact(other):
|
||||||
|
if not interactable:
|
||||||
|
return
|
||||||
|
|
||||||
|
_do_open()
|
46
Door.tscn
Normal file
46
Door.tscn
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
[gd_scene load_steps=6 format=3 uid="uid://cjn7bvtws2uip"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Door.gd" id="1_5n8dw"]
|
||||||
|
|
||||||
|
[sub_resource type="BoxShape3D" id="BoxShape3D_7fob4"]
|
||||||
|
size = Vector3(1.92, 3.84, 0.1)
|
||||||
|
|
||||||
|
[sub_resource type="BoxMesh" id="BoxMesh_n4ovh"]
|
||||||
|
size = Vector3(1.92, 3.84, 0.1)
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_0hgwy"]
|
||||||
|
resource_name = "open"
|
||||||
|
tracks/0/type = "bezier"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("CollisionShape3D:position:x")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"handle_modes": PackedInt32Array(0, 0),
|
||||||
|
"points": PackedFloat32Array(0, -0.25, 0, 0.5, 0, 1.76, -0.5, 0, 0.25, 0),
|
||||||
|
"times": PackedFloat32Array(0, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ol8av"]
|
||||||
|
_data = {
|
||||||
|
"open": SubResource("Animation_0hgwy")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Door" type="AnimatableBody3D"]
|
||||||
|
script = ExtResource("1_5n8dw")
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.92, 0)
|
||||||
|
shape = SubResource("BoxShape3D_7fob4")
|
||||||
|
|
||||||
|
[node name="CSGMesh3D" type="CSGMesh3D" parent="CollisionShape3D"]
|
||||||
|
mesh = SubResource("BoxMesh_n4ovh")
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
|
libraries = {
|
||||||
|
"": SubResource("AnimationLibrary_ol8av")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Timer" type="Timer" parent="."]
|
||||||
|
one_shot = true
|
2
assets
2
assets
|
@ -1 +1 @@
|
||||||
Subproject commit e986619d8be0a12c1dc3616b87080f9cc9d9778b
|
Subproject commit c82fba33a3fb4ad42210a56d670bc2271c171e98
|
|
@ -24,6 +24,7 @@ texture = ExtResource("3_qtx1j")
|
||||||
texture_type = 2
|
texture_type = 2
|
||||||
|
|
||||||
[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_npjyt"]
|
[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_npjyt"]
|
||||||
|
output_port_for_preview = 0
|
||||||
operator = 2
|
operator = 2
|
||||||
|
|
||||||
[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_g351s"]
|
[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_g351s"]
|
||||||
|
@ -117,5 +118,5 @@ nodes/fragment/8/position = Vector2(200, 120)
|
||||||
nodes/fragment/9/node = SubResource("VisualShaderNodeVectorOp_mvcqe")
|
nodes/fragment/9/node = SubResource("VisualShaderNodeVectorOp_mvcqe")
|
||||||
nodes/fragment/9/position = Vector2(480, 460)
|
nodes/fragment/9/position = Vector2(480, 460)
|
||||||
nodes/fragment/10/node = SubResource("VisualShaderNodeVectorOp_xrdx0")
|
nodes/fragment/10/node = SubResource("VisualShaderNodeVectorOp_xrdx0")
|
||||||
nodes/fragment/10/position = Vector2(520, 640)
|
nodes/fragment/10/position = Vector2(520, 660)
|
||||||
nodes/fragment/connections = PackedInt32Array(2, 4, 5, 0, 3, 0, 5, 1, 4, 0, 6, 1, 2, 4, 6, 0, 5, 0, 7, 2, 8, 0, 7, 0, 2, 4, 0, 1, 7, 0, 0, 0, 6, 0, 0, 9, 9, 0, 7, 1, 4, 1, 9, 1, 10, 0, 9, 0, 2, 0, 10, 0)
|
nodes/fragment/connections = PackedInt32Array(2, 4, 5, 0, 3, 0, 5, 1, 4, 0, 6, 1, 2, 4, 6, 0, 5, 0, 7, 2, 8, 0, 7, 0, 2, 4, 0, 1, 7, 0, 0, 0, 6, 0, 0, 9, 9, 0, 7, 1, 4, 1, 9, 1, 10, 0, 9, 0, 2, 0, 10, 0)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=10 format=3 uid="uid://bp1fooevcl4lk"]
|
[gd_scene load_steps=11 format=3 uid="uid://bp1fooevcl4lk"]
|
||||||
|
|
||||||
[ext_resource type="ArrayMesh" uid="uid://cfm21e1rmsbvt" path="res://assets/maps/devworld.obj" id="1_67d5q"]
|
[ext_resource type="ArrayMesh" uid="uid://cfm21e1rmsbvt" path="res://assets/maps/devworld.obj" id="1_67d5q"]
|
||||||
[ext_resource type="PackedScene" uid="uid://wl1n3y8mcq0x" path="res://Commentary.tscn" id="2_3gk04"]
|
[ext_resource type="PackedScene" uid="uid://wl1n3y8mcq0x" path="res://Commentary.tscn" id="2_3gk04"]
|
||||||
|
@ -6,6 +6,7 @@
|
||||||
[ext_resource type="AudioStream" uid="uid://7s6wb487kv2d" path="res://bomb-has-been-defused-csgo-sound-effect.mp3" id="3_sy6mw"]
|
[ext_resource type="AudioStream" uid="uid://7s6wb487kv2d" path="res://bomb-has-been-defused-csgo-sound-effect.mp3" id="3_sy6mw"]
|
||||||
[ext_resource type="PackedScene" uid="uid://ce7nfed54mwps" path="res://Button.tscn" id="5_57sxr"]
|
[ext_resource type="PackedScene" uid="uid://ce7nfed54mwps" path="res://Button.tscn" id="5_57sxr"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cp4rwojl3c3y3" path="res://test.tscn" id="6_8wwor"]
|
[ext_resource type="PackedScene" uid="uid://cp4rwojl3c3y3" path="res://test.tscn" id="6_8wwor"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cjn7bvtws2uip" path="res://Door.tscn" id="7_0wker"]
|
||||||
|
|
||||||
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_fwixm"]
|
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_fwixm"]
|
||||||
data = PackedVector3Array(-504, -64, 256, -504, -64, 128, -504, -192, 128, -504, -192, 256, -504, -64, 256, -504, -192, 128, -504, -64, 256, -512, -64, 256, -512, -64, 128, -504, -64, 128, -504, -64, 256, -512, -64, 128, -504, -64, 256, -504, -192, 256, -512, -192, 256, -512, -64, 256, -504, -64, 256, -512, -192, 256, -504, -64, 128, -512, -64, 128, -512, -192, 128, -504, -192, 128, -504, -64, 128, -512, -192, 128, -504, -192, 256, -504, -192, 128, -512, -192, 128, -512, -192, 256, -504, -192, 256, -512, -192, 128, -512, -64, 256, -512, -192, 256, -512, -192, 128, -512, -64, 128, -512, -64, 256, -512, -192, 128, -128, 64, 8, -128, 64, 0, -128, -320, 0, -128, -320, 8, -128, 64, 8, -128, -320, 0, -128, 64, 8, -512, 64, 8, -512, 64, 0, -128, 64, 0, -128, 64, 8, -512, 64, 0, -128, 64, 8, -128, -320, 8, -512, -320, 8, -512, 64, 8, -128, 64, 8, -512, -320, 8, -128, 64, 0, -512, 64, 0, -512, -320, 0, -128, -320, 0, -128, 64, 0, -512, -320, 0, -128, -320, 8, -128, -320, 0, -512, -320, 0, -512, -320, 8, -128, -320, 8, -512, -320, 0, -512, 64, 8, -512, -320, 8, -512, -320, 0, -512, 64, 0, -512, 64, 8, -512, -320, 0, -512, 64, 392, -512, 64, 8, -512, -320, 8, -512, -320, 392, -512, 64, 392, -512, -320, 8, -512, 64, 392, -520, 64, 392, -520, 64, 8, -512, 64, 8, -512, 64, 392, -520, 64, 8, -512, 64, 392, -512, -320, 392, -520, -320, 392, -520, 64, 392, -512, 64, 392, -520, -320, 392, -512, 64, 8, -520, 64, 8, -520, -320, 8, -512, -320, 8, -512, 64, 8, -520, -320, 8, -520, 64, 392, -520, -320, 392, -520, -320, 8, -520, 64, 8, -520, 64, 392, -520, -320, 8, -512, -320, 392, -512, -320, 8, -520, -320, 8, -520, -320, 392, -512, -320, 392, -520, -320, 8, 512, 1024, 416, 512, 1024, 96, 512, 1016, 96, 512, 1016, 416, 512, 1024, 416, 512, 1016, 96, 512, 1016, 96, 512, 1024, 96, 512, 1016, 0, 512, 1024, 96, 512, 1024, 0, 512, 1016, 0, -512, 1024, 96, 512, 1024, 96, 512, 1024, 416, 512, 1024, 96, 16, 1024, 96, 16, 1024, 0, 512, 1024, 96, 16, 1024, 0, 512, 1024, 0, -512, 1024, 96, 512, 1024, 416, -512, 1024, 416, -32, 1024, 96, -512, 1024, 96, -512, 1024, 0, -32, 1024, 96, -512, 1024, 0, -32, 1024, 0, 512, 1024, 96, 512, 1016, 96, 16, 1016, 96, 16, 1024, 96, 512, 1024, 96, 16, 1016, 96, 512, 1024, 0, 16, 1024, 0, 16, 1016, 0, 512, 1016, 0, 512, 1024, 0, 16, 1016, 0, 512, 1016, 416, 512, 1016, 96, -512, 1016, 96, 512, 1016, 96, 512, 1016, 0, 16, 1016, 0, 512, 1016, 96, 16, 1016, 0, 16, 1016, 96, 512, 1016, 416, -512, 1016, 96, -512, 1016, 416, -512, 1016, 0, -512, 1016, 96, -32, 1016, 96, -512, 1016, 0, -32, 1016, 96, -32, 1016, 0, 16, 1024, 96, 16, 1016, 96, 16, 1016, 0, 16, 1024, 0, 16, 1024, 96, 16, 1016, 0, -32, 1024, 96, -32, 1024, 0, -32, 1016, 0, -32, 1016, 96, -32, 1024, 96, -32, 1016, 0, 512, 1024, 416, 512, 1016, 416, -512, 1016, 416, -512, 1024, 416, 512, 1024, 416, -512, 1016, 416, -32, 1024, 96, -32, 1016, 96, -512, 1016, 96, -512, 1024, 96, -32, 1024, 96, -512, 1016, 96, 512, 1024, 96, -512, 1024, 96, -512, 1016, 96, 512, 1016, 96, 512, 1024, 96, -512, 1016, 96, -512, 1024, 416, -512, 1016, 416, -512, 1016, 96, -512, 1024, 96, -512, 1024, 416, -512, 1016, 96, -512, 1024, 96, -512, 1016, 96, -512, 1016, 0, -512, 1024, 0, -512, 1024, 96, -512, 1016, 0, -32, 1024, 0, -512, 1024, 0, -512, 1016, 0, -32, 1016, 0, -32, 1024, 0, -512, 1016, 0, 1024, 1024, 0, 1024, 1024, -64, 1024, -1024, -64, 1024, -1024, 0, 1024, 1024, 0, 1024, -1024, -64, 1024, 1024, 0, -1024, 1024, 0, -1024, 1024, -64, 1024, 1024, -64, 1024, 1024, 0, -1024, 1024, -64, 1024, 1024, 0, 1024, -1024, 0, -1024, -1024, 0, -1024, 1024, 0, 1024, 1024, 0, -1024, -1024, 0, 1024, 1024, -64, -1024, 1024, -64, -1024, -1024, -64, 1024, -1024, -64, 1024, 1024, -64, -1024, -1024, -64, 1024, -1024, 0, 1024, -1024, -64, -1024, -1024, -64, -1024, -1024, 0, 1024, -1024, 0, -1024, -1024, -64, -1024, 1024, 0, -1024, -1024, 0, -1024, -1024, -64, -1024, 1024, -64, -1024, 1024, 0, -1024, -1024, -64)
|
data = PackedVector3Array(-504, -64, 256, -504, -64, 128, -504, -192, 128, -504, -192, 256, -504, -64, 256, -504, -192, 128, -504, -64, 256, -512, -64, 256, -512, -64, 128, -504, -64, 128, -504, -64, 256, -512, -64, 128, -504, -64, 256, -504, -192, 256, -512, -192, 256, -512, -64, 256, -504, -64, 256, -512, -192, 256, -504, -64, 128, -512, -64, 128, -512, -192, 128, -504, -192, 128, -504, -64, 128, -512, -192, 128, -504, -192, 256, -504, -192, 128, -512, -192, 128, -512, -192, 256, -504, -192, 256, -512, -192, 128, -512, -64, 256, -512, -192, 256, -512, -192, 128, -512, -64, 128, -512, -64, 256, -512, -192, 128, -128, 64, 8, -128, 64, 0, -128, -320, 0, -128, -320, 8, -128, 64, 8, -128, -320, 0, -128, 64, 8, -512, 64, 8, -512, 64, 0, -128, 64, 0, -128, 64, 8, -512, 64, 0, -128, 64, 8, -128, -320, 8, -512, -320, 8, -512, 64, 8, -128, 64, 8, -512, -320, 8, -128, 64, 0, -512, 64, 0, -512, -320, 0, -128, -320, 0, -128, 64, 0, -512, -320, 0, -128, -320, 8, -128, -320, 0, -512, -320, 0, -512, -320, 8, -128, -320, 8, -512, -320, 0, -512, 64, 8, -512, -320, 8, -512, -320, 0, -512, 64, 0, -512, 64, 8, -512, -320, 0, -512, 64, 392, -512, 64, 8, -512, -320, 8, -512, -320, 392, -512, 64, 392, -512, -320, 8, -512, 64, 392, -520, 64, 392, -520, 64, 8, -512, 64, 8, -512, 64, 392, -520, 64, 8, -512, 64, 392, -512, -320, 392, -520, -320, 392, -520, 64, 392, -512, 64, 392, -520, -320, 392, -512, 64, 8, -520, 64, 8, -520, -320, 8, -512, -320, 8, -512, 64, 8, -520, -320, 8, -520, 64, 392, -520, -320, 392, -520, -320, 8, -520, 64, 8, -520, 64, 392, -520, -320, 8, -512, -320, 392, -512, -320, 8, -520, -320, 8, -520, -320, 392, -512, -320, 392, -520, -320, 8, 512, 1024, 416, 512, 1024, 96, 512, 1016, 96, 512, 1016, 416, 512, 1024, 416, 512, 1016, 96, 512, 1016, 96, 512, 1024, 96, 512, 1016, 0, 512, 1024, 96, 512, 1024, 0, 512, 1016, 0, -512, 1024, 96, 512, 1024, 96, 512, 1024, 416, 512, 1024, 96, 16, 1024, 96, 16, 1024, 0, 512, 1024, 96, 16, 1024, 0, 512, 1024, 0, -512, 1024, 96, 512, 1024, 416, -512, 1024, 416, -32, 1024, 96, -512, 1024, 96, -512, 1024, 0, -32, 1024, 96, -512, 1024, 0, -32, 1024, 0, 512, 1024, 96, 512, 1016, 96, 16, 1016, 96, 16, 1024, 96, 512, 1024, 96, 16, 1016, 96, 512, 1024, 0, 16, 1024, 0, 16, 1016, 0, 512, 1016, 0, 512, 1024, 0, 16, 1016, 0, 512, 1016, 416, 512, 1016, 96, -512, 1016, 96, 512, 1016, 96, 512, 1016, 0, 16, 1016, 0, 512, 1016, 96, 16, 1016, 0, 16, 1016, 96, 512, 1016, 416, -512, 1016, 96, -512, 1016, 416, -512, 1016, 0, -512, 1016, 96, -32, 1016, 96, -512, 1016, 0, -32, 1016, 96, -32, 1016, 0, 16, 1024, 96, 16, 1016, 96, 16, 1016, 0, 16, 1024, 0, 16, 1024, 96, 16, 1016, 0, -32, 1024, 96, -32, 1024, 0, -32, 1016, 0, -32, 1016, 96, -32, 1024, 96, -32, 1016, 0, 512, 1024, 416, 512, 1016, 416, -512, 1016, 416, -512, 1024, 416, 512, 1024, 416, -512, 1016, 416, -32, 1024, 96, -32, 1016, 96, -512, 1016, 96, -512, 1024, 96, -32, 1024, 96, -512, 1016, 96, 512, 1024, 96, -512, 1024, 96, -512, 1016, 96, 512, 1016, 96, 512, 1024, 96, -512, 1016, 96, -512, 1024, 416, -512, 1016, 416, -512, 1016, 96, -512, 1024, 96, -512, 1024, 416, -512, 1016, 96, -512, 1024, 96, -512, 1016, 96, -512, 1016, 0, -512, 1024, 0, -512, 1024, 96, -512, 1016, 0, -32, 1024, 0, -512, 1024, 0, -512, 1016, 0, -32, 1016, 0, -32, 1024, 0, -512, 1016, 0, 1024, 1024, 0, 1024, 1024, -64, 1024, -1024, -64, 1024, -1024, 0, 1024, 1024, 0, 1024, -1024, -64, 1024, 1024, 0, -1024, 1024, 0, -1024, 1024, -64, 1024, 1024, -64, 1024, 1024, 0, -1024, 1024, -64, 1024, 1024, 0, 1024, -1024, 0, -1024, -1024, 0, -1024, 1024, 0, 1024, 1024, 0, -1024, -1024, 0, 1024, 1024, -64, -1024, 1024, -64, -1024, -1024, -64, 1024, -1024, -64, 1024, 1024, -64, -1024, -1024, -64, 1024, -1024, 0, 1024, -1024, -64, -1024, -1024, -64, -1024, -1024, 0, 1024, -1024, 0, -1024, -1024, -64, -1024, 1024, 0, -1024, -1024, 0, -1024, -1024, -64, -1024, 1024, -64, -1024, 1024, 0, -1024, -1024, -64)
|
||||||
|
@ -55,3 +56,7 @@ light_color = Color(1, 0, 1, 1)
|
||||||
light_energy = 16.0
|
light_energy = 16.0
|
||||||
spot_range = 7.86984
|
spot_range = 7.86984
|
||||||
spot_angle = 35.8279
|
spot_angle = 35.8279
|
||||||
|
|
||||||
|
[node name="Door" parent="." instance=ExtResource("7_0wker")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.32, 0, -40.8083)
|
||||||
|
autoclose_time = 2.0
|
||||||
|
|
Loading…
Reference in a new issue