Custom func_godot entities

This commit is contained in:
Marco 2025-06-12 11:50:22 +02:00
commit 929d993f99
360 changed files with 4983 additions and 3944 deletions

View file

@ -0,0 +1,23 @@
[gd_resource type="Resource" script_class="FuncGodotFGDBaseClass" load_steps=3 format=3 uid="uid://5bc1qysixhmh"]
[ext_resource type="Script" uid="uid://6o4wbl0iau0v" path="res://addons/func_godot/src/fgd/func_godot_fgd_base_class.gd" id="1_4prc0"]
[ext_resource type="Resource" uid="uid://x4g06004i574" path="res://3D/TrenchBroom/EntityDefinitions/base/globalname_base.tres" id="1_4xlxh"]
[resource]
script = ExtResource("1_4prc0")
classname = "Actor"
description = ""
func_godot_internal = false
base_classes = Array[Resource]([ExtResource("1_4xlxh")])
class_properties = {
"flags": [["Player", 1, 0], ["BIG friend", 2, 0], ["Attentive friend", 4, 0], ["Happy friend", 8, 0]],
"scale": 1.0
}
class_property_descriptions = {}
auto_apply_to_matching_node_properties = false
meta_properties = {
"color": Color(0.8, 0, 0, 1),
"size": AABB(-8, -8, -8, 8, 8, 8)
}
node_class = ""
name_property = ""

View file

@ -0,0 +1,24 @@
[gd_resource type="Resource" script_class="FuncGodotFGDBaseClass" load_steps=3 format=3 uid="uid://bfjnt8q3l2p65"]
[ext_resource type="Resource" uid="uid://x4g06004i574" path="res://3D/TrenchBroom/EntityDefinitions/base/globalname_base.tres" id="1_ftv6l"]
[ext_resource type="Script" uid="uid://6o4wbl0iau0v" path="res://addons/func_godot/src/fgd/func_godot_fgd_base_class.gd" id="1_grnar"]
[resource]
script = ExtResource("1_grnar")
classname = "Func"
description = ""
func_godot_internal = false
base_classes = Array[Resource]([ExtResource("1_ftv6l")])
class_properties = {
"_phong": false
}
class_property_descriptions = {
"_phong": "Set to 1 to give the brush entity smooth shading."
}
auto_apply_to_matching_node_properties = false
meta_properties = {
"color": Color(0.8, 0.8, 0.8, 1),
"size": AABB(-8, -8, -8, 8, 8, 8)
}
node_class = ""
name_property = ""

View file

@ -0,0 +1,24 @@
[gd_resource type="Resource" script_class="FuncGodotFGDBaseClass" load_steps=2 format=3 uid="uid://x4g06004i574"]
[ext_resource type="Script" uid="uid://6o4wbl0iau0v" path="res://addons/func_godot/src/fgd/func_godot_fgd_base_class.gd" id="1_wlfmo"]
[resource]
script = ExtResource("1_wlfmo")
classname = "Globalname"
description = ""
func_godot_internal = false
base_classes = Array[Resource]([])
class_properties = {
"globalname": ""
}
class_property_descriptions = {
"globalname": "Unique name in the Map Scene. When FuncGodot builds the map, this entity will be renamed to entity_ + globalname. This can be a useful alternative to targetname, especially when trying to reparent generated nodes."
}
auto_apply_to_matching_node_properties = false
meta_properties = {
"color": Color(0.8, 0.8, 0.8, 1),
"size": AABB(-8, -8, -8, 8, 8, 8)
}
node_class = ""
name_property = ""
metadata/_custom_type_script = "uid://6o4wbl0iau0v"

View file

@ -0,0 +1,33 @@
[gd_resource type="Resource" script_class="FuncGodotFGDBaseClass" load_steps=3 format=3 uid="uid://bpiblsew5s5so"]
[ext_resource type="Resource" uid="uid://x4g06004i574" path="res://3D/TrenchBroom/EntityDefinitions/base/globalname_base.tres" id="1_1p2gj"]
[ext_resource type="Script" uid="uid://6o4wbl0iau0v" path="res://addons/func_godot/src/fgd/func_godot_fgd_base_class.gd" id="2_7j6bh"]
[resource]
script = ExtResource("2_7j6bh")
classname = "Light"
description = ""
func_godot_internal = false
base_classes = Array[Resource]([ExtResource("1_1p2gj")])
class_properties = {
"color": Color(1, 1, 1, 1),
"energy": 1.0,
"indirect_energy": 1.0,
"shadow_bias": 0.1,
"shadows": false
}
class_property_descriptions = {
"color": "The light's color.",
"energy": "The light's strength multiplier. For OmniLight3D and SpotLight3D, changing this value will only change the light color's intensity, not the light's radius.",
"indirect_energy": "The light's strength multiplier. For OmniLight3D and SpotLight3D, changing this value will only change the light color's intensity, not the light's radius.",
"shadow_bias": "Used to adjust shadow appearance. Too small a value results in self-shadowing, while too large a value causes shadows to separate from casters. Adjust as needed.",
"shadows": "If true, the light will cast real-time shadows. This has a significant performance cost. Only enable shadow rendering when it makes a noticeable difference in the scene's appearance"
}
auto_apply_to_matching_node_properties = false
meta_properties = {
"color": Color(0.8, 0.8, 0, 1),
"size": AABB(-8, -8, -8, 8, 8, 8)
}
node_class = ""
name_property = ""
metadata/_custom_type_script = "uid://6o4wbl0iau0v"

View file

@ -0,0 +1,25 @@
[gd_resource type="Resource" script_class="FuncGodotFGDBaseClass" load_steps=2 format=3 uid="uid://kerywjgft7vh"]
[ext_resource type="Script" uid="uid://6o4wbl0iau0v" path="res://addons/func_godot/src/fgd/func_godot_fgd_base_class.gd" id="1_uy4g8"]
[resource]
script = ExtResource("1_uy4g8")
classname = "Target"
description = ""
func_godot_internal = false
base_classes = Array[Resource]([])
class_properties = {
"target": NodePath(""),
"targetfunc": ""
}
class_property_descriptions = {
"target": "Entity group to call the use function on when this entity is triggered.",
"targetfunc": "Function to call on target entities. As is, the target function cannot accept arguments, so make sure it doesn't require specifying arguments."
}
auto_apply_to_matching_node_properties = false
meta_properties = {
"color": Color(0.8, 0.8, 0.8, 1),
"size": AABB(-8, -8, -8, 8, 8, 8)
}
node_class = ""
name_property = ""

View file

@ -0,0 +1,23 @@
[gd_resource type="Resource" script_class="FuncGodotFGDBaseClass" load_steps=2 format=3 uid="uid://c1utxplehq2jl"]
[ext_resource type="Script" uid="uid://6o4wbl0iau0v" path="res://addons/func_godot/src/fgd/func_godot_fgd_base_class.gd" id="1_7j8c1"]
[resource]
script = ExtResource("1_7j8c1")
classname = "Targetname"
description = ""
func_godot_internal = false
base_classes = Array[Resource]([])
class_properties = {
"targetname": null
}
class_property_descriptions = {
"targetname": "Adds this entity to a group with this targetname."
}
auto_apply_to_matching_node_properties = false
meta_properties = {
"color": Color(0.8, 0.8, 0.8, 1),
"size": AABB(-8, -8, -8, 8, 8, 8)
}
node_class = ""
name_property = ""

View file

@ -0,0 +1,22 @@
[gd_resource type="Resource" script_class="FuncGodotFGDBaseClass" load_steps=5 format=3 uid="uid://ermxog0n4mvn"]
[ext_resource type="Script" uid="uid://6o4wbl0iau0v" path="res://addons/func_godot/src/fgd/func_godot_fgd_base_class.gd" id="1_0kba8"]
[ext_resource type="Resource" uid="uid://kerywjgft7vh" path="res://3D/TrenchBroom/EntityDefinitions/base/target_base.tres" id="1_73jh0"]
[ext_resource type="Resource" uid="uid://c1utxplehq2jl" path="res://3D/TrenchBroom/EntityDefinitions/base/targetname_base.tres" id="2_f4xyy"]
[ext_resource type="Resource" uid="uid://x4g06004i574" path="res://3D/TrenchBroom/EntityDefinitions/base/globalname_base.tres" id="3_mslp0"]
[resource]
script = ExtResource("1_0kba8")
classname = "Trigger"
description = ""
func_godot_internal = false
base_classes = Array[Resource]([ExtResource("1_73jh0"), ExtResource("2_f4xyy"), ExtResource("3_mslp0")])
class_properties = {}
class_property_descriptions = {}
auto_apply_to_matching_node_properties = false
meta_properties = {
"color": Color(0.8, 0.8, 0.8, 1),
"size": AABB(-8, -8, -8, 8, 8, 8)
}
node_class = ""
name_property = ""

View file

@ -0,0 +1,23 @@
[gd_resource type="Resource" script_class="FuncGodotFGDPointClass" load_steps=3 format=3 uid="uid://ia1t5p4mhom3"]
[ext_resource type="Script" uid="uid://c83r7t467hm4m" path="res://addons/func_godot/src/fgd/func_godot_fgd_point_class.gd" id="1_28dln"]
[ext_resource type="Resource" uid="uid://bpiblsew5s5so" path="res://3D/TrenchBroom/EntityDefinitions/base/light_base.tres" id="1_xk42r"]
[resource]
script = ExtResource("1_28dln")
apply_rotation_on_map_build = false
apply_scale_on_map_build = true
classname = "light_omni"
description = "OmniLight3D entity."
func_godot_internal = false
base_classes = Array[Resource]([ExtResource("1_xk42r")])
class_properties = {
"range": 320.0
}
class_property_descriptions = {
"range": "The light's radius in Quake Units. The entity script converts this to Godot Units in the LightOmni script."
}
auto_apply_to_matching_node_properties = false
meta_properties = {}
node_class = "OmniLight3D"
name_property = ""

View file

@ -0,0 +1,29 @@
[gd_resource type="Resource" script_class="FuncGodotFGDPointClass" load_steps=4 format=3 uid="uid://ctrecvowhcqx0"]
[ext_resource type="Script" uid="uid://c83r7t467hm4m" path="res://addons/func_godot/src/fgd/func_godot_fgd_point_class.gd" id="1_2vopw"]
[ext_resource type="Resource" uid="uid://bpiblsew5s5so" path="res://3D/TrenchBroom/EntityDefinitions/base/light_base.tres" id="1_i5rgu"]
[ext_resource type="Script" uid="uid://crjplbs250g75" path="res://3D/TrenchBroom/EntityScripts/Lights/light_spot.gd" id="3_ibopf"]
[resource]
script = ExtResource("1_2vopw")
script_class = ExtResource("3_ibopf")
apply_rotation_on_map_build = true
apply_scale_on_map_build = true
classname = "light_spot"
description = "SpotLight3D entity."
func_godot_internal = false
base_classes = Array[Resource]([ExtResource("1_i5rgu")])
class_properties = {
"angle": 45.0,
"mangle": Vector3(0, 0, 0),
"range": 320.0
}
class_property_descriptions = {
"angle": "The spotlight's angle in degrees.",
"mangle": "Orientation in degrees.",
"range": "The maximal range that can be reached by the spotlight in Quake Units. The entity script converts this to Godot Units in the LightOmni script."
}
auto_apply_to_matching_node_properties = false
meta_properties = {}
node_class = "SpotLight3D"
name_property = ""

View file

@ -0,0 +1,11 @@
## Special Light base class that contains static helper functions for LightOmni and LightSpot entities.
class_name LightBase
extends Light3D
static func _func_godot_apply_properties(node: Light3D, props: Dictionary) -> void:
node.light_energy = props["energy"] as float
node.light_indirect_energy = props["indirect_energy"] as float
node.shadow_bias = props["shadow_bias"] as float
node.shadow_enabled = props["shadows"] as bool
node.light_color = props["color"] as Color
node.light_bake_mode = Light3D.BAKE_DYNAMIC

View file

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

View file

@ -0,0 +1,7 @@
@tool
class_name LightOmni
extends OmniLight3D
func _func_godot_apply_properties(props: Dictionary) -> void:
LightBase._func_godot_apply_properties(self, props)
omni_range = (props["range"] as float) * TbManager.INVERSE_SCALE

View file

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

View file

@ -0,0 +1,8 @@
@tool
class_name LightSpot
extends SpotLight3D
func _func_godot_apply_properties(props: Dictionary) -> void:
LightBase._func_godot_apply_properties(self, props)
spot_angle = props["angle"] as float
spot_range = (props["range"] as float) * TbManager.INVERSE_SCALE

View file

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

View file

@ -0,0 +1,42 @@
class_name TbManager
extends Node
# Common inverse scale. Calculated as 1.0 / Inverse Scale Factor.
# Used to help translate properties using Quake Units into Godot Units.
const INVERSE_SCALE: float = 0.03125
enum {
WORLD_LAYER = (1 << 0),
ACTOR_LAYER = (1 << 1),
TRIGGER_LAYER = (1 << 2)
}
func use_targets(activator: Node, target: String) -> void:
# Targetnames are really Godot Groups, so we can have multiple entities
# share a common "targetname" in Trenchbroom.
var target_list: Array[Node] = get_tree().get_nodes_in_group(target)
for targ in target_list:
var f: String
# Be careful when specifying a function since we can't pass arguments
# to it (without hackarounds of course)
if 'targetfunc' in activator:
f = activator.targetfunc
if f.is_empty():
f = "use"
if targ.has_method(f):
targ.call(f)
func set_targetname(node: Node, targetname: String) -> void:
if node != null and not targetname.is_empty():
node.add_to_group(targetname)
# Converts Quake 1 axis to Godot axis
static func id_vec_to_godot_vec(vec: Variant)->Vector3:
var org: Vector3 = Vector3.ZERO
if vec is Vector3:
org = vec
elif vec is String:
var arr: PackedFloat64Array = (vec as String).split_floats(" ")
for i in max(arr.size(), 3):
org[i] = arr[i]
return Vector3(org.y, org.z, org.x)

View file

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

View file

@ -0,0 +1,19 @@
[gd_resource type="Resource" script_class="FuncGodotFGDFile" load_steps=9 format=3 uid="uid://onsfttdpojex"]
[ext_resource type="Resource" uid="uid://kerywjgft7vh" path="res://3D/TrenchBroom/EntityDefinitions/base/target_base.tres" id="1_abw2p"]
[ext_resource type="Script" uid="uid://cknmd0lgmorx2" path="res://addons/func_godot/src/fgd/func_godot_fgd_file.gd" id="1_p3xok"]
[ext_resource type="Resource" uid="uid://x4g06004i574" path="res://3D/TrenchBroom/EntityDefinitions/base/globalname_base.tres" id="1_wfoxw"]
[ext_resource type="Resource" uid="uid://bpiblsew5s5so" path="res://3D/TrenchBroom/EntityDefinitions/base/light_base.tres" id="2_abw2p"]
[ext_resource type="Resource" uid="uid://c1utxplehq2jl" path="res://3D/TrenchBroom/EntityDefinitions/base/targetname_base.tres" id="2_entxp"]
[ext_resource type="Resource" uid="uid://5bc1qysixhmh" path="res://3D/TrenchBroom/EntityDefinitions/base/actor_base.tres" id="5_mkw5g"]
[ext_resource type="Resource" path="res://3D/TrenchBroom/EntityDefinitions/base/func_base.tres" id="6_1xsdl"]
[ext_resource type="Resource" path="res://3D/TrenchBroom/EntityDefinitions/base/trigger_base.tres" id="7_2isdf"]
[resource]
script = ExtResource("1_p3xok")
export_file = false
target_map_editor = 1
fgd_name = "FuncGodot"
base_fgd_files = Array[Resource]([])
entity_definitions = Array[Resource]([ExtResource("1_abw2p"), ExtResource("2_entxp"), ExtResource("1_wfoxw"), ExtResource("5_mkw5g"), ExtResource("2_abw2p"), ExtResource("6_1xsdl"), ExtResource("7_2isdf")])
metadata/_custom_type_script = "uid://cknmd0lgmorx2"

View file

@ -0,0 +1,17 @@
[gd_resource type="Resource" script_class="FuncGodotFGDFile" load_steps=8 format=3 uid="uid://cxqi6r6nblcn3"]
[ext_resource type="Resource" uid="uid://nayxb8n7see2" path="res://addons/func_godot/fgd/phong_base.tres" id="1_24lxq"]
[ext_resource type="Resource" uid="uid://onsfttdpojex" path="res://3D/TrenchBroom/fgd_base.tres" id="1_dlwdq"]
[ext_resource type="Resource" uid="uid://dgkdkac8ppgnq" path="res://3D/TrenchBroom/fgd_solid.tres" id="2_bci5m"]
[ext_resource type="Resource" uid="uid://bdji3873bg32h" path="res://addons/func_godot/fgd/worldspawn.tres" id="2_dlwdq"]
[ext_resource type="Resource" uid="uid://b700sa4be6dfa" path="res://3D/TrenchBroom/fgd_point.tres" id="3_0gbih"]
[ext_resource type="Resource" uid="uid://ch3e0dix85uhb" path="res://addons/func_godot/fgd/func_detail_illusionary.tres" id="5_7icdq"]
[ext_resource type="Script" uid="uid://cknmd0lgmorx2" path="res://addons/func_godot/src/fgd/func_godot_fgd_file.gd" id="7_m2ebq"]
[resource]
script = ExtResource("7_m2ebq")
export_file = false
target_map_editor = 1
fgd_name = "FuncGodot"
base_fgd_files = Array[Resource]([ExtResource("1_dlwdq"), ExtResource("2_bci5m"), ExtResource("3_0gbih")])
entity_definitions = Array[Resource]([ExtResource("1_24lxq"), ExtResource("2_dlwdq"), ExtResource("5_7icdq")])

View file

@ -0,0 +1,14 @@
[gd_resource type="Resource" script_class="FuncGodotFGDFile" load_steps=4 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"]
[ext_resource type="Resource" uid="uid://ctrecvowhcqx0" path="res://3D/TrenchBroom/EntityDefinitions/point/lights/light_spot.tres" id="2_u7uvb"]
[resource]
script = ExtResource("1_lykim")
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")])
metadata/_custom_type_script = "uid://cknmd0lgmorx2"

View file

@ -0,0 +1,16 @@
[gd_resource type="Resource" script_class="FuncGodotFGDFile" load_steps=6 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"]
[ext_resource type="Resource" uid="uid://ch3e0dix85uhb" path="res://addons/func_godot/fgd/func_detail_illusionary.tres" id="2_1pqwq"]
[ext_resource type="Resource" uid="uid://b70vf4t5dc70t" path="res://addons/func_godot/fgd/func_geo.tres" id="3_ire2f"]
[ext_resource type="Resource" uid="uid://dg5x44cc7flew" path="res://addons/func_godot/fgd/func_illusionary.tres" id="4_h7bc3"]
[resource]
script = ExtResource("1_jws5j")
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")])
metadata/_custom_type_script = "uid://cknmd0lgmorx2"

View file

@ -0,0 +1,31 @@
[gd_resource type="Resource" script_class="FuncGodotMapSettings" load_steps=4 format=3 uid="uid://cx41lsryg5wpm"]
[ext_resource type="Material" uid="uid://cvex6toty8yn7" path="res://addons/func_godot/textures/default_material.tres" id="1_frq64"]
[ext_resource type="Resource" uid="uid://cxqi6r6nblcn3" path="res://3D/TrenchBroom/fgd_main.tres" id="2_timv6"]
[ext_resource type="Script" uid="uid://bctwech0sq0kh" path="res://addons/func_godot/src/map/func_godot_map_settings.gd" id="3_u7jfk"]
[resource]
script = ExtResource("3_u7jfk")
inverse_scale_factor = 16.0
entity_fgd = ExtResource("2_timv6")
entity_name_property = "globalname"
base_texture_dir = "res://textures"
texture_file_extensions = Array[String](["png", "jpg", "jpeg", "bmp", "tga", "webp"])
clip_texture = "special/clip"
skip_texture = "special/skip"
origin_texture = "special/origin"
texture_wads = Array[Resource]([])
material_file_extension = "tres"
default_material = ExtResource("1_frq64")
default_material_albedo_uniform = ""
albedo_map_pattern = "%s_albedo.%s"
normal_map_pattern = "%s_normal.%s"
metallic_map_pattern = "%s_metallic.%s"
roughness_map_pattern = "%s_roughness.%s"
emission_map_pattern = "%s_emission.%s"
ao_map_pattern = "%s_ao.%s"
height_map_pattern = "%s_height.%s"
orm_map_pattern = "%s_orm.%s"
save_generated_materials = true
uv_unwrap_texel_size = 2.0
use_trenchbroom_groups_hierarchy = false