mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-07-07 07:21:17 +00:00
Triggerable movable walls
This commit is contained in:
parent
f3edc2b433
commit
9d0036c436
20 changed files with 1292 additions and 693 deletions
|
|
@ -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 = ""
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
48
3D/TrenchBroom/EntityDefinitions/solid/funcs/func_move.tres
Normal file
48
3D/TrenchBroom/EntityDefinitions/solid/funcs/func_move.tres
Normal 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"
|
||||
157
3D/TrenchBroom/EntityScripts/Solid/FuncMove.cs
Normal file
157
3D/TrenchBroom/EntityScripts/Solid/FuncMove.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
1
3D/TrenchBroom/EntityScripts/Solid/FuncMove.cs.uid
Normal file
1
3D/TrenchBroom/EntityScripts/Solid/FuncMove.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://c5nyynixjdc6k
|
||||
|
|
@ -37,8 +37,7 @@ public partial class TriggerArea : Area3D
|
|||
ActivationType = activationType;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO: Oneshot
|
||||
}
|
||||
|
||||
public void _on_ent_entered(Node ent)
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue