Triggerable movable walls

This commit is contained in:
Marco 2025-06-28 13:59:12 +02:00
commit 9d0036c436
20 changed files with 1292 additions and 693 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -475,7 +475,7 @@
}
// brush 52
{
( 312 336 16 ) ( 312 336 17 ) ( 312 335 16 ) Walls/Wall0 [ 0 1 0 0 ] [ 0 0 -1 0 ] 90 -1 1
( 328 336 16 ) ( 328 336 17 ) ( 328 335 16 ) Walls/Wall0 [ 0 1 0 0 ] [ 0 0 -1 0 ] 180 -1 1
( 328 328 16 ) ( 328 328 17 ) ( 329 328 16 ) Walls/Wall0 [ 1 0 0 8 ] [ 0 0 -1 0 ] 0 1 1
( 328 336 16 ) ( 328 335 16 ) ( 329 336 16 ) Walls/Wall0 [ 0 -1 0 0 ] [ -1 0 0 -24 ] 270 1 1
( 344 208 48 ) ( 345 208 48 ) ( 344 207 48 ) Manual/Black [ 0 -1 0 0 ] [ -1 0 0 -24 ] 270 1 1
@ -484,7 +484,7 @@
}
// brush 53
{
( 312 296 16 ) ( 312 296 17 ) ( 312 295 16 ) Walls/Wall0 [ 0 1 0 -8 ] [ 0 0 -1 0 ] 90 -1 1
( 328 296 16 ) ( 328 296 17 ) ( 328 295 16 ) Walls/Wall0 [ 0 1 0 -8 ] [ 0 0 -1 0 ] 180 -1 1
( 328 288 16 ) ( 328 288 17 ) ( 329 288 16 ) Walls/Wall0 [ 1 0 0 8 ] [ 0 0 -1 0 ] 0 1 1
( 328 296 16 ) ( 328 295 16 ) ( 329 296 16 ) Walls/Wall0 [ 0 -1 0 -8 ] [ -1 0 0 -24 ] 270 1 1
( 344 168 48 ) ( 345 168 48 ) ( 344 167 48 ) Manual/Black [ 0 -1 0 -8 ] [ -1 0 0 -24 ] 270 1 1
@ -511,7 +511,7 @@
}
// brush 56
{
( 320 136 16 ) ( 320 136 17 ) ( 320 135 16 ) Walls/Wall0 [ 0 1 0 -8 ] [ 0 0 -1 0 ] 90 -1 1
( 328 136 16 ) ( 328 136 17 ) ( 328 135 16 ) Walls/Wall0 [ 0 1 0 -8 ] [ 0 0 -1 0 ] 180 -1 1
( 328 128 16 ) ( 328 128 17 ) ( 329 128 16 ) Walls/Wall0 [ 1 0 0 -8 ] [ 0 0 -1 0 ] 0 1 1
( 328 136 16 ) ( 328 135 16 ) ( 329 136 16 ) Walls/Wall0 [ 0 -1 0 -8 ] [ -1 0 0 8 ] 270 1 1
( 344 8 48 ) ( 345 8 48 ) ( 344 7 48 ) Manual/Black [ 0 -1 0 -8 ] [ -1 0 0 8 ] 270 1 1
@ -520,7 +520,7 @@
}
// brush 57
{
( 320 176 16 ) ( 320 176 17 ) ( 320 175 16 ) Walls/Wall0 [ 0 1 0 0 ] [ 0 0 -1 0 ] 90 -1 1
( 328 176 16 ) ( 328 176 17 ) ( 328 175 16 ) Walls/Wall0 [ 0 1 0 0 ] [ 0 0 -1 0 ] 180 -1 1
( 328 168 16 ) ( 328 168 17 ) ( 329 168 16 ) Walls/Wall0 [ 1 0 0 8 ] [ 0 0 -1 0 ] 0 1 1
( 328 176 16 ) ( 328 175 16 ) ( 329 176 16 ) Walls/Wall0 [ 0 -1 0 0 ] [ -1 0 0 -24 ] 270 1 1
( 344 48 48 ) ( 345 48 48 ) ( 344 47 48 ) Manual/Black [ 0 -1 0 0 ] [ -1 0 0 -24 ] 270 1 1
@ -4054,15 +4054,15 @@
"_tb_name" "Wall_Panel_Blue"
"_tb_id" "39"
"_tb_linked_group_id" "{ad70deec-5095-4407-afc9-0f7b57c61fe5}"
"_tb_transformation" "-1.8369701987210297e-16 1 0 160.00000000000006 -1 -1.8369701987210297e-16 0 504.0000000000001 0 0 1 0 0 0 0 1"
"_tb_transformation" "-1.8369701987210297e-16 1 0 176.00000000000006 -1 -1.8369701987210297e-16 0 504.0000000000001 0 0 1 0 0 0 0 1"
// brush 0
{
( 312 504 32 ) ( 312 504 33 ) ( 312 503 32 ) Manual/Black [ -1.8369701987210297e-16 -1 0 0 ] [ 0 0 -1 0 ] 180 1 1
( 192 296 32 ) ( 191 296 32 ) ( 192 296 33 ) special/clip [ -1 1.8369701987210297e-16 0 0 ] [ 0 0 1 -16 ] 0 0.5 -1
( 320 520 16 ) ( 319 520 16 ) ( 320 519 16 ) special/clip [ -1 1.8369701987210297e-16 0 0 ] [ 1.8369701987210297e-16 1 0 -8 ] 0 1 1
( 192 504 48 ) ( 192 503 48 ) ( 191 504 48 ) Manual/Black [ -1 1.8369701987210297e-16 0 0 ] [ 1.8369701987210297e-16 1 0 0 ] 180 1 1
( 320 328 16 ) ( 320 328 17 ) ( 319 328 16 ) special/clip [ -1 1.8369701987210297e-16 0 0 ] [ 0 0 1 -16 ] 0 0.5 -1
( 320 520 16 ) ( 320 519 16 ) ( 320 520 17 ) Manual/Blue_Panel_Wall [ -1.8369701987210297e-16 -1 0 8 ] [ 0 0 -1 -16 ] 180 1 1
( 328 504 32 ) ( 328 504 33 ) ( 328 503 32 ) Manual/Black [ -1.8369701987210297e-16 -1 0 0 ] [ 0 0 -1 0 ] 0 1 1
( 208 296 32 ) ( 207 296 32 ) ( 208 296 33 ) special/clip [ -1 1.8369701987210297e-16 0 0 ] [ 0 0 1 -16 ] 180 0.5 -1
( 336 520 16 ) ( 335 520 16 ) ( 336 519 16 ) special/clip [ -1 1.8369701987210297e-16 0 16 ] [ 1.8369701987210297e-16 1 0 -8 ] 180 1 1
( 208 504 48 ) ( 208 503 48 ) ( 207 504 48 ) Manual/Black [ -1 1.8369701987210297e-16 0 0 ] [ 1.8369701987210297e-16 1 0 0 ] 0 1 1
( 336 328 16 ) ( 336 328 17 ) ( 335 328 16 ) special/clip [ -1 1.8369701987210297e-16 0 0 ] [ 0 0 1 -16 ] 180 0.5 -1
( 336 520 16 ) ( 336 519 16 ) ( 336 520 17 ) Manual/Blue_Panel_Wall [ -1.8369701987210297e-16 -1 0 8 ] [ 0 0 -1 -16 ] 0 1 1
}
}
// entity 223
@ -4072,15 +4072,15 @@
"_tb_name" "Wall_Panel_Blue"
"_tb_id" "40"
"_tb_linked_group_id" "{ad70deec-5095-4407-afc9-0f7b57c61fe5}"
"_tb_transformation" "-1.8369701987210297e-16 1 0 168.00000000000006 -1 -1.8369701987210297e-16 0 344.0000000000001 0 0 1 0 0 0 0 1"
"_tb_transformation" "-1.8369701987210297e-16 1 0 176.00000000000006 -1 -1.8369701987210297e-16 0 344.0000000000001 0 0 1 0 0 0 0 1"
// brush 0
{
( 320 344 32 ) ( 320 344 33 ) ( 320 343 32 ) Manual/Black [ -1.8369701987210297e-16 -1 0 0 ] [ 0 0 -1 0 ] 270 1 1
( 200 136 32 ) ( 199 136 32 ) ( 200 136 33 ) special/clip [ -1 1.8369701987210297e-16 0 16 ] [ 0 0 1 -16 ] 90 0.5 -1
( 328 360 16 ) ( 327 360 16 ) ( 328 359 16 ) special/clip [ -1 1.8369701987210297e-16 0 8 ] [ 1.8369701987210297e-16 1 0 -8 ] 270 1 1
( 200 344 48 ) ( 200 343 48 ) ( 199 344 48 ) Manual/Black [ -1 1.8369701987210297e-16 0 0 ] [ 1.8369701987210297e-16 1 0 0 ] 270 1 1
( 328 168 16 ) ( 328 168 17 ) ( 327 168 16 ) special/clip [ -1 1.8369701987210297e-16 0 16 ] [ 0 0 1 -16 ] 270 0.5 -1
( 328 360 16 ) ( 328 359 16 ) ( 328 360 17 ) Manual/Blue_Panel_Wall [ -1.8369701987210297e-16 -1 0 8 ] [ 0 0 -1 -16 ] 90 1 1
( 328 344 32 ) ( 328 344 33 ) ( 328 343 32 ) Manual/Black [ -1.8369701987210297e-16 -1 0 0 ] [ 0 0 -1 0 ] 180 1 1
( 208 136 32 ) ( 207 136 32 ) ( 208 136 33 ) special/clip [ -1 1.8369701987210297e-16 0 0 ] [ 0 0 1 -16 ] 0 0.5 -1
( 336 360 16 ) ( 335 360 16 ) ( 336 359 16 ) special/clip [ -1 1.8369701987210297e-16 0 16 ] [ 1.8369701987210297e-16 1 0 -8 ] 0 1 1
( 208 344 48 ) ( 208 343 48 ) ( 207 344 48 ) Manual/Black [ -1 1.8369701987210297e-16 0 0 ] [ 1.8369701987210297e-16 1 0 0 ] 180 1 1
( 336 168 16 ) ( 336 168 17 ) ( 335 168 16 ) special/clip [ -1 1.8369701987210297e-16 0 0 ] [ 0 0 1 -16 ] 0 0.5 -1
( 336 360 16 ) ( 336 359 16 ) ( 336 360 17 ) Manual/Blue_Panel_Wall [ -1.8369701987210297e-16 -1 0 8 ] [ 0 0 -1 -16 ] 180 1 1
}
}
// entity 224
@ -4270,6 +4270,52 @@
}
// entity 260
{
"classname" "trigger_alarm"
"origin" "344 256 56"
"target" "wall_trap_1"
"activationtype" "Open"
"activateonenable" "1"
}
// entity 261
{
"classname" "func_move"
"move_pos" "0.0 0.0 -66.0"
"targetname" "wall_trap_1"
"speed" "0.25"
// brush 0
{
( 344 296 16 ) ( 344 297 16 ) ( 344 296 17 ) Walls/Wall0 [ 0 -1 0 0 ] [ 0 0 -1 0 ] 0 1 1
( 344 296 16 ) ( 344 296 17 ) ( 345 296 16 ) Walls/Wall0 [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
( 344 296 16 ) ( 345 296 16 ) ( 344 297 16 ) Walls/Wall0 [ -1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
( 352 328 48 ) ( 352 329 48 ) ( 353 328 48 ) Walls/Wall0 [ 1 0 0 0 ] [ 0 -1 0 0 ] 270 1 1
( 352 328 24 ) ( 353 328 24 ) ( 352 328 25 ) Walls/Wall0 [ -1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
( 352 328 24 ) ( 352 328 25 ) ( 352 329 24 ) Walls/Wall0 [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
}
}
// entity 262
{
"classname" "actor_controlpad"
"origin" "420 396 20"
"target" "wall_trap_1"
}
// entity 263
{
"classname" "func_move"
"move_pos" "0.0 0.0 -66.0"
"targetname" "wall_trap_1"
"speed" "0.25"
// brush 0
{
( 344 136 16 ) ( 344 137 16 ) ( 344 136 17 ) Walls/Wall0 [ 0 -1 0 0 ] [ 0 0 -1 0 ] 90 1 1
( 344 136 16 ) ( 344 136 17 ) ( 345 136 16 ) Walls/Wall0 [ 1 0 0 0 ] [ 0 0 -1 0 ] 90 1 1
( 344 136 16 ) ( 345 136 16 ) ( 344 137 16 ) Walls/Wall0 [ -1 0 0 0 ] [ 0 -1 0 0 ] 90 1 1
( 352 168 48 ) ( 352 169 48 ) ( 353 168 48 ) Walls/Wall0 [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
( 352 168 24 ) ( 353 168 24 ) ( 352 168 25 ) Walls/Wall0 [ -1 0 0 0 ] [ 0 0 -1 0 ] 90 1 1
( 352 168 24 ) ( 352 168 25 ) ( 352 169 24 ) Walls/Wall0 [ 0 1 0 0 ] [ 0 0 -1 0 ] 90 1 1
}
}
// entity 264
{
"classname" "func_group"
"_tb_type" "_tb_layer"
"_tb_name" "Computer Room"
@ -4348,37 +4394,37 @@
( 104 -200 60 ) ( 104 -200 61 ) ( 104 -199 60 ) Manual/Blue_Panel_Wall [ 0 1 0 -16 ] [ 0 0 -1 24 ] 0 1 1
}
}
// entity 261
// entity 265
{
"classname" "actor_table"
"origin" "48 -164 60"
"_tb_layer" "37"
}
// entity 262
// entity 266
{
"classname" "actor_terminal_big"
"origin" "8 -140 68"
"_tb_layer" "37"
}
// entity 263
// entity 267
{
"classname" "actor_terminal_big"
"origin" "8 -164 68"
"_tb_layer" "37"
}
// entity 264
// entity 268
{
"classname" "actor_mainframe"
"origin" "8 -184 68"
"_tb_layer" "37"
}
// entity 265
// entity 269
{
"classname" "actor_mainframe"
"origin" "8 -200 68"
"_tb_layer" "37"
}
// entity 266
// entity 270
{
"classname" "actor_terminal"
"origin" "48 -168 68"

View file

@ -4,18 +4,19 @@
[ext_resource type="PackedScene" uid="uid://sy821kigcoqx" path="res://3D/BlockbenchModels/FloorEmitter/Floor_Emitter.gltf" id="3_ro7iq"]
[ext_resource type="Script" uid="uid://bf5f2phitdqw8" path="res://Scripts/Actors/BulletSpawner3D.cs" id="4_0cjnq"]
[sub_resource type="BoxShape3D" id="BoxShape3D_hsg1w"]
size = Vector3(0.763428, 0.469452, 0.77832)
[sub_resource type="CylinderShape3D" id="CylinderShape3D_ro7iq"]
height = 0.297607
radius = 0.277344
[node name="FloorEmitter" type="StaticBody3D"]
collision_layer = 16
collision_layer = 64
collision_mask = 0
script = ExtResource("1_dtfaj")
EmitOnStart = true
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00549316, 0.0253752, -0.000488281)
shape = SubResource("BoxShape3D_hsg1w")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00549316, 0.116073, -0.000488281)
shape = SubResource("CylinderShape3D_ro7iq")
[node name="blockbench_export" parent="." instance=ExtResource("3_ro7iq")]

View file

@ -0,0 +1,25 @@
[gd_scene load_steps=5 format=3 uid="uid://yath5bvxo3cn"]
[ext_resource type="Script" uid="uid://dpibtd73awwp7" path="res://Scripts/Actors/ScriptableBulletsEmitter3D.cs" id="1_3n1ol"]
[ext_resource type="PackedScene" uid="uid://lwpt32xplrjw" path="res://3D/BlockbenchModels/WallEmitter/Wall_Emitter.gltf" id="3_3n1ol"]
[ext_resource type="Script" uid="uid://bf5f2phitdqw8" path="res://Scripts/Actors/BulletSpawner3D.cs" id="3_g6b3n"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_ro7iq"]
height = 0.297607
radius = 0.277344
[node name="WallEmitter" type="StaticBody3D"]
collision_layer = 64
collision_mask = 0
script = ExtResource("1_3n1ol")
EmitOnStart = true
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00549316, 0.116073, -0.000488281)
shape = SubResource("CylinderShape3D_ro7iq")
[node name="BulletSpawner3D" type="Node3D" parent="."]
script = ExtResource("3_g6b3n")
[node name="blockbench_export" parent="." instance=ExtResource("3_3n1ol")]
transform = Transform3D(-1, 0, 8.74228e-08, 0, 1, 0, -8.74228e-08, 0, -1, 0, 0, 0)

View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://dtuxpu88vaini"]
[ext_resource type="Script" uid="uid://bwh3ft5pcmajd" path="res://Scripts/Actors/3D/AlarmTrigger3D.cs" id="1_guk3i"]
[node name="AlarmTrigger3d" type="Node3D"]
script = ExtResource("1_guk3i")

View file

@ -1,9 +1,10 @@
[gd_resource type="Resource" script_class="FuncGodotFGDModelPointClass" load_steps=5 format=3 uid="uid://ceio7tm5eopbb"]
[gd_resource type="Resource" script_class="FuncGodotFGDModelPointClass" load_steps=6 format=3 uid="uid://ceio7tm5eopbb"]
[ext_resource type="Resource" uid="uid://5bc1qysixhmh" path="res://3D/TrenchBroom/EntityDefinitions/base/actor_base.tres" id="1_5ms1a"]
[ext_resource type="PackedScene" uid="uid://du6hlcoq0iip4" path="res://3D/Scenes/Props/control_pad_3d.tscn" id="2_5ms1a"]
[ext_resource type="Resource" uid="uid://kerywjgft7vh" path="res://3D/TrenchBroom/EntityDefinitions/base/target_base.tres" id="2_65tcb"]
[ext_resource type="Script" uid="uid://dkmyelig23ub5" path="res://addons/func_godot/src/fgd/func_godot_fgd_model_point_class.gd" id="3_y02cg"]
[ext_resource type="Resource" uid="uid://bd4h6ha84s74b" path="res://3D/TrenchBroom/EntityDefinitions/base/activation_type_base.tres" id="3_ybdcc"]
[resource]
script = ExtResource("3_y02cg")
@ -19,13 +20,13 @@ apply_scale_on_map_build = false
classname = "actor_controlpad"
description = "Control Pad"
func_godot_internal = false
base_classes = Array[Resource]([ExtResource("1_5ms1a"), ExtResource("2_65tcb")])
base_classes = Array[Resource]([ExtResource("1_5ms1a"), ExtResource("2_65tcb"), ExtResource("3_ybdcc")])
class_properties = {}
class_property_descriptions = {}
auto_apply_to_matching_node_properties = false
meta_properties = {
"size": AABB(-4, -4, -4, 4, 4, 4),
"studio": "\"3D\\MapModels/actor_controlpad.glb\""
"studio": "\"3D/MapModels/actor_controlpad.glb\""
}
node_class = ""
name_property = ""

View file

@ -0,0 +1,33 @@
[gd_resource type="Resource" script_class="FuncGodotFGDPointClass" load_steps=6 format=3 uid="uid://fbovhni8adhg"]
[ext_resource type="Script" uid="uid://c83r7t467hm4m" path="res://addons/func_godot/src/fgd/func_godot_fgd_point_class.gd" id="1_28xij"]
[ext_resource type="Resource" uid="uid://5bc1qysixhmh" path="res://3D/TrenchBroom/EntityDefinitions/base/actor_base.tres" id="1_eykl4"]
[ext_resource type="Resource" uid="uid://kerywjgft7vh" path="res://3D/TrenchBroom/EntityDefinitions/base/target_base.tres" id="2_tniba"]
[ext_resource type="Resource" uid="uid://bd4h6ha84s74b" path="res://3D/TrenchBroom/EntityDefinitions/base/activation_type_base.tres" id="3_1p4gc"]
[ext_resource type="PackedScene" uid="uid://dtuxpu88vaini" path="res://3D/Scenes/Triggers/AlarmTrigger_3D.tscn" id="4_drrch"]
[resource]
script = ExtResource("1_28xij")
scene_file = ExtResource("4_drrch")
apply_rotation_on_map_build = false
apply_scale_on_map_build = false
classname = "trigger_alarm"
description = "Alarm trigger"
func_godot_internal = false
base_classes = Array[Resource]([ExtResource("1_eykl4"), ExtResource("2_tniba"), ExtResource("3_1p4gc")])
class_properties = {
"activateondisable": false,
"activateonenable": true
}
class_property_descriptions = {
"activateondisable": "Activates the trigger when the alarm is disabled",
"activateonenable": "Activate the trigger when the alarm is triggered"
}
auto_apply_to_matching_node_properties = false
meta_properties = {
"color": Color(0.6, 0.462745, 0.666667, 1),
"size": AABB(-8, -8, -8, 8, 8, 8)
}
node_class = ""
name_property = ""
metadata/_custom_type_script = "uid://c83r7t467hm4m"

View file

@ -0,0 +1,48 @@
[gd_resource type="Resource" script_class="FuncGodotFGDSolidClass" load_steps=5 format=3 uid="uid://jnnorlsenrwb"]
[ext_resource type="Script" uid="uid://msq50x6rk4po" path="res://addons/func_godot/src/fgd/func_godot_fgd_solid_class.gd" id="1_iat24"]
[ext_resource type="Resource" uid="uid://bfjnt8q3l2p65" path="res://3D/TrenchBroom/EntityDefinitions/base/func_base.tres" id="1_u74n5"]
[ext_resource type="Resource" uid="uid://c1utxplehq2jl" path="res://3D/TrenchBroom/EntityDefinitions/base/targetname_base.tres" id="2_hl13i"]
[ext_resource type="Script" uid="uid://c5nyynixjdc6k" path="res://3D/TrenchBroom/EntityScripts/Solid/FuncMove.cs" id="4_idgeg"]
[resource]
script = ExtResource("1_iat24")
spawn_type = 2
origin_type = 3
build_visuals = true
use_in_baked_light = true
shadow_casting_setting = 1
build_occlusion = false
render_layers = 1
collision_shape_type = 2
collision_layer = 1
collision_mask = 0
collision_priority = 1.0
collision_shape_margin = 0.04
add_textures_metadata = false
add_vertex_metadata = false
add_face_position_metadata = false
add_face_normal_metadata = false
add_collision_shape_face_range_metadata = false
script_class = ExtResource("4_idgeg")
classname = "func_move"
description = "Movable and rotatable geometry. Valid move functions are use, toggle, mv_forward, and mv_reverse."
func_godot_internal = false
base_classes = Array[Resource]([ExtResource("1_u74n5"), ExtResource("2_hl13i")])
class_properties = {
"move_pos": Vector3(0, 0, 0),
"move_rot": Vector3(0, 0, 0),
"speed": 3.0
}
class_property_descriptions = {
"move_pos": "Relative destination position in Quake Units. This will be converted into Godot Units in the FuncMove script.",
"move_rot": "Rotation destination in degrees.",
"speed": "Speed"
}
auto_apply_to_matching_node_properties = false
meta_properties = {
"color": Color(0, 0.965697, 0.199462, 1)
}
node_class = "AnimatableBody3D"
name_property = ""
metadata/_custom_type_script = "uid://msq50x6rk4po"

View file

@ -0,0 +1,157 @@
using System;
using Cirno.Scripts;
using Cirno.Scripts.Utils;
using Godot;
using Godot.Collections;
namespace Cirno._3D.TrenchBroom.EntityScripts.Solid;
[Tool]
public partial class FuncMove : AnimatableBody3D, IActivable
{
[Export] public string TargetName { get; private set; }
[Export] public Array<Vector3> MovePos { get; set; } = [Vector3.Zero, Vector3.Zero];
[Export] public Vector3 MoveRot { get; set; } = Vector3.Zero;
[Export] public float Speed { get; set; } = 3.0f;
public enum MoveStates
{
READY,
MOVE
}
private MoveStates _state = MoveStates.READY;
private float _moveProgress = 0.0f;
private float _moveProgressTarget = 0.0f;
public void _func_godot_apply_properties(Dictionary<string, Variant> props)
{
TargetName = props["targetname"].AsString();
MovePos[1] = QuakeTools.IdVecToGodotVec(props["move_pos"]) * QuakeTools.InverseScale;
if (props["move_rot"].Obj is Vector3 rotVec)
{
MoveRot = new Vector3(Mathf.DegToRad(rotVec.X), Mathf.DegToRad(rotVec.Y), Mathf.DegToRad(rotVec.Z));
}
Speed = props["speed"].AsSingle();
// if (props.TryGetValue("activationtype", out var type))
// {
// var t = Enum.TryParse(type, true, out ActivationType activationType);
// if (t)
// {
// ActivationType = activationType;
// }
// }
// TODO: Oneshot
}
public void MoveForward()
{
_moveProgressTarget = 1.0f;
}
public void Use()
{
MoveForward();
}
public void MoveReverse()
{
_moveProgressTarget = 0.0f;
}
public bool Activate(ActivationType activationType = ActivationType.Toggle)
{
switch (activationType)
{
case ActivationType.Toggle:
case ActivationType.Use:
Toggle();
break;
case ActivationType.Enable:
case ActivationType.Open:
MoveForward();
break;
case ActivationType.Disable:
case ActivationType.Close:
MoveReverse();
break;
case ActivationType.Destroy:
break;
default:
throw new ArgumentOutOfRangeException(nameof(activationType), activationType, null);
}
return true;
}
public void Toggle()
{
if (_moveProgressTarget > 0.0)
{
MoveReverse();
}
else
{
MoveForward();
}
}
public FuncMove()
{
AddToGroup("func_move");
SyncToPhysics = false;
}
public override void _Ready()
{
if (Engine.IsEditorHint()) return;
if (!string.IsNullOrWhiteSpace(TargetName))
{
this.AddToGroup(TargetName);
}
MovePos[0] = Position;
MovePos[1] += MovePos[0];
if (Speed > 0.0f)
{
Speed = 1.0f / Speed;
}
}
public override void _PhysicsProcess(double delta)
{
if (Engine.IsEditorHint()) return;
if (_moveProgress == _moveProgressTarget)
{
return;
}
if (_moveProgress < _moveProgressTarget)
{
_moveProgress = Mathf.Min(_moveProgress + (float)(Speed * delta), _moveProgressTarget);
}
else if (_moveProgress > _moveProgressTarget)
{
_moveProgress = Mathf.Max(_moveProgress - (float)(Speed * delta), _moveProgressTarget);
}
if (MovePos[0] != MovePos[1])
{
Position = MovePos[0].Lerp(MovePos[1], _moveProgress);
}
if (MoveRot != Vector3.Zero)
{
Rotation = Vector3.Zero.Lerp(MoveRot, _moveProgress);
}
}
}

View file

@ -0,0 +1 @@
uid://c5nyynixjdc6k

View file

@ -37,8 +37,7 @@ public partial class TriggerArea : Area3D
ActivationType = activationType;
}
}
// TODO: Oneshot
}
public void _on_ent_entered(Node ent)

View file

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="FuncGodotFGDFile" load_steps=39 format=3 uid="uid://b700sa4be6dfa"]
[gd_resource type="Resource" script_class="FuncGodotFGDFile" load_steps=40 format=3 uid="uid://b700sa4be6dfa"]
[ext_resource type="Resource" uid="uid://ia1t5p4mhom3" path="res://3D/TrenchBroom/EntityDefinitions/point/lights/light_omni.tres" id="1_7vcj1"]
[ext_resource type="Script" uid="uid://cknmd0lgmorx2" path="res://addons/func_godot/src/fgd/func_godot_fgd_file.gd" id="1_lykim"]
@ -38,6 +38,7 @@
[ext_resource type="Resource" uid="uid://m0xahs14etiy" path="res://3D/TrenchBroom/EntityDefinitions/point/actors/Actor_SecurityCamera.tres" id="35_3jqmy"]
[ext_resource type="Resource" uid="uid://db7vsj36v1m2e" path="res://3D/TrenchBroom/EntityDefinitions/point/actors/Actor_Wallfan.tres" id="36_p5b6l"]
[ext_resource type="Resource" uid="uid://tqytdmynf2ko" path="res://3D/TrenchBroom/EntityDefinitions/point/lights/light_special.tres" id="37_53o7h"]
[ext_resource type="Resource" uid="uid://fbovhni8adhg" path="res://3D/TrenchBroom/EntityDefinitions/point/triggers/Alarm_Trigger_3D.tres" id="38_mdgca"]
[resource]
script = ExtResource("1_lykim")
@ -45,5 +46,5 @@ export_file = false
target_map_editor = 1
fgd_name = "FuncGodot"
base_fgd_files = Array[Resource]([])
entity_definitions = Array[Resource]([ExtResource("1_7vcj1"), ExtResource("2_u7uvb"), ExtResource("3_u7uvb"), ExtResource("4_1nmxk"), ExtResource("5_ljb2x"), ExtResource("6_seuvu"), ExtResource("7_fmwex"), ExtResource("8_c8m8m"), ExtResource("9_14sjf"), ExtResource("10_xik3w"), ExtResource("11_dgiqm"), ExtResource("12_1teik"), ExtResource("13_f0hti"), ExtResource("14_6ld6e"), ExtResource("15_g8j5j"), ExtResource("16_7h4of"), ExtResource("17_m3sbm"), ExtResource("18_m3sbm"), ExtResource("19_hvhb8"), ExtResource("20_3v5us"), ExtResource("21_g67cj"), ExtResource("22_iy67w"), ExtResource("23_b5lmu"), ExtResource("24_ndas4"), ExtResource("25_n7wsi"), ExtResource("26_v48k5"), ExtResource("27_ombvk"), ExtResource("28_31lma"), ExtResource("29_louv0"), ExtResource("30_wfgfu"), ExtResource("31_elv2e"), ExtResource("32_elv2e"), ExtResource("33_aawmv"), ExtResource("34_wy0ht"), ExtResource("35_3jqmy"), ExtResource("36_p5b6l"), ExtResource("37_53o7h")])
entity_definitions = Array[Resource]([ExtResource("1_7vcj1"), ExtResource("2_u7uvb"), ExtResource("3_u7uvb"), ExtResource("4_1nmxk"), ExtResource("5_ljb2x"), ExtResource("6_seuvu"), ExtResource("7_fmwex"), ExtResource("8_c8m8m"), ExtResource("9_14sjf"), ExtResource("10_xik3w"), ExtResource("11_dgiqm"), ExtResource("12_1teik"), ExtResource("13_f0hti"), ExtResource("14_6ld6e"), ExtResource("15_g8j5j"), ExtResource("16_7h4of"), ExtResource("17_m3sbm"), ExtResource("18_m3sbm"), ExtResource("19_hvhb8"), ExtResource("20_3v5us"), ExtResource("21_g67cj"), ExtResource("22_iy67w"), ExtResource("23_b5lmu"), ExtResource("24_ndas4"), ExtResource("25_n7wsi"), ExtResource("26_v48k5"), ExtResource("27_ombvk"), ExtResource("28_31lma"), ExtResource("29_louv0"), ExtResource("30_wfgfu"), ExtResource("31_elv2e"), ExtResource("32_elv2e"), ExtResource("33_aawmv"), ExtResource("34_wy0ht"), ExtResource("35_3jqmy"), ExtResource("36_p5b6l"), ExtResource("37_53o7h"), ExtResource("38_mdgca")])
metadata/_custom_type_script = "uid://cknmd0lgmorx2"

View file

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="FuncGodotFGDFile" load_steps=8 format=3 uid="uid://dgkdkac8ppgnq"]
[gd_resource type="Resource" script_class="FuncGodotFGDFile" load_steps=9 format=3 uid="uid://dgkdkac8ppgnq"]
[ext_resource type="Script" uid="uid://cknmd0lgmorx2" path="res://addons/func_godot/src/fgd/func_godot_fgd_file.gd" id="1_jws5j"]
[ext_resource type="Resource" uid="uid://cxy7jnh6d7msn" path="res://addons/func_godot/fgd/func_detail.tres" id="1_rbohd"]
@ -7,6 +7,7 @@
[ext_resource type="Resource" uid="uid://dg5x44cc7flew" path="res://addons/func_godot/fgd/func_illusionary.tres" id="4_h7bc3"]
[ext_resource type="Resource" uid="uid://cqyc33bbc701f" path="res://3D/TrenchBroom/EntityDefinitions/solid/triggers/trigger_area.tres" id="5_1pqwq"]
[ext_resource type="Resource" uid="uid://c2x5nns4yv5y1" path="res://3D/TrenchBroom/EntityDefinitions/solid/Brush/acid_area.tres" id="6_ire2f"]
[ext_resource type="Resource" uid="uid://jnnorlsenrwb" path="res://3D/TrenchBroom/EntityDefinitions/solid/funcs/func_move.tres" id="7_h7bc3"]
[resource]
script = ExtResource("1_jws5j")
@ -14,5 +15,5 @@ export_file = false
target_map_editor = 1
fgd_name = "FuncGodot"
base_fgd_files = Array[Resource]([])
entity_definitions = Array[Resource]([ExtResource("1_rbohd"), ExtResource("2_1pqwq"), ExtResource("3_ire2f"), ExtResource("4_h7bc3"), ExtResource("5_1pqwq"), ExtResource("6_ire2f")])
entity_definitions = Array[Resource]([ExtResource("1_rbohd"), ExtResource("2_1pqwq"), ExtResource("3_ire2f"), ExtResource("4_h7bc3"), ExtResource("5_1pqwq"), ExtResource("6_ire2f"), ExtResource("7_h7bc3")])
metadata/_custom_type_script = "uid://cknmd0lgmorx2"

View file

@ -65,7 +65,7 @@ hframes = 4
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.84862, 0, -4.8932)
[node name="StartPosition" type="Marker3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 21.7161, 1.57535, 4.13675)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 20.4046, 1.57535, 19.2572)
[node name="CameraTarget" type="Marker3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 21.0389, 2.33215, 3.16925)

View file

@ -0,0 +1,115 @@
using System;
using System.Linq;
using Godot;
using Godot.Collections;
namespace Cirno.Scripts.Actors._3D;
[Tool]
public partial class AlarmTrigger3D : Node3D
{
[Export] public string TargetGroup { get; private set; }
[Export] public Node Target { get; set; }
[Export] public Array<Node> Targets { get; private set; } = [];
[Export] public ActivationType ActivationType { get; set; } = ActivationType.Toggle;
[Export] public bool ActivateOnEnable { get; set; }
[Export] public bool ActivateOnDisable { get; set; }
public void _func_godot_apply_properties(Dictionary<string, string> props)
{
TargetGroup = props["target"];
if (props.TryGetValue("activationtype", out var type))
{
var t = Enum.TryParse(type, true, out ActivationType activationType);
if (t)
{
ActivationType = activationType;
}
}
if (bool.TryParse(props["activateonenable"], out bool activateOnEnable))
{
ActivateOnEnable = activateOnEnable;
}
if (bool.TryParse(props["activateondisable"], out bool activateOnDisable))
{
ActivateOnDisable = activateOnDisable;
}
// TODO: Oneshot
}
public override void _Ready()
{
if (Engine.IsEditorHint()) return;
if (AlarmManager.Instance is null)
{
return;
}
if (ActivateOnEnable)
{
AlarmManager.Instance.AlarmEnabled3D += AlarmEnabled;
}
if (ActivateOnDisable)
{
AlarmManager.Instance.AlarmDisabled += AlarmDisabled;
}
}
private void AlarmDisabled()
{
if (!ActivateOnDisable) return;
Activate(ActivationType);
}
private void AlarmEnabled(Vector3 location)
{
if (!ActivateOnEnable) return;
Activate(ActivationType);
}
public bool Activate(ActivationType activationType = ActivationType.Toggle)
{
var activationTypeToUse = activationType is ActivationType.Use ? ActivationType : activationType;
// Compatibility for old single system
bool success = ActivateTarget(Target, activationTypeToUse);
if (!string.IsNullOrWhiteSpace(TargetGroup))
{
UseTargets(this, TargetGroup);
}
return Targets.Aggregate(success, (current, target) => ActivateTarget(target, activationTypeToUse) | success);
}
private bool ActivateTarget(Node target, ActivationType activationType = ActivationType.Toggle)
{
if (target is not IActivable activable) return false;
activable?.Activate(activationType);
return true;
}
private void UseTargets(Node activator, string target)
{
GD.Print($"Trying to use targets called: {target}");
var targetList = GetTree().GetNodesInGroup(target);
foreach (var t in targetList)
{
//string f;
GD.Print($"Trying to use {t.Name}");
if (t is IActivable activable)
{
GD.Print($"Activating {t.Name}");
activable.Activate(ActivationType);
}
}
}
}

View file

@ -0,0 +1 @@
uid://bwh3ft5pcmajd

View file

@ -0,0 +1,30 @@
using Godot;
namespace Cirno.Scripts.Utils;
public static class QuakeTools
{
// Common inverse scale. Calculated as 1.0 / Inverse Scale Factor.
// Used to help translate properties using Quake Units into Godot Units.
public const float InverseScale = 0.03125f;
public static Vector3 IdVecToGodotVec(Variant vec)
{
var org = Vector3.Zero;
if (vec.Obj is Vector3 vec3)
{
org = vec3;
}
else if (vec.Obj is string vecs)
{
var arr = vecs.SplitFloats(" ");
for (int i = 0; i < Mathf.Max(arr.Length, 3); i++)
{
org[i] = arr[i];
}
}
return new Vector3(org.Y, org.Z, org.X);
}
}

View file

@ -0,0 +1 @@
uid://c13los771tgmd