Initial commit
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,21 @@
|
||||
class_name FmodEmitterPropertyInspectorPlugin extends EditorInspectorPlugin
|
||||
|
||||
var _open_project_explorer_callable: Callable
|
||||
var _event_editor_property_scene: PackedScene = load("res://addons/fmod/tool/property_editors/FmodEventEditorProperty.tscn")
|
||||
|
||||
func _init(plugin: FmodPlugin):
|
||||
_open_project_explorer_callable = plugin.open_project_explorer_events
|
||||
|
||||
func _can_handle(object: Object):
|
||||
return object is FmodEventEmitter2D or \
|
||||
object is FmodEventEmitter3D
|
||||
|
||||
func _parse_property(object: Object, type: Variant.Type, name: String, hint_type: PropertyHint, hint_string: String, usage_flags: int, wide: bool):
|
||||
return name == "event_name" || name == "event_guid"
|
||||
|
||||
func _parse_category(object: Object, category: String):
|
||||
if category != "FmodEventEmitter2D" and category != "FmodEventEmitter3D":
|
||||
return
|
||||
var editor_property := _event_editor_property_scene.instantiate()
|
||||
editor_property.initialize(_open_project_explorer_callable, "event_name", "event_guid")
|
||||
add_property_editor_for_multiple_properties("Fmod event", PackedStringArray(["event_name", "event_guid"]), editor_property)
|
||||
@@ -0,0 +1,17 @@
|
||||
extends Area3D
|
||||
class_name InteractBox
|
||||
|
||||
signal interactedWith(playerRef: PlayerCharacter)
|
||||
@export var object: Node #Logic for how the interaction works, look for the ButtonLogicToggle, or ButtonLogicImpulse nodes
|
||||
@export var type: String = "default"
|
||||
var playerRef: PlayerCharacter
|
||||
|
||||
func _ready() -> void:
|
||||
set_collision_layer_value(6,true) #Enables Interaction colision layer
|
||||
set_collision_layer_value(1,false) #Disables Default collision layer
|
||||
set_collision_mask_value(1,false) #Disables Default collision mask
|
||||
monitoring = false
|
||||
|
||||
func interact() -> void:
|
||||
interactedWith.emit(playerRef)
|
||||
playerRef = null
|
||||
@@ -0,0 +1,53 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://se7om65u4681"
|
||||
path="res://.godot/imported/Starter.blend-1dfc0b78136912a528a1626a2e084faa.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/3D/Rooms/Starter.blend"
|
||||
dest_files=["res://.godot/imported/Starter.blend-1dfc0b78136912a528a1626a2e084faa.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
_subresources={}
|
||||
blender/nodes/visible=0
|
||||
blender/nodes/active_collection_only=false
|
||||
blender/nodes/punctual_lights=true
|
||||
blender/nodes/cameras=true
|
||||
blender/nodes/custom_properties=true
|
||||
blender/nodes/modifiers=1
|
||||
blender/meshes/colors=false
|
||||
blender/meshes/uvs=true
|
||||
blender/meshes/normals=true
|
||||
blender/meshes/export_geometry_nodes_instances=false
|
||||
blender/meshes/tangents=true
|
||||
blender/meshes/skins=2
|
||||
blender/meshes/export_bones_deforming_mesh_only=false
|
||||
blender/materials/unpack_enabled=true
|
||||
blender/materials/export_materials=1
|
||||
blender/animation/limit_playback=true
|
||||
blender/animation/always_sample=true
|
||||
blender/animation/group_tracks=true
|
||||
@@ -0,0 +1,83 @@
|
||||
extends Node
|
||||
## This class implements a handshake protocol over UDP for multiple classes.
|
||||
|
||||
class HandshakeStatus:
|
||||
var did_read: bool = false
|
||||
var did_write: bool = false
|
||||
var did_handshake: bool = false
|
||||
|
||||
func _to_string():
|
||||
return "$" + \
|
||||
("r" if did_read else "-") + \
|
||||
("w" if did_write else "-") + \
|
||||
("x" if did_handshake else "-")
|
||||
|
||||
static func from_string(str: String) -> HandshakeStatus:
|
||||
var result = HandshakeStatus.new()
|
||||
result.did_read = str.contains("r")
|
||||
result.did_write = str.contains("w")
|
||||
result.did_handshake = str.contains("x")
|
||||
return result
|
||||
|
||||
## Conduct handshake over a [PacketPeer] instance.
|
||||
func over_packet_peer(peer: PacketPeer, timeout: float = 8.0, frequency: float = 0.1) -> Error:
|
||||
var result = ERR_TIMEOUT
|
||||
var status = HandshakeStatus.new()
|
||||
status.did_write = true
|
||||
|
||||
while timeout >= 0:
|
||||
# Process incoming packets
|
||||
while peer.get_available_packet_count() > 0:
|
||||
var packet = peer.get_packet()
|
||||
var incoming_status = HandshakeStatus.from_string(packet.get_string_from_ascii())
|
||||
|
||||
# We did get a packet, so that means we read them
|
||||
status.did_read = true
|
||||
|
||||
# They already read us, so that's a handshake
|
||||
if incoming_status.did_read:
|
||||
status.did_handshake = true
|
||||
|
||||
# Both peers ack'd the handshake, we've succeeded
|
||||
if incoming_status.did_handshake and status.did_handshake:
|
||||
result = OK
|
||||
timeout = 0 # Break outer loop
|
||||
|
||||
# Send our state
|
||||
peer.put_packet(status.to_string().to_ascii_buffer())
|
||||
|
||||
await get_tree().create_timer(frequency).timeout
|
||||
timeout -= frequency
|
||||
|
||||
# If we've read them and we know we've sent data to them successfully,
|
||||
# we're *probably* good to connect, even if the handshake did not actually
|
||||
# go through.
|
||||
# Depending on the context, the calling code may decide to connect anyway,
|
||||
# based on this return value.
|
||||
if status.did_read and status.did_write and not status.did_handshake:
|
||||
result = ERR_BUSY
|
||||
|
||||
return result
|
||||
|
||||
## Conduct handshake over an [ENetConnection].
|
||||
##
|
||||
## [i]Note[/i] that this is not a full-fledged handshake, since we can't receive
|
||||
## data over the connection. Instead, we just pretend that the handshake is
|
||||
## successful on our end and blast that status for a given time.
|
||||
func over_enet(connection: ENetConnection, address: String, port: int, timeout: float = 8.0, frequency: float = 0.1) -> Error:
|
||||
var result = OK
|
||||
var status = HandshakeStatus.new()
|
||||
|
||||
# Pretend this is a perfectly healthy handshake, since we can't receive data here
|
||||
status.did_write = true
|
||||
status.did_read = true
|
||||
status.did_handshake = true
|
||||
|
||||
while timeout >= 0:
|
||||
# Send our state
|
||||
connection.socket_send(address, port, status.to_string().to_ascii_buffer())
|
||||
|
||||
await get_tree().create_timer(frequency).timeout
|
||||
timeout -= frequency
|
||||
|
||||
return result
|
||||
Reference in New Issue
Block a user