Initial commit
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://elyx6og67vso"
|
||||
path="res://.godot/imported/CorridorDeadEnd.blend-0ad58fe467f7cecb6027ce364429467f.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/3D/Corriodors/CorridorDeadEnd.blend"
|
||||
dest_files=["res://.godot/imported/CorridorDeadEnd.blend-0ad58fe467f7cecb6027ce364429467f.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,142 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://e5txgsvnchha"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dfqkj3vcm3a84" path="res://script/mainmenu.gd" id="1_0khfh"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_qajsf"]
|
||||
colors = PackedColorArray(0, 0, 0, 1, 0, 0, 0, 1)
|
||||
|
||||
[sub_resource type="GradientTexture2D" id="GradientTexture2D_sp1j3"]
|
||||
gradient = SubResource("Gradient_qajsf")
|
||||
width = 32
|
||||
height = 32
|
||||
fill_to = Vector2(1, 1)
|
||||
|
||||
[node name="Mainmenu" type="Control"]
|
||||
z_index = 4
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_0khfh")
|
||||
|
||||
[node name="Menu" type="Panel" parent="."]
|
||||
process_mode = 3
|
||||
layout_mode = 0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
focus_mode = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Menu"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_left = 50
|
||||
theme_override_constants/margin_top = 50
|
||||
theme_override_constants/margin_right = 50
|
||||
theme_override_constants/margin_bottom = 50
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Menu/MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HBoxContainer4" type="HBoxContainer" parent="Menu/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer4"]
|
||||
custom_minimum_size = Vector2(32, 32)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ProfileSprite" type="Sprite2D" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
texture = SubResource("GradientTexture2D_sp1j3")
|
||||
centered = false
|
||||
|
||||
[node name="VBoxContainer2" type="VBoxContainer" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer4"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="NameEdit" type="LineEdit" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer2"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 2.0
|
||||
max_length = 16
|
||||
editable = false
|
||||
|
||||
[node name="VBoxContainer3" type="VBoxContainer" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer4"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Start" type="Button" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer3"]
|
||||
process_mode = 3
|
||||
layout_mode = 2
|
||||
disabled = true
|
||||
text = "Create Game"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Menu/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VBoxMultiplayerDisabled" type="VBoxContainer" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer/VBoxMultiplayerDisabled"]
|
||||
layout_mode = 2
|
||||
text = "Global Lobbies"
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer/VBoxMultiplayerDisabled"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
color = Color(0.129412, 0.129412, 0.129412, 1)
|
||||
|
||||
[node name="Label" type="Label" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer/VBoxMultiplayerDisabled/ColorRect"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -11.5
|
||||
offset_right = 20.0
|
||||
offset_bottom = 11.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
text = "Please start Steam to enable multiplayer mode.
|
||||
Connections via LAN and join codes are currently disable / not implemented. "
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="RefreshLobbies2" type="Button" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer/VBoxMultiplayerDisabled"]
|
||||
layout_mode = 2
|
||||
focus_mode = 0
|
||||
disabled = true
|
||||
text = "Refresh"
|
||||
|
||||
[node name="VBoxLobbylist" type="VBoxContainer" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer/VBoxLobbylist"]
|
||||
layout_mode = 2
|
||||
text = "Global Lobbies"
|
||||
|
||||
[node name="ItemList" type="ItemList" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer/VBoxLobbylist"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
same_column_width = true
|
||||
|
||||
[node name="RefreshLobbies" type="Button" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer/VBoxLobbylist"]
|
||||
layout_mode = 2
|
||||
text = "Refresh"
|
||||
|
||||
[connection signal="pressed" from="Menu/MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer3/Start" to="." method="on_start_pressed"]
|
||||
[connection signal="pressed" from="Menu/MarginContainer/VBoxContainer/HBoxContainer/VBoxMultiplayerDisabled/RefreshLobbies2" to="." method="on_refresh_lobbies_2_pressed"]
|
||||
[connection signal="item_activated" from="Menu/MarginContainer/VBoxContainer/HBoxContainer/VBoxLobbylist/ItemList" to="." method="on_lobby_list_item_activated"]
|
||||
[connection signal="pressed" from="Menu/MarginContainer/VBoxContainer/HBoxContainer/VBoxLobbylist/RefreshLobbies" to="." method="on_refresh_lobbies_pressed"]
|
||||
@@ -0,0 +1,6 @@
|
||||
extends BasicRoom
|
||||
class_name CorridorFourWay
|
||||
|
||||
var gridSlots: Array[Vector2] = [Vector2(0,0),Vector2(1,0),Vector2(1,1),Vector2(1,-1),Vector2(2,0)]
|
||||
var doorSlots: Array[Vector3] = [Vector3(0,0,3),Vector3(2,0,1),Vector3(1,-1,4),Vector3(1,1,2)]
|
||||
var scenePath = "res://SpaceshipRooms/Corridors/CorridorLong.tscn"
|
||||
@@ -0,0 +1,391 @@
|
||||
extends Node3D
|
||||
class_name LevelGenerator
|
||||
|
||||
var levelGrid: Array[Array]
|
||||
@export var gridSize: int = 225
|
||||
|
||||
@export var doorBlock: PackedScene # Temporary
|
||||
|
||||
var rng := RandomNumberGenerator.new() #Get random values, usefull for random level generation huh
|
||||
var currentMission: Mission
|
||||
var doorSpawnPoints: Array[DoorPosition] #Where to put them doors
|
||||
var doorBlockSpawnPoints: Array[DoorPosition] #Where to put them door blockers
|
||||
|
||||
func _ready() -> void:
|
||||
initGrid() #Assign a new grid space object to each space of the 1x1m grid
|
||||
|
||||
#Center the world
|
||||
position.x = -gridSize/2
|
||||
position.z = -gridSize/2
|
||||
|
||||
currentMission = RescueMission.new() #Have something choose the mission type in this part later
|
||||
|
||||
#Biomes
|
||||
var doorList: Array[DoorPosition] #Seccond Array contains door positions
|
||||
for bPrio in currentMission.biomes.size():
|
||||
doorList = placeBiomes(currentMission.biomes[bPrio])
|
||||
spreadBiomes()
|
||||
placeRooms(doorList)
|
||||
|
||||
#Doors
|
||||
findValidDoors()
|
||||
spawnDoors()
|
||||
|
||||
#Misc Utility
|
||||
func initGrid() -> void:
|
||||
for x in gridSize:
|
||||
var newRow: Array
|
||||
levelGrid.push_back(newRow)
|
||||
for y in gridSize:
|
||||
var newCell := GridCell.new()
|
||||
newCell.position = Vector2i(x,y)
|
||||
levelGrid[x].push_back(newCell)
|
||||
|
||||
func addGridCells(cell1: GridCell,cell2: GridCell) -> GridCell:
|
||||
var returnCell: GridCell = GridCell.new()
|
||||
returnCell.spaceTaken = cell1.spaceTaken or cell2.spaceTaken
|
||||
returnCell.door = cell1.door or cell2.door
|
||||
if cell1.door and !cell2.door:
|
||||
returnCell.doorOrientation = cell1.doorOrientation
|
||||
else:
|
||||
returnCell.doorOrientation = cell2.doorOrientation
|
||||
returnCell.position = cell1.position
|
||||
returnCell.biome = cell1.biome
|
||||
return returnCell
|
||||
|
||||
func addArrays2D(array1: Array[Array], array2: Array[Array], arr2pos: Vector2i = Vector2i(0,0)) -> void:
|
||||
if array1.size() <= (arr2pos.x) + array2.size(): return
|
||||
if array1[arr2pos.y].size() <= (arr2pos.y) + array2[0].size(): return
|
||||
for x in array2.size():
|
||||
for y in array2[x].size():
|
||||
array1[x+arr2pos.x][y+arr2pos.y] = addGridCells(array1[x+arr2pos.x][y+arr2pos.y],array2[x][y])
|
||||
|
||||
func checkOverlapArrays2D(array1: Array[Array], array2: Array[Array], arr2pos: Vector2i = Vector2i(0,0)) -> bool:
|
||||
if array1.size() <= arr2pos.x + array2.size() or arr2pos.x < 0: return true
|
||||
if array1[arr2pos.y].size() <= arr2pos.y + array2[0].size() or arr2pos.y < 0: return true
|
||||
for x in array2.size():
|
||||
for y in array2[x].size():
|
||||
if array1[x+arr2pos.x][y+arr2pos.y].spaceTaken and array2[x][y].spaceTaken: return true
|
||||
return false
|
||||
|
||||
func checkBiomeOverlap(biome: String, pos: Vector2i, length: int, height: int) -> bool:
|
||||
if levelGrid.size() <= pos.x + length or pos.x < 0: return true
|
||||
if levelGrid[pos.y].size() <= pos.y + height or pos.y < 0: return true
|
||||
for x in length:
|
||||
for y in height:
|
||||
if levelGrid[x+pos.x][y+pos.y].biome: return true
|
||||
return false
|
||||
|
||||
func rotateArray2D(array: Array[Array], numberOfRotationsBy90Degrees: int) -> void:
|
||||
var size: int = array.size()
|
||||
var layerCount: int = size/2
|
||||
|
||||
for x in numberOfRotationsBy90Degrees%4:
|
||||
for layer in layerCount:
|
||||
var first: int = layer
|
||||
var last: int = size - first - 1
|
||||
|
||||
for element in range(first, last):
|
||||
var offset = element - first
|
||||
|
||||
var top = array[first][element]
|
||||
var right = array[element][last]
|
||||
var bot = array[last][last-offset]
|
||||
var left = array[last-offset][first]
|
||||
|
||||
array[element][last] = top
|
||||
array[last][last-offset] = right
|
||||
array[last-offset][first] = bot
|
||||
array[first][element] = left
|
||||
|
||||
func getDoorPosition(cell: GridCell, GridCellPosition: Vector2i) -> DoorPosition:
|
||||
if !cell.door:
|
||||
print("Tried to get door at cell that isnt a door")
|
||||
return null
|
||||
var returnDoorPosition := DoorPosition.new()
|
||||
returnDoorPosition.pos = GridCellPosition
|
||||
returnDoorPosition.orientation = cell.doorOrientation
|
||||
return returnDoorPosition
|
||||
|
||||
func addObject(AddedObject:PackedScene, Parent: Node3D, Position: Vector3, Rotation: Vector3= Vector3(0,0,0)):
|
||||
if !AddedObject:
|
||||
print("tried to add object but packed scene is null")
|
||||
return
|
||||
var obj = AddedObject.instantiate()
|
||||
Parent.add_child(obj)
|
||||
obj.position = Position
|
||||
obj.rotation = Rotation
|
||||
return obj
|
||||
|
||||
func changeBiomeArea2D(biome: String,pos:Vector2i,length: int,height: int):
|
||||
for x in length:
|
||||
for y in height:
|
||||
levelGrid[pos.x+x][pos.y+y].biome = biome
|
||||
|
||||
#Spawning Rooms
|
||||
func rotateRoomData(roomData: RoomData, numberOfRotationsBy90Degrees: int) -> void:
|
||||
rotateArray2D(roomData.roomGrid,numberOfRotationsBy90Degrees)
|
||||
roomData.rotations = wrapi(roomData.rotations + numberOfRotationsBy90Degrees,0,4)
|
||||
for door in roomData.doorPositions:
|
||||
door.rotatePosRight(roomData.roomGrid.size(),numberOfRotationsBy90Degrees)
|
||||
roomData.roomGrid[door.pos.x][door.pos.y].doorOrientation = wrapi(door.orientation-2,0,4)
|
||||
|
||||
func spawnRoom(roomDataInput: RoomData,pos: Vector2i,numberOfRotationsBy90Degrees: int = 0, centered: bool = false) -> Array[DoorPosition]: #Pos corresponds to the upper left corner of the room immage
|
||||
var roomData: RoomData = roomDataInput.duplicateRoom()
|
||||
var roomScene: PackedScene = load(roomData.roomSceneRef)
|
||||
rotateRoomData(roomData,numberOfRotationsBy90Degrees)
|
||||
var roomGrid := roomData.roomGrid
|
||||
var doorPositions: Array[DoorPosition] = roomData.doorPositions
|
||||
if centered:
|
||||
pos = Vector2i(pos.x-(roomGrid.size()/2),pos.y-(roomGrid[0].size()/2))
|
||||
|
||||
addArrays2D(levelGrid,roomGrid,pos)
|
||||
addObject(roomScene,self,Vector3(pos.x+(roomGrid.size()/2),0,pos.y+(roomGrid[0].size()/2)),Vector3(0,(roomData.rotations%4)*PI/2,0))
|
||||
for door in doorPositions:
|
||||
door.pos = pos + door.pos
|
||||
|
||||
return doorPositions
|
||||
|
||||
func getDoorFromRoom(roomData: RoomData,index: int) -> DoorPosition:
|
||||
return roomData.doorPositions[index % roomData.doorPositions.size()]
|
||||
|
||||
func putRoomAtDoor(roomData: RoomData, door: DoorPosition,spawnDoorIndex: int) -> Array: ##Return array contains roomData, spawn Pos in that order
|
||||
#Init Values:
|
||||
var spawnDoor: DoorPosition = getDoorFromRoom(roomData,spawnDoorIndex) #Which door from the spawned room connects to the exiting room
|
||||
var doorOrientationDifference : int = wrapi(spawnDoor.orientation - door.orientation,0,4) #Difference in orinet. between spawned and existing room
|
||||
var numberOfRoomRotations: int = 0 #How many rotations are needed to make spawned rooms spawn door face the existing door
|
||||
var spawnPos: Vector2i
|
||||
var doorOffset: Vector2i #Offset by 1 space so the doors are next to eachother and not inside eachoter
|
||||
|
||||
#Find number of rotations and then rotate the room
|
||||
if !doorOrientationDifference == 2:
|
||||
if doorOrientationDifference == 1:
|
||||
numberOfRoomRotations = 3
|
||||
if doorOrientationDifference == 0:
|
||||
numberOfRoomRotations = 2
|
||||
if doorOrientationDifference == 3:
|
||||
numberOfRoomRotations = 1
|
||||
rotateRoomData(roomData,numberOfRoomRotations)
|
||||
|
||||
#Get new values for spawnDoor and set door offset
|
||||
spawnDoor = getDoorFromRoom(roomData,spawnDoorIndex)
|
||||
match spawnDoor.orientation:
|
||||
0: doorOffset = Vector2i(0,-1)
|
||||
1: doorOffset = Vector2i(1,0)
|
||||
2: doorOffset = Vector2i(0,1)
|
||||
3: doorOffset = Vector2i(-1,0)
|
||||
|
||||
#Set spawn pos and return values
|
||||
spawnPos = door.pos - spawnDoor.pos + doorOffset
|
||||
var returnArray: Array = [roomData,spawnPos]
|
||||
return returnArray
|
||||
|
||||
func spawnRoomAtDoor(roomDataInput: Array[RoomData], door: DoorPosition, biome: String) -> Array[DoorPosition]:
|
||||
var returnArray: Array[DoorPosition]
|
||||
var roomData: RoomData = null
|
||||
var spawnDoorIndex: int = -1
|
||||
#Choose the room to use
|
||||
var rooms: Array[RoomData] = roomDataInput.duplicate()
|
||||
rooms.shuffle()
|
||||
for room in rooms:
|
||||
#Randomise door checking order
|
||||
var doorIndices: Array[int]
|
||||
for x in room.doorPositions.size():
|
||||
doorIndices.push_back(x)
|
||||
doorIndices.shuffle()
|
||||
|
||||
#Check if doorIndex fits and assign roomData and spawnDoorIndex if it does
|
||||
for doorIndex in doorIndices:
|
||||
if checkIfRoomFits(room,door,doorIndex, biome):
|
||||
roomData = room.duplicateRoom()
|
||||
spawnDoorIndex = doorIndex
|
||||
break
|
||||
|
||||
#Check if a room has been found
|
||||
if !roomData or spawnDoorIndex == -1:
|
||||
return returnArray
|
||||
|
||||
#Get Spawn Info and spawn room
|
||||
var spawnInfo: Array = putRoomAtDoor(roomData,door,spawnDoorIndex)
|
||||
spawnRoom(spawnInfo[0],spawnInfo[1])
|
||||
returnArray = spawnInfo[0].doorPositions
|
||||
for x in returnArray.size():
|
||||
returnArray[x].pos = spawnInfo[1] + returnArray[x].pos
|
||||
return returnArray
|
||||
|
||||
func checkIfBiomeFits(length: int, height: int, pos: Vector2i, biome: String) -> bool:
|
||||
if levelGrid.size() <= pos.x + length or pos.x < 0: return true
|
||||
if levelGrid[pos.y].size() <= pos.y + height or pos.y < 0: return true
|
||||
for x in length:
|
||||
for y in height:
|
||||
if levelGrid[x+pos.x][y+pos.y].biome != biome: return false
|
||||
return true
|
||||
|
||||
func checkIfRoomFits(roomDataInput: RoomData,door: DoorPosition,spawnDoorIndex: int, biome: String) -> bool:
|
||||
var roomData: RoomData = roomDataInput.duplicateRoom()
|
||||
var spawnInfo: Array = putRoomAtDoor(roomData,door,spawnDoorIndex)
|
||||
return !checkOverlapArrays2D(levelGrid,spawnInfo[0].roomGrid,spawnInfo[1]) and checkIfBiomeFits(spawnInfo[0].roomGrid.size(),spawnInfo[0].roomGrid[0].size(),spawnInfo[1],biome)
|
||||
|
||||
func isOutOfArray2DBounds(sizeX: int, sizeY: int, pos: Vector2i) -> bool:
|
||||
if pos.x >= sizeX or pos.x < 0 or pos.y >= sizeY or pos.y < 0:
|
||||
return true
|
||||
else:
|
||||
return false
|
||||
|
||||
func isValidDoor(pos:Vector2i) -> bool: # Checks if the door connects to another door using its orientation,
|
||||
#if this function finds a valid door, it removes the door status from the other door to avoid duplicated doors
|
||||
match levelGrid[pos.x][pos.y].doorOrientation:
|
||||
0:
|
||||
if isOutOfArray2DBounds(levelGrid.size(),levelGrid[0].size(),Vector2i(pos.x,pos.y-1)): return false
|
||||
if !levelGrid[pos.x][pos.y-1].door: return false
|
||||
else: levelGrid[pos.x][pos.y-1].door = false
|
||||
1:
|
||||
if isOutOfArray2DBounds(levelGrid.size(),levelGrid[0].size(),Vector2i(pos.x+1,pos.y)): return false
|
||||
if !levelGrid[pos.x+1][pos.y].door: return false
|
||||
else: levelGrid[pos.x+1][pos.y].door = false
|
||||
2:
|
||||
if isOutOfArray2DBounds(levelGrid.size(),levelGrid[0].size(),Vector2i(pos.x,pos.y+1)): return false
|
||||
if !levelGrid[pos.x][pos.y+1].door: return false
|
||||
else: levelGrid[pos.x][pos.y+1].door = false
|
||||
3:
|
||||
if isOutOfArray2DBounds(levelGrid.size(),levelGrid[0].size(),Vector2i(pos.x-1,pos.y)): return false
|
||||
if !levelGrid[pos.x-1][pos.y].door: return false
|
||||
else: levelGrid[pos.x-1][pos.y].door = false
|
||||
return true
|
||||
|
||||
func findValidDoors() -> void:
|
||||
for x in levelGrid.size():
|
||||
for y in levelGrid[x].size():
|
||||
if levelGrid[x][y].door:
|
||||
var newDoorObject := DoorPosition.new()
|
||||
newDoorObject.pos = Vector2i(x,y)
|
||||
newDoorObject.orientation = levelGrid[x][y].doorOrientation
|
||||
if isValidDoor(Vector2i(x,y)):
|
||||
doorSpawnPoints.push_back(newDoorObject)
|
||||
else:
|
||||
doorBlockSpawnPoints.push_back(newDoorObject)
|
||||
|
||||
func spawnDoors() -> void:
|
||||
for doorSpawn in doorSpawnPoints:
|
||||
debugCubeAtPos(doorSpawn.pos)
|
||||
for doorBlockSpawn in doorBlockSpawnPoints:
|
||||
addObject(doorBlock,self,Vector3(doorBlockSpawn.pos.x+0.5,0,doorBlockSpawn.pos.y+0.5),Vector3(0,doorBlockSpawn.orientation*-PI/2,0))
|
||||
pass
|
||||
|
||||
func generateBiomePos(biome: String,starterRoomSize: Vector2i) -> Vector2i:
|
||||
var genPos: Vector2i
|
||||
var possiblePos: Array[Vector2i]
|
||||
|
||||
#Find all possible Pos without a biome
|
||||
for x in levelGrid.size():
|
||||
for cell in levelGrid[x]:
|
||||
if !cell.biome:
|
||||
possiblePos.push_back(cell.position)
|
||||
|
||||
#Go through all pos untill one works
|
||||
genPos = possiblePos[rng.randi_range(0,possiblePos.size()-1)]
|
||||
while checkBiomeOverlap(biome,genPos,starterRoomSize.x,starterRoomSize.y):
|
||||
possiblePos.erase(genPos)
|
||||
genPos = possiblePos[rng.randi_range(0,possiblePos.size()-1)]
|
||||
|
||||
return genPos
|
||||
|
||||
#Biomes
|
||||
func getBiome(biomeName: String) -> Biome:
|
||||
for prio in currentMission.biomes.size():
|
||||
for biome in currentMission.biomes[prio]:
|
||||
if biome.name == biomeName:
|
||||
return biome
|
||||
return
|
||||
|
||||
func placeBiomes(biomes: Array[Biome]) -> Array[DoorPosition]:
|
||||
var returnDoorLists: Array[DoorPosition] = []
|
||||
|
||||
for biome in biomes:
|
||||
var starterRoomSize: Vector2i = Vector2i(biome.starterRoom.roomGrid.size(),biome.starterRoom.roomGrid[0].size())
|
||||
var generatePos: Vector2i = generateBiomePos(biome.name,starterRoomSize)
|
||||
|
||||
changeBiomeArea2D(biome.name,generatePos,starterRoomSize.x,starterRoomSize.y)
|
||||
|
||||
#Spawn Starter room and add doors to list
|
||||
var doorList: Array[DoorPosition]
|
||||
doorList = spawnRoom(biome.starterRoom,generatePos)
|
||||
returnDoorLists += doorList
|
||||
|
||||
return returnDoorLists
|
||||
|
||||
func fillCell(cellBiome: String,pos: Vector2i) -> GridCell:
|
||||
if isOutOfArray2DBounds(levelGrid.size(),levelGrid[0].size(),pos): return
|
||||
if !levelGrid[pos.x][pos.y].biome:
|
||||
levelGrid[pos.x][pos.y].biome = cellBiome
|
||||
return levelGrid[pos.x][pos.y]
|
||||
return
|
||||
|
||||
func spreadCell(cell: GridCell,pos: Vector2i) -> Array[GridCell]:
|
||||
var returnCells: Array[GridCell] = []
|
||||
returnCells.push_back(fillCell(cell.biome,pos + Vector2i(0,-1)))
|
||||
returnCells.push_back(fillCell(cell.biome,pos + Vector2i(1,0)))
|
||||
returnCells.push_back(fillCell(cell.biome,pos + Vector2i(0,1)))
|
||||
returnCells.push_back(fillCell(cell.biome,pos + Vector2i(-1,0)))
|
||||
while returnCells.has(null):
|
||||
returnCells.erase(null)
|
||||
return returnCells
|
||||
|
||||
func allCellsHaveBiome() -> bool:
|
||||
for x in levelGrid.size():
|
||||
for cell in levelGrid[x]:
|
||||
if !cell.biome: return false
|
||||
return true
|
||||
|
||||
func spreadBiomes() -> void:
|
||||
#Get all current biome grid cells -> Put them in starterCells
|
||||
var startCells: Array[GridCell] = []
|
||||
for x in levelGrid.size():
|
||||
for y in levelGrid[x].size():
|
||||
if levelGrid[x][y].biome:
|
||||
startCells.push_back(levelGrid[x][y])
|
||||
|
||||
#Spread them by one -> put the new ones in a new array
|
||||
while !allCellsHaveBiome():
|
||||
startCells.shuffle()
|
||||
var newCells: Array[GridCell] = []
|
||||
for cell in startCells:
|
||||
if rng.randf() * getBiome(cell.biome).spread > 0.49:
|
||||
newCells += spreadCell(cell,cell.position)
|
||||
else:
|
||||
newCells.push_back(cell)
|
||||
#New cells now contains all that were newly assigned a biome and the ones that didnt spread
|
||||
startCells = newCells
|
||||
|
||||
func placeRooms(doorList: Array[DoorPosition]) -> void:
|
||||
var nextDoors: Array[DoorPosition] = []
|
||||
|
||||
#YES I KNOW A DO WHILE LOOP IS BETTER HERE BUT GODOT DOESNT HAVE IT
|
||||
for door in doorList:
|
||||
var doorBiome: Biome = getBiome(levelGrid[door.pos.x][door.pos.y].biome)
|
||||
nextDoors += spawnRoomAtDoor(doorBiome.roomList.rooms,door,doorBiome.name)
|
||||
doorList = nextDoors
|
||||
|
||||
while !doorList.is_empty():
|
||||
for door in doorList:
|
||||
var doorBiome: Biome = getBiome(levelGrid[door.pos.x][door.pos.y].biome)
|
||||
nextDoors += spawnRoomAtDoor(doorBiome.roomList.rooms,door,doorBiome.name)
|
||||
doorList = nextDoors
|
||||
nextDoors = []
|
||||
|
||||
#Debug Functions
|
||||
func printLevelGrid() -> void:
|
||||
for x in levelGrid.size():
|
||||
for y in levelGrid[x].size():
|
||||
if levelGrid[x][y].spaceTaken:
|
||||
debugCubeAtPos(Vector2(x,y))
|
||||
|
||||
func printBiomeGrid() -> void:
|
||||
for x in levelGrid.size():
|
||||
for y in levelGrid[x].size():
|
||||
if levelGrid[x][y].biome == "test":
|
||||
debugCubeAtPos(Vector2(x,y))
|
||||
|
||||
func debugCubeAtPos(pos: Vector2):
|
||||
var debugCube: PackedScene = preload("res://test/debugCube.tscn")
|
||||
addObject(debugCube,self,Vector3(pos.x+0.5,0,pos.y+0.5))
|
||||
@@ -0,0 +1 @@
|
||||
uid://b808bc8l22smt
|
||||
@@ -0,0 +1 @@
|
||||
uid://enftc34b0t86
|
||||
@@ -0,0 +1,4 @@
|
||||
extends SkeletonIK3D
|
||||
|
||||
func _ready() -> void:
|
||||
start()
|
||||
@@ -0,0 +1,18 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://dwa766yx7axly"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cub0eem47ktoj" path="res://assets/2D/SteeringMinigame/Astroid.png" id="1_x4x3j"]
|
||||
[ext_resource type="Script" uid="uid://bdt2b0lde2vqk" path="res://scene/minigames/steering/astroid.gd" id="2_x64bv"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_x4x3j"]
|
||||
radius = 21.2132
|
||||
|
||||
[node name="Astroid" type="Sprite2D"]
|
||||
texture = ExtResource("1_x4x3j")
|
||||
script = ExtResource("2_x64bv")
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
shape = SubResource("CircleShape2D_x4x3j")
|
||||
|
||||
[connection signal="area_entered" from="Area2D" to="." method="_on_area_2d_area_entered"]
|
||||
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://1bkjenax2g3s"
|
||||
path="res://.godot/imported/Ambience 1 SpaceBots Audio.mp3-c69d0bcb5d16e80c0a5b5c8b44ac1b1c.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Audio/Ambience 1 SpaceBots Audio.mp3"
|
||||
dest_files=["res://.godot/imported/Ambience 1 SpaceBots Audio.mp3-c69d0bcb5d16e80c0a5b5c8b44ac1b1c.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 16 MiB |
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
uid://rywjg37p7ush
|
||||
@@ -0,0 +1 @@
|
||||
uid://ve2vtibvt77m
|
||||
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://05h4ut8n30e0"
|
||||
path="res://.godot/imported/Front.png-1a0be28f228305563864f23148c09992.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/2D/Front.png"
|
||||
dest_files=["res://.godot/imported/Front.png-1a0be28f228305563864f23148c09992.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=4
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
@@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://b3xdqyhicgrtk"
|
||||
path="res://.godot/imported/MainHangarExport.glb-ffd5971678b047352f89af4c67418643.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/3D/MainHangarExport.glb"
|
||||
dest_files=["res://.godot/imported/MainHangarExport.glb-ffd5971678b047352f89af4c67418643.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={}
|
||||
gltf/naming_version=1
|
||||
gltf/embedded_image_handling=1
|
||||
@@ -0,0 +1,53 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://m6ux1hg2ge40"
|
||||
path="res://.godot/imported/CorridorLTurn.blend-6412260df984ac36775cd74b6ef24f99.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/3D/Corriodors/CorridorLTurn.blend"
|
||||
dest_files=["res://.godot/imported/CorridorLTurn.blend-6412260df984ac36775cd74b6ef24f99.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,64 @@
|
||||
[gd_scene load_steps=7 format=4 uid="uid://7p668ibmmx21"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cww7fnikeau22" path="res://Maps/Spaceship/RoomScripts/corridor_dead_end.gd" id="1_1beyu"]
|
||||
[ext_resource type="Script" uid="uid://b7ma88dd5c5tb" path="res://Maps/Spaceship/Objects/flicker_omni_light_3d.gd" id="2_nbfqo"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_obqup"]
|
||||
|
||||
[sub_resource type="ArrayMesh" id="ArrayMesh_g7bps"]
|
||||
_surfaces = [{
|
||||
"aabb": AABB(-3.5, 0, -7, 7, 7, 14),
|
||||
"format": 34359742465,
|
||||
"index_count": 204,
|
||||
"index_data": PackedByteArray("AAABAAIAAAADAAEABAACAAEABQAAAAIABQADAAAABgACAAQABQACAAcABgAHAAIABAABAAgACAAGAAQACAABAAkAAwAJAAEACAAKAAYACAAJAAoABgALAAcACgALAAYADAAHAAsADAAFAAcADQALAAoACwANAAwACQAOAAoADQAKAA4ADwAOAAkADgAPAA0AAwAQAAkADwAJABAAAwAPABAAEQADAAUAAwARAA8ABQAMABEADwASAA0ADQATAAwADQASABMADAAUABEADAATABQAEQAVAA8AEQAUABUADwAVABIAEwAWABQAFgAVABQAEgAXABMAFgATABcAFQAYABIAGAAVABkAFwASABoAGgASABgAFgAXABsAFQAcABkAFgAcABUAGAAZAB0AHQAaABgAHAAdABkAFwAaAB4AHgAbABcAHwAaAB0AHwAeABoAHwAgAB4AHwAdACEAIAAfACEAHAAhAB0AHgAgACIAHgAiABsAIAAhACIAFgAbACIAIwAhABwAHAAWACMAIwAiACEAFgAiACMA"),
|
||||
"primitive": 3,
|
||||
"uv_scale": Vector4(0, 0, 0, 0),
|
||||
"vertex_count": 36,
|
||||
"vertex_data": PackedByteArray("AABgwAAAAAAAAODAAABgQJqZyUAAAODAAABgwJqZyUAAAODAAABgQAAAAAAAAODAMzMzwAAA4ECamcnAAABgwAAAAAAAAOBAMzMzwAAA4EAAAOBAAABgwJqZyUAAAOBAMzMzQAAA4ECamcnAAABgQJqZyUAAAOBAMzMzQAAA4EAAAOBAVlJAwCsp0EAAAOBAAQDAvwAAoEAAAOBAAQDAPwAAoEAAAOBAVlJAQCsp0EAAAOBAAQDAPwAAAAAAAOBAAABgQAAAAAAAAOBAAQDAvwAAAAAAAOBAAQDAPwAAoEBmZt5AAQDAvwAAoEBmZt5AAQDAv78tNz3SSN9AAQDAP78tNz3SSN9ACSdewJJ77DyEE99AVlJAwCsp0EBmZt5AVlJAQCsp0EBmZt5ACSdeQJJ77DyEE99Azz8yQDTa3kDY/d5AZ7RdwOgfyUDY/d5ACSdeQJB77DyEE9/AZ7RdQOgfyUDY/d5Azz8ywDTa3kDY/d5ASD0yQCWN3kCkHsnASD0ywCWN3kCkHsnA8epdQEz5yEB59d7A8epdwEz5yEB59d7ACSdewJB77DyEE9/A")
|
||||
}]
|
||||
blend_shape_mode = 0
|
||||
|
||||
[sub_resource type="ArrayMesh" id="ArrayMesh_1beyu"]
|
||||
resource_name = "CorridorDeadEnd_Cube_001"
|
||||
_surfaces = [{
|
||||
"aabb": AABB(-3.5, 0, -7, 7, 7, 14),
|
||||
"attribute_data": PackedByteArray("AADAPgAAQD+ZmRk/AAAAP5mZGT8AAEA/AADAPgAAAD8AAMA+AAAAP5mZGT8AAIA+mZkZPwAAAD8AAMA+AACAPgAAwD4AAAAA27YNPyBJkj1JkuQ+IEmSPZmZGT8AAAAAenkbP8DQkDzMzBw/wMxMPNu2DT9w2zY+AAAgP2hmZj4AACA/wMzMPHp5Gz/o5W0+SpLkPmzbNj6ZmRk/AACAPszMHD80M3M+AADAPgAAgD4AAMA+AAAAAAAAwD4AAAA/AADAPgAAQD9JkuQ+IEmSPUqS5D5s2zY+AADAPgAAgD4AAMA+AACAP5mZGT8AAEA/mZkZPwAAgD8AAMA+AABAPwAAID8AAIA/mZkZPwAAQD8AACA/MzNDP5mZGT8AAIA/AAAgP5qZOT+ZmRk/AAAAPwAAID9mZgY/mZkZPwAAQD9lZiY/nJn5PpmZGT8AAIA+ZmYmPwAAgD6ZmRk/AAAAP2VmJj+cmfk+mZlZPwIAgD6amVk/mJn5PmZmJj8AAIA+AADAPgAAQD+ZmRk/AAAAPwAAwD4AAAA/mZkZPwAAQD8AAMA+AAAAP5mZGT8AAIA+AADAPgAAgD6ZmRk/AAAAP9u2DT8gSZI9AADAPgAAAABJkuQ+IEmSPXp5Gz/A0JA8mZkZPwAAAAAAAMA+AAAAPwAAwD4AAAAAAADAPgAAQD9KkuQ+bNs2PgAAwD4AAIA+SZLkPiBJkj0AAMA+AACAP5mZGT8AAEA/AADAPgAAQD+ZmRk/AACAP9u2DT9w2zY+enkbP8DQkDzbtg0/IEmSPQAAID9oZmY+enkbP+jlbT4AACA/wMzMPEqS5D5s2zY+enkbP+jlbT7btg0/cNs2PgAAwD4AAIA+mZkZPwAAgD7MzBw/wMxMPJmZGT8AAAAAenkbP8DQkDyZmRk/AACAPszMHD80M3M+enkbP+jlbT4AACA/AACAP5mZGT8AAEA/mZkZPwAAgD8AACA/MzNDPwAAID+amTk/mZkZPwAAAD+ZmRk/AABAPwAAID9mZgY/ZWYmP5yZ+T6ZmRk/AACAPpmZGT8AAAA/ZmYmPwAAgD5lZiY/nJn5PpmZWT8CAIA+ZmYmPwAAgD6amVk/mJn5PkmS5D4gSZI9SpLkPmzbNj5KkuQ+bNs2PkmS5D4gSZI927YNPyBJkj1JkuQ+IEmSPUmS5D4gSZI927YNPyBJkj1KkuQ+bNs2Ptu2DT9w2zY+27YNP3DbNj5KkuQ+bNs2Ptu2DT9w2zY+27YNPyBJkj3btg0/IEmSPdu2DT9w2zY+"),
|
||||
"format": 34359742487,
|
||||
"index_count": 204,
|
||||
"index_data": PackedByteArray("AAABAAIAAAADAAEABAAFAAYABAAHAAUACAAJAAoACQAIAAsACQALAAwADQAMAAsADAAOAAkADgAMAA8ADwAMABAADgAPABEAEQASAA4AEgARABMAEwARABQAEgATABUAFgAXABgAGQAXABYAFwAZABoAFwAaABsAHAAdAB4AHAAfAB0AIAAhACIAIAAjACEAJAAlACYAJAAnACUAKAApACoAKAArACkALAAtAC4ALAAvAC0AMAAxADIAMAAzADEANAA1ADYANAA3ADUAOAA5ADoAOQA4ADsAOQA7ADwAPQA+AD8APgA9AEAAQAA9AEEAPgBAAEIAQwBEAEUAQwBGAEQARwBIAEkASABHAEoASgBHAEsASABKAEwATQBOAE8ATgBNAFAATgBQAFEAUgBTAFQAVQBWAFcAWABZAFoAWABbAFkAXABdAF4AXABfAF0AYABhAGIAYABjAGEAZABlAGYAZABnAGUAaABpAGoAaABrAGkAbABtAG4AbABvAG0AcABxAHIAcABzAHEAdAB1AHYAdAB3AHUA"),
|
||||
"material": SubResource("StandardMaterial3D_obqup"),
|
||||
"primitive": 3,
|
||||
"uv_scale": Vector4(0, 0, 0, 0),
|
||||
"vertex_count": 120,
|
||||
"vertex_data": PackedByteArray("AABgwAAAAAAAAODAAABgQJqZyUAAAODAAABgwJqZyUAAAODAAABgQAAAAAAAAODAAABgQAAAAAAAAODAAABgQJqZyUAAAOBAAABgQJqZyUAAAODAAABgQAAAAAAAAOBAAABgwAAAAAAAAOBAAQDAvwAAoEAAAOBAAQDAvwAAAAAAAOBAAABgwJqZyUAAAOBAVlJAwCsp0EAAAOBAMzMzwAAA4EAAAOBAAQDAPwAAoEAAAOBAMzMzQAAA4EAAAOBAMzMzwAAA4EAAAOBAVlJAQCsp0EAAAOBAAQDAPwAAAAAAAOBAAABgQJqZyUAAAOBAMzMzQAAA4EAAAOBAAABgQAAAAAAAAOBAAABgwAAAAAAAAOBAAABgQAAAAAAAAODAAABgwAAAAAAAAODAAQDAvwAAAAAAAOBAAQDAPwAAAAAAAOBAAABgQAAAAAAAAOBAAABgwAAAAAAAAOBAAABgwJqZyUAAAODAAABgwJqZyUAAAOBAAABgwAAAAAAAAODAMzMzwAAA4EAAAOBAAABgwJqZyUAAAODAMzMzwAAA4ECamcnAAABgwJqZyUAAAOBAMzMzwAAA4ECamcnAAABgQJqZyUAAAODAMzMzQAAA4ECamcnAAABgwJqZyUAAAODAMzMzQAAA4ECamcnAAABgQJqZyUAAAOBAMzMzQAAA4EAAAOBAAABgQJqZyUAAAODAMzMzQAAA4ECamcnAMzMzwAAA4EAAAOBAMzMzwAAA4ECamcnAMzMzQAAA4EAAAOBACSdewJB77DyEE9/A8epdQEz5yEB59d7ACSdeQJB77DyEE9/A8epdwEz5yEB59d7ACSdeQJB77DyEE9/AZ7RdQOgfyUDY/d5ACSdeQJJ77DyEE99A8epdQEz5yEB59d7AAQDAvwAAoEBmZt5ACSdewJJ77DyEE99AAQDAv78tNz3SSN9AVlJAwCsp0EBmZt5AZ7RdwOgfyUDY/d5ACSdeQJB77DyEE9/ACSdewJJ77DyEE99ACSdewJB77DyEE9/AAQDAP78tNz3SSN9ACSdeQJJ77DyEE99AAQDAv78tNz3SSN9ACSdewJJ77DyEE99A8epdwEz5yEB59d7ACSdewJB77DyEE9/AZ7RdwOgfyUDY/d5AAQDAPwAAoEBmZt5AVlJAwCsp0EBmZt5AAQDAvwAAoEBmZt5Azz8yQDTa3kDY/d5AVlJAQCsp0EBmZt5Azz8ywDTa3kDY/d5AAQDAP78tNz3SSN9AVlJAQCsp0EBmZt5AAQDAPwAAoEBmZt5ACSdeQJJ77DyEE99AZ7RdQOgfyUDY/d5Azz8ywDTa3kDY/d5AZ7RdwOgfyUDY/d5AVlJAwCsp0EBmZt5AZ7RdQOgfyUDY/d5Azz8yQDTa3kDY/d5AVlJAQCsp0EBmZt5Azz8ywDTa3kDY/d5A8epdwEz5yEB59d7AZ7RdwOgfyUDY/d5ASD0ywCWN3kCkHsnASD0ywCWN3kCkHsnA8epdQEz5yEB59d7A8epdwEz5yEB59d7ASD0yQCWN3kCkHsnASD0yQCWN3kCkHsnAZ7RdQOgfyUDY/d5A8epdQEz5yEB59d7Azz8yQDTa3kDY/d5ASD0yQCWN3kCkHsnAzz8ywDTa3kDY/d5Azz8yQDTa3kDY/d5ASD0ywCWN3kCkHsnAAQDAvwAAAAAAAOBAAQDAP78tNz3SSN9AAQDAPwAAAAAAAOBAAQDAv78tNz3SSN9AAQDAvwAAoEAAAOBAAQDAv78tNz3SSN9AAQDAvwAAAAAAAOBAAQDAvwAAoEBmZt5AAQDAPwAAAAAAAOBAAQDAPwAAoEBmZt5AAQDAPwAAoEAAAOBAAQDAP78tNz3SSN9AAQDAPwAAoEAAAOBAAQDAvwAAoEBmZt5AAQDAvwAAoEAAAOBAAQDAPwAAoEBmZt5A//////9//////////3//////////f/////////9///////9//3///////3//f///////f/9///////9//3////9//3//f////3//f/9//v//f/9//3////9//3+ziqX6/3//f2mWyfT/f/9/f7E+5/9//3//f/7//3//f/9//v//f/9//3/+//9//3+Vacn0/3//f/9/////f/9/S3Wl+v9//39/Tj7n/3//f/9/////fwAAqqr/v/9/AACqqv+//38AAP///7//fwAAqqr/v/9/AACqqv+//38AAAAAVRUAAP9//3///wAA/3//f///AAD/f/9///8AAP9//3////8//7//v//f/z//v/+//9//P/+//7//3/8//7//v//f/7////9//9//v////3//3/+/////f//f/7////9//9//v/+//z//3/+//7//P//f/7//v/8//9//v/+//z//3/9///8AAP+//3///wAA/7//f///AAD/v/9///8AAP+//3/rfwCACgD/f+t//n8KAP9/63/sfxMA/3/rfxKAEwAdAN5/4n8TAB0A3n/dfw4AHQDef9R/DgAdAN5/4n8YAHsAnwATfzgAewCfAGt/DAB7AJ8Ae4AAAHsAnwBafxQAewCfAJ+AEQAZgP//oKr3PxmA//+Aqvc/GYD//////78ZgP//kqr3PxmA//8RADGVGYD//5kX/T/h/95/IYAOAOH/3n8cgBMA4f/efxyAGADh/95/KoAOAJD+//8lfyIBkP7//zKCzQGQ/v///3+3AJD+//9lfoEBkP7//zp9FQKQ/v//P4TQAoP/nwDYgC4Ag/+fAIB/AQCD/58Ag38AAIP/nwDhgDMAg/+fAF9/EQCQCG736LJkGpAIbvfosmQakAhu9+iyZBpu9273Fk1kGm73bvcWTWQabvdu9xZNZBrIv9A/OsAVIMi/0D/ZwMUfyL/QPzLAGSDIv9A/5cC/H/9/nD8gf2kg/3+cP+qAbCD/f5w/935zIP9/nD9IgYMgNkDQPyc/xh82QNA/xD8VIDZA0D8iP8MfNkDQP8w/GSD/fxYAAAD/P/9/FgAAAP8//38WAAAA/z//fxYAAAD/P/9/qqr///8//3+qqv///z//f6qq////P/9/qqr///8/////f////7////9/////v////3////+/////f////78AAP9/////vwAA/3////+/AAD/f////78AAP9/////v/9/AAD///+//38AAP///7//fwAA////v/9/AAD///+/")
|
||||
}]
|
||||
blend_shape_mode = 0
|
||||
shadow_mesh = SubResource("ArrayMesh_g7bps")
|
||||
|
||||
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_pjmyq"]
|
||||
data = PackedVector3Array(-3.5, 0, -7, 3.5, 6.3, -7, -3.5, 6.3, -7, -3.5, 0, -7, 3.5, 0, -7, 3.5, 6.3, -7, 3.5, 0, -7, 3.5, 6.3, 7, 3.5, 6.3, -7, 3.5, 0, -7, 3.5, 0, 7, 3.5, 6.3, 7, -3.5, 0, 7, -1.5, 5, 7, -1.5, 0, 7, -1.5, 5, 7, -3.5, 0, 7, -3.5, 6.3, 7, -1.5, 5, 7, -3.5, 6.3, 7, -3.005, 6.505, 7, -2.8, 7, 7, -3.005, 6.505, 7, -3.5, 6.3, 7, -3.005, 6.505, 7, 1.5, 5, 7, -1.5, 5, 7, 1.5, 5, 7, -3.005, 6.505, 7, 2.8, 7, 7, 2.8, 7, 7, -3.005, 6.505, 7, -2.8, 7, 7, 1.5, 5, 7, 2.8, 7, 7, 3.005, 6.505, 7, 3.005, 6.505, 7, 1.5, 0, 7, 1.5, 5, 7, 1.5, 0, 7, 3.005, 6.505, 7, 3.5, 6.3, 7, 3.5, 6.3, 7, 3.005, 6.505, 7, 2.8, 7, 7, 1.5, 0, 7, 3.5, 6.3, 7, 3.5, 0, 7, -3.5, 0, 7, 3.5, 0, -7, -3.5, 0, -7, -1.5, 0, 7, 3.5, 0, -7, -3.5, 0, 7, 3.5, 0, -7, -1.5, 0, 7, 1.5, 0, 7, 3.5, 0, -7, 1.5, 0, 7, 3.5, 0, 7, -3.5, 0, 7, -3.5, 6.3, -7, -3.5, 6.3, 7, -3.5, 0, 7, -3.5, 0, -7, -3.5, 6.3, -7, -2.8, 7, 7, -3.5, 6.3, -7, -2.8, 7, -6.3, -2.8, 7, 7, -3.5, 6.3, 7, -3.5, 6.3, -7, -2.8, 7, -6.3, 3.5, 6.3, -7, 2.8, 7, -6.3, -2.8, 7, -6.3, -3.5, 6.3, -7, 3.5, 6.3, -7, 2.8, 7, -6.3, 3.5, 6.3, 7, 2.8, 7, 7, 2.8, 7, -6.3, 3.5, 6.3, -7, 3.5, 6.3, 7, 2.8, 7, -6.3, -2.8, 7, 7, -2.8, 7, -6.3, 2.8, 7, -6.3, 2.8, 7, 7, -2.8, 7, 7, -3.4711, 0.0289, -6.9711, 3.4675, 6.2804, -6.9675, 3.4711, 0.0289, -6.9711, -3.4711, 0.0289, -6.9711, -3.4675, 6.2804, -6.9675, 3.4675, 6.2804, -6.9675, 3.4711, 0.0289, -6.9711, 3.4641, 6.2851, 6.9685, 3.4711, 0.0289, 6.9711, 3.4711, 0.0289, -6.9711, 3.4675, 6.2804, -6.9675, 3.4641, 6.2851, 6.9685, -1.5, 5, 6.95, -3.4711, 0.0289, 6.9711, -1.5, 0.0447, 6.9776, -3.4711, 0.0289, 6.9711, -1.5, 5, 6.95, -3.005, 6.505, 6.95, -3.4711, 0.0289, 6.9711, -3.005, 6.505, 6.95, -3.4641, 6.2851, 6.9685, 3.4711, 0.0289, -6.9711, -3.4711, 0.0289, 6.9711, -3.4711, 0.0289, -6.9711, -3.4711, 0.0289, 6.9711, 3.4711, 0.0289, -6.9711, 1.5, 0.0447, 6.9776, 1.5, 0.0447, 6.9776, 3.4711, 0.0289, -6.9711, 3.4711, 0.0289, 6.9711, -3.4711, 0.0289, 6.9711, 1.5, 0.0447, 6.9776, -1.5, 0.0447, 6.9776, -3.4711, 0.0289, 6.9711, -3.4675, 6.2804, -6.9675, -3.4711, 0.0289, -6.9711, -3.4711, 0.0289, 6.9711, -3.4641, 6.2851, 6.9685, -3.4675, 6.2804, -6.9675, 1.5, 5, 6.95, -3.005, 6.505, 6.95, -1.5, 5, 6.95, -3.005, 6.505, 6.95, 1.5, 5, 6.95, 2.7851, 6.9641, 6.9685, 2.7851, 6.9641, 6.9685, 1.5, 5, 6.95, 3.005, 6.505, 6.95, -3.005, 6.505, 6.95, 2.7851, 6.9641, 6.9685, -2.7851, 6.9641, 6.9685, 1.5, 0.0447, 6.9776, 3.005, 6.505, 6.95, 1.5, 5, 6.95, 3.005, 6.505, 6.95, 1.5, 0.0447, 6.9776, 3.4711, 0.0289, 6.9711, 3.005, 6.505, 6.95, 3.4711, 0.0289, 6.9711, 3.4641, 6.2851, 6.9685, -2.7851, 6.9641, 6.9685, -3.4641, 6.2851, 6.9685, -3.005, 6.505, 6.95, 3.4641, 6.2851, 6.9685, 2.7851, 6.9641, 6.9685, 3.005, 6.505, 6.95, -2.7851, 6.9641, 6.9685, -3.4675, 6.2804, -6.9675, -3.4641, 6.2851, 6.9685, -2.7851, 6.9641, 6.9685, -2.785, 6.9547, -6.285, -3.4675, 6.2804, -6.9675, -2.785, 6.9547, -6.285, 3.4675, 6.2804, -6.9675, -3.4675, 6.2804, -6.9675, -2.785, 6.9547, -6.285, 2.785, 6.9547, -6.285, 3.4675, 6.2804, -6.9675, 2.785, 6.9547, -6.285, 3.4641, 6.2851, 6.9685, 3.4675, 6.2804, -6.9675, 2.785, 6.9547, -6.285, 2.7851, 6.9641, 6.9685, 3.4641, 6.2851, 6.9685, 2.785, 6.9547, -6.285, -2.7851, 6.9641, 6.9685, 2.7851, 6.9641, 6.9685, 2.785, 6.9547, -6.285, -2.785, 6.9547, -6.285, -2.7851, 6.9641, 6.9685, -1.5, 0, 7, 1.5, 0.0447, 6.9776, 1.5, 0, 7, -1.5, 0, 7, -1.5, 0.0447, 6.9776, 1.5, 0.0447, 6.9776, -1.5, 5, 7, -1.5, 0.0447, 6.9776, -1.5, 0, 7, -1.5, 5, 7, -1.5, 5, 6.95, -1.5, 0.0447, 6.9776, 1.5, 0, 7, 1.5, 5, 6.95, 1.5, 5, 7, 1.5, 0, 7, 1.5, 0.0447, 6.9776, 1.5, 5, 6.95, 1.5, 5, 7, -1.5, 5, 6.95, -1.5, 5, 7, 1.5, 5, 7, 1.5, 5, 6.95, -1.5, 5, 6.95)
|
||||
|
||||
[node name="CorridorDeadEnd" type="Node3D" node_paths=PackedStringArray("Lights")]
|
||||
script = ExtResource("1_1beyu")
|
||||
Lights = [NodePath("OmniLight3D")]
|
||||
metadata/_custom_type_script = "uid://lmn08s8c5lfo"
|
||||
|
||||
[node name="Cube" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1.19249e-08, 0, -1, 0, 1, 0, 1, 0, 1.19249e-08, 3.5, 0, 0)
|
||||
mesh = SubResource("ArrayMesh_1beyu")
|
||||
skeleton = NodePath("")
|
||||
metadata/extras = {
|
||||
"poliigon_props": {}
|
||||
}
|
||||
|
||||
[node name="StaticBody3D" type="StaticBody3D" parent="Cube"]
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Cube/StaticBody3D"]
|
||||
shape = SubResource("ConcavePolygonShape3D_pjmyq")
|
||||
debug_fill = false
|
||||
|
||||
[node name="OmniLight3D" type="OmniLight3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.1751, 5.51291, 0)
|
||||
omni_range = 10.0
|
||||
script = ExtResource("2_nbfqo")
|
||||
metadata/_custom_type_script = "uid://b7ma88dd5c5tb"
|
||||
@@ -0,0 +1,5 @@
|
||||
extends Node
|
||||
class_name RandomObject
|
||||
|
||||
@export var dir: String
|
||||
@export var probability: float #Value between 0 and 1
|
||||
Binary file not shown.
@@ -0,0 +1,61 @@
|
||||
class_name PerformancesDisplay extends Node
|
||||
|
||||
|
||||
const CORE_CPU_DSP_CATEGORY = "FMOD [Core]/Cpu DSP"
|
||||
const CORE_CPU_GEOMETRY_CATEGORY = "FMOD [Core]/Cpu Geometry"
|
||||
const CORE_CPU_STREAM_CATEGORY = "FMOD [Core]/Cpu Stream"
|
||||
const CORE_CPU_UPDATE_CATEGORY = "FMOD/[Core] Cpu Update"
|
||||
const CORE_CPU_CONVOLUTION_THREAD1_CATEGORY = "FMOD/[Core] Cpu convolution Thread 1"
|
||||
const CORE_CPU_CONVOLUTION_THREAD2_CATEGORY = "FMOD/[Core] Cpu convolution Thread 2"
|
||||
|
||||
const STUDIO_CPU_UPDATE_CATEGORY = "FMOD/[Studio] Cpu Update"
|
||||
|
||||
const MEMORY_CURRENTLY_ALLOCATED_CATEGORY = "FMOD/[Memory] Currently allocated"
|
||||
const MEMORY_MAX_ALLOCATED_CATEGORY = "FMOD/[Memory] Max allocated"
|
||||
|
||||
const FILE_SAMPLE_CATEGORY = "FMOD/[File] Sample bytes read"
|
||||
const FILE_STREAM_CATEGORY = "FMOD/[File] Stream bytes read"
|
||||
const FILE_OTHER_CATEGORY = "FMOD/[File] Other bytes read"
|
||||
|
||||
func _enter_tree():
|
||||
var performance_data: FmodPerformanceData = FmodServer.get_performance_data()
|
||||
add_monitor(CORE_CPU_DSP_CATEGORY, func(): return performance_data.dsp)
|
||||
add_monitor(CORE_CPU_GEOMETRY_CATEGORY, func(): return performance_data.geometry)
|
||||
add_monitor(CORE_CPU_STREAM_CATEGORY, func(): return performance_data.stream)
|
||||
add_monitor(CORE_CPU_UPDATE_CATEGORY, func(): return performance_data.update)
|
||||
add_monitor(CORE_CPU_CONVOLUTION_THREAD1_CATEGORY, func(): return performance_data.convolution1)
|
||||
add_monitor(CORE_CPU_CONVOLUTION_THREAD2_CATEGORY, func(): return performance_data.convolution2)
|
||||
|
||||
add_monitor(STUDIO_CPU_UPDATE_CATEGORY, func(): return performance_data.studio)
|
||||
|
||||
add_monitor(MEMORY_CURRENTLY_ALLOCATED_CATEGORY, func(): return performance_data.currently_allocated)
|
||||
add_monitor(MEMORY_MAX_ALLOCATED_CATEGORY, func(): return performance_data.max_allocated)
|
||||
|
||||
add_monitor(FILE_SAMPLE_CATEGORY, func(): return performance_data.sample_bytes_read)
|
||||
add_monitor(FILE_STREAM_CATEGORY, func(): return performance_data.stream_bytes_read)
|
||||
add_monitor(FILE_OTHER_CATEGORY, func(): return performance_data.other_bytes_read)
|
||||
|
||||
func _exit_tree() -> void:
|
||||
remove_monitor(CORE_CPU_DSP_CATEGORY)
|
||||
remove_monitor(CORE_CPU_GEOMETRY_CATEGORY)
|
||||
remove_monitor(CORE_CPU_STREAM_CATEGORY)
|
||||
remove_monitor(CORE_CPU_UPDATE_CATEGORY)
|
||||
remove_monitor(CORE_CPU_CONVOLUTION_THREAD1_CATEGORY)
|
||||
remove_monitor(CORE_CPU_CONVOLUTION_THREAD2_CATEGORY)
|
||||
|
||||
remove_monitor(STUDIO_CPU_UPDATE_CATEGORY)
|
||||
|
||||
remove_monitor(MEMORY_CURRENTLY_ALLOCATED_CATEGORY)
|
||||
remove_monitor(MEMORY_MAX_ALLOCATED_CATEGORY)
|
||||
|
||||
remove_monitor(FILE_SAMPLE_CATEGORY)
|
||||
remove_monitor(FILE_STREAM_CATEGORY)
|
||||
remove_monitor(FILE_OTHER_CATEGORY)
|
||||
|
||||
func add_monitor(title: String, callable: Callable) -> void:
|
||||
if not Performance.has_custom_monitor(title):
|
||||
Performance.add_custom_monitor(title, callable)
|
||||
|
||||
func remove_monitor(title: String) -> void:
|
||||
if Performance.has_custom_monitor(title):
|
||||
Performance.remove_custom_monitor(title)
|
||||
Binary file not shown.
@@ -0,0 +1,122 @@
|
||||
extends Node
|
||||
|
||||
signal noray_connected
|
||||
signal player_ready(id : int)
|
||||
const NORAY_ADDRESS = "tomfol.io"
|
||||
const NORAY_PORT = 8890
|
||||
|
||||
var is_host = false
|
||||
var external_oid = ""
|
||||
var debug = false
|
||||
|
||||
var playerDict: Dictionary[int,PlayerCharacter]
|
||||
var alivePlayerDict: Dictionary[int,PlayerCharacter]
|
||||
var currentMapLogic: MapLogic
|
||||
|
||||
@onready var errordialog = $/root/Main/Dialogs/ErrorDialog
|
||||
@onready var start_btn : Button = $/root/Main/Mainmenu/Menu/MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer3/Start
|
||||
@onready var main : Main = $/root/Main
|
||||
func _ready():
|
||||
Noray.on_connect_to_host.connect(on_noray_connected)
|
||||
Noray.on_connect_nat.connect(handle_nat_connection)
|
||||
#Noray.on_connect_relay.connect(handle_relay_connection)
|
||||
|
||||
Noray.connect_to_host(NORAY_ADDRESS, NORAY_PORT)
|
||||
player_ready.connect(peer_connected)
|
||||
multiplayer.peer_disconnected.connect(peer_disconnected)
|
||||
func getCurrentMapLogic() -> MapLogic:
|
||||
return currentMapLogic
|
||||
func setCurrentMapLogic(toMap: MapLogic) -> void:
|
||||
currentMapLogic = toMap
|
||||
|
||||
func peer_connected(id: int) -> void:
|
||||
if !get_node("/root/Main/Players").get_child_count(): return
|
||||
|
||||
playerDict.set(id,get_node("/root/Main/Players/" + str(id)))
|
||||
alivePlayerDict.set(id,get_node("/root/Main/Players/" + str(id)))
|
||||
if !playerDict.get(id): playerDict.erase(id)
|
||||
if !alivePlayerDict.get(id): alivePlayerDict.erase(id)
|
||||
|
||||
func peer_disconnected(id: int) -> void:
|
||||
playerDict.erase(id)
|
||||
alivePlayerDict.erase(id)
|
||||
|
||||
|
||||
func on_noray_connected():
|
||||
print("Connected to Noray server")
|
||||
|
||||
Noray.register_host()
|
||||
await Noray.on_pid
|
||||
await Noray.register_remote()
|
||||
start_btn.disabled = false
|
||||
noray_connected.emit()
|
||||
|
||||
func host():
|
||||
var peer = ENetMultiplayerPeer.new()
|
||||
var error = OK
|
||||
if debug:
|
||||
error = peer.create_server(1069)
|
||||
else:
|
||||
error = peer.create_server(Noray.local_port)
|
||||
if error:
|
||||
errordialog.title = "Error"
|
||||
errordialog.dialog_text = "Failed to create Server: " + str(error_string(error) + " (" + str(error) + ")")
|
||||
errordialog.popup_centered()
|
||||
errordialog.get_ok_button().grab_focus()
|
||||
main.close_network()
|
||||
else:
|
||||
multiplayer.multiplayer_peer = peer
|
||||
is_host = true
|
||||
|
||||
func join(oid: String):
|
||||
if debug:
|
||||
var peer = ENetMultiplayerPeer.new()
|
||||
var error = peer.create_client("localhost", 1069)
|
||||
print("Join: " + error_string(error) + " " + str(error))
|
||||
multiplayer.multiplayer_peer = peer
|
||||
return
|
||||
Noray.connect_nat(oid)
|
||||
external_oid = oid
|
||||
|
||||
func handle_nat_connection(address, port):
|
||||
var err = await connect_to_server(address, port)
|
||||
|
||||
if err != OK && !is_host:
|
||||
print("NAT failed, using relay")
|
||||
err = Noray.connect_relay(external_oid)
|
||||
|
||||
return err
|
||||
|
||||
func handle_relay_connection(address, port):
|
||||
return await connect_to_server(address, port)
|
||||
|
||||
func connect_to_server(address, port):
|
||||
var err = OK
|
||||
if !is_host:
|
||||
var udp = PacketPeerUDP.new()
|
||||
udp.bind(Noray.local_port)
|
||||
udp.set_dest_address(address, port)
|
||||
|
||||
err = await PacketHandshake.over_packet_peer(udp)
|
||||
udp.close()
|
||||
|
||||
if err != OK:
|
||||
if err != ERR_BUSY:
|
||||
print("Handshake failed")
|
||||
return err
|
||||
else:
|
||||
print("Handshake success")
|
||||
|
||||
var peer = ENetMultiplayerPeer.new()
|
||||
err = peer.create_client(address, port, 0, 0, 0, Noray.local_port)
|
||||
|
||||
if err != OK:
|
||||
return err
|
||||
|
||||
multiplayer.multiplayer_peer = peer
|
||||
|
||||
return OK
|
||||
else:
|
||||
err = await PacketHandshake.over_enet(multiplayer.multiplayer_peer.host, address, port)
|
||||
|
||||
return err
|
||||
@@ -0,0 +1,9 @@
|
||||
<svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 21" width="20" height="21">
|
||||
<title>banks_icon</title>
|
||||
<defs>
|
||||
<image width="20" height="21" id="img1" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAVCAMAAABxCz6aAAAAAXNSR0IB2cksfwAAAapQTFRFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHR0dT09PUlJSWFhYV1dXUVFRS0tLKCgoAAAAAAAAAAAACgoKdnZ2kpKSjo6OjY2NkZGRh4eHAAAAAAAAAAAAAAAAGBgYVlZWUFBQMTExAAAAAAAABwcHKysrLCwsLi4uLS0tLy8vERERAAAAAAAAPDw8hoaGhYWFeXl5eHh4gYGBiYmJXFxcAAAAQUFBiIiIgICAhISEgoKCFRUVCAgIODg4dXV1YGBgAAAAQEBAg4ODe3t7ISEhEhISXV1dPz8/FhYWZmZmJCQkDAwMYmJiX19fIiIiJiYmf39/j4+PTU1NioqKCQkJbGxsMjIyd3d3fX19dHR0fn5+GhoaPj4+cnJyMzMzWlpaY2NjTk5OGxsbi4uLDQ0NZ2dnDg4OcXFxGRkZKioqZGRkfHx8EBAQW1tbAgICOzs7Q0NDHx8fCwsLREREcHBwR0dHaGhoSUlJFxcXJycnQkJCbm5uWVlZjIyMAAAAAAAAGhoaX19fMjIyAAAAAAAAAAAAAAAAnoaMsQAAAI50Uk5TABGKrbq9wcrJxa+THwrA///////////WGpv/////////wwlU//////+OxP/////////ly///////////6P/////////////n/////////////////////////////////////////////////////////////////////////////v///+a05vn2NoXh4LvdJzEAAAFmSURBVHicY2BgYGRiZmFlY+fgYOdkZeXi5mEAAl4+fgEBQSFhIBAREBAVE5cACkpKScvIykGArKy8Ar+iEoOyiqqaOhJQ01DRZNDS1tHVAQJdPT19EK1jYGjEYGwiZ2pqqiBnZm5hKWcFZMpZ2zBw2NrZ2zs4ijpJORu6uJra25u6uTNweNjZe3p5+/j6+QcEBgUr2JuGgAUtHUPDwiMi+aPsRKNjHKCCCoIqsXGm8QkKiYIqYaYQQSvLpORYj5RUg7T00IzMODuwYJZrdoqVY6CKSraXQ5RYjhVEMCE3L8ouX0UlOt7KtKAwCiwYVVQcUiJQEl1allMeV5FnBbUotjKoys612rTQKVfVXgEi6FDtXCZnF1zjIFuoIgq13c7etDbIILGu3rLOuRzueKDX8hpyg0p96oUULCGCjbLAUIiKamoWDjBtATJb0lsZ2to73EKAID0goBDC6ORk6Opm70EBvVrKAPo3aJSuHMDoAAAAAElFTkSuQmCC"/>
|
||||
</defs>
|
||||
<style>
|
||||
</style>
|
||||
<use id="Background" href="#img1" x="0" y="0"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
@@ -0,0 +1,38 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://o2chsr07oeqs"
|
||||
path="res://.godot/imported/bank_icon.svg-8de6c7bff09a67352e162b3c61b601de.ctex"
|
||||
metadata={
|
||||
"has_editor_variant": true,
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/fmod/icons/bank_icon.svg"
|
||||
dest_files=["res://.godot/imported/bank_icon.svg-8de6c7bff09a67352e162b3c61b601de.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=true
|
||||
editor/convert_colors_with_editor_theme=true
|
||||
@@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://bu2k5m2goye0i"
|
||||
path="res://.godot/imported/PCB.glb-91ec23b12cefdfbade05cd7fa81514d9.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/3D/PCB.glb"
|
||||
dest_files=["res://.godot/imported/PCB.glb-91ec23b12cefdfbade05cd7fa81514d9.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={}
|
||||
gltf/naming_version=1
|
||||
gltf/embedded_image_handling=1
|
||||
@@ -0,0 +1,2 @@
|
||||
extends BasicRoom
|
||||
class_name Starter
|
||||
@@ -0,0 +1,351 @@
|
||||
extends CharacterBody3D
|
||||
class_name PlayerCharacter
|
||||
|
||||
var aceleration: float = 4.32 #Current aceleration
|
||||
var maxSpeed: float = 6.2 #Maximum Speed
|
||||
var sprintSpeed: float = 3.34 #Additional Speed gained while Sprinting
|
||||
var slowdownSpeedLimit: float = 0.8 #How fast the player can go when slowed
|
||||
var gear: String = "neutral" #Weather the player is going forward, backward or standing still
|
||||
var isMoving: bool = false
|
||||
var slowed: bool = false
|
||||
|
||||
var momentum: float = 0
|
||||
var newMoveDirection: Vector3 = Vector3(0,0,0)
|
||||
var moveDirection: Vector3 = Vector3(0,0,0)
|
||||
var deceleration: float = 5.56
|
||||
|
||||
var turnSpeed: float = PI/2 #Speed at wich body turn sideways
|
||||
var handling: float = 0.67
|
||||
var facingDirection = Vector2(0,1) #Where the legs are facing
|
||||
var sprinting = false #While Player is sprinting
|
||||
var sprintEnergy: float = 100 #Energy used for Sprinting
|
||||
var sprintEnergyInitialUse: float = 4.5 #How much % sprint energy is used immediatly when initiating a sprint
|
||||
var sprintEnergyUse: float = 17.5 #How much % energy is used per 1 sec of sprint
|
||||
var sprintEnergyGain: float = 30 #How much % energy is gained per 1 sec of recovery
|
||||
|
||||
var maxDriftAngle = 0.12 #Quaternion(0,0,0.06,0.998).normalized() #How much the playesr turns to the side while drifting (radians)
|
||||
var rightLeftLean: float = 0.0 #How much the player leans right or left from -1 to 1 with negative numbers being left and 0 being no lean
|
||||
|
||||
var currentControlState: int = 0
|
||||
enum controls {DEFAULT,STANDARD_MINIGAME}
|
||||
|
||||
var health: float = 100.0
|
||||
var invoulnerable: bool = false
|
||||
var alive: bool = true
|
||||
|
||||
@onready var camera: Camera3D = $CameraPivot/Camera3D
|
||||
@onready var cameraPivot: Marker3D = $CameraPivot
|
||||
|
||||
@onready var flashlight: SpotLight3D = $CameraPivot/Camera3D/flashlight
|
||||
|
||||
|
||||
@onready var backlightR := $pivot/BodyPivot/body/BacklightR
|
||||
@onready var backlightL := $pivot/BodyPivot/body/BacklightL
|
||||
|
||||
@onready var pivot: = $pivot
|
||||
@onready var headPivot: = $pivot/HeadBinoculars/HeadPivot
|
||||
@onready var headBinoculars: = $pivot/HeadBinoculars
|
||||
@onready var legs := $pivot/BodyPivot/CaterpillarLegs
|
||||
@onready var body: = $pivot/BodyPivot/body
|
||||
|
||||
@onready var hud = $/root/Main/Hud
|
||||
@onready var interactCross := $/root/Main/Hud/InteractCross
|
||||
@onready var sprintBar := $/root/Main/Hud/TextureProgressBar
|
||||
|
||||
@onready var grabRaycast: = $CameraPivot/Camera3D/GrabDetector
|
||||
@onready var grabPivot: = $pivot/BodyPivot/body/GrabPivot
|
||||
@onready var grabBox: = $pivot/BodyPivot/body/GrabBox
|
||||
var grabbedObject: GrabableObject
|
||||
|
||||
@onready var interactRaycast = $CameraPivot/Camera3D/InteractDetector
|
||||
@onready var VoiceChat = $VoiceChat
|
||||
|
||||
@onready var bodyPivot: Node3D = $pivot/BodyPivot
|
||||
var mouseSensetivity := 0.1 #How much mouse movement affects ingame camera movement
|
||||
|
||||
var spectatorScene: PackedScene = preload("res://actors/Player/Spectator.tscn")
|
||||
var spectatorParent: Node3D
|
||||
|
||||
var mapLogic: MapLogic
|
||||
|
||||
#Camera Shake Stuff
|
||||
var traumaReductionRate:float = 0.34
|
||||
var trauma: float = 0
|
||||
@export var maxX = 12
|
||||
@export var maxY = 12
|
||||
@export var maxZ = 7
|
||||
@export var shakeIntensety : float = 7.0
|
||||
var time: float = 0
|
||||
@export var noise: Noise
|
||||
var noiseSpeed: float = 50
|
||||
var initialRotation = rotation_degrees as Vector3
|
||||
# Camera Shake Stuff end
|
||||
|
||||
func _enter_tree() -> void:
|
||||
set_multiplayer_authority(name.to_int())
|
||||
if is_multiplayer_authority():
|
||||
$CameraPivot/Camera3D.make_current()
|
||||
$pivot/HeadBinoculars.hide()
|
||||
$/root/Main/Hud/TextureProgressBar.show()
|
||||
|
||||
func _ready() -> void:
|
||||
Multiplayer.player_ready.emit(int(name))
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
mapLogic = Multiplayer.currentMapLogic
|
||||
spectatorParent = get_node("/root/Main/Spectators")
|
||||
if mapLogic:
|
||||
mapLogic.onCollision.connect(onCollision)
|
||||
if is_multiplayer_authority():
|
||||
position.y += 2
|
||||
return
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if not is_multiplayer_authority(): return
|
||||
if not alive: return
|
||||
|
||||
if invoulnerable and trauma == 0.0:
|
||||
invoulnerable = false
|
||||
|
||||
if Input.is_action_just_pressed("debug"): ##Debug
|
||||
die()
|
||||
|
||||
match currentControlState:
|
||||
controls.DEFAULT:
|
||||
regularControlsIdle(delta)
|
||||
controls.STANDARD_MINIGAME:
|
||||
standardMinigameControlsIdle(delta)
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if not is_multiplayer_authority(): return
|
||||
if not alive: return
|
||||
|
||||
match currentControlState:
|
||||
controls.DEFAULT:
|
||||
regularControlsPhysics(delta)
|
||||
controls.STANDARD_MINIGAME:
|
||||
endOfPhysicsCleanup(delta)
|
||||
|
||||
func standardMinigameControlsIdle(_delta:float):
|
||||
if Input.is_action_just_pressed("moveDown") or Input.is_action_just_pressed("interact"):
|
||||
currentControlState = controls.DEFAULT
|
||||
|
||||
func regularControlsIdle(_delta:float):
|
||||
#Interacting Logic
|
||||
var InteractCollider: InteractBox = interactRaycast.get_collider()
|
||||
|
||||
if InteractCollider and Input.is_action_just_pressed("interact"):
|
||||
InteractCollider.playerRef = self
|
||||
InteractCollider.interact()
|
||||
if InteractCollider.type == "minigame":
|
||||
currentControlState = controls.STANDARD_MINIGAME
|
||||
momentum = 0
|
||||
|
||||
#Grabbing Logic
|
||||
var GrabCollider: GrabBox = grabRaycast.get_collider()
|
||||
var grabBoxCollider: Array[Area3D] = grabBox.get_overlapping_areas()
|
||||
|
||||
|
||||
if(grabBoxCollider and Input.is_action_just_pressed("interact") and !grabbedObject):
|
||||
if grabBoxCollider.has(GrabCollider): #If the player is looking at an object and it is in the grab box
|
||||
grabbedObject = GrabCollider.grab()
|
||||
else:
|
||||
#If the player is not looking at an object, grab the closet one in the grab box
|
||||
var closestObj: GrabBox
|
||||
var distanceToClosestObj: float = 100
|
||||
for grabObj in grabBoxCollider:
|
||||
if (getDistance(self,grabObj) < distanceToClosestObj):
|
||||
closestObj = grabObj
|
||||
distanceToClosestObj = getDistance(self, grabObj)
|
||||
grabbedObject = closestObj.grab()
|
||||
|
||||
if InteractCollider or grabBoxCollider:
|
||||
interactCross.show()
|
||||
else:
|
||||
interactCross.hide()
|
||||
|
||||
if Input.is_action_just_pressed("flashlight"):
|
||||
flashlight.visible = !flashlight.visible
|
||||
|
||||
if grabbedObject:
|
||||
grabbedObject.global_position = grabPivot.global_position# + grabbedObject.grabPositionPositionOffset
|
||||
grabbedObject.rotation = grabPivot.global_rotation + grabbedObject.grabPositionRotationOffset
|
||||
if grabbedObject.grabBox.heavy: slowed = true
|
||||
if Input.is_action_just_pressed("drop"):
|
||||
grabbedObject.release.rpc()
|
||||
grabbedObject = null
|
||||
slowed = false
|
||||
momentum = 0
|
||||
|
||||
if Input.is_action_just_pressed("throw"):
|
||||
grabbedObject.release.rpc()
|
||||
grabbedObject.throw.rpc_id(1,facingDirection.x,facingDirection.y,camera.rotation.x)
|
||||
grabbedObject = null
|
||||
slowed = false
|
||||
momentum = 0
|
||||
|
||||
func regularControlsPhysics(delta: float):
|
||||
isMoving = false
|
||||
|
||||
#Drain energy on sprint start to prevent the player from pressing sprint every other frame to get infinity energy
|
||||
if Input.is_action_just_pressed("Sprint"):
|
||||
sprintEnergy = clamp(sprintEnergy - sprintEnergyInitialUse, -(sprintEnergyInitialUse*2) , 100)
|
||||
|
||||
# Rest of sprint energy logic
|
||||
if Input.is_action_pressed("Sprint"):
|
||||
sprintEnergy = clamp(sprintEnergy - sprintEnergyUse * delta, 0 , 100) # Drain sprint when holding the button
|
||||
|
||||
if sprintEnergy > 0:
|
||||
sprinting = true
|
||||
else:
|
||||
sprinting = false
|
||||
|
||||
else:
|
||||
sprinting = false
|
||||
sprintEnergy = clamp(sprintEnergy + sprintEnergyGain * delta, -(sprintEnergyInitialUse*2) , 100) # Gain sprint when not holding the button
|
||||
|
||||
|
||||
if not is_on_floor(): velocity += get_gravity()
|
||||
|
||||
newMoveDirection = Vector3(0,0,0)
|
||||
|
||||
# Set moveDirection based on input
|
||||
if Input.is_action_pressed("moveUp") and !Input.is_action_pressed("moveDown"):
|
||||
isMoving = true
|
||||
newMoveDirection += Vector3(facingDirection.x,0,facingDirection.y)
|
||||
if Input.is_action_pressed("moveRight") and !Input.is_action_pressed("moveLeft"):
|
||||
newMoveDirection -= Vector3(facingDirection.x,0,facingDirection.y).rotated(up_direction,PI/2)
|
||||
if Input.is_action_pressed("moveLeft") and !Input.is_action_pressed("moveRight"):
|
||||
newMoveDirection += Vector3(facingDirection.x,0,facingDirection.y).rotated(up_direction,PI/2)
|
||||
if Input.is_action_pressed("moveDown") and !Input.is_action_pressed("moveUp"):
|
||||
isMoving = true
|
||||
newMoveDirection += Vector3(facingDirection.x,0,facingDirection.y)
|
||||
showBacklights()
|
||||
else:
|
||||
hideBacklights()
|
||||
|
||||
|
||||
if newMoveDirection != Vector3(0,0,0):
|
||||
moveDirection = clampVectorLength(moveDirection + newMoveDirection*delta,0,handling)
|
||||
|
||||
|
||||
endOfPhysicsCleanup(delta)
|
||||
|
||||
#Momentum stuff
|
||||
if isMoving:
|
||||
if Input.is_action_pressed("moveDown"):
|
||||
momentum = clamp(momentum + -aceleration*2 * delta,-maxSpeed/2,maxSpeed)
|
||||
else:
|
||||
momentum = clamp(momentum + aceleration * delta,-maxSpeed/2,maxSpeed)
|
||||
else:
|
||||
if momentum >= 0:
|
||||
momentum = clamp(momentum - deceleration * delta,-maxSpeed/2,maxSpeed)
|
||||
if momentum < 0:
|
||||
momentum = clamp(momentum + deceleration * delta,-maxSpeed/2,maxSpeed)
|
||||
|
||||
if sprinting and isMoving and !Input.is_action_pressed("moveDown"):
|
||||
velocity = clampVectorLength(moveDirection.normalized() * (momentum + sprintSpeed),0,maxSpeed+sprintSpeed)
|
||||
else:
|
||||
velocity = clampVectorLength(moveDirection.normalized() * momentum,0,maxSpeed)
|
||||
|
||||
bodyPivot.rotation.y = rotate_toward(bodyPivot.rotation.y, -atan2(moveDirection.z,moveDirection.x) + PI/2,delta*turnSpeed)
|
||||
#print(facingDirection.length())
|
||||
move_and_slide() #applies movement
|
||||
|
||||
func endOfPhysicsCleanup(delta: float):
|
||||
trauma = max(trauma-delta*traumaReductionRate,0)
|
||||
time += delta
|
||||
rotation_degrees.x = initialRotation.x + maxX * getShakeIntensity() * getNoiseFromSeed(343)
|
||||
rotation_degrees.y = initialRotation.y + maxY * getShakeIntensity() * getNoiseFromSeed(123)
|
||||
rotation_degrees.z = initialRotation.z + maxZ * getShakeIntensity() * getNoiseFromSeed(234)
|
||||
#Rotate head based on camera movement
|
||||
headPivot.rotation.y = cameraPivot.rotation.y
|
||||
headPivot.rotation.x = -camera.rotation.x
|
||||
if trauma == 0.0:
|
||||
headPivot.rotation.z = 0.0
|
||||
headBinoculars.rotation.z = 0.0
|
||||
sprintBar.value = sprintEnergy
|
||||
|
||||
|
||||
func showBacklights() -> void:
|
||||
backlightL.show()
|
||||
backlightR.show()
|
||||
|
||||
func hideBacklights() -> void:
|
||||
backlightL.hide()
|
||||
backlightR.hide()
|
||||
|
||||
|
||||
|
||||
|
||||
func useSprintEnergy(delta: float):
|
||||
sprintEnergy = clamp(sprintEnergy - sprintEnergyUse * delta, 0, 100)
|
||||
|
||||
func setRightLeftLean(direction: int, strength: float, delta: float) -> void:
|
||||
if direction > 0 and rightLeftLean < 0:
|
||||
rightLeftLean = 0
|
||||
elif direction < 0 and rightLeftLean > 0:
|
||||
rightLeftLean = 0
|
||||
rightLeftLean = clamp(rightLeftLean + strength * delta * direction,-1,1)
|
||||
|
||||
func getAngleBetweenVectors(a: Vector3, b: Vector3) -> float:
|
||||
if a.length() == 0 or b. length() == 0:
|
||||
return 0
|
||||
return acos((a.dot(b)/(a.length()*b.length())))
|
||||
|
||||
func getDistance(a: Node3D, b: Node3D) -> float:
|
||||
var distanceVector: Vector3
|
||||
distanceVector = b.global_position - a.global_position
|
||||
return distanceVector.length()
|
||||
|
||||
func clampVectorLength(Vector: Vector3, minLength: float, maxLength: float) -> Vector3:
|
||||
#scales Vector up/ down to the max/ min length givin. If the Vector has a length of 0 it will be returned without being scaled.
|
||||
if Vector.length() == 0: return Vector
|
||||
if Vector.length() < minLength:
|
||||
return Vector * minLength / Vector.length()
|
||||
elif Vector.length() > maxLength:
|
||||
return Vector * maxLength / Vector.length()
|
||||
return Vector
|
||||
|
||||
func onCollision() -> void:
|
||||
trauma = 1
|
||||
|
||||
func addTrauma(traumaAmount: float):
|
||||
trauma = clamp(trauma+traumaAmount,0,1)
|
||||
|
||||
func getShakeIntensity() -> float:
|
||||
return shakeIntensety * trauma * trauma
|
||||
|
||||
func getNoiseFromSeed(seed_: int) -> float:
|
||||
noise.seed = seed_
|
||||
return noise.get_noise_1d(time*noiseSpeed)
|
||||
|
||||
func _input(event: InputEvent) -> void: #Camera movement with mouse
|
||||
if event is InputEventMouseMotion && Input.mouse_mode == 2:
|
||||
camera.rotation.x -= clamp(deg_to_rad(event.relative.y * mouseSensetivity),-180,180)
|
||||
cameraPivot.rotation.y -= deg_to_rad(event.relative.x * mouseSensetivity)
|
||||
facingDirection = facingDirection.rotated(deg_to_rad(event.relative.x * mouseSensetivity))
|
||||
|
||||
camera.rotation_degrees.x = clamp(camera.rotation_degrees.x, -70, 70)
|
||||
cameraPivot.rotation.z = 0
|
||||
|
||||
func _on_hurt_box_hit_taken(attack: Attack) -> void:
|
||||
if invoulnerable: return
|
||||
|
||||
trauma = attack.trauma
|
||||
health -= attack.damage
|
||||
if health <= 0.0:
|
||||
die()
|
||||
invoulnerable = true
|
||||
|
||||
func die() -> void:
|
||||
Multiplayer.alivePlayerDict.erase(int(name))
|
||||
headBinoculars.show()
|
||||
headPivot.position = Vector3(0,0.382,0.063)
|
||||
headPivot.rotation = Vector3(0,0,0)
|
||||
$"pivot/pivotRightLeg/pivotLeftLeg/body/Grabby Arms_L".rotation.x = deg_to_rad(90)
|
||||
$"pivot/pivotRightLeg/pivotLeftLeg/body/Grabby Arms_R".rotation.x = deg_to_rad(90)
|
||||
var spectator = spectatorScene.instantiate()
|
||||
spectatorParent.add_child(spectator)
|
||||
camera.current = false
|
||||
alive = false
|
||||
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bh3ouq57aapyf"
|
||||
path.s3tc="res://.godot/imported/Sample1_Poliigon_PlasticMoldDryBlast_7495_Metallic_2K_jpg-Poliigon_PlasticMoldDryBlast_7495_Roughness_2K_jpg.png-a62e882379a4359c27096a292b9c875e.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/3D/Sample1_Poliigon_PlasticMoldDryBlast_7495_Metallic_2K_jpg-Poliigon_PlasticMoldDryBlast_7495_Roughness_2K_jpg.png"
|
||||
dest_files=["res://.godot/imported/Sample1_Poliigon_PlasticMoldDryBlast_7495_Metallic_2K_jpg-Poliigon_PlasticMoldDryBlast_7495_Roughness_2K_jpg.png-a62e882379a4359c27096a292b9c875e.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
@@ -0,0 +1,43 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://2v4kbjdwtms7"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://lmn08s8c5lfo" path="res://Maps/Spaceship/RoomScripts/BasicRoom.gd" id="1_ext5g"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ext5g"]
|
||||
albedo_color = Color(1.0107458e-06, 0.53601325, 5.7756904e-07, 1)
|
||||
|
||||
[node name="StartTest" type="Node3D"]
|
||||
script = ExtResource("1_ext5g")
|
||||
metadata/_custom_type_script = "uid://lmn08s8c5lfo"
|
||||
|
||||
[node name="CSGCombiner3D" type="CSGCombiner3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10, 0.5, -10)
|
||||
material_override = SubResource("StandardMaterial3D_ext5g")
|
||||
use_collision = true
|
||||
|
||||
[node name="CSGBox3D" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 2, 10)
|
||||
size = Vector3(12, 6, 10)
|
||||
|
||||
[node name="CSGBox3D2" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.5, 1, 5)
|
||||
operation = 2
|
||||
size = Vector3(3, 3, 1)
|
||||
|
||||
[node name="CSGBox3D5" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12, 1, 9.5)
|
||||
operation = 2
|
||||
size = Vector3(1, 3, 3)
|
||||
|
||||
[node name="CSGBox3D4" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 9.5, 1, 15)
|
||||
operation = 2
|
||||
size = Vector3(3, 3, 1)
|
||||
|
||||
[node name="CSGBox3D3" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 2, 10)
|
||||
operation = 2
|
||||
size = Vector3(11, 5, 9)
|
||||
|
||||
[node name="OmniLight3D" type="OmniLight3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.8641336, 2.426403, 0)
|
||||
omni_range = 9.494983
|
||||
@@ -0,0 +1,2 @@
|
||||
extends Object
|
||||
class_name Biome
|
||||
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cf2hy467n7ge2"
|
||||
path.s3tc="res://.godot/imported/Sample1_MetalGalvanizedSteelWorn001_COL_2K_METALNESS.jpg-2e1b2aa8ba3b87a586a45c8dea408a41.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/3D/Sample1_MetalGalvanizedSteelWorn001_COL_2K_METALNESS.jpg"
|
||||
dest_files=["res://.godot/imported/Sample1_MetalGalvanizedSteelWorn001_COL_2K_METALNESS.jpg-2e1b2aa8ba3b87a586a45c8dea408a41.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
@@ -0,0 +1 @@
|
||||
uid://ymaax1x5fos3
|
||||
@@ -0,0 +1 @@
|
||||
uid://dnjusl5hyybly
|
||||
@@ -0,0 +1,38 @@
|
||||
extends BasicRoom
|
||||
class_name CorridorDeadEndBreakable
|
||||
|
||||
@onready var wallShard: MeshInstance3D = $WallShard
|
||||
var broken: bool = false
|
||||
|
||||
@onready var interactBox: InteractBox = $InteractBox
|
||||
|
||||
@onready var holeProximety = $Area3D
|
||||
var repairCube: Area3D
|
||||
var toolBox: bool = false
|
||||
var interacted: bool = false
|
||||
|
||||
func updateWallVisibility(status: bool):
|
||||
broken = !status
|
||||
wallShard.visible = status
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
repairCube = null
|
||||
toolBox = false
|
||||
var objectsProxy: Array[Area3D] = holeProximety.get_overlapping_areas()
|
||||
for obj in objectsProxy:
|
||||
if obj.type == "RepairCube":
|
||||
repairCube = obj
|
||||
if obj.type == "ToolBox":
|
||||
toolBox = true
|
||||
|
||||
if repairCube and toolBox and interacted:
|
||||
updateWallVisibility(true)
|
||||
interacted = false
|
||||
repairCube.get_parent().queue_free()
|
||||
SpaceshipLogicRef.hullBreached = false
|
||||
|
||||
|
||||
func _on_interact_box_interacted_with(_playerRef: PlayerCharacter) -> void:
|
||||
interacted = true
|
||||
#Needs to be replaced with a repair minigame/ progress bar later
|
||||
@@ -0,0 +1 @@
|
||||
uid://co1ktq45h26wx
|
||||
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
<svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 21" width="20" height="21">
|
||||
<title>vca_icon</title>
|
||||
<defs>
|
||||
<image width="20" height="21" id="img1" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAVCAMAAABxCz6aAAAAAXNSR0IB2cksfwAAAapQTFRFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHR0dT09PUlJSWFhYV1dXUVFRS0tLKCgoAAAAAAAAAAAACgoKdnZ2kpKSjo6OjY2NkZGRh4eHAAAAAAAAAAAAAAAAGBgYVlZWUFBQMTExAAAAAAAABwcHKysrLCwsLi4uLS0tLy8vERERAAAAAAAAPDw8hoaGhYWFeXl5eHh4gYGBiYmJXFxcAAAAQUFBiIiIgICAhISEgoKCFRUVCAgIODg4dXV1YGBgAAAAQEBAg4ODe3t7ISEhEhISXV1dPz8/FhYWZmZmJCQkDAwMYmJiX19fIiIiJiYmf39/j4+PTU1NioqKCQkJbGxsMjIyd3d3fX19dHR0fn5+GhoaPj4+cnJyMzMzWlpaY2NjTk5OGxsbi4uLDQ0NZ2dnDg4OcXFxGRkZKioqZGRkfHx8EBAQW1tbAgICOzs7Q0NDHx8fCwsLREREcHBwR0dHaGhoSUlJFxcXJycnQkJCbm5uWVlZjIyMAAAAAAAAGhoaX19fMjIyAAAAAAAAAAAAAAAAnoaMsQAAAI50Uk5TABGKrbq9wcrJxa+THwrA///////////WGpv/////////wwlU//////+OxP/////////ly///////////6P/////////////n/////////////////////////////////////////////////////////////////////////////v///+a05vn2NoXh4LvdJzEAAAFmSURBVHicY2BgYGRiZmFlY+fgYOdkZeXi5mEAAl4+fgEBQSFhIBAREBAVE5cACkpKScvIykGArKy8Ar+iEoOyiqqaOhJQ01DRZNDS1tHVAQJdPT19EK1jYGjEYGwiZ2pqqiBnZm5hKWcFZMpZ2zBw2NrZ2zs4ijpJORu6uJra25u6uTNweNjZe3p5+/j6+QcEBgUr2JuGgAUtHUPDwiMi+aPsRKNjHKCCCoIqsXGm8QkKiYIqYaYQQSvLpORYj5RUg7T00IzMODuwYJZrdoqVY6CKSraXQ5RYjhVEMCE3L8ouX0UlOt7KtKAwCiwYVVQcUiJQEl1allMeV5FnBbUotjKoys612rTQKVfVXgEi6FDtXCZnF1zjIFuoIgq13c7etDbIILGu3rLOuRzueKDX8hpyg0p96oUULCGCjbLAUIiKamoWDjBtATJb0lsZ2to73EKAID0goBDC6ORk6Opm70EBvVrKAPo3aJSuHMDoAAAAAElFTkSuQmCC"/>
|
||||
</defs>
|
||||
<style>
|
||||
</style>
|
||||
<use id="Background" href="#img1" x="0" y="0"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
@@ -0,0 +1,263 @@
|
||||
extends Node
|
||||
#{
|
||||
#var mic_capture : AudioEffectOpusChunked
|
||||
#var audio_stats : Dictionary[int, Array] # id->[last_number, packetsreceived, packetslost]
|
||||
#var packets_sent: int = 0
|
||||
#
|
||||
#var packet_queue: Dictionary[int, Array] # sender_id -> Array of PackedByteArrays
|
||||
#
|
||||
#
|
||||
#func _ready():
|
||||
#playstuff()
|
||||
#var mic_bus = AudioServer.get_bus_index("Mic")
|
||||
#mic_capture = AudioServer.get_bus_effect(mic_bus, 0)
|
||||
#
|
||||
#func _process(_delta: float):
|
||||
#if !mic_capture or Multiplayer.playerDict.is_empty():
|
||||
#return
|
||||
#if Input.is_action_just_pressed("noise"):
|
||||
#play_note(69)
|
||||
#print("test")
|
||||
#var t1 = Time.get_unix_time_from_system()
|
||||
#for sender in packet_queue.keys():
|
||||
#var VoiceChatPlayerOutputNode: AudioStreamPlayer3D = Multiplayer.playerDict.get(sender).VoiceChat
|
||||
#var OpusStream : AudioStreamOpusChunked = VoiceChatPlayerOutputNode.stream
|
||||
#while OpusStream.chunk_space_available() and packet_queue.get(sender).size() > 0:
|
||||
#var pkt: PackedByteArray = packet_queue.get(sender).pop_front()
|
||||
#print(packet_queue.get(sender).size())
|
||||
#OpusStream.queue_length_frames()
|
||||
#OpusStream.push_opus_packet(pkt, 8, 0)
|
||||
#var t2 = Time.get_unix_time_from_system()
|
||||
#print("Time 1: ", 1000*(t2-t1), "ms")
|
||||
#var seq_num : PackedByteArray = PackedByteArray()
|
||||
#seq_num.resize(8)
|
||||
#while mic_capture.chunk_available():
|
||||
#if multiplayer.multiplayer_peer.get_connection_status() != MultiplayerPeer.CONNECTION_CONNECTED:
|
||||
#mic_capture.drop_chunk()
|
||||
#continue
|
||||
#seq_num.encode_u64(0,packets_sent+1)
|
||||
#var packet = mic_capture.read_opus_packet(seq_num)
|
||||
#mic_capture.drop_chunk()
|
||||
#_voice_packet_received.rpc(packet)
|
||||
#packets_sent += 1
|
||||
#if (packets_sent % 500) == 0:
|
||||
#print("Packets sent: ", packets_sent, " from id ", multiplayer.get_unique_id(), " ", hash(packet))
|
||||
#print("Size before: ", packet.size())
|
||||
#print("Hash send: ", hash(packet))
|
||||
#var t3 = Time.get_unix_time_from_system()
|
||||
#print("Time 2: ", 1000*(t3-t2), "ms")
|
||||
#
|
||||
#@rpc("any_peer", "call_remote" ,"unreliable_ordered", 1)
|
||||
#func _voice_packet_received(packet: PackedByteArray):
|
||||
#var sender_id = multiplayer.get_remote_sender_id()
|
||||
#
|
||||
##Stats for printing
|
||||
#var sender_stats = audio_stats.get(sender_id, [0,0,0])
|
||||
#if (sender_stats[0]+1 != packet.decode_u32(0)):
|
||||
#sender_stats[2]+=1
|
||||
#sender_stats[0]=packet.decode_u64(0)
|
||||
#sender_stats[1]+=1
|
||||
#audio_stats.set(sender_id, sender_stats)
|
||||
#if (sender_stats[1] % 500) == 0:
|
||||
#print("Packets received: ", sender_stats[1], " from id ", sender_id, " Lossrate: ", sender_stats[2], "/", sender_stats[1], "(" , str(100*(sender_stats[2]/sender_stats[1])), "%)")
|
||||
#print("Size after: ", packet.size())
|
||||
#print("Hash received: ", hash(packet))
|
||||
#print("Packet no.: ", packet.decode_u64(0))
|
||||
#var VoiceChatPlayerOutputNode: AudioStreamPlayer3D = Multiplayer.playerDict.get(sender_id).VoiceChat
|
||||
#var _OpusStream : AudioStreamOpusChunked = VoiceChatPlayerOutputNode.stream
|
||||
## OpusSteam
|
||||
#if not packet_queue.has(sender_id):
|
||||
#var x : Array[PackedByteArray] = []
|
||||
#packet_queue.set(sender_id, x)
|
||||
#if packet_queue.get(sender_id).size() > 250:
|
||||
#push_error("VoiceChat buffer for user ", sender_id, " too large!")
|
||||
#var x : Array[PackedByteArray] = []
|
||||
#packet_queue.set(sender_id, x)
|
||||
#packet_queue.get(sender_id).append(packet)
|
||||
#
|
||||
#var playback: AudioStreamGeneratorPlayback
|
||||
#var player : AudioStreamPlayer
|
||||
#
|
||||
#func playstuff():
|
||||
#var generator = AudioStreamGenerator.new()
|
||||
#generator.mix_rate = 44100
|
||||
#generator.buffer_length = 2
|
||||
#player = AudioStreamPlayer.new()
|
||||
#player.bus = "Mic"
|
||||
#player.stream = generator
|
||||
#add_child(player)
|
||||
#player.play()
|
||||
#playback = player.get_stream_playback()
|
||||
#
|
||||
#func play_note(midi_note: int):
|
||||
#var freq = 440.0 * pow(2.0, (midi_note - 69) / 12.0) # MIDI ? Hz
|
||||
#generate_sine_wave(freq)
|
||||
#
|
||||
#func generate_sine_wave(frequency: float):
|
||||
#var sample_rate = 44100.0
|
||||
#var increment = TAU * frequency / sample_rate
|
||||
#var phase = 0.0
|
||||
#var num_samples = int(sample_rate * 2) # 0.5 seconds
|
||||
#var buffer = PackedVector2Array()
|
||||
#for i in num_samples:
|
||||
#var sample = sin(phase)
|
||||
#buffer.append(Vector2(sample, sample)) # stereo
|
||||
#phase += increment
|
||||
#playback.push_buffer(buffer)
|
||||
#}
|
||||
var current_sample_rate: int = 48000
|
||||
var has_loopback: bool = false
|
||||
var local_playback: AudioStreamGeneratorPlayback = null
|
||||
var local_voice_buffer: PackedByteArray = PackedByteArray()
|
||||
var network_playback: Dictionary[int, AudioStreamGeneratorPlayback] = {}
|
||||
var network_voice_buffer: Dictionary[int, PackedByteArray] = {}
|
||||
var max_buffer_size: int = 1000
|
||||
|
||||
@onready var loopback_player : AudioStreamPlayer= $/root/Main/VoiceLoopback
|
||||
|
||||
func _ready() -> void:
|
||||
if not Steamworks.is_initiallized:
|
||||
push_warning("[VoiceChat] VoiceChat disabled due to SteamAPI.")
|
||||
return
|
||||
record_voice(true)
|
||||
loopback_player.stream.mix_rate = current_sample_rate
|
||||
loopback_player.play()
|
||||
local_playback = loopback_player.get_stream_playback()
|
||||
multiplayer.peer_disconnected.connect(remove_disconnected_peer)
|
||||
Multiplayer.player_ready.connect(add_joined_peer)
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if not Steamworks.is_initiallized:
|
||||
return
|
||||
check_for_voice_local()
|
||||
for player : int in network_voice_buffer:
|
||||
process_voice_data(network_voice_buffer.get(player), player)
|
||||
|
||||
func add_joined_peer(id):
|
||||
var player : Node3D = Multiplayer.playerDict.get(id)
|
||||
var remote_audio_stream_playback = player.get_node_or_null(^"VoiceChat_a").get_stream_playback()
|
||||
network_playback.set(id, remote_audio_stream_playback)
|
||||
network_voice_buffer.set(id,PackedByteArray())
|
||||
|
||||
func remove_disconnected_peer(id):
|
||||
network_playback.erase(id)
|
||||
network_voice_buffer.erase(id)
|
||||
|
||||
func check_for_voice_local() -> void:
|
||||
var available_voice: Dictionary = Steam.getAvailableVoice()
|
||||
if !available_voice:
|
||||
return
|
||||
# Seems there is voice data
|
||||
if available_voice['result'] == Steam.VOICE_RESULT_OK and available_voice['buffer'] > 0:
|
||||
# Valve's getVoice uses 1024 but GodotSteam's is set at 8192?
|
||||
# Our sizes might be way off; internal GodotSteam notes that Valve suggests 8kb
|
||||
# However, this is not mentioned in the header nor the SpaceWar example but -is- in Valve's docs which are usually wrong
|
||||
var voice_data: Dictionary = Steam.getVoice()
|
||||
if voice_data['result'] == Steam.VOICE_RESULT_OK and voice_data['written']:
|
||||
print("[VoiceChat] Voice message has data: %s / %s" % [voice_data['result'], voice_data['written']])
|
||||
|
||||
# Here we can pass this voice data off on the network
|
||||
#TODO: Only execute if multiplayer connected
|
||||
get_sample_rate()
|
||||
send_voice.rpc(voice_data['buffer'])
|
||||
|
||||
# If loopback is enable, play it back at this point
|
||||
if has_loopback:
|
||||
print("[VoiceChat] Loopback on")
|
||||
# Our sample rate function above without toggling
|
||||
process_voice_data(voice_data['buffer'], 0)
|
||||
|
||||
@rpc("any_peer","call_remote","unreliable")
|
||||
func send_voice(voice_buffer : PackedByteArray):
|
||||
var sender_id : int = multiplayer.get_remote_sender_id()
|
||||
if not network_playback.has(sender_id):
|
||||
push_error("[VoiceChat] Received audio data, but there is no AudioStreamPlayer available for that user. Emitter: " + str(sender_id))
|
||||
return
|
||||
if not network_voice_buffer.has(sender_id):
|
||||
push_error("[VoiceChat] Received audio data without allocated voice buffer for that user. Emitter: " + str(sender_id))
|
||||
return
|
||||
var local_peer_buffer : PackedByteArray = network_voice_buffer.get(sender_id)
|
||||
if local_peer_buffer.size() >= max_buffer_size:
|
||||
push_error("[VoiceChat] AudioBuffer exeeding size limit. Emitter: " + str(sender_id))
|
||||
local_peer_buffer.append_array(voice_buffer)
|
||||
print_debug("[VoiceChat] AudioBuffer size: " + str(local_peer_buffer.size()))
|
||||
|
||||
@rpc("any_peer","call_remote","reliable")
|
||||
func send_sample_rate(sample_rate : int):
|
||||
var sender_id : int = multiplayer.get_remote_sender_id()
|
||||
if sample_rate < 11025 || sample_rate > 48000:
|
||||
push_warning("[VoiceChat] Received invalid sample rate for peer. Emitter: " + str(sender_id))
|
||||
return
|
||||
if not network_playback.has(sender_id):
|
||||
push_warning("[VoiceChat] Received sample rate for invalid peer. Emitter: " + str(sender_id)) # Race condition?
|
||||
return
|
||||
network_playback.get(sender_id).stream.mix_rate = sample_rate
|
||||
network_playback.get(sender_id).clear_buffer()
|
||||
network_voice_buffer.get(sender_id).clear()
|
||||
|
||||
func get_sample_rate() -> void:
|
||||
current_sample_rate = Steam.getVoiceOptimalSampleRate()
|
||||
if loopback_player.stream.mix_rate != current_sample_rate:
|
||||
send_sample_rate.rpc(current_sample_rate)
|
||||
loopback_player.stream.mix_rate = current_sample_rate
|
||||
print("[VoiceChat] Changed own sample rate to: " + str(current_sample_rate))
|
||||
|
||||
func process_voice_data(voice_data: PackedByteArray, voice_source: int) -> void:
|
||||
|
||||
var decompressed_voice: Dictionary = Steam.decompressVoice(voice_data, current_sample_rate)
|
||||
|
||||
if decompressed_voice['result'] == Steam.VOICE_RESULT_OK and decompressed_voice['size'] > 0:
|
||||
print("[VoiceChat] Decompressed voice: %s" % decompressed_voice['size'])
|
||||
|
||||
if voice_source == 0:
|
||||
local_voice_buffer = decompressed_voice['uncompressed']
|
||||
local_voice_buffer.resize(decompressed_voice['size'])
|
||||
|
||||
# We now iterate through the local_voice_buffer and push the samples to the audio generator
|
||||
for i: int in local_playback.get_frames_available():
|
||||
if local_voice_buffer.size() == 0: break
|
||||
# Steam's audio data is represented as 16-bit single channel PCM audio, so we need to convert it to amplitudes
|
||||
# Combine the low and high bits to get full 16-bit value
|
||||
var raw_value: int = local_voice_buffer[0] | (local_voice_buffer[1] << 8)
|
||||
# Make it a 16-bit signed integer
|
||||
raw_value = (raw_value + 32768) & 0xffff
|
||||
# Convert the 16-bit integer to a float on from -1 to 1
|
||||
var amplitude: float = float(raw_value - 32768) / 32768.0
|
||||
|
||||
# push_frame() takes a Vector2. The x represents the left channel and the y represents the right channel
|
||||
local_playback.push_frame(Vector2(amplitude, amplitude))
|
||||
|
||||
# Delete the used samples
|
||||
local_voice_buffer.remove_at(0)
|
||||
local_voice_buffer.remove_at(0)
|
||||
else:
|
||||
#TODO: Better naming
|
||||
#Better explanation for 16-bit conversions
|
||||
network_voice_buffer.set(voice_source, decompressed_voice['uncompressed'])
|
||||
var _network_voice_buffer : PackedByteArray = network_voice_buffer.get(voice_source)
|
||||
_network_voice_buffer.resize(decompressed_voice['size'])
|
||||
var _network_playback : AudioStreamGeneratorPlayback = network_playback.get(voice_source)
|
||||
for i: int in _network_playback.get_frames_available():
|
||||
if _network_playback.size() == 0: break
|
||||
var raw_value: int = _network_voice_buffer[0] | (_network_voice_buffer[1] << 8)
|
||||
# Make it a 16-bit signed integer
|
||||
raw_value = (raw_value + 32768) & 0xffff
|
||||
# Convert the 16-bit integer to a float on from -1 to 1
|
||||
var amplitude: float = float(raw_value - 32768) / 32768.0
|
||||
|
||||
# push_frame() takes a Vector2. The x represents the left channel and the y represents the right channel
|
||||
_network_playback.push_frame(Vector2(amplitude, amplitude))
|
||||
|
||||
# Delete the used samples
|
||||
_network_playback.remove_at(0)
|
||||
_network_playback.remove_at(0)
|
||||
|
||||
func record_voice(is_recording: bool) -> void:
|
||||
# If talking, suppress all other audio or voice comms from the Steam UI
|
||||
Steam.setInGameVoiceSpeaking(Steamworks.steam_id, is_recording)
|
||||
|
||||
if is_recording:
|
||||
Steam.startVoiceRecording()
|
||||
else:
|
||||
Steam.stopVoiceRecording()
|
||||
@@ -0,0 +1,38 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dgna04txtwnyb"
|
||||
path="res://.godot/imported/d_parameter_icon.svg-d339e4e3f950ae8593b999ef51579136.ctex"
|
||||
metadata={
|
||||
"has_editor_variant": true,
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/fmod/icons/d_parameter_icon.svg"
|
||||
dest_files=["res://.godot/imported/d_parameter_icon.svg-d339e4e3f950ae8593b999ef51579136.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=true
|
||||
editor/convert_colors_with_editor_theme=true
|
||||
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b7bpona2op82b"
|
||||
path="res://.godot/imported/THallwayRoomData.png-0e4645eaba254d51a19ae30b45b14ea1.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Maps/Rooms/Generic Connectors/THallway/THallwayRoomData.png"
|
||||
dest_files=["res://.godot/imported/THallwayRoomData.png-0e4645eaba254d51a19ae30b45b14ea1.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
@@ -0,0 +1,53 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://c5po4eh46xksf"
|
||||
path="res://.godot/imported/CorridorShort.blend-aee424ab35dfc02d4163a9c8086c58c9.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/3D/Corriodors/CorridorShort.blend"
|
||||
dest_files=["res://.godot/imported/CorridorShort.blend-aee424ab35dfc02d4163a9c8086c58c9.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 @@
|
||||
uid://cp822pg0wyna7
|
||||
@@ -0,0 +1,38 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://crsj4jjaeq87a"
|
||||
path="res://.godot/imported/vca_icon.svg-def43f27fe148a7a0b18c7dcaab20c79.ctex"
|
||||
metadata={
|
||||
"has_editor_variant": true,
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/fmod/icons/vca_icon.svg"
|
||||
dest_files=["res://.godot/imported/vca_icon.svg-def43f27fe148a7a0b18c7dcaab20c79.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=true
|
||||
editor/convert_colors_with_editor_theme=true
|
||||
@@ -0,0 +1,9 @@
|
||||
[gd_resource type="NoiseTexture2D" load_steps=2 format=3 uid="uid://bw51s1b3tsawp"]
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_qcrta"]
|
||||
noise_type = 5
|
||||
seed = 69
|
||||
frequency = 0.1
|
||||
|
||||
[resource]
|
||||
noise = SubResource("FastNoiseLite_qcrta")
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 395 B |
@@ -0,0 +1,122 @@
|
||||
extends Node3D
|
||||
class_name LevelGenerator
|
||||
|
||||
var levelGrid: Array[Array]
|
||||
@export var gridSize: int = 250
|
||||
|
||||
var spawnableRooms: Array[RoomData]
|
||||
var biomes: Array[Biome]
|
||||
var rng := RandomNumberGenerator.new()
|
||||
|
||||
func _ready() -> void:
|
||||
initGrid()
|
||||
|
||||
var spaceshipRoomList := RoomListSpaceship.new() # Have something choose the map in this part later
|
||||
spawnableRooms = spaceshipRoomList.rooms
|
||||
|
||||
|
||||
var temp: Array[DoorPosition]
|
||||
|
||||
# Generate the level
|
||||
temp = spawnRoom(spawnableRooms[0],Vector2i(40,40),0,true)
|
||||
for x in temp:
|
||||
spawnRoomAtDoor(spawnableRooms[0],x)
|
||||
printLevelGrid()
|
||||
|
||||
func initGrid() -> void:
|
||||
for x in gridSize:
|
||||
var newRow: Array
|
||||
levelGrid.push_back(newRow)
|
||||
for y in gridSize:
|
||||
var newCell := GridCell.new()
|
||||
levelGrid[x].push_back(newCell)
|
||||
func addGridCells(cell1: GridCell,cell2: GridCell) -> GridCell:
|
||||
var returnCell: GridCell = GridCell.new()
|
||||
returnCell.spaceTaken = cell1.spaceTaken or cell2.spaceTaken
|
||||
returnCell.door = cell2.door
|
||||
returnCell.doorOrientation = cell2.doorOrientation
|
||||
returnCell.biome = cell1.biome
|
||||
return returnCell
|
||||
func addArrays2D(array1: Array[Array], array2: Array[Array], arr2pos: Vector2i = Vector2i(0,0)) -> void:
|
||||
if array1.size() < (arr2pos.x - 1) + array2.size(): return
|
||||
if array1[arr2pos.y].size() < (arr2pos.y - 1) + array2[0].size(): return
|
||||
for x in array2.size():
|
||||
for y in array2[x].size():
|
||||
array1[x+arr2pos.x][y+arr2pos.y] = addGridCells(array1[x+arr2pos.x][y+arr2pos.y],array2[x][y])
|
||||
func rotateArray2D(array: Array[Array], numberOfRotationsBy90Degrees: int = 1) -> void:
|
||||
var size: int = array.size()
|
||||
var layerCount: int = size/2
|
||||
|
||||
for x in numberOfRotationsBy90Degrees%4:
|
||||
for layer in layerCount:
|
||||
var first: int = layer
|
||||
var last: int = size - first - 1
|
||||
|
||||
for element in range(first, last):
|
||||
var offset = element - first
|
||||
|
||||
var top = array[first][element]
|
||||
var right = array[element][last]
|
||||
var bot = array[last][last-offset]
|
||||
var left = array[last-offset][first]
|
||||
|
||||
array[element][last] = top
|
||||
array[last][last-offset] = right
|
||||
array[last-offset][first] = bot
|
||||
array[first][element] = left
|
||||
func getDoorPosition(cell: GridCell, GridCellPosition: Vector2i) -> DoorPosition:
|
||||
if !cell.door:
|
||||
print("Tried to get door at cell that isnt a door")
|
||||
return null
|
||||
var returnDoorPosition := DoorPosition.new()
|
||||
returnDoorPosition.pos = GridCellPosition
|
||||
returnDoorPosition.orientation = cell.doorOrientation
|
||||
return returnDoorPosition
|
||||
func addObject(AddedObject:PackedScene, Parent: Node3D, Position: Vector3, Rotation: Vector3= Vector3(0,0,0)):
|
||||
if !AddedObject:
|
||||
print("tried to add object but packed scene is null")
|
||||
return
|
||||
var obj = AddedObject.instantiate()
|
||||
Parent.add_child(obj)
|
||||
obj.position = Position
|
||||
obj.rotation = Rotation
|
||||
return obj
|
||||
func rotateRoom(roomData: RoomData, numberOfRotationsBy90Degrees: int) -> void:
|
||||
rotateArray2D(roomData.roomGrid,numberOfRotationsBy90Degrees)
|
||||
for door in roomData.doorPositions:
|
||||
door.rotatePosRight(roomData.roomGrid.size(),numberOfRotationsBy90Degrees)
|
||||
door.orientation += numberOfRotationsBy90Degrees % 4
|
||||
func spawnRoom(roomData: RoomData,pos: Vector2i,numberOfRotationsBy90Degrees: int = 0, centered: bool = false) -> Array[DoorPosition]: #Pos corresponds to the upper left corner of the room immage
|
||||
var roomScene: PackedScene = load(roomData.roomSceneRef)
|
||||
|
||||
rotateRoom(roomData,numberOfRotationsBy90Degrees)
|
||||
var roomGrid := roomData.roomGrid
|
||||
var doorPositions: Array[DoorPosition] = roomData.doorPositions
|
||||
if centered:
|
||||
pos = Vector2i(pos.x-(roomGrid.size()/2),pos.y-(roomGrid[0].size()/2))
|
||||
|
||||
addArrays2D(levelGrid,roomGrid,pos)
|
||||
addObject(roomScene,self,Vector3(pos.x+(roomGrid.size()/2),0,pos.y+(roomGrid[0].size()/2)),Vector3(0,(numberOfRotationsBy90Degrees%4)*PI/2,0))
|
||||
for door in doorPositions:
|
||||
door.pos += pos
|
||||
|
||||
return doorPositions
|
||||
func spawnRoomAtDoor(roomData: RoomData, door: DoorPosition) -> void:
|
||||
var spawnDoor: DoorPosition = roomData.doorPositions[rng.randi_range(0,roomData.doorPositions.size()-1)]
|
||||
var doorOrientationDifference : int = spawnDoor.orientation - door.orientation
|
||||
var numberOfRoomRotations: int = 0
|
||||
if !abs(doorOrientationDifference) == 2:
|
||||
if doorOrientationDifference > 0:
|
||||
numberOfRoomRotations = 1
|
||||
if doorOrientationDifference == 0:
|
||||
numberOfRoomRotations = 2
|
||||
if doorOrientationDifference < 0:
|
||||
numberOfRoomRotations = 3
|
||||
|
||||
spawnRoom(roomData,door.pos,numberOfRoomRotations)
|
||||
func printLevelGrid() -> void:
|
||||
var debugCube: PackedScene = preload("res://test/debugCube.tscn")
|
||||
for x in levelGrid.size():
|
||||
for y in levelGrid[x].size():
|
||||
if levelGrid[x][y].spaceTaken:
|
||||
addObject(debugCube,self,Vector3(x+0.5,0,y+0.5))
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,156 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://c240icwf4uov8"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b4avd5n3wv18p" path="res://script/main.gd" id="1"]
|
||||
[ext_resource type="PackedScene" uid="uid://hx4hednm6nub" path="res://scene/mainmenu.tscn" id="2_v0l8b"]
|
||||
[ext_resource type="Texture2D" uid="uid://s7wkvdx006f" path="res://assets/2D/Back.png" id="3_0ha60"]
|
||||
[ext_resource type="Texture2D" uid="uid://dra4s4sa7lh6t" path="res://assets/2D/Progress.png" id="4_4j5ol"]
|
||||
[ext_resource type="Texture2D" uid="uid://c1401tikex5vt" path="res://assets/2D/Viser.png" id="5_0ha60"]
|
||||
[ext_resource type="PackedScene" uid="uid://d1dplm1rdcx1h" path="res://scene/settingsmenu.tscn" id="6_4j5ol"]
|
||||
[ext_resource type="Texture2D" uid="uid://csbtt12ohhvec" path="res://assets/2D/GreenCross.png" id="7_p1hux"]
|
||||
[ext_resource type="PackedScene" uid="uid://bo3jh7r0wnwgr" path="res://scene/pausemenu.tscn" id="8_of57s"]
|
||||
|
||||
[sub_resource type="AudioStreamMicrophone" id="AudioStreamMicrophone_of57s"]
|
||||
|
||||
[sub_resource type="AudioStreamOpusChunked" id="AudioStreamOpusChunked_of57s"]
|
||||
audiosamplerate = 48000
|
||||
audiosamplesize = 960
|
||||
mix_rate = 48000
|
||||
|
||||
[node name="Main" type="Control"]
|
||||
process_mode = 3
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("1")
|
||||
metadata/_edit_horizontal_guides_ = [-61.0]
|
||||
|
||||
[node name="Dialogs" type="Node" parent="."]
|
||||
|
||||
[node name="DisconnectDialog" type="AcceptDialog" parent="Dialogs"]
|
||||
title = "Server connection:"
|
||||
dialog_text = "Connection closed"
|
||||
|
||||
[node name="InviteCodeDialog" type="AcceptDialog" parent="Dialogs"]
|
||||
auto_translate_mode = 1
|
||||
title = "Lobby code:"
|
||||
initial_position = 2
|
||||
size = Vector2i(158, 100)
|
||||
dialog_text = "Error"
|
||||
|
||||
[node name="JoinGameDialog" type="AcceptDialog" parent="Dialogs"]
|
||||
auto_translate_mode = 1
|
||||
title = "Logging in..."
|
||||
initial_position = 2
|
||||
size = Vector2i(158, 100)
|
||||
dialog_text = "Error"
|
||||
|
||||
[node name="ErrorDialog" type="AcceptDialog" parent="Dialogs"]
|
||||
auto_translate_mode = 1
|
||||
title = "Logging in..."
|
||||
initial_position = 2
|
||||
size = Vector2i(158, 100)
|
||||
dialog_text = "Error"
|
||||
|
||||
[node name="Settingsmenu" parent="." instance=ExtResource("6_4j5ol")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
|
||||
[node name="Mainmenu" parent="." instance=ExtResource("2_v0l8b")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
|
||||
[node name="Pausemenu" parent="." instance=ExtResource("8_of57s")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
|
||||
[node name="Hud" type="Control" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 1
|
||||
|
||||
[node name="TextureProgressBar" type="TextureProgressBar" parent="Hud"]
|
||||
z_index = 2
|
||||
layout_mode = 1
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -101.25
|
||||
offset_top = -129.0
|
||||
offset_right = 101.25
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
value = 100.0
|
||||
nine_patch_stretch = true
|
||||
texture_under = ExtResource("3_0ha60")
|
||||
texture_progress = ExtResource("4_4j5ol")
|
||||
|
||||
[node name="Identifier" type="Label" parent="Hud"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -94.0
|
||||
offset_bottom = 23.0
|
||||
grow_horizontal = 0
|
||||
|
||||
[node name="Viser" type="TextureRect" parent="Hud"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("5_0ha60")
|
||||
stretch_mode = 3
|
||||
|
||||
[node name="InteractCross" type="TextureRect" parent="Hud"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -160.0
|
||||
offset_top = -120.0
|
||||
offset_right = -120.0
|
||||
offset_bottom = -80.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
texture = ExtResource("7_p1hux")
|
||||
|
||||
[node name="Maps" type="Node3D" parent="."]
|
||||
|
||||
[node name="Players" type="Node3D" parent="."]
|
||||
|
||||
[node name="Spectators" type="Node3D" parent="."]
|
||||
|
||||
[node name="MapSpawner" type="MultiplayerSpawner" parent="."]
|
||||
_spawnable_scenes = PackedStringArray("uid://bco4seshb8fjf", "uid://k0jpd2sugl7b")
|
||||
spawn_path = NodePath("../Maps")
|
||||
|
||||
[node name="PlayerSpawner" type="MultiplayerSpawner" parent="."]
|
||||
_spawnable_scenes = PackedStringArray("uid://rvvjguhqjtpb")
|
||||
spawn_path = NodePath("../Players")
|
||||
|
||||
[node name="VoiceInput" type="AudioStreamPlayer" parent="."]
|
||||
stream = SubResource("AudioStreamMicrophone_of57s")
|
||||
autoplay = true
|
||||
bus = &"Mic"
|
||||
|
||||
[node name="DebugVoiceOutput" type="AudioStreamPlayer3D" parent="."]
|
||||
stream = SubResource("AudioStreamOpusChunked_of57s")
|
||||
autoplay = true
|
||||
@@ -0,0 +1,121 @@
|
||||
[gd_scene load_steps=17 format=3 uid="uid://bco4seshb8fjf"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://fvwy57of2gvq" path="res://Maps/Lobby/lobby.gd" id="1_3j6ah"]
|
||||
[ext_resource type="Texture2D" uid="uid://cimsjl61nhh5s" path="res://assets/2D/HDR_blue_nebulae-1.hdr" id="1_o7c6e"]
|
||||
[ext_resource type="Script" uid="uid://cjgxd88k1bntf" path="res://script/pathfindingGridLoad.gd" id="3_bhyb3"]
|
||||
[ext_resource type="Script" uid="uid://cjiiw7cybj24b" path="res://script/ButtonLogicImpulse.gd" id="4_2vvmy"]
|
||||
[ext_resource type="Script" uid="uid://ymaax1x5fos3" path="res://script/interactBox.gd" id="5_f6mem"]
|
||||
[ext_resource type="AudioStream" uid="uid://1bkjenax2g3s" path="res://assets/Audio/Ambience 1 SpaceBots Audio.mp3" id="6_f6mem"]
|
||||
[ext_resource type="PackedScene" uid="uid://1u8jah8h1mav" path="res://Maps/Spaceship/Objects/Grabable/boombox_1.tscn" id="7_b4v87"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_skcuv"]
|
||||
interpolation_mode = 1
|
||||
offsets = PackedFloat32Array(0, 0.25, 0.361502, 0.375, 0.488263, 0.5, 0.615023, 0.625, 0.732394, 0.75, 0.859155, 0.875, 1)
|
||||
colors = PackedColorArray(0, 0, 0, 1, 0.25, 0.25, 0.25, 1, 0.28169, 0.28169, 0.28169, 1, 0.375, 0.375, 0.375, 1, 0.408451, 0.408451, 0.408451, 1, 0.5, 0.5, 0.5, 1, 0.530516, 0.530516, 0.530516, 1, 0.625, 0.625, 0.625, 1, 0.661972, 0.661972, 0.661972, 1, 0.75, 0.75, 0.75, 1, 0.802817, 0.802817, 0.802817, 1, 0.875, 0.875, 0.875, 1, 1, 1, 1, 1)
|
||||
metadata/_snap_enabled = true
|
||||
metadata/_snap_count = 8
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_h11mn"]
|
||||
gradient = SubResource("Gradient_skcuv")
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_3j6ah"]
|
||||
offsets = PackedFloat32Array(0.187793, 0.704225, 0.929577)
|
||||
colors = PackedColorArray(0, 0, 0, 1, 0.58042, 0.58042, 0.58042, 1, 0.860369, 0.860369, 0.860369, 1)
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_bhyb3"]
|
||||
frequency = 0.03
|
||||
fractal_octaves = 8
|
||||
fractal_lacunarity = 5.0
|
||||
fractal_gain = 0.495
|
||||
fractal_weighted_strength = 0.23
|
||||
domain_warp_enabled = true
|
||||
|
||||
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_jyrsd"]
|
||||
color_ramp = SubResource("Gradient_3j6ah")
|
||||
noise = SubResource("FastNoiseLite_bhyb3")
|
||||
|
||||
[sub_resource type="PanoramaSkyMaterial" id="PanoramaSkyMaterial_2vvmy"]
|
||||
panorama = ExtResource("1_o7c6e")
|
||||
|
||||
[sub_resource type="Sky" id="Sky_bs3qb"]
|
||||
sky_material = SubResource("PanoramaSkyMaterial_2vvmy")
|
||||
|
||||
[sub_resource type="Environment" id="Environment_f6mem"]
|
||||
background_mode = 2
|
||||
sky = SubResource("Sky_bs3qb")
|
||||
glow_enabled = true
|
||||
glow_levels/1 = 1.38
|
||||
glow_levels/2 = 1.55
|
||||
glow_levels/3 = 5.63
|
||||
glow_levels/5 = 1.75
|
||||
glow_levels/6 = 0.9
|
||||
glow_levels/7 = 0.75
|
||||
glow_strength = 1.73
|
||||
glow_mix = 0.03
|
||||
glow_bloom = 0.05
|
||||
glow_blend_mode = 4
|
||||
glow_hdr_luminance_cap = 1.5
|
||||
glow_map = SubResource("NoiseTexture2D_jyrsd")
|
||||
volumetric_fog_emission = Color(1, 1, 1, 1)
|
||||
volumetric_fog_emission_energy = 0.04
|
||||
adjustment_brightness = 1.5
|
||||
adjustment_color_correction = SubResource("GradientTexture1D_h11mn")
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_b4v87"]
|
||||
size = Vector3(4.5, 1, 1)
|
||||
|
||||
[node name="Lobby" type="Node3D"]
|
||||
script = ExtResource("1_3j6ah")
|
||||
metadata/_custom_type_script = "uid://cbjn7f7r081q8"
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_f6mem")
|
||||
|
||||
[node name="CSGCombiner3D" type="CSGCombiner3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 10.1725, 0)
|
||||
use_collision = true
|
||||
|
||||
[node name="CSGBox3D2" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.00969505, 0)
|
||||
operation = 2
|
||||
size = Vector3(49, 19, 49)
|
||||
|
||||
[node name="CSGBox3D" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
flip_faces = true
|
||||
size = Vector3(50, 20, 50)
|
||||
|
||||
[node name="OmniLight3D" type="OmniLight3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 7.47177, 0)
|
||||
omni_range = 19.6325
|
||||
|
||||
[node name="PathfindingGridLoader" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25, 2.01037, -25)
|
||||
script = ExtResource("3_bhyb3")
|
||||
lengthX = 25
|
||||
lengthZ = 25
|
||||
metadata/_custom_type_script = "uid://cjgxd88k1bntf"
|
||||
|
||||
[node name="StartMission" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.69191, 1.21511)
|
||||
pixel_size = 0.02
|
||||
text = "Start Mission"
|
||||
|
||||
[node name="ButtonLogicImpulse" type="Timer" parent="StartMission" node_paths=PackedStringArray("interactBox")]
|
||||
script = ExtResource("4_2vvmy")
|
||||
interactBox = NodePath("../InteractBox")
|
||||
metadata/_custom_type_script = "uid://cjiiw7cybj24b"
|
||||
|
||||
[node name="InteractBox" type="Area3D" parent="StartMission" node_paths=PackedStringArray("object")]
|
||||
script = ExtResource("5_f6mem")
|
||||
object = NodePath("../ButtonLogicImpulse")
|
||||
metadata/_custom_type_script = "uid://ymaax1x5fos3"
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="StartMission/InteractBox"]
|
||||
shape = SubResource("BoxShape3D_b4v87")
|
||||
|
||||
[node name="AudioStreamPlayer3D" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("6_f6mem")
|
||||
parameters/looping = true
|
||||
|
||||
[node name="Boombox1" parent="." instance=ExtResource("7_b4v87")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.3857, 1.1725, -4.27042)
|
||||
@@ -0,0 +1,53 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://dx0tmtlu464ey"
|
||||
path="res://.godot/imported/CorridorLTurn.blend-6412260df984ac36775cd74b6ef24f99.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/3D/Corriodors/CorridorLTurn.blend"
|
||||
dest_files=["res://.godot/imported/CorridorLTurn.blend-6412260df984ac36775cd74b6ef24f99.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,117 @@
|
||||
[gd_scene load_steps=16 format=3 uid="uid://bco4seshb8fjf"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://fvwy57of2gvq" path="res://Maps/Lobby/lobby.gd" id="1_3j6ah"]
|
||||
[ext_resource type="Texture2D" uid="uid://cimsjl61nhh5s" path="res://assets/2D/HDR_blue_nebulae-1.hdr" id="1_o7c6e"]
|
||||
[ext_resource type="Script" uid="uid://cjgxd88k1bntf" path="res://script/pathfindingGridLoad.gd" id="3_bhyb3"]
|
||||
[ext_resource type="Script" uid="uid://cjiiw7cybj24b" path="res://script/ButtonLogicImpulse.gd" id="4_2vvmy"]
|
||||
[ext_resource type="Script" uid="uid://ymaax1x5fos3" path="res://script/interactBox.gd" id="5_f6mem"]
|
||||
[ext_resource type="AudioStream" uid="uid://1bkjenax2g3s" path="res://assets/Audio/Ambience 1 SpaceBots Audio.mp3" id="6_f6mem"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_skcuv"]
|
||||
interpolation_mode = 1
|
||||
offsets = PackedFloat32Array(0, 0.25, 0.361502, 0.375, 0.488263, 0.5, 0.615023, 0.625, 0.732394, 0.75, 0.859155, 0.875, 1)
|
||||
colors = PackedColorArray(0, 0, 0, 1, 0.25, 0.25, 0.25, 1, 0.28169, 0.28169, 0.28169, 1, 0.375, 0.375, 0.375, 1, 0.408451, 0.408451, 0.408451, 1, 0.5, 0.5, 0.5, 1, 0.530516, 0.530516, 0.530516, 1, 0.625, 0.625, 0.625, 1, 0.661972, 0.661972, 0.661972, 1, 0.75, 0.75, 0.75, 1, 0.802817, 0.802817, 0.802817, 1, 0.875, 0.875, 0.875, 1, 1, 1, 1, 1)
|
||||
metadata/_snap_enabled = true
|
||||
metadata/_snap_count = 8
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_h11mn"]
|
||||
gradient = SubResource("Gradient_skcuv")
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_3j6ah"]
|
||||
offsets = PackedFloat32Array(0.187793, 0.704225, 0.929577)
|
||||
colors = PackedColorArray(0, 0, 0, 1, 0.58042, 0.58042, 0.58042, 1, 0.860369, 0.860369, 0.860369, 1)
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_bhyb3"]
|
||||
frequency = 0.03
|
||||
fractal_octaves = 8
|
||||
fractal_lacunarity = 5.0
|
||||
fractal_gain = 0.495
|
||||
fractal_weighted_strength = 0.23
|
||||
domain_warp_enabled = true
|
||||
|
||||
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_jyrsd"]
|
||||
noise = SubResource("FastNoiseLite_bhyb3")
|
||||
color_ramp = SubResource("Gradient_3j6ah")
|
||||
|
||||
[sub_resource type="PanoramaSkyMaterial" id="PanoramaSkyMaterial_2vvmy"]
|
||||
panorama = ExtResource("1_o7c6e")
|
||||
|
||||
[sub_resource type="Sky" id="Sky_bs3qb"]
|
||||
sky_material = SubResource("PanoramaSkyMaterial_2vvmy")
|
||||
|
||||
[sub_resource type="Environment" id="Environment_f6mem"]
|
||||
background_mode = 2
|
||||
sky = SubResource("Sky_bs3qb")
|
||||
glow_enabled = true
|
||||
glow_levels/1 = 1.38
|
||||
glow_levels/2 = 1.55
|
||||
glow_levels/3 = 5.63
|
||||
glow_levels/5 = 1.75
|
||||
glow_levels/6 = 0.9
|
||||
glow_levels/7 = 0.75
|
||||
glow_strength = 1.73
|
||||
glow_mix = 0.03
|
||||
glow_bloom = 0.05
|
||||
glow_blend_mode = 4
|
||||
glow_hdr_luminance_cap = 1.5
|
||||
glow_map = SubResource("NoiseTexture2D_jyrsd")
|
||||
volumetric_fog_emission = Color(1, 1, 1, 1)
|
||||
volumetric_fog_emission_energy = 0.04
|
||||
adjustment_brightness = 1.5
|
||||
adjustment_color_correction = SubResource("GradientTexture1D_h11mn")
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_b4v87"]
|
||||
size = Vector3(4.5, 1, 1)
|
||||
|
||||
[node name="Lobby" type="Node3D"]
|
||||
script = ExtResource("1_3j6ah")
|
||||
metadata/_custom_type_script = "uid://cbjn7f7r081q8"
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_f6mem")
|
||||
|
||||
[node name="CSGCombiner3D" type="CSGCombiner3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 10.1725, 0)
|
||||
use_collision = true
|
||||
|
||||
[node name="CSGBox3D2" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.00969505, 0)
|
||||
operation = 2
|
||||
size = Vector3(49, 19, 49)
|
||||
|
||||
[node name="CSGBox3D" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
flip_faces = true
|
||||
size = Vector3(50, 20, 50)
|
||||
|
||||
[node name="OmniLight3D" type="OmniLight3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 7.47177, 0)
|
||||
omni_range = 19.6325
|
||||
|
||||
[node name="PathfindingGridLoader" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25, 2.01037, -25)
|
||||
script = ExtResource("3_bhyb3")
|
||||
lengthX = 25
|
||||
lengthZ = 25
|
||||
metadata/_custom_type_script = "uid://cjgxd88k1bntf"
|
||||
|
||||
[node name="StartMission" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.69191, 1.21511)
|
||||
pixel_size = 0.02
|
||||
text = "Start Mission"
|
||||
|
||||
[node name="ButtonLogicImpulse" type="Timer" parent="StartMission" node_paths=PackedStringArray("interactBox")]
|
||||
script = ExtResource("4_2vvmy")
|
||||
interactBox = NodePath("../InteractBox")
|
||||
metadata/_custom_type_script = "uid://cjiiw7cybj24b"
|
||||
|
||||
[node name="InteractBox" type="Area3D" parent="StartMission" node_paths=PackedStringArray("object")]
|
||||
script = ExtResource("5_f6mem")
|
||||
object = NodePath("../ButtonLogicImpulse")
|
||||
metadata/_custom_type_script = "uid://ymaax1x5fos3"
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="StartMission/InteractBox"]
|
||||
shape = SubResource("BoxShape3D_b4v87")
|
||||
|
||||
[node name="AudioStreamPlayer3D" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("6_f6mem")
|
||||
parameters/looping = true
|
||||
@@ -0,0 +1 @@
|
||||
uid://b6rr4vk4esf3s
|
||||
Binary file not shown.
@@ -0,0 +1,75 @@
|
||||
extends Node
|
||||
|
||||
@onready var syncedFeatures: ConfigFile = ConfigFile.new()
|
||||
@onready var settingsmenu = $/root/Main/Settingsmenu/VBoxContainer/MarginContainer2/HBoxContainer/VBoxContainer
|
||||
@onready var config : ConfigFile = ConfigFile.new()
|
||||
@export var debug : bool = false
|
||||
|
||||
func _ready() -> void:
|
||||
var ms = MultiplayerSynchronizer.new()
|
||||
var spg = SceneReplicationConfig.new()
|
||||
var ppath = name + ":syncedFeatures"
|
||||
spg.add_property(ppath)
|
||||
ms.name = "ConfigSynchronizer"
|
||||
ms.replication_config = spg
|
||||
$/root.add_child.call_deferred(ms)
|
||||
loadConfig()
|
||||
update_menu()
|
||||
|
||||
func update_menu():
|
||||
for feature in config.get_sections():
|
||||
var container = HBoxContainer.new()
|
||||
container.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
container.name = feature
|
||||
var label = Label.new()
|
||||
label.text = feature
|
||||
container.add_child(label)
|
||||
var control : Control
|
||||
match config.get_value(feature,"mode","_"):
|
||||
"check":
|
||||
control = CheckButton.new()
|
||||
"color:":
|
||||
control = ColorPickerButton.new()
|
||||
"text":
|
||||
control = LineEdit.new()
|
||||
"menu":
|
||||
control = OptionButton.new()
|
||||
"button":
|
||||
control = Button.new()
|
||||
_:
|
||||
control = Button.new()
|
||||
container.add_child(control)
|
||||
settingsmenu.add_child(container)
|
||||
func loadConfig():
|
||||
var err : Error = config.load("user://config.cfg") if not debug else config.load("res://defaultconfig.cfg")
|
||||
match err:
|
||||
OK:
|
||||
print("Config loaded.")
|
||||
return
|
||||
ERR_FILE_NOT_FOUND:
|
||||
push_error("Config not found. Loading default config.")
|
||||
_:
|
||||
push_error("Failed to load config: error " + str(err))
|
||||
var err2 : Error = config.load("res://defaultconfig.cfg")
|
||||
match err2:
|
||||
OK:
|
||||
push_warning("Default config loaded successfully.")
|
||||
ERR_PARSE_ERROR:
|
||||
push_error("Invalid default config")
|
||||
get_tree().quit(1)
|
||||
return
|
||||
_:
|
||||
push_error("Yay a bug " + str(err2))
|
||||
get_tree().quit(1)
|
||||
return
|
||||
if ResourceLoader.exists("user://config.cfg"):
|
||||
return
|
||||
var err3 : Error = config.save("user://config.cfg")
|
||||
match err3:
|
||||
OK:
|
||||
print("Saved new config file")
|
||||
ERR_FILE_NO_PERMISSION:
|
||||
push_error("No permission to save new config file.")
|
||||
_:
|
||||
push_error("Could not save new config file: " + str(err3))
|
||||
return
|
||||
@@ -0,0 +1,116 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://bo3jh7r0wnwgr"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cc7mhq778g5c8" path="res://script/pausemenu.gd" id="1_qajsf"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_qajsf"]
|
||||
colors = PackedColorArray(0, 0, 0, 1, 0, 0, 0, 1)
|
||||
|
||||
[sub_resource type="GradientTexture2D" id="GradientTexture2D_sp1j3"]
|
||||
gradient = SubResource("Gradient_qajsf")
|
||||
width = 32
|
||||
height = 32
|
||||
fill_to = Vector2(1, 1)
|
||||
|
||||
[node name="Pausemenu" type="Control"]
|
||||
z_index = 4
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_qajsf")
|
||||
|
||||
[node name="Menu" type="Panel" parent="."]
|
||||
process_mode = 3
|
||||
layout_mode = 0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
focus_mode = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Menu"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 13
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -127.0
|
||||
offset_right = 127.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_left = 50
|
||||
theme_override_constants/margin_top = 50
|
||||
theme_override_constants/margin_right = 50
|
||||
theme_override_constants/margin_bottom = 50
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Menu/MarginContainer"]
|
||||
custom_minimum_size = Vector2(500, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HBoxContainer4" type="HBoxContainer" parent="Menu/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer4"]
|
||||
custom_minimum_size = Vector2(32, 32)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ProfileSprite" type="Sprite2D" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
texture = SubResource("GradientTexture2D_sp1j3")
|
||||
centered = false
|
||||
|
||||
[node name="VBoxContainer2" type="VBoxContainer" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer4"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="NameEdit" type="LineEdit" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer2"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 2.0
|
||||
placeholder_text = "Username"
|
||||
max_length = 16
|
||||
editable = false
|
||||
|
||||
[node name="VBoxContainer3" type="VBoxContainer" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer4"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Start" type="Button" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer3"]
|
||||
process_mode = 3
|
||||
layout_mode = 2
|
||||
disabled = true
|
||||
text = "Start"
|
||||
|
||||
[node name="Disconnect" type="Button" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer3"]
|
||||
process_mode = 3
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Disconnect"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Menu/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VBoxContainer2" type="VBoxContainer" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="CurrentLobbyLabel" type="Label" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer2"]
|
||||
layout_mode = 2
|
||||
text = "Current Lobby"
|
||||
|
||||
[node name="LobbyMemberList" type="ItemList" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer2"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
same_column_width = true
|
||||
|
||||
[node name="DebugModeBtn" type="Button" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer2"]
|
||||
layout_mode = 2
|
||||
text = "Debug Mode: false"
|
||||
|
||||
[connection signal="pressed" from="Menu/MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer3/Start" to="." method="_on_start_pressed"]
|
||||
[connection signal="pressed" from="Menu/MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer3/Disconnect" to="." method="_on_disconnect_pressed"]
|
||||
[connection signal="item_activated" from="Menu/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer2/LobbyMemberList" to="." method="_on_lobby_member_list_item_activated"]
|
||||
[connection signal="pressed" from="Menu/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer2/DebugModeBtn" to="." method="_on_debug_mode_btn_pressed"]
|
||||
@@ -0,0 +1,258 @@
|
||||
extends Node
|
||||
#{
|
||||
#var mic_capture : AudioEffectOpusChunked
|
||||
#var audio_stats : Dictionary[int, Array] # id->[last_number, packetsreceived, packetslost]
|
||||
#var packets_sent: int = 0
|
||||
#
|
||||
#var packet_queue: Dictionary[int, Array] # sender_id -> Array of PackedByteArrays
|
||||
#
|
||||
#
|
||||
#func _ready():
|
||||
#playstuff()
|
||||
#var mic_bus = AudioServer.get_bus_index("Mic")
|
||||
#mic_capture = AudioServer.get_bus_effect(mic_bus, 0)
|
||||
#
|
||||
#func _process(_delta: float):
|
||||
#if !mic_capture or Multiplayer.playerDict.is_empty():
|
||||
#return
|
||||
#if Input.is_action_just_pressed("noise"):
|
||||
#play_note(69)
|
||||
#print("test")
|
||||
#var t1 = Time.get_unix_time_from_system()
|
||||
#for sender in packet_queue.keys():
|
||||
#var VoiceChatPlayerOutputNode: AudioStreamPlayer3D = Multiplayer.playerDict.get(sender).VoiceChat
|
||||
#var OpusStream : AudioStreamOpusChunked = VoiceChatPlayerOutputNode.stream
|
||||
#while OpusStream.chunk_space_available() and packet_queue.get(sender).size() > 0:
|
||||
#var pkt: PackedByteArray = packet_queue.get(sender).pop_front()
|
||||
#print(packet_queue.get(sender).size())
|
||||
#OpusStream.queue_length_frames()
|
||||
#OpusStream.push_opus_packet(pkt, 8, 0)
|
||||
#var t2 = Time.get_unix_time_from_system()
|
||||
#print("Time 1: ", 1000*(t2-t1), "ms")
|
||||
#var seq_num : PackedByteArray = PackedByteArray()
|
||||
#seq_num.resize(8)
|
||||
#while mic_capture.chunk_available():
|
||||
#if multiplayer.multiplayer_peer.get_connection_status() != MultiplayerPeer.CONNECTION_CONNECTED:
|
||||
#mic_capture.drop_chunk()
|
||||
#continue
|
||||
#seq_num.encode_u64(0,packets_sent+1)
|
||||
#var packet = mic_capture.read_opus_packet(seq_num)
|
||||
#mic_capture.drop_chunk()
|
||||
#_voice_packet_received.rpc(packet)
|
||||
#packets_sent += 1
|
||||
#if (packets_sent % 500) == 0:
|
||||
#print("Packets sent: ", packets_sent, " from id ", multiplayer.get_unique_id(), " ", hash(packet))
|
||||
#print("Size before: ", packet.size())
|
||||
#print("Hash send: ", hash(packet))
|
||||
#var t3 = Time.get_unix_time_from_system()
|
||||
#print("Time 2: ", 1000*(t3-t2), "ms")
|
||||
#
|
||||
#@rpc("any_peer", "call_remote" ,"unreliable_ordered", 1)
|
||||
#func _voice_packet_received(packet: PackedByteArray):
|
||||
#var sender_id = multiplayer.get_remote_sender_id()
|
||||
#
|
||||
##Stats for printing
|
||||
#var sender_stats = audio_stats.get(sender_id, [0,0,0])
|
||||
#if (sender_stats[0]+1 != packet.decode_u32(0)):
|
||||
#sender_stats[2]+=1
|
||||
#sender_stats[0]=packet.decode_u64(0)
|
||||
#sender_stats[1]+=1
|
||||
#audio_stats.set(sender_id, sender_stats)
|
||||
#if (sender_stats[1] % 500) == 0:
|
||||
#print("Packets received: ", sender_stats[1], " from id ", sender_id, " Lossrate: ", sender_stats[2], "/", sender_stats[1], "(" , str(100*(sender_stats[2]/sender_stats[1])), "%)")
|
||||
#print("Size after: ", packet.size())
|
||||
#print("Hash received: ", hash(packet))
|
||||
#print("Packet no.: ", packet.decode_u64(0))
|
||||
#var VoiceChatPlayerOutputNode: AudioStreamPlayer3D = Multiplayer.playerDict.get(sender_id).VoiceChat
|
||||
#var _OpusStream : AudioStreamOpusChunked = VoiceChatPlayerOutputNode.stream
|
||||
## OpusSteam
|
||||
#if not packet_queue.has(sender_id):
|
||||
#var x : Array[PackedByteArray] = []
|
||||
#packet_queue.set(sender_id, x)
|
||||
#if packet_queue.get(sender_id).size() > 250:
|
||||
#push_error("VoiceChat buffer for user ", sender_id, " too large!")
|
||||
#var x : Array[PackedByteArray] = []
|
||||
#packet_queue.set(sender_id, x)
|
||||
#packet_queue.get(sender_id).append(packet)
|
||||
#
|
||||
#var playback: AudioStreamGeneratorPlayback
|
||||
#var player : AudioStreamPlayer
|
||||
#
|
||||
#func playstuff():
|
||||
#var generator = AudioStreamGenerator.new()
|
||||
#generator.mix_rate = 44100
|
||||
#generator.buffer_length = 2
|
||||
#player = AudioStreamPlayer.new()
|
||||
#player.bus = "Mic"
|
||||
#player.stream = generator
|
||||
#add_child(player)
|
||||
#player.play()
|
||||
#playback = player.get_stream_playback()
|
||||
#
|
||||
#func play_note(midi_note: int):
|
||||
#var freq = 440.0 * pow(2.0, (midi_note - 69) / 12.0) # MIDI ? Hz
|
||||
#generate_sine_wave(freq)
|
||||
#
|
||||
#func generate_sine_wave(frequency: float):
|
||||
#var sample_rate = 44100.0
|
||||
#var increment = TAU * frequency / sample_rate
|
||||
#var phase = 0.0
|
||||
#var num_samples = int(sample_rate * 2) # 0.5 seconds
|
||||
#var buffer = PackedVector2Array()
|
||||
#for i in num_samples:
|
||||
#var sample = sin(phase)
|
||||
#buffer.append(Vector2(sample, sample)) # stereo
|
||||
#phase += increment
|
||||
#playback.push_buffer(buffer)
|
||||
#}
|
||||
var current_sample_rate: int = 48000
|
||||
var has_loopback: bool = false
|
||||
var local_playback: AudioStreamGeneratorPlayback = null
|
||||
var local_voice_buffer: PackedByteArray = PackedByteArray()
|
||||
var network_playback: Dictionary[int, AudioStreamGeneratorPlayback] = {}
|
||||
var network_voice_buffer: Dictionary[int, PackedByteArray] = {}
|
||||
var max_buffer_size: int = 1000
|
||||
|
||||
@onready var loopback_player : AudioStreamPlayer= $/root/Main/VoiceLoopback
|
||||
|
||||
func _ready() -> void:
|
||||
if not Steamworks.is_initiallized:
|
||||
push_warning("[VoiceChat] VoiceChat disabled due to SteamAPI.")
|
||||
return
|
||||
record_voice(true)
|
||||
loopback_player.stream.mix_rate = current_sample_rate
|
||||
loopback_player.play()
|
||||
local_playback = loopback_player.get_stream_playback()
|
||||
multiplayer.peer_disconnected.connect(remove_disconnected_peer)
|
||||
multiplayer.peer_connected.connect(add_joined_peer)
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if not Steamworks.is_initiallized:
|
||||
return
|
||||
check_for_voice_local()
|
||||
for player : int in network_voice_buffer:
|
||||
process_voice_data(network_voice_buffer.get(player), str(player))
|
||||
|
||||
func add_joined_peer(id):
|
||||
var remote_audio_stream_player : Node3D = get_node_or_null(NodePath("/root/Main/Players/%d/VoiceChat_a" % id))
|
||||
network_playback.set(id, remote_audio_stream_player)
|
||||
network_voice_buffer.set(id,PackedByteArray())
|
||||
|
||||
func remove_disconnected_peer(id):
|
||||
network_playback.erase(id)
|
||||
network_voice_buffer.erase(id)
|
||||
|
||||
func check_for_voice_local() -> void:
|
||||
var available_voice: Dictionary = Steam.getAvailableVoice()
|
||||
if !available_voice:
|
||||
return
|
||||
# Seems there is voice data
|
||||
if available_voice['result'] == Steam.VOICE_RESULT_OK and available_voice['buffer'] > 0:
|
||||
# Valve's getVoice uses 1024 but GodotSteam's is set at 8192?
|
||||
# Our sizes might be way off; internal GodotSteam notes that Valve suggests 8kb
|
||||
# However, this is not mentioned in the header nor the SpaceWar example but -is- in Valve's docs which are usually wrong
|
||||
var voice_data: Dictionary = Steam.getVoice()
|
||||
if voice_data['result'] == Steam.VOICE_RESULT_OK and voice_data['written']:
|
||||
print("Voice message has data: %s / %s" % [voice_data['result'], voice_data['written']])
|
||||
|
||||
# Here we can pass this voice data off on the network
|
||||
send_voice.rpc(voice_data['buffer'])
|
||||
|
||||
# If loopback is enable, play it back at this point
|
||||
if has_loopback:
|
||||
print("Loopback on")
|
||||
# Our sample rate function above without toggling
|
||||
get_sample_rate()
|
||||
process_voice_data(voice_data, "local")
|
||||
|
||||
@rpc("any_peer","call_remote","unreliable")
|
||||
func send_voice(voice_buffer : PackedByteArray):
|
||||
var sender_id : int = multiplayer.get_remote_sender_id()
|
||||
if not network_playback.has(sender_id):
|
||||
push_error("[VoiceChat] Received audio data, but there is no AudioStreamPlayer available for that user. Emitter: " + str(sender_id))
|
||||
return
|
||||
if not network_voice_buffer.has(sender_id):
|
||||
push_error("[VoiceChat] Received audio data without allocated voice buffer for that user. Emitter: " + str(sender_id))
|
||||
return
|
||||
var local_peer_buffer : PackedByteArray = network_voice_buffer.get(sender_id)
|
||||
if local_peer_buffer.size() >= max_buffer_size:
|
||||
push_error("[VoiceChat] AudioBuffer exeeding size limit. Emitter: " + str(sender_id))
|
||||
local_peer_buffer.append_array(voice_buffer)
|
||||
print_debug("[VoiceChat] AudioBuffer size: " + str(local_peer_buffer.size()))
|
||||
|
||||
@rpc("any_peer","call_remote","reliable")
|
||||
func send_sample_rate(sample_rate : int):
|
||||
if sample_rate < 11025 || sample_rate > 48000:
|
||||
return
|
||||
var sender_id : int = multiplayer.get_remote_sender_id()
|
||||
if network_playback.has(sender_id):
|
||||
network_playback.get(sender_id).stream.mix_rate = sample_rate
|
||||
network_playback.get(sender_id).clear_buffer()
|
||||
network_voice_buffer.get(sender_id).clear()
|
||||
|
||||
func get_sample_rate() -> void:
|
||||
current_sample_rate = Steam.getVoiceOptimalSampleRate()
|
||||
if loopback_player.stream.mix_rate != current_sample_rate:
|
||||
send_sample_rate.rpc(current_sample_rate)
|
||||
loopback_player.stream.mix_rate = current_sample_rate
|
||||
print("[VoiceChat] Changed own sample rate to: %s", current_sample_rate)
|
||||
|
||||
func process_voice_data(voice_data: Dictionary, voice_source: String) -> void:
|
||||
|
||||
var decompressed_voice: Dictionary = Steam.decompressVoice(voice_data['buffer'], current_sample_rate)
|
||||
|
||||
if decompressed_voice['result'] == Steam.VOICE_RESULT_OK and decompressed_voice['size'] > 0:
|
||||
print("[VoiceChat] Decompressed voice: %s" % decompressed_voice['size'])
|
||||
|
||||
if voice_source == "local":
|
||||
local_voice_buffer = decompressed_voice['uncompressed']
|
||||
local_voice_buffer.resize(decompressed_voice['size'])
|
||||
|
||||
# We now iterate through the local_voice_buffer and push the samples to the audio generator
|
||||
for i: int in local_playback.get_frames_available():
|
||||
if local_voice_buffer.size() == 0: break
|
||||
# Steam's audio data is represented as 16-bit single channel PCM audio, so we need to convert it to amplitudes
|
||||
# Combine the low and high bits to get full 16-bit value
|
||||
var raw_value: int = local_voice_buffer[0] | (local_voice_buffer[1] << 8)
|
||||
# Make it a 16-bit signed integer
|
||||
raw_value = (raw_value + 32768) & 0xffff
|
||||
# Convert the 16-bit integer to a float on from -1 to 1
|
||||
var amplitude: float = float(raw_value - 32768) / 32768.0
|
||||
|
||||
# push_frame() takes a Vector2. The x represents the left channel and the y represents the right channel
|
||||
local_playback.push_frame(Vector2(amplitude, amplitude))
|
||||
|
||||
# Delete the used samples
|
||||
local_voice_buffer.remove_at(0)
|
||||
local_voice_buffer.remove_at(0)
|
||||
else:
|
||||
#TODO: Better naming
|
||||
#Better explanation for 16-bit conversions
|
||||
network_voice_buffer.set(voice_source, decompressed_voice['uncompressed'])
|
||||
var _network_voice_buffer : PackedByteArray = network_voice_buffer.get(voice_source)
|
||||
_network_voice_buffer.resize(decompressed_voice['size'])
|
||||
var _network_playback : AudioStreamGenerator = network_playback.get(voice_source)
|
||||
for i: int in _network_playback.get_frames_available():
|
||||
if _network_playback.size() == 0: break
|
||||
var raw_value: int = _network_voice_buffer[0] | (_network_voice_buffer[1] << 8)
|
||||
# Make it a 16-bit signed integer
|
||||
raw_value = (raw_value + 32768) & 0xffff
|
||||
# Convert the 16-bit integer to a float on from -1 to 1
|
||||
var amplitude: float = float(raw_value - 32768) / 32768.0
|
||||
|
||||
# push_frame() takes a Vector2. The x represents the left channel and the y represents the right channel
|
||||
_network_playback.push_frame(Vector2(amplitude, amplitude))
|
||||
|
||||
# Delete the used samples
|
||||
_network_playback.remove_at(0)
|
||||
_network_playback.remove_at(0)
|
||||
|
||||
func record_voice(is_recording: bool) -> void:
|
||||
# If talking, suppress all other audio or voice comms from the Steam UI
|
||||
Steam.setInGameVoiceSpeaking(Steamworks.steam_id, is_recording)
|
||||
|
||||
if is_recording:
|
||||
Steam.startVoiceRecording()
|
||||
else:
|
||||
Steam.stopVoiceRecording()
|
||||
@@ -0,0 +1,30 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://ct2gxkwg5fb3m"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://rvvjguhqjtpb" path="res://actors/player_character.tscn" id="1_syuel"]
|
||||
[ext_resource type="PackedScene" uid="uid://10bx1tluk6fg" path="res://assets/PCB.glb" id="2_8a8pi"]
|
||||
|
||||
[sub_resource type="Environment" id="Environment_syuel"]
|
||||
ambient_light_color = Color(0.60933, 0.60933, 0.60933, 1)
|
||||
|
||||
[sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_yr2l0"]
|
||||
|
||||
[node name="Test" type="Node3D"]
|
||||
|
||||
[node name="geometrie" type="Node3D" parent="."]
|
||||
|
||||
[node name="PlayerCharacter" parent="." instance=ExtResource("1_syuel")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4, 1.07014, -0.0941736)
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_syuel")
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.596225, 0.802817, 0, -0.802817, 0.596225, 0, 8.53603, 0)
|
||||
|
||||
[node name="StaticBody3D" type="StaticBody3D" parent="."]
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D"]
|
||||
shape = SubResource("WorldBoundaryShape3D_yr2l0")
|
||||
|
||||
[node name="PCB" parent="." instance=ExtResource("2_8a8pi")]
|
||||
transform = Transform3D(3, 0, 0, 0, 3, 0, 0, 0, 3, -3.1363, 0.169454, -7.97793)
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
uid://77q1pjrfpua6
|
||||
@@ -0,0 +1,45 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://cftfv7v8syhig"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c7ea7hd1t6ucj" path="res://script/ShipLogic.gd" id="1_iuibe"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3ny31fbtn7eb" path="res://test/debugCube.tscn" id="3_6dd4g"]
|
||||
[ext_resource type="Texture2D" uid="uid://cimsjl61nhh5s" path="res://assets/2D/HDR_blue_nebulae-1.hdr" id="4_fd4og"]
|
||||
[ext_resource type="Script" uid="uid://cq0sxwn7k47n6" path="res://Maps/MapGenerator/levelGenerator.gd" id="4_yoeks"]
|
||||
[ext_resource type="Texture2D" uid="uid://b6v8etoyl3auu" path="res://test/HugeTestRoom.png" id="5_7qc4s"]
|
||||
|
||||
[sub_resource type="PanoramaSkyMaterial" id="PanoramaSkyMaterial_yoeks"]
|
||||
panorama = ExtResource("4_fd4og")
|
||||
|
||||
[sub_resource type="Sky" id="Sky_ly181"]
|
||||
sky_material = SubResource("PanoramaSkyMaterial_yoeks")
|
||||
|
||||
[sub_resource type="Environment" id="Environment_7qc4s"]
|
||||
background_mode = 2
|
||||
sky = SubResource("Sky_ly181")
|
||||
ambient_light_source = 2
|
||||
ambient_light_color = Color(0.241156, 0.241156, 0.241156, 1)
|
||||
ssr_enabled = true
|
||||
glow_enabled = true
|
||||
glow_intensity = 1.1
|
||||
|
||||
[sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_iuibe"]
|
||||
|
||||
[node name="SpaceshipTest" type="Node3D"]
|
||||
script = ExtResource("1_iuibe")
|
||||
metadata/_custom_type_script = "uid://c7ea7hd1t6ucj"
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_7qc4s")
|
||||
|
||||
[node name="StaticBody3D" type="StaticBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0445775, 0)
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D"]
|
||||
shape = SubResource("WorldBoundaryShape3D_iuibe")
|
||||
|
||||
[node name="DebugCube" parent="." instance=ExtResource("3_6dd4g")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.552344, 0)
|
||||
|
||||
[node name="LevelGenerator" type="Node3D" parent="."]
|
||||
script = ExtResource("4_yoeks")
|
||||
testTexture = ExtResource("5_7qc4s")
|
||||
metadata/_custom_type_script = "uid://cq0sxwn7k47n6"
|
||||
@@ -0,0 +1,167 @@
|
||||
extends Control
|
||||
class_name Main
|
||||
|
||||
@onready var start_btn : Button = $Mainmenu/Menu/MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer3/Start
|
||||
@onready var disconnect_btn : Button = $Pausemenu/Menu/MarginContainer/VBoxCurrentLobby/Disconnect
|
||||
@onready var name_edit : = $Mainmenu/Menu/MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer2/NameEdit
|
||||
@onready var disconnectDialog = $Dialogs/DisconnectDialog
|
||||
@onready var pausemenu = $Pausemenu
|
||||
@onready var mainmenu = $Mainmenu
|
||||
@onready var hud = $Hud
|
||||
@onready var mapsParent: Node3D = $Maps
|
||||
@onready var playersParent: Node3D = $Players
|
||||
|
||||
var peer = WebSocketMultiplayerPeer.new()
|
||||
var lobby: PackedScene = preload("res://Maps/Lobby/Lobby.tscn")
|
||||
|
||||
var player: PackedScene = preload("res://actors/Player/player_character.tscn")
|
||||
|
||||
func _init():
|
||||
peer.supported_protocols = ["ludus"]
|
||||
Steamworks.initialize()
|
||||
|
||||
func _ready():
|
||||
await Multiplayer.noray_connected
|
||||
multiplayer.peer_connected.connect(peer_connected)
|
||||
multiplayer.peer_disconnected.connect(peer_disconnected)
|
||||
multiplayer.server_disconnected.connect(close_network)
|
||||
multiplayer.connection_failed.connect(close_network)
|
||||
multiplayer.connected_to_server.connect(connected)
|
||||
# Set the player name according to the system username. Fallback to the path.
|
||||
if Steamworks.is_initiallized:
|
||||
get_tree().auto_accept_quit = false
|
||||
Steamworks.create_lobby()
|
||||
name_edit.text = Steam.getPersonaName()
|
||||
elif false: #TODO: Set text to saved value
|
||||
name_edit.text = ""
|
||||
disableMultiplayer()
|
||||
else:
|
||||
name_edit.text = "Spacebots Player"
|
||||
disableMultiplayer()
|
||||
|
||||
func _process(_delta: float):
|
||||
if Input.is_action_just_pressed("pause") and playersParent.get_child_count() > 0 and %Settingsmenu.visible == false:
|
||||
if not pausemenu.visible:
|
||||
pausemenu.show()
|
||||
pausemenu.grab_focus() #TODO: fix
|
||||
hud.hide()
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CONFINED
|
||||
else:
|
||||
hud.show()
|
||||
pausemenu.hide()
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
|
||||
func disableMultiplayer() -> void:
|
||||
$/root/Main/Mainmenu/Menu/MarginContainer/VBoxContainer/HBoxContainer/VBoxMultiplayerDisabled.show()
|
||||
$/root/Main/Mainmenu/Menu/MarginContainer/VBoxContainer/HBoxContainer/VBoxLobbylist.hide()
|
||||
|
||||
func start_game():
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
mainmenu.hide()
|
||||
start_btn.disabled = true
|
||||
disconnect_btn.disabled = false
|
||||
hud.show()
|
||||
|
||||
@rpc("authority","call_local","reliable")
|
||||
func changeMap(newMap: PackedScene) -> void:
|
||||
var map := newMap.instantiate()
|
||||
if mapsParent.get_child_count() > 0:
|
||||
if Multiplayer.getCurrentMapLogic().is_connected(StringName("missionLost"),missionLost):
|
||||
Multiplayer.getCurrentMapLogic().disconnect(StringName("missionLost"),missionLost)
|
||||
mapsParent.get_child(0).queue_free()
|
||||
|
||||
mapsParent.add_child(map)
|
||||
initiatePlayerPosition(map.playerStartPos)
|
||||
|
||||
Multiplayer.setCurrentMapLogic(map)
|
||||
map.missionLost.connect(missionLost)
|
||||
|
||||
func initiatePlayerPosition(pos: Vector3) -> void:
|
||||
for p in Multiplayer.playerDict.values():
|
||||
if p.is_multiplayer_authority():
|
||||
p.global_position = pos
|
||||
|
||||
func missionLost() -> void:
|
||||
changeMap(lobby)
|
||||
|
||||
func stop_game():
|
||||
disconnect_btn.disabled = true
|
||||
mainmenu.show()
|
||||
pausemenu.hide()
|
||||
hud.hide()
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CONFINED
|
||||
#Steamworks.stop()
|
||||
|
||||
var currentMaps = mapsParent.get_children()
|
||||
for child in currentMaps:
|
||||
child.queue_free()
|
||||
|
||||
var players = playersParent.get_children()
|
||||
for child in players:
|
||||
child.set_process(false)
|
||||
child.queue_free()
|
||||
await get_tree().process_frame
|
||||
start_btn.disabled = false
|
||||
|
||||
|
||||
func close_network():
|
||||
peer.close()
|
||||
stop_game()
|
||||
disconnectDialog.popup_centered()
|
||||
disconnectDialog.get_ok_button().grab_focus()
|
||||
multiplayer.multiplayer_peer = null
|
||||
Multiplayer.currentMapLogic = null
|
||||
Multiplayer.playerDict = {}
|
||||
Multiplayer.alivePlayerDict = {}
|
||||
Multiplayer.is_host = false
|
||||
Steamworks.lobby_id = 0
|
||||
Steamworks.lobby_members = []
|
||||
Steamworks.lobby_members_max = 5
|
||||
Steamworks.steam_id = 0
|
||||
Steamworks.steam_username = ""
|
||||
|
||||
|
||||
func connected():
|
||||
if Multiplayer.is_host == false:
|
||||
add_player.rpc_id(1, multiplayer.get_unique_id())
|
||||
|
||||
|
||||
func peer_connected(_id):
|
||||
pass
|
||||
#Steamworks.on_peer_add(id)
|
||||
|
||||
|
||||
func peer_disconnected(id):
|
||||
if Multiplayer.is_host:
|
||||
remove_player(id)
|
||||
|
||||
func on_server_disconnected():
|
||||
on_Disconnect_pressed()
|
||||
|
||||
func on_Start_pressed():
|
||||
Multiplayer.host()
|
||||
start_game()
|
||||
changeMap(lobby)
|
||||
add_player(multiplayer.get_unique_id())
|
||||
|
||||
func on_Disconnect_pressed():
|
||||
if Steamworks.lobby_members.size() > 1:
|
||||
Steam.leaveLobby(Steamworks.lobby_id)
|
||||
close_network()
|
||||
|
||||
func on_Connect(norayid: String):
|
||||
start_btn.disabled = true
|
||||
disconnect_btn.disabled = false
|
||||
start_game()
|
||||
Multiplayer.join(norayid)
|
||||
|
||||
@rpc("any_peer")
|
||||
func add_player(id):
|
||||
var player_instance: CharacterBody3D = player.instantiate()
|
||||
player_instance.name = str(id)
|
||||
playersParent.add_child(player_instance)
|
||||
|
||||
@rpc("any_peer")
|
||||
func remove_player(id):
|
||||
if playersParent.get_node(str(id)):
|
||||
playersParent.get_node(str(id)).queue_free()
|
||||
@@ -0,0 +1,53 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://dmmq24i6wdn7a"
|
||||
path="res://.godot/imported/Cart.blend-7a4ac7ffff96c212439abb3c5a04e811.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/3D/Objects/Cart.blend"
|
||||
dest_files=["res://.godot/imported/Cart.blend-7a4ac7ffff96c212439abb3c5a04e811.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 @@
|
||||
uid://c4bkcld6mpuj7
|
||||
@@ -0,0 +1,155 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://c240icwf4uov8"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b4avd5n3wv18p" path="res://script/main.gd" id="1"]
|
||||
[ext_resource type="PackedScene" uid="uid://e5txgsvnchha" path="res://scene/mainmenu.tscn" id="2_v0l8b"]
|
||||
[ext_resource type="Texture2D" uid="uid://s7wkvdx006f" path="res://assets/2D/Back.png" id="3_0ha60"]
|
||||
[ext_resource type="Texture2D" uid="uid://dra4s4sa7lh6t" path="res://assets/2D/Progress.png" id="4_4j5ol"]
|
||||
[ext_resource type="Texture2D" uid="uid://c1401tikex5vt" path="res://assets/2D/Viser.png" id="5_0ha60"]
|
||||
[ext_resource type="PackedScene" uid="uid://d1dplm1rdcx1h" path="res://scene/settingsmenu.tscn" id="6_4j5ol"]
|
||||
[ext_resource type="Texture2D" uid="uid://csbtt12ohhvec" path="res://assets/2D/GreenCross.png" id="7_p1hux"]
|
||||
[ext_resource type="PackedScene" uid="uid://c3cjtslhed2oc" path="res://scene/pausemenu.tscn" id="8_of57s"]
|
||||
|
||||
[sub_resource type="AudioStreamMicrophone" id="AudioStreamMicrophone_of57s"]
|
||||
|
||||
[sub_resource type="AudioStreamOpusChunked" id="AudioStreamOpusChunked_of57s"]
|
||||
audiosamplerate = 48000
|
||||
audiosamplesize = 960
|
||||
mix_rate = 48000
|
||||
|
||||
[node name="Main" type="Control"]
|
||||
process_mode = 3
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("1")
|
||||
metadata/_edit_horizontal_guides_ = [-61.0]
|
||||
|
||||
[node name="Dialogs" type="Node" parent="."]
|
||||
|
||||
[node name="DisconnectDialog" type="AcceptDialog" parent="Dialogs"]
|
||||
title = "Server connection:"
|
||||
dialog_text = "Connection closed"
|
||||
|
||||
[node name="InviteCodeDialog" type="AcceptDialog" parent="Dialogs"]
|
||||
auto_translate_mode = 1
|
||||
title = "Lobby code:"
|
||||
initial_position = 2
|
||||
size = Vector2i(158, 100)
|
||||
dialog_text = "Error"
|
||||
|
||||
[node name="JoinGameDialog" type="AcceptDialog" parent="Dialogs"]
|
||||
auto_translate_mode = 1
|
||||
title = "Logging in..."
|
||||
initial_position = 2
|
||||
size = Vector2i(158, 100)
|
||||
dialog_text = "Error"
|
||||
|
||||
[node name="ErrorDialog" type="AcceptDialog" parent="Dialogs"]
|
||||
auto_translate_mode = 1
|
||||
title = "Logging in..."
|
||||
initial_position = 2
|
||||
size = Vector2i(158, 100)
|
||||
dialog_text = "Error"
|
||||
|
||||
[node name="Settingsmenu" parent="." instance=ExtResource("6_4j5ol")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
|
||||
[node name="Mainmenu" parent="." instance=ExtResource("2_v0l8b")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
|
||||
[node name="Pausemenu" parent="." instance=ExtResource("8_of57s")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
|
||||
[node name="Hud" type="Control" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 1
|
||||
|
||||
[node name="TextureProgressBar" type="TextureProgressBar" parent="Hud"]
|
||||
z_index = 2
|
||||
layout_mode = 1
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -101.25
|
||||
offset_top = -129.0
|
||||
offset_right = 101.25
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
value = 100.0
|
||||
nine_patch_stretch = true
|
||||
texture_under = ExtResource("3_0ha60")
|
||||
texture_progress = ExtResource("4_4j5ol")
|
||||
|
||||
[node name="Identifier" type="Label" parent="Hud"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -94.0
|
||||
offset_bottom = 23.0
|
||||
grow_horizontal = 0
|
||||
|
||||
[node name="Viser" type="TextureRect" parent="Hud"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("5_0ha60")
|
||||
stretch_mode = 3
|
||||
|
||||
[node name="InteractCross" type="TextureRect" parent="Hud"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -160.0
|
||||
offset_top = -120.0
|
||||
offset_right = -120.0
|
||||
offset_bottom = -80.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
texture = ExtResource("7_p1hux")
|
||||
|
||||
[node name="Maps" type="Node3D" parent="."]
|
||||
|
||||
[node name="Players" type="Node3D" parent="."]
|
||||
|
||||
[node name="Spectators" type="Node3D" parent="."]
|
||||
|
||||
[node name="MapSpawner" type="MultiplayerSpawner" parent="."]
|
||||
_spawnable_scenes = PackedStringArray("uid://bco4seshb8fjf", "uid://k0jpd2sugl7b")
|
||||
spawn_path = NodePath("../Maps")
|
||||
|
||||
[node name="PlayerSpawner" type="MultiplayerSpawner" parent="."]
|
||||
_spawnable_scenes = PackedStringArray("uid://rvvjguhqjtpb")
|
||||
spawn_path = NodePath("../Players")
|
||||
|
||||
[node name="VoiceInput" type="AudioStreamPlayer" parent="."]
|
||||
stream = SubResource("AudioStreamMicrophone_of57s")
|
||||
autoplay = true
|
||||
|
||||
[node name="DebugVoiceOutput" type="AudioStreamPlayer3D" parent="."]
|
||||
stream = SubResource("AudioStreamOpusChunked_of57s")
|
||||
autoplay = true
|
||||
@@ -0,0 +1,36 @@
|
||||
extends Marker3D
|
||||
class_name SpiderIKTarget
|
||||
|
||||
@export var step_target: Marker3D
|
||||
@export var step_distance: float = 1.75
|
||||
@export var tween_duration: float = 0.45
|
||||
|
||||
@export var adjacent_target: SpiderIKTarget
|
||||
@export var opposite_target: SpiderIKTarget
|
||||
|
||||
var spider_body: CharacterBody3D
|
||||
|
||||
var is_stepping := false
|
||||
var can_step : = false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
top_level = true
|
||||
spider_body = get_parent()
|
||||
step_distance = step_distance * owner.scale.x
|
||||
tween_duration = tween_duration * owner.scale.x
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if !is_stepping && !adjacent_target.is_stepping && abs(self.global_position.distance_to(step_target.global_position)) >= step_distance:
|
||||
step()
|
||||
opposite_target.step()
|
||||
|
||||
func step():
|
||||
var target_pos = step_target.global_position
|
||||
var half_way = (global_position + step_target.global_position) /2
|
||||
is_stepping = true
|
||||
|
||||
var t = create_tween()
|
||||
t.tween_property(self,"global_position",half_way + owner.basis.y-Vector3(0,0.45,0)*owner.scale.x,tween_duration / spider_body.velocity.length())
|
||||
t.tween_property(self,"global_position", target_pos,tween_duration / spider_body.velocity.length())
|
||||
t.tween_callback(func(): is_stepping = false)
|
||||
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
extends Marker3D
|
||||
class_name PathfindingNode
|
||||
|
||||
var id: int
|
||||
|
||||
@export var proxy_node := false ##If true this node will added to the proxyNode group on ready
|
||||
|
||||
@export var nextNodes: Array[PathfindingNode]
|
||||
@export var astar_weight: float = 1.0
|
||||
|
||||
func _ready() -> void:
|
||||
add_to_group("proxyNode")
|
||||
@@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bew2tk4aobc2e"
|
||||
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.svg"
|
||||
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=4
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
Binary file not shown.
@@ -0,0 +1,22 @@
|
||||
extends Object
|
||||
class_name Biome
|
||||
|
||||
var name: String
|
||||
var roomList: RoomList
|
||||
var starterRoom: RoomData
|
||||
|
||||
var spread: float
|
||||
var priority: int #Biomes with a prio of 0 will always be placed, after Biomes of lower priority will be placed
|
||||
|
||||
#Place all prio 0 Biomes
|
||||
#Then place x number of prio 1 biomes
|
||||
#Then place y number of prio 2 biomes
|
||||
# [...]
|
||||
#Spread biomes
|
||||
|
||||
func _init(bName: String, rList: RoomList, sRoom: RoomData, bSpread: float, bPrio: int) -> void:
|
||||
name = bName
|
||||
roomList = rList
|
||||
starterRoom = sRoom
|
||||
spread = bSpread
|
||||
priority = bPrio
|
||||
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b6x4cjfkc55yj"
|
||||
path.s3tc="res://.godot/imported/Sample1_Poliigon_MetalSteelBrushed_7174_Normal.jpg-3dda21cfdfc7c1ba0a571055d61d35de.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/3D/Sample1_Poliigon_MetalSteelBrushed_7174_Normal.jpg"
|
||||
dest_files=["res://.godot/imported/Sample1_Poliigon_MetalSteelBrushed_7174_Normal.jpg-3dda21cfdfc7c1ba0a571055d61d35de.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=1
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=1
|
||||
roughness/src_normal="res://assets/3D/Sample1_Poliigon_MetalSteelBrushed_7174_Normal.jpg"
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
@@ -0,0 +1 @@
|
||||
uid://0ohd4n5yjilb
|
||||
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c07ms152i77j0"
|
||||
path="res://.godot/imported/BiomeExitChecker.png-a0cdf239bba0df1644b5e7c7b49312b1.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Maps/MapGenerator/BiomeExitChecker.png"
|
||||
dest_files=["res://.godot/imported/BiomeExitChecker.png-a0cdf239bba0df1644b5e7c7b49312b1.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
@@ -0,0 +1,589 @@
|
||||
extends Node3D
|
||||
class_name LevelGenerator
|
||||
|
||||
var levelGrid: Array[Array]
|
||||
@export var gridSize: int = 100
|
||||
|
||||
@export var mapLogic: MapLogic
|
||||
|
||||
@export var doorBlock: PackedScene # Temporary
|
||||
@export var doorOBJ: PackedScene #Temporary
|
||||
@export var tile: PackedScene # Temporary
|
||||
@export var tileWall: PackedScene # Temporary
|
||||
@export var tileCorner: PackedScene # Temporary
|
||||
|
||||
@export var levelGenSeed: String = "default"
|
||||
|
||||
var rng: RandomNumberGenerator = RandomNumberGenerator.new() #Get random values, usefull for random level generation huh
|
||||
var currentMission: Mission
|
||||
|
||||
var doorSpawnPoints: Array[DoorPosition] #Where to put them doors
|
||||
var doorBlockSpawnPoints: Array[DoorPosition] #Where to put them door blockers
|
||||
|
||||
var biomeExitPositions: Array[BiomeExit] #Points where you can leave a biome
|
||||
var biomeExitChecker: RoomData = RoomData.new(preload("res://Maps/MapGenerator/BiomeExitChecker.png").get_image(),"null") #Nonexisten Room used to check if a door is a valid Biome Exit
|
||||
var connectPathPositions: PackedVector2Array #Where to place floor tiles of connecting paths
|
||||
|
||||
var astar: AStar2D = AStar2D.new()
|
||||
|
||||
func _ready() -> void:
|
||||
initRandom() # Set seed for level generation
|
||||
initGrid() #Assign a new grid space object to each space of the 1x1m grid
|
||||
|
||||
#Center the world
|
||||
position.x = -gridSize/2
|
||||
position.z = -gridSize/2
|
||||
|
||||
currentMission = RescueMission.new() #Have something choose the mission type in this part later
|
||||
|
||||
#Biomes
|
||||
var doorList: Array[DoorPosition] #Seccond Array contains door positions
|
||||
for bPrio in currentMission.biomes.size():
|
||||
doorList = placeBiomes(currentMission.biomes[bPrio])
|
||||
spreadBiomes()
|
||||
|
||||
#Rooms into Biomes
|
||||
placeRooms(doorList)
|
||||
|
||||
#Doors
|
||||
chooseBiomeExits()
|
||||
#print(biomeExitPositions[0].biome,biomeExitPositions[1].biome)r
|
||||
doorsAtBiomeExits()
|
||||
findValidDoors()
|
||||
spawnDoors()
|
||||
|
||||
#Generate Astar setup for finding Paths between Biomes and Rooms
|
||||
generateAstarPoints()
|
||||
connectAstarPoints()
|
||||
weightAstarPoints()
|
||||
|
||||
#Connect Biomes
|
||||
connectPathPositions = generateConnectionPath()
|
||||
generateFloorPositions()
|
||||
placeFloorPositionTiles()
|
||||
placeWallsAlongTiles()
|
||||
print("done")
|
||||
func initRandom() -> void:
|
||||
rng.set_seed(hash(levelGenSeed))
|
||||
|
||||
|
||||
#Misc Utility
|
||||
func initGrid() -> void:
|
||||
for x in gridSize:
|
||||
var newRow: Array
|
||||
levelGrid.push_back(newRow)
|
||||
for y in gridSize:
|
||||
var newCell := GridCell.new()
|
||||
newCell.position = Vector2i(x,y)
|
||||
levelGrid[x].push_back(newCell)
|
||||
|
||||
func addGridCells(cell1: GridCell,cell2: GridCell) -> GridCell:
|
||||
var returnCell: GridCell = GridCell.new()
|
||||
returnCell.spaceTaken = cell1.spaceTaken or cell2.spaceTaken
|
||||
returnCell.door = cell1.door or cell2.door
|
||||
if cell1.door and !cell2.door:
|
||||
returnCell.doorOrientation = cell1.doorOrientation
|
||||
else:
|
||||
returnCell.doorOrientation = cell2.doorOrientation
|
||||
returnCell.position = cell1.position
|
||||
returnCell.biome = cell1.biome
|
||||
returnCell.biomeConnection = cell1.biomeConnection
|
||||
return returnCell
|
||||
|
||||
func shuffleArray(array: Array) -> Array:
|
||||
for i in array.size()-1:
|
||||
#Get Array indexes
|
||||
var iA: int = array.size()-1-i
|
||||
var iB: int = rng.randi_range(0,array.size()-2-i)
|
||||
|
||||
#Get two elements from the array
|
||||
var a = array[iA]
|
||||
var b = array[iB]
|
||||
|
||||
#Swap both elements
|
||||
array[iB] = a
|
||||
array[iA] = b
|
||||
|
||||
return array
|
||||
|
||||
func addArrays2D(array1: Array[Array], array2: Array[Array], arr2pos: Vector2i = Vector2i(0,0)) -> void:
|
||||
if array1.size() <= (arr2pos.x) + array2.size(): return
|
||||
if array1[arr2pos.y].size() <= (arr2pos.y) + array2[0].size(): return
|
||||
for x in array2.size():
|
||||
for y in array2[x].size():
|
||||
array1[x+arr2pos.x][y+arr2pos.y] = addGridCells(array1[x+arr2pos.x][y+arr2pos.y],array2[x][y])
|
||||
|
||||
func checkOverlapArrays2D(array1: Array[Array], array2: Array[Array], arr2pos: Vector2i = Vector2i(0,0)) -> bool:
|
||||
if array1.size() <= arr2pos.x + array2.size() or arr2pos.x < 0: return true
|
||||
if array1[arr2pos.y].size() <= arr2pos.y + array2[0].size() or arr2pos.y < 0: return true
|
||||
for x in array2.size():
|
||||
for y in array2[x].size():
|
||||
if array1[x+arr2pos.x][y+arr2pos.y].spaceTaken and array2[x][y].spaceTaken: return true
|
||||
return false
|
||||
|
||||
func checkBiomeOverlap(biome: String, pos: Vector2i, length: int, height: int) -> bool:
|
||||
if levelGrid.size() <= pos.x + length or pos.x < 0: return true
|
||||
if levelGrid[pos.y].size() <= pos.y + height or pos.y < 0: return true
|
||||
for x in length:
|
||||
for y in height:
|
||||
if levelGrid[x+pos.x][y+pos.y].biome: return true
|
||||
return false
|
||||
|
||||
func rotateArray2D(array: Array[Array], numberOfRotationsBy90Degrees: int) -> void:
|
||||
var size: int = array.size()
|
||||
var layerCount: int = size/2
|
||||
|
||||
for x in numberOfRotationsBy90Degrees%4:
|
||||
for layer in layerCount:
|
||||
var first: int = layer
|
||||
var last: int = size - first - 1
|
||||
|
||||
for element in range(first, last):
|
||||
var offset = element - first
|
||||
|
||||
var top = array[first][element]
|
||||
var right = array[element][last]
|
||||
var bot = array[last][last-offset]
|
||||
var left = array[last-offset][first]
|
||||
|
||||
array[element][last] = top
|
||||
array[last][last-offset] = right
|
||||
array[last-offset][first] = bot
|
||||
array[first][element] = left
|
||||
|
||||
func getDoorPosition(cell: GridCell, GridCellPosition: Vector2i) -> DoorPosition:
|
||||
if !cell.door:
|
||||
print("Tried to get door at cell that isnt a door")
|
||||
return null
|
||||
var returnDoorPosition := DoorPosition.new()
|
||||
returnDoorPosition.pos = GridCellPosition
|
||||
returnDoorPosition.orientation = cell.doorOrientation
|
||||
return returnDoorPosition
|
||||
|
||||
func addObject(AddedObject:PackedScene, Parent: Node3D, Position: Vector3, Rotation: Vector3= Vector3(0,0,0)):
|
||||
if !AddedObject:
|
||||
print("tried to add object but packed scene is null")
|
||||
return
|
||||
var obj = AddedObject.instantiate()
|
||||
Parent.add_child(obj)
|
||||
obj.position = Position
|
||||
obj.rotation = Rotation
|
||||
return obj
|
||||
|
||||
func changeBiomeArea2D(biome: String,pos:Vector2i,length: int,height: int):
|
||||
for x in length:
|
||||
for y in height:
|
||||
levelGrid[pos.x+x][pos.y+y].biome = biome
|
||||
|
||||
#Spawning Rooms
|
||||
func rotateRoomData(roomData: RoomData, numberOfRotationsBy90Degrees: int) -> void:
|
||||
rotateArray2D(roomData.roomGrid,numberOfRotationsBy90Degrees)
|
||||
roomData.rotations = wrapi(roomData.rotations + numberOfRotationsBy90Degrees,0,4)
|
||||
for door in roomData.doorPositions:
|
||||
door.rotatePosRight(roomData.roomGrid.size(),numberOfRotationsBy90Degrees)
|
||||
roomData.roomGrid[door.pos.x][door.pos.y].doorOrientation = wrapi(door.orientation-2,0,4)
|
||||
|
||||
func spawnRoom(roomDataInput: RoomData,pos: Vector2i,numberOfRotationsBy90Degrees: int = 0, centered: bool = false) -> Array[DoorPosition]: #Pos corresponds to the upper left corner of the room immage
|
||||
var roomData: RoomData = roomDataInput.duplicateRoom()
|
||||
var roomScene: PackedScene = load(roomData.roomSceneRef)
|
||||
rotateRoomData(roomData,numberOfRotationsBy90Degrees)
|
||||
var roomGrid := roomData.roomGrid
|
||||
var doorPositions: Array[DoorPosition] = roomData.doorPositions
|
||||
if centered:
|
||||
pos = Vector2i(pos.x-(roomGrid.size()/2),pos.y-(roomGrid[0].size()/2))
|
||||
|
||||
addArrays2D(levelGrid,roomGrid,pos)
|
||||
addObject(roomScene,self,Vector3(pos.x+(roomGrid.size()/2),0,pos.y+(roomGrid[0].size()/2)),Vector3(0,(roomData.rotations%4)*PI/2,0))
|
||||
for door in doorPositions:
|
||||
door.pos = pos + door.pos
|
||||
|
||||
return doorPositions
|
||||
|
||||
func getDoorFromRoom(roomData: RoomData,index: int) -> DoorPosition:
|
||||
return roomData.doorPositions[index % roomData.doorPositions.size()]
|
||||
|
||||
func putRoomAtDoor(roomData: RoomData, door: DoorPosition,spawnDoorIndex: int) -> Array: ##Return array contains roomData, spawn Pos in that order
|
||||
#Init Values:
|
||||
var spawnDoor: DoorPosition = getDoorFromRoom(roomData,spawnDoorIndex) #Which door from the spawned room connects to the exiting room
|
||||
var doorOrientationDifference : int = wrapi(spawnDoor.orientation - door.orientation,0,4) #Difference in orinet. between spawned and existing room
|
||||
var numberOfRoomRotations: int = 0 #How many rotations are needed to make spawned rooms spawn door face the existing door
|
||||
var spawnPos: Vector2i
|
||||
var doorOffset: Vector2i #Offset by 1 space so the doors are next to eachother and not inside eachoter
|
||||
|
||||
#Find number of rotations and then rotate the room
|
||||
if !doorOrientationDifference == 2:
|
||||
if doorOrientationDifference == 1:
|
||||
numberOfRoomRotations = 3
|
||||
if doorOrientationDifference == 0:
|
||||
numberOfRoomRotations = 2
|
||||
if doorOrientationDifference == 3:
|
||||
numberOfRoomRotations = 1
|
||||
rotateRoomData(roomData,numberOfRoomRotations)
|
||||
|
||||
#Get new values for spawnDoor and set door offset
|
||||
spawnDoor = getDoorFromRoom(roomData,spawnDoorIndex)
|
||||
match spawnDoor.orientation:
|
||||
0: doorOffset = Vector2i(0,-1)
|
||||
1: doorOffset = Vector2i(1,0)
|
||||
2: doorOffset = Vector2i(0,1)
|
||||
3: doorOffset = Vector2i(-1,0)
|
||||
|
||||
#Set spawn pos and return values
|
||||
spawnPos = door.pos - spawnDoor.pos + doorOffset
|
||||
var returnArray: Array = [roomData,spawnPos]
|
||||
return returnArray
|
||||
|
||||
func spawnRoomAtDoor(roomDataInput: Array[RoomData], door: DoorPosition, biome: String) -> Array[DoorPosition]:
|
||||
var returnArray: Array[DoorPosition]
|
||||
var roomData: RoomData = null
|
||||
var spawnDoorIndex: int = -1
|
||||
#Choose the room to use
|
||||
var rooms: Array[RoomData] = roomDataInput.duplicate()
|
||||
|
||||
shuffleArray(rooms)
|
||||
for room in rooms:
|
||||
#Randomise door checking order
|
||||
var doorIndices: Array[int]
|
||||
for x in room.doorPositions.size():
|
||||
doorIndices.push_back(x)
|
||||
shuffleArray(doorIndices)
|
||||
|
||||
#Check if doorIndex fits and assign roomData and spawnDoorIndex if it does
|
||||
for doorIndex in doorIndices:
|
||||
if checkIfRoomFits(room,door,doorIndex, biome):
|
||||
roomData = room.duplicateRoom()
|
||||
spawnDoorIndex = doorIndex
|
||||
break
|
||||
|
||||
#Check if a room has been found
|
||||
if !roomData or spawnDoorIndex == -1:
|
||||
var checkPosition = door.pos
|
||||
match door.orientation:
|
||||
0: checkPosition += Vector2i(-1,-2)
|
||||
1: checkPosition += Vector2i(0,-1)
|
||||
2: checkPosition += Vector2i(-1,0)
|
||||
3: checkPosition += Vector2i(-2,-1)
|
||||
if !checkOverlapArrays2D(levelGrid,biomeExitChecker.roomGrid,checkPosition):
|
||||
biomeExitPositions.push_back(BiomeExit.new(door.pos,door.orientation,biome))
|
||||
return returnArray
|
||||
|
||||
#Get Spawn Info and spawn room
|
||||
var spawnInfo: Array = putRoomAtDoor(roomData,door,spawnDoorIndex)
|
||||
spawnRoom(spawnInfo[0],spawnInfo[1])
|
||||
returnArray = spawnInfo[0].doorPositions
|
||||
for x in returnArray.size():
|
||||
returnArray[x].pos = spawnInfo[1] + returnArray[x].pos
|
||||
return returnArray
|
||||
|
||||
func checkIfBiomeFits(length: int, height: int, pos: Vector2i, biome: String) -> bool:
|
||||
if levelGrid.size() <= pos.x + length or pos.x < 0: return true
|
||||
if levelGrid[pos.y].size() <= pos.y + height or pos.y < 0: return true
|
||||
for x in length:
|
||||
for y in height:
|
||||
if levelGrid[x+pos.x][y+pos.y].biome != biome:
|
||||
return false
|
||||
return true
|
||||
|
||||
func checkIfRoomFits(roomDataInput: RoomData,door: DoorPosition,spawnDoorIndex: int, biome: String) -> bool:
|
||||
var roomData: RoomData = roomDataInput.duplicateRoom()
|
||||
var spawnInfo: Array = putRoomAtDoor(roomData,door,spawnDoorIndex)
|
||||
|
||||
if !checkOverlapArrays2D(levelGrid,spawnInfo[0].roomGrid,spawnInfo[1]) and checkIfBiomeFits(spawnInfo[0].roomGrid.size(),spawnInfo[0].roomGrid[0].size(),spawnInfo[1],biome):
|
||||
return true
|
||||
else:
|
||||
return false
|
||||
|
||||
func isOutOfArray2DBounds(sizeX: int, sizeY: int, pos: Vector2i) -> bool:
|
||||
if pos.x >= sizeX or pos.x < 0 or pos.y >= sizeY or pos.y < 0:
|
||||
return true
|
||||
else:
|
||||
return false
|
||||
|
||||
func isValidDoor(pos:Vector2i) -> bool: # Checks if the door connects to another door using its orientation,
|
||||
#if this function finds a valid door, it removes the door status from the other door to avoid duplicated doors
|
||||
match levelGrid[pos.x][pos.y].doorOrientation:
|
||||
0:
|
||||
if isOutOfArray2DBounds(levelGrid.size(),levelGrid[0].size(),Vector2i(pos.x,pos.y-1)): return false
|
||||
if !levelGrid[pos.x][pos.y-1].door: return false
|
||||
else: levelGrid[pos.x][pos.y-1].door = false
|
||||
1:
|
||||
if isOutOfArray2DBounds(levelGrid.size(),levelGrid[0].size(),Vector2i(pos.x+1,pos.y)): return false
|
||||
if !levelGrid[pos.x+1][pos.y].door: return false
|
||||
else: levelGrid[pos.x+1][pos.y].door = false
|
||||
2:
|
||||
if isOutOfArray2DBounds(levelGrid.size(),levelGrid[0].size(),Vector2i(pos.x,pos.y+1)): return false
|
||||
if !levelGrid[pos.x][pos.y+1].door: return false
|
||||
else: levelGrid[pos.x][pos.y+1].door = false
|
||||
3:
|
||||
if isOutOfArray2DBounds(levelGrid.size(),levelGrid[0].size(),Vector2i(pos.x-1,pos.y)): return false
|
||||
if !levelGrid[pos.x-1][pos.y].door: return false
|
||||
else: levelGrid[pos.x-1][pos.y].door = false
|
||||
return true
|
||||
|
||||
func findValidDoors() -> void:
|
||||
for x in levelGrid.size():
|
||||
for y in levelGrid[x].size():
|
||||
if levelGrid[x][y].door:
|
||||
var newDoorObject := DoorPosition.new()
|
||||
newDoorObject.pos = Vector2i(x,y)
|
||||
newDoorObject.orientation = levelGrid[x][y].doorOrientation
|
||||
if isValidDoor(Vector2i(x,y)):
|
||||
doorSpawnPoints.push_back(newDoorObject)
|
||||
else:
|
||||
doorBlockSpawnPoints.push_back(newDoorObject)
|
||||
|
||||
func spawnDoors() -> void:
|
||||
for doorSpawn in doorSpawnPoints:
|
||||
addObject(doorOBJ,self,Vector3(doorSpawn.pos.x+0.5,0,doorSpawn.pos.y+0.5),Vector3(0,doorSpawn.orientation*-PI/2,0))
|
||||
#debugCubeAtPos(doorSpawn.pos)
|
||||
for doorBlockSpawn in doorBlockSpawnPoints:
|
||||
addObject(doorBlock,self,Vector3(doorBlockSpawn.pos.x+0.5,0,doorBlockSpawn.pos.y+0.5),Vector3(0,doorBlockSpawn.orientation*-PI/2,0))
|
||||
|
||||
func placeRooms(doorList: Array[DoorPosition]) -> void:
|
||||
var nextDoors: Array[DoorPosition] = []
|
||||
|
||||
#YES I KNOW A DO WHILE LOOP IS BETTER HERE BUT GODOT DOESNT HAVE IT
|
||||
for door in doorList:
|
||||
var doorBiome: Biome = getBiome(levelGrid[door.pos.x][door.pos.y].biome)
|
||||
nextDoors += spawnRoomAtDoor(doorBiome.roomList.rooms,door,doorBiome.name)
|
||||
doorList = nextDoors
|
||||
|
||||
while !doorList.is_empty():
|
||||
for door in doorList:
|
||||
var doorBiome: Biome = getBiome(levelGrid[door.pos.x][door.pos.y].biome)
|
||||
nextDoors += spawnRoomAtDoor(doorBiome.roomList.rooms,door,doorBiome.name)
|
||||
doorList = nextDoors
|
||||
nextDoors = []
|
||||
|
||||
#Generating Biomes
|
||||
func getBiome(biomeName: String) -> Biome:
|
||||
for prio in currentMission.biomes.size():
|
||||
for biome in currentMission.biomes[prio]:
|
||||
if biome.name == biomeName:
|
||||
return biome
|
||||
return
|
||||
|
||||
func generateBiomePos(biome: String,starterRoomSize: Vector2i) -> Vector2i:
|
||||
var genPos: Vector2i
|
||||
var possiblePos: Array[Vector2i]
|
||||
|
||||
#Find all possible Pos without a biome
|
||||
for x in levelGrid.size():
|
||||
for cell in levelGrid[x]:
|
||||
if !cell.biome:
|
||||
possiblePos.push_back(cell.position)
|
||||
|
||||
#Go through all pos untill one works
|
||||
genPos = possiblePos[rng.randi_range(0,possiblePos.size()-1)]
|
||||
while checkBiomeOverlap(biome,genPos,starterRoomSize.x,starterRoomSize.y):
|
||||
possiblePos.erase(genPos)
|
||||
genPos = possiblePos[rng.randi_range(0,possiblePos.size()-1)]
|
||||
|
||||
return genPos
|
||||
|
||||
func placeBiomes(biomes: Array[Biome]) -> Array[DoorPosition]:
|
||||
var returnDoorLists: Array[DoorPosition] = []
|
||||
|
||||
for biome in biomes:
|
||||
var starterRoomSize: Vector2i = Vector2i(biome.starterRoom.roomGrid.size(),biome.starterRoom.roomGrid[0].size())
|
||||
var generatePos: Vector2i = generateBiomePos(biome.name,starterRoomSize)
|
||||
#mapLogic.playerStartPos = Vector3(generatePos.x-gridSize/2-5,0.5,generatePos.y-gridSize/2-5)
|
||||
changeBiomeArea2D(biome.name,generatePos,starterRoomSize.x,starterRoomSize.y)
|
||||
|
||||
#Spawn Starter room and add doors to list
|
||||
var doorList: Array[DoorPosition]
|
||||
doorList = spawnRoom(biome.starterRoom,generatePos)
|
||||
returnDoorLists += doorList
|
||||
|
||||
return returnDoorLists
|
||||
|
||||
func fillCell(cellBiome: String,pos: Vector2i) -> GridCell:
|
||||
if isOutOfArray2DBounds(levelGrid.size(),levelGrid[0].size(),pos): return
|
||||
if !levelGrid[pos.x][pos.y].biome:
|
||||
levelGrid[pos.x][pos.y].biome = cellBiome
|
||||
return levelGrid[pos.x][pos.y]
|
||||
return
|
||||
|
||||
func spreadCell(cell: GridCell,pos: Vector2i) -> Array[GridCell]:
|
||||
var returnCells: Array[GridCell] = []
|
||||
returnCells.push_back(fillCell(cell.biome,pos + Vector2i(0,-1)))
|
||||
returnCells.push_back(fillCell(cell.biome,pos + Vector2i(1,0)))
|
||||
returnCells.push_back(fillCell(cell.biome,pos + Vector2i(0,1)))
|
||||
returnCells.push_back(fillCell(cell.biome,pos + Vector2i(-1,0)))
|
||||
while returnCells.has(null):
|
||||
returnCells.erase(null)
|
||||
return returnCells
|
||||
|
||||
func allCellsHaveBiome() -> bool:
|
||||
for x in levelGrid.size():
|
||||
for cell in levelGrid[x]:
|
||||
if !cell.biome: return false
|
||||
return true
|
||||
|
||||
func spreadBiomes() -> void:
|
||||
#Get all current biome grid cells -> Put them in starterCells
|
||||
var startCells: Array[GridCell] = []
|
||||
for x in levelGrid.size():
|
||||
for y in levelGrid[x].size():
|
||||
if levelGrid[x][y].biome:
|
||||
startCells.push_back(levelGrid[x][y])
|
||||
|
||||
#Spread them by one -> put the new ones in a new array
|
||||
while !allCellsHaveBiome():
|
||||
shuffleArray(startCells)
|
||||
var newCells: Array[GridCell] = []
|
||||
for cell in startCells:
|
||||
if rng.randf() * getBiome(cell.biome).spread > 0.49:
|
||||
newCells += spreadCell(cell,cell.position)
|
||||
else:
|
||||
newCells.push_back(cell)
|
||||
#New cells now contains all that were newly assigned a biome and the ones that didnt spread
|
||||
startCells = newCells
|
||||
|
||||
#Astar
|
||||
func generateAstarPoints(findAllSpaceTakenCells: bool = false) -> void:
|
||||
var currentID: int = 0
|
||||
for x in levelGrid.size():
|
||||
for y in levelGrid[x].size():
|
||||
if levelGrid[x][y].spaceTaken == findAllSpaceTakenCells:
|
||||
astar.add_point(currentID,Vector2i(x,y))
|
||||
currentID += 1
|
||||
|
||||
func connectAstarPoints() -> void:
|
||||
for point in astar.get_point_ids():
|
||||
var possibleNeighbors: Array[int] = [point+1,point-1,point-gridSize,point+gridSize]
|
||||
|
||||
for posNeigh in possibleNeighbors:
|
||||
if astar.has_point(posNeigh):
|
||||
astar.connect_points(point,posNeigh,true)
|
||||
|
||||
func weightAstarPoints() -> void:
|
||||
for point in astar.get_point_ids():
|
||||
if astar.get_point_connections(point).size() != 4:
|
||||
astar.set_point_weight_scale(point,10)
|
||||
|
||||
func posToID(pos: Vector2i) -> int:
|
||||
return gridSize*pos.x + pos.y
|
||||
|
||||
#Generating Biome Connections
|
||||
func chooseBiomeExits() -> void:
|
||||
var existingBiomes: Array[String] = []
|
||||
var currentBiomeExits: Array[BiomeExit] = []
|
||||
var choosenBiomeExits: Array[BiomeExit] = []
|
||||
# Find What Biomes are Present
|
||||
for x in levelGrid.size():
|
||||
for y in levelGrid[x].size():
|
||||
if !existingBiomes.has(levelGrid[x][y].biome):
|
||||
existingBiomes.push_back(levelGrid[x][y].biome)
|
||||
|
||||
#For each biome choose a number of exit
|
||||
for i in existingBiomes.size():
|
||||
#Look through all exits for exits belonging to this biome
|
||||
for exit in biomeExitPositions:
|
||||
if exit.biome == existingBiomes[i]:
|
||||
currentBiomeExits.push_back(exit)
|
||||
biomeExitPositions.erase(exit)
|
||||
|
||||
#For each other biome, choose an exit
|
||||
for n in existingBiomes.size()-1:
|
||||
# Randomly determine an exit
|
||||
var exit: BiomeExit = currentBiomeExits[rng.randi_range(0,currentBiomeExits.size()-1)]
|
||||
|
||||
#Test if exit was already choosen
|
||||
if !choosenBiomeExits.has(exit):
|
||||
choosenBiomeExits.push_back(exit)
|
||||
|
||||
currentBiomeExits.clear()
|
||||
|
||||
#Get rid of all other exits
|
||||
biomeExitPositions = choosenBiomeExits
|
||||
|
||||
func doorsAtBiomeExits() -> void:
|
||||
for exit in biomeExitPositions:
|
||||
levelGrid[exit.pos.x][exit.pos.y].door = false
|
||||
|
||||
func generateConnectionPath() -> PackedVector2Array:
|
||||
var returnArray: PackedVector2Array = []
|
||||
|
||||
#Look through all exits and find the closest other exit
|
||||
for exit in biomeExitPositions:
|
||||
var closestPoint: Vector2i
|
||||
var closestPointDistance: float = gridSize*gridSize
|
||||
for exit1 in biomeExitPositions:
|
||||
if (exit1.pos - exit.pos).length() < closestPointDistance and exit.biome != exit1.biome:
|
||||
closestPoint = exit1.pos
|
||||
closestPointDistance = (exit1.pos - exit.pos).length()
|
||||
#Connect the exits
|
||||
returnArray += astar.get_point_path(posToID(exit.pos),posToID(closestPoint))
|
||||
|
||||
return returnArray #astar.get_point_path(posToID(biomeA.pos),posToID(biomeB.pos))
|
||||
|
||||
func addFloorPos(gridCell: GridCell) -> void:
|
||||
if !gridCell.biomeConnection and !gridCell.spaceTaken:
|
||||
connectPathPositions.push_back(gridCell.position)
|
||||
gridCell.biomeConnection = true
|
||||
gridCell.spaceTaken = true
|
||||
|
||||
func generateFloorPositions(spread: int = 2) -> void:
|
||||
for x in spread:
|
||||
for y in connectPathPositions.size():
|
||||
var fPos: Vector2i = connectPathPositions[y]
|
||||
levelGrid[fPos.x][fPos.y].spaceTaken = true
|
||||
levelGrid[fPos.x][fPos.y].biomeConnection = true
|
||||
addFloorPos(levelGrid[clampi(fPos.x+1,0,gridSize-1)][fPos.y])
|
||||
addFloorPos(levelGrid[fPos.x][clampi(fPos.y+1,0,gridSize-1)])
|
||||
addFloorPos(levelGrid[clampi(fPos.x-1,0,gridSize-1)][fPos.y])
|
||||
addFloorPos(levelGrid[fPos.x][clampi(fPos.y-1,0,gridSize-1)])
|
||||
|
||||
func placeFloorPositionTiles() -> void:
|
||||
for tilePos in connectPathPositions:
|
||||
addObject(tile,self,Vector3(tilePos.x+0.5,0,tilePos.y+0.5))
|
||||
|
||||
func spawnWallSegment(pos: Vector2i,rot: int) -> void:
|
||||
addObject(tileWall,self,Vector3(pos.x+0.5,0,pos.y+0.5),Vector3(0,rot*PI/2,0))
|
||||
|
||||
func spawnCornerSegment(pos: Vector2i,rot: int) -> void:
|
||||
addObject(tileCorner,self,Vector3(pos.x+0.5,0,pos.y+0.5),Vector3(0,rot*PI/2,0))
|
||||
|
||||
func placeWallsAlongTiles() -> void:
|
||||
for x in levelGrid.size():
|
||||
for y in levelGrid[x].size():
|
||||
if !levelGrid[x][y].biomeConnection: continue
|
||||
if x+1 != levelGrid.size():
|
||||
if !levelGrid[x+1][y].spaceTaken: spawnWallSegment(Vector2i(x,y),3)
|
||||
if x != 0:
|
||||
if !levelGrid[x-1][y].spaceTaken: spawnWallSegment(Vector2i(x,y),1)
|
||||
if y+1 != levelGrid.size():
|
||||
if !levelGrid[x][y+1].spaceTaken: spawnWallSegment(Vector2i(x,y),2)
|
||||
if y != -1:
|
||||
if !levelGrid[x][y-1].spaceTaken: spawnWallSegment(Vector2i(x,y),0)
|
||||
if x+1 != levelGrid.size() and y+1 != levelGrid.size():
|
||||
if !levelGrid[x+1][y+1].spaceTaken: spawnCornerSegment(Vector2i(x,y),3)
|
||||
if x != 0 and y != 0:
|
||||
if !levelGrid[x-1][y-1].spaceTaken: spawnCornerSegment(Vector2i(x,y),1)
|
||||
if x+1 != levelGrid.size() and y != 0:
|
||||
if !levelGrid[x+1][y-1].spaceTaken: spawnCornerSegment(Vector2i(x,y),0)
|
||||
if y+1 != levelGrid.size() and x != 0:
|
||||
if !levelGrid[x-1][y+1].spaceTaken: spawnCornerSegment(Vector2i(x,y),2)
|
||||
|
||||
#Debug Functions
|
||||
func printLevelGrid() -> void:
|
||||
for x in levelGrid.size():
|
||||
for y in levelGrid[x].size():
|
||||
if levelGrid[x][y].biomeConnection:
|
||||
debugCubeAtPos(Vector2(x,y))
|
||||
|
||||
func printBiomeGrid() -> void:
|
||||
for x in levelGrid.size():
|
||||
for y in levelGrid[x].size():
|
||||
if levelGrid[x][y].biome == "test":
|
||||
debugCubeAtPos(Vector2(x,y))
|
||||
|
||||
func debugCubeAtPos(pos: Vector2):
|
||||
var debugCube: PackedScene = preload("res://test/debugCube.tscn")
|
||||
addObject(debugCube,self,Vector3(pos.x+0.5,0,pos.y+0.5))
|
||||
|
||||
func showAstarPoints() -> void:
|
||||
for point in astar.get_point_ids():
|
||||
var point_pos: Vector2i = astar.get_point_position(point)
|
||||
debugCubeAtPos(point_pos)
|
||||
@@ -0,0 +1,33 @@
|
||||
extends RigidBody3D
|
||||
class_name GrabableObject
|
||||
|
||||
@export var grabBox: GrabBox
|
||||
|
||||
var isGrabbed: bool = false
|
||||
@export var grabPositionPositionOffset: Vector3
|
||||
@export var grabPositionRotationOffset: Vector3
|
||||
@export var putDownPositionOffset: Vector3
|
||||
@export var throwingForce = 8.0 #How strong objects are thrown
|
||||
|
||||
func _ready() -> void:
|
||||
grabBox = $GrabBox
|
||||
grabBox.grabbedByPlayer.connect(grab.rpc.bind(multiplayer.get_unique_id()))
|
||||
set_collision_layer_value(1,false) #Disables default collision layer
|
||||
|
||||
|
||||
@rpc("any_peer", "call_local")
|
||||
func grab(id):
|
||||
isGrabbed = true
|
||||
freeze = true
|
||||
if not get_multiplayer_authority() == id:
|
||||
set_multiplayer_authority(id)
|
||||
|
||||
@rpc("authority", "call_local")
|
||||
func release():
|
||||
isGrabbed = false
|
||||
freeze = false
|
||||
set_multiplayer_authority(1)
|
||||
|
||||
@rpc("any_peer","call_local")
|
||||
func throw(facingDirectionX,facingDirectionY,cameraRotationX):
|
||||
linear_velocity = Vector3(facingDirectionX,cameraRotationX/PI*2+0.3,facingDirectionY) * throwingForce
|
||||
@@ -0,0 +1,59 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://6jxdjqjv3tbq"
|
||||
path="res://.godot/imported/Storage.blend-b3e35ae4647cb04ee67d0f8e74a06365.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/3D/Rooms/Storage.blend"
|
||||
dest_files=["res://.godot/imported/Storage.blend-b3e35ae4647cb04ee67d0f8e74a06365.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
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=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_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
|
||||
gltf/naming_version=0
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
@@ -0,0 +1,41 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bx6t0uwwdmqs"
|
||||
path.s3tc="res://.godot/imported/Sample1_MetalGalvanizedSteelWorn001_METALNESS_2K_METALNESS_jpg-MetalGalvanizedSteelWorn001_ROUGHNESS_2K_METALNESS_jpg.png-f8899c49ae3cfdcdce322598c0e6a225.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/3D/Sample1_MetalGalvanizedSteelWorn001_METALNESS_2K_METALNESS_jpg-MetalGalvanizedSteelWorn001_ROUGHNESS_2K_METALNESS_jpg.png"
|
||||
dest_files=["res://.godot/imported/Sample1_MetalGalvanizedSteelWorn001_METALNESS_2K_METALNESS_jpg-MetalGalvanizedSteelWorn001_ROUGHNESS_2K_METALNESS_jpg.png-f8899c49ae3cfdcdce322598c0e6a225.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
@@ -0,0 +1,116 @@
|
||||
[gd_scene load_steps=4 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://script/pausemenu.gd" id="1_qajsf"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_qajsf"]
|
||||
colors = PackedColorArray(0, 0, 0, 1, 0, 0, 0, 1)
|
||||
|
||||
[sub_resource type="GradientTexture2D" id="GradientTexture2D_sp1j3"]
|
||||
gradient = SubResource("Gradient_qajsf")
|
||||
width = 32
|
||||
height = 32
|
||||
fill_to = Vector2(1, 1)
|
||||
|
||||
[node name="Pausemenu" type="Control"]
|
||||
z_index = 4
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_qajsf")
|
||||
|
||||
[node name="Menu" type="Panel" parent="."]
|
||||
process_mode = 3
|
||||
layout_mode = 0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
focus_mode = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Menu"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 13
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -127.0
|
||||
offset_right = 127.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_left = 50
|
||||
theme_override_constants/margin_top = 50
|
||||
theme_override_constants/margin_right = 50
|
||||
theme_override_constants/margin_bottom = 50
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Menu/MarginContainer"]
|
||||
custom_minimum_size = Vector2(500, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HBoxContainer4" type="HBoxContainer" parent="Menu/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer4"]
|
||||
custom_minimum_size = Vector2(32, 32)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ProfileSprite" type="Sprite2D" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
texture = SubResource("GradientTexture2D_sp1j3")
|
||||
centered = false
|
||||
|
||||
[node name="VBoxContainer2" type="VBoxContainer" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer4"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="NameEdit" type="LineEdit" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer2"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 2.0
|
||||
placeholder_text = "Username"
|
||||
max_length = 16
|
||||
editable = false
|
||||
|
||||
[node name="VBoxContainer3" type="VBoxContainer" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer4"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Start" type="Button" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer3"]
|
||||
process_mode = 3
|
||||
layout_mode = 2
|
||||
disabled = true
|
||||
text = "Start"
|
||||
|
||||
[node name="Disconnect" type="Button" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer3"]
|
||||
process_mode = 3
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Disconnect"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Menu/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VBoxContainer2" type="VBoxContainer" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="CurrentLobbyLabel" type="Label" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer2"]
|
||||
layout_mode = 2
|
||||
text = "Current Lobby"
|
||||
|
||||
[node name="LobbyMemberList" type="ItemList" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer2"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
same_column_width = true
|
||||
|
||||
[node name="DebugModeBtn" type="Button" parent="Menu/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer2"]
|
||||
layout_mode = 2
|
||||
text = "Debug Mode: false"
|
||||
|
||||
[connection signal="pressed" from="Menu/MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer3/Start" to="." method="_on_start_pressed"]
|
||||
[connection signal="pressed" from="Menu/MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer3/Disconnect" to="." method="_on_disconnect_pressed"]
|
||||
[connection signal="item_activated" from="Menu/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer2/LobbyMemberList" to="." method="_on_lobby_member_list_item_activated"]
|
||||
[connection signal="pressed" from="Menu/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer2/DebugModeBtn" to="." method="_on_debug_mode_btn_pressed"]
|
||||
@@ -0,0 +1 @@
|
||||
uid://c7ea7hd1t6ucj
|
||||
@@ -0,0 +1,53 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://o5mfysu0k6j7"
|
||||
path="res://.godot/imported/Door.blend-c1d9940ec7f793d6297d321a546a591a.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/3D/Objects/Door.blend"
|
||||
dest_files=["res://.godot/imported/Door.blend-c1d9940ec7f793d6297d321a546a591a.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 @@
|
||||
uid://b7nx043bbja0u
|
||||
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://v848hb3emx1j"
|
||||
path="res://.godot/imported/StartTest.png-f66fedc25ea6de8acc4c567aa11e3948.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://test/StartTest.png"
|
||||
dest_files=["res://.godot/imported/StartTest.png-f66fedc25ea6de8acc4c567aa11e3948.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
@@ -0,0 +1 @@
|
||||
uid://cds10pm7hwn3p
|
||||
@@ -0,0 +1,15 @@
|
||||
[gd_resource type="AudioBusLayout" load_steps=2 format=3 uid="uid://dckdvxj335uso"]
|
||||
|
||||
[sub_resource type="AudioEffectOpusChunked" id="AudioEffectOpusChunked_j3pel"]
|
||||
resource_name = "OpusChunked"
|
||||
|
||||
[resource]
|
||||
bus/0/volume_db = 0.267241
|
||||
bus/1/name = &"Mic"
|
||||
bus/1/solo = false
|
||||
bus/1/mute = true
|
||||
bus/1/bypass_fx = false
|
||||
bus/1/volume_db = 0.0
|
||||
bus/1/send = &"Master"
|
||||
bus/1/effect/0/effect = SubResource("AudioEffectOpusChunked_j3pel")
|
||||
bus/1/effect/0/enabled = true
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
uid://105kn4rcg8bd
|
||||
@@ -0,0 +1 @@
|
||||
uid://28gkh48f7sib
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>libgodotsteam</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.godotsteam.godotsteam</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>libgodotsteam</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>4.15</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
<array>
|
||||
<string>MacOSX</string>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>4.15</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.12</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,108 @@
|
||||
[preset.0]
|
||||
|
||||
name="RP4"
|
||||
platform="Windows Desktop"
|
||||
runnable=true
|
||||
advanced_options=false
|
||||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="Binarys/Spacebots.exe"
|
||||
patches=PackedStringArray()
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
seed=0
|
||||
encrypt_pck=false
|
||||
encrypt_directory=false
|
||||
script_export_mode=2
|
||||
|
||||
[preset.0.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
debug/export_console_wrapper=0
|
||||
binary_format/embed_pck=true
|
||||
texture_format/s3tc_bptc=true
|
||||
texture_format/etc2_astc=false
|
||||
binary_format/architecture="x86_64"
|
||||
codesign/enable=false
|
||||
codesign/timestamp=true
|
||||
codesign/timestamp_server_url=""
|
||||
codesign/digest_algorithm=1
|
||||
codesign/description=""
|
||||
codesign/custom_options=PackedStringArray()
|
||||
application/modify_resources=false
|
||||
application/icon="uid://7pvy0oj2u05y"
|
||||
application/console_wrapper_icon="uid://7pvy0oj2u05y"
|
||||
application/icon_interpolation=4
|
||||
application/file_version=""
|
||||
application/product_version=""
|
||||
application/company_name="Boring Game Studio"
|
||||
application/product_name="Spacebots"
|
||||
application/file_description=""
|
||||
application/copyright=""
|
||||
application/trademarks=""
|
||||
application/export_angle=0
|
||||
application/export_d3d12=0
|
||||
application/d3d12_agility_sdk_multiarch=true
|
||||
ssh_remote_deploy/enabled=false
|
||||
ssh_remote_deploy/host="user@host_ip"
|
||||
ssh_remote_deploy/port="22"
|
||||
ssh_remote_deploy/extra_args_ssh=""
|
||||
ssh_remote_deploy/extra_args_scp=""
|
||||
ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}'
|
||||
$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}'
|
||||
$trigger = New-ScheduledTaskTrigger -Once -At 00:00
|
||||
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
|
||||
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings
|
||||
Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true
|
||||
Start-ScheduledTask -TaskName godot_remote_debug
|
||||
while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 }
|
||||
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue"
|
||||
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
|
||||
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
|
||||
Remove-Item -Recurse -Force '{temp_dir}'"
|
||||
|
||||
[preset.1]
|
||||
|
||||
name="Linux"
|
||||
platform="Linux"
|
||||
runnable=true
|
||||
advanced_options=false
|
||||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="binaries/Spacebots_runnable_linux.exe.x86_64"
|
||||
patches=PackedStringArray()
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
seed=0
|
||||
encrypt_pck=false
|
||||
encrypt_directory=false
|
||||
script_export_mode=2
|
||||
|
||||
[preset.1.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
debug/export_console_wrapper=1
|
||||
binary_format/embed_pck=false
|
||||
texture_format/s3tc_bptc=true
|
||||
texture_format/etc2_astc=false
|
||||
binary_format/architecture="x86_64"
|
||||
ssh_remote_deploy/enabled=false
|
||||
ssh_remote_deploy/host="user@host_ip"
|
||||
ssh_remote_deploy/port="22"
|
||||
ssh_remote_deploy/extra_args_ssh=""
|
||||
ssh_remote_deploy/extra_args_scp=""
|
||||
ssh_remote_deploy/run_script="#!/usr/bin/env bash
|
||||
export DISPLAY=:0
|
||||
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
|
||||
\"{temp_dir}/{exe_name}\" {cmd_args}"
|
||||
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
|
||||
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
|
||||
rm -rf \"{temp_dir}\""
|
||||
@@ -0,0 +1,20 @@
|
||||
extends Object
|
||||
class_name GridCell
|
||||
|
||||
var position: Vector2i
|
||||
var spaceTaken: bool = false
|
||||
var biomeConnection: bool = false
|
||||
var door: bool = false
|
||||
var doorOrientation: int
|
||||
enum doorOrientations {north,east,south,west}
|
||||
|
||||
var biome: String
|
||||
|
||||
func duplicate() -> GridCell:
|
||||
var returnData := GridCell.new()
|
||||
returnData.spaceTaken = spaceTaken
|
||||
returnData.door = door
|
||||
returnData.doorOrientation = doorOrientation
|
||||
returnData.biome = biome
|
||||
returnData.biomeConnection = biomeConnection
|
||||
return returnData
|
||||
@@ -0,0 +1,207 @@
|
||||
[gd_scene load_steps=33 format=3 uid="uid://k0jpd2sugl7b"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c7ea7hd1t6ucj" path="res://script/ShipLogic.gd" id="1_gidgt"]
|
||||
[ext_resource type="Texture2D" uid="uid://cimsjl61nhh5s" path="res://assets/2D/HDR_blue_nebulae-1.hdr" id="2_4sohr"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3ny31fbtn7eb" path="res://test/debugCube.tscn" id="2_nlsxl"]
|
||||
[ext_resource type="PackedScene" uid="uid://2y66sfeblm38" path="res://Maps/Spaceship/Objects/Grabable/FuelCanister.tscn" id="2_rp302"]
|
||||
[ext_resource type="PackedScene" uid="uid://yg472lgqdca7" path="res://Maps/Spaceship/Objects/Grabable/PowerCell.tscn" id="2_yje2s"]
|
||||
[ext_resource type="PackedScene" uid="uid://clhhslugpfugs" path="res://Maps/Spaceship/Rooms/Starter.tscn" id="3_bs3qb"]
|
||||
[ext_resource type="Script" uid="uid://d3w6uvg5hmphc" path="res://script/randomObject.gd" id="5_rp302"]
|
||||
[ext_resource type="PackedScene" uid="uid://dluf007dbq25" path="res://Maps/Spaceship/Rooms/storage.tscn" id="5_ttkoc"]
|
||||
[ext_resource type="PackedScene" uid="uid://ddacwr4hkhu51" path="res://Maps/Spaceship/Corridors/CorridorShort.tscn" id="5_wf1j8"]
|
||||
[ext_resource type="PackedScene" uid="uid://7ycmkl7f4shi" path="res://Maps/Spaceship/Rooms/generator.tscn" id="6_yje2s"]
|
||||
[ext_resource type="PackedScene" uid="uid://coscryni2ckd7" path="res://Maps/Spaceship/Corridors/CorridorTTurn.tscn" id="7_l5vk7"]
|
||||
[ext_resource type="PackedScene" uid="uid://dqqm5nv732hqq" path="res://Maps/Spaceship/Corridors/CorridorLTurn.tscn" id="9_4wod1"]
|
||||
[ext_resource type="PackedScene" uid="uid://c2wd2wxtbgt2h" path="res://Maps/Spaceship/Corridors/CorridorFourWay.tscn" id="10_ttkoc"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsogpm3kf7s1l" path="res://Maps/Spaceship/Rooms/control.tscn" id="13_uljtq"]
|
||||
[ext_resource type="PackedScene" uid="uid://c52lwhaynro5j" path="res://Maps/Spaceship/Objects/ControllLever.tscn" id="14_ogiy5"]
|
||||
[ext_resource type="PackedScene" uid="uid://botctq3i0fq1t" path="res://Maps/Spaceship/Rooms/fuel_tank.tscn" id="14_sw4ah"]
|
||||
[ext_resource type="PackedScene" uid="uid://7p668ibmmx21" path="res://Maps/Spaceship/Corridors/CorridorDeadEnd.tscn" id="15_6akxh"]
|
||||
[ext_resource type="PackedScene" uid="uid://cxijyr4imvpw2" path="res://Maps/Spaceship/Corridors/corridor_dead_end_breakable.tscn" id="15_h11mn"]
|
||||
[ext_resource type="Texture2D" uid="uid://bp5exqkba4hr3" path="res://assets/2D/SteeringMinigame/Spaceship.png" id="15_jyrsd"]
|
||||
[ext_resource type="PackedScene" uid="uid://cffn8ih6c2oyg" path="res://Maps/Spaceship/Objects/repair_cart.tscn" id="20_6akxh"]
|
||||
[ext_resource type="PackedScene" uid="uid://wo0ikejk0hag" path="res://Maps/Spaceship/Objects/Grabable/RepairCube.tscn" id="21_ddgy6"]
|
||||
[ext_resource type="Script" uid="uid://cjgxd88k1bntf" path="res://script/pathfindingGridLoad.gd" id="22_jidkq"]
|
||||
[ext_resource type="PackedScene" uid="uid://dsp8is8odlbph" path="res://Maps/Spaceship/Objects/Grabable/toolbox.tscn" id="22_n0f7y"]
|
||||
[ext_resource type="PackedScene" uid="uid://b6thwnvy4x07a" path="res://actors/Enemies/Spider/mech_spider_base.tscn" id="23_jidkq"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_sw4ah"]
|
||||
interpolation_mode = 1
|
||||
offsets = PackedFloat32Array(0, 0.25, 0.361502, 0.375, 0.488263, 0.5, 0.615023, 0.625, 0.732394, 0.75, 0.859155, 0.875, 1)
|
||||
colors = PackedColorArray(0, 0, 0, 1, 0.25, 0.25, 0.25, 1, 0.28169, 0.28169, 0.28169, 1, 0.375, 0.375, 0.375, 1, 0.408451, 0.408451, 0.408451, 1, 0.5, 0.5, 0.5, 1, 0.530516, 0.530516, 0.530516, 1, 0.625, 0.625, 0.625, 1, 0.661972, 0.661972, 0.661972, 1, 0.75, 0.75, 0.75, 1, 0.802817, 0.802817, 0.802817, 1, 0.875, 0.875, 0.875, 1, 1, 1, 1, 1)
|
||||
metadata/_snap_enabled = true
|
||||
metadata/_snap_count = 8
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_2xebv"]
|
||||
gradient = SubResource("Gradient_sw4ah")
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_h11mn"]
|
||||
offsets = PackedFloat32Array(0.187793, 0.704225, 0.929577)
|
||||
colors = PackedColorArray(0, 0, 0, 1, 0.58042, 0.58042, 0.58042, 1, 0.860369, 0.860369, 0.860369, 1)
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_ogiy5"]
|
||||
frequency = 0.03
|
||||
fractal_octaves = 8
|
||||
fractal_lacunarity = 5.0
|
||||
fractal_gain = 0.495
|
||||
fractal_weighted_strength = 0.23
|
||||
domain_warp_enabled = true
|
||||
|
||||
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_cijsx"]
|
||||
color_ramp = SubResource("Gradient_h11mn")
|
||||
noise = SubResource("FastNoiseLite_ogiy5")
|
||||
|
||||
[sub_resource type="PanoramaSkyMaterial" id="PanoramaSkyMaterial_bs3qb"]
|
||||
panorama = ExtResource("2_4sohr")
|
||||
|
||||
[sub_resource type="Sky" id="Sky_ck252"]
|
||||
sky_material = SubResource("PanoramaSkyMaterial_bs3qb")
|
||||
|
||||
[sub_resource type="Environment" id="Environment_ayklm"]
|
||||
background_mode = 2
|
||||
sky = SubResource("Sky_ck252")
|
||||
glow_enabled = true
|
||||
glow_levels/1 = 1.38
|
||||
glow_levels/2 = 1.55
|
||||
glow_levels/3 = 5.63
|
||||
glow_levels/5 = 1.75
|
||||
glow_levels/6 = 0.9
|
||||
glow_levels/7 = 0.75
|
||||
glow_strength = 1.73
|
||||
glow_mix = 0.03
|
||||
glow_bloom = 0.05
|
||||
glow_blend_mode = 4
|
||||
glow_hdr_luminance_cap = 1.5
|
||||
glow_map = SubResource("NoiseTexture2D_cijsx")
|
||||
volumetric_fog_emission = Color(1, 1, 1, 1)
|
||||
volumetric_fog_emission_energy = 0.04
|
||||
adjustment_brightness = 1.5
|
||||
adjustment_color_correction = SubResource("GradientTexture1D_2xebv")
|
||||
|
||||
[node name="Spaceship" type="Node3D" node_paths=PackedStringArray("anouncerVoiceEmitter", "controllRoom", "breakableRoom", "pathPivot", "pathfindingGridLoader")]
|
||||
script = ExtResource("1_gidgt")
|
||||
anouncerVoiceEmitter = NodePath("AouncerVoice")
|
||||
controllRoom = NodePath("Rooms/Controll")
|
||||
breakableRoom = NodePath("Rooms/CorridorDeadEndBreakable2")
|
||||
debugObj = ExtResource("2_nlsxl")
|
||||
pathPivot = NodePath("PathPivot")
|
||||
pathfindingGridLoader = NodePath("PathfindingGridLoader")
|
||||
metadata/_custom_type_script = "uid://c7ea7hd1t6ucj"
|
||||
|
||||
[node name="PowerCell" parent="." instance=ExtResource("2_yje2s")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -29.0185, 0.615273, 19.527)
|
||||
|
||||
[node name="FuelCanister" parent="." instance=ExtResource("2_rp302")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.54061, 0.395963, 1.71824)
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_ayklm")
|
||||
|
||||
[node name="Rooms" type="Node3D" parent="."]
|
||||
|
||||
[node name="CorridorShort" parent="Rooms" instance=ExtResource("5_wf1j8")]
|
||||
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 7, 0, 14.01)
|
||||
|
||||
[node name="Starter" parent="Rooms" instance=ExtResource("3_bs3qb")]
|
||||
|
||||
[node name="Generator" parent="Rooms" instance=ExtResource("6_yje2s")]
|
||||
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 28.01, 0, -21)
|
||||
|
||||
[node name="CorridorTTurn" parent="Rooms" instance=ExtResource("7_l5vk7")]
|
||||
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, 0, -14.01)
|
||||
|
||||
[node name="CorridorLTurn" parent="Rooms" instance=ExtResource("9_4wod1")]
|
||||
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 7, 0, 28.01)
|
||||
|
||||
[node name="CorridorFourWay" parent="Rooms" instance=ExtResource("10_ttkoc")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -28.01, 0, 7)
|
||||
|
||||
[node name="Controll" parent="Rooms" node_paths=PackedStringArray("controllStick", "SpaceshipLogicRef") instance=ExtResource("13_uljtq")]
|
||||
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -17.5087, 0, -24.5)
|
||||
controllStick = NodePath("../CorridorDeadEnd/LeverPivot")
|
||||
SpaceshipLogicRef = NodePath("../..")
|
||||
|
||||
[node name="CorridorShort2" parent="Rooms" instance=ExtResource("5_wf1j8")]
|
||||
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -21, 0, -7)
|
||||
|
||||
[node name="FuelTank" parent="Rooms" node_paths=PackedStringArray("SpaceshipLogicRef") instance=ExtResource("14_sw4ah")]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -20.9954, -7, 45.6114)
|
||||
SpaceshipLogicRef = NodePath("../..")
|
||||
|
||||
[node name="CorridorDeadEndBreakable" parent="Rooms" instance=ExtResource("15_h11mn")]
|
||||
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 24.5, 0, 35)
|
||||
|
||||
[node name="CorridorDeadEndBreakable2" parent="Rooms" instance=ExtResource("15_h11mn")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -41.983, 0, -10.4939)
|
||||
|
||||
[node name="Storage" parent="Rooms" instance=ExtResource("5_ttkoc")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -24.515, 0, 28.1)
|
||||
|
||||
[node name="CorridorTTurn2" parent="Rooms" instance=ExtResource("7_l5vk7")]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -35, 0, 7)
|
||||
|
||||
[node name="CorridorDeadEnd" parent="Rooms" instance=ExtResource("15_6akxh")]
|
||||
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, -42.0032, 0, 20.9783)
|
||||
|
||||
[node name="LeverPivot" parent="Rooms/CorridorDeadEnd" instance=ExtResource("14_ogiy5")]
|
||||
transform = Transform3D(4.99998, 0, -0.0130021, 0, 5, 0, 0.0130021, 0, 4.99998, 8.88818, 0.084, -0.0222626)
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="Rooms/CorridorDeadEnd"]
|
||||
transform = Transform3D(-0.00260054, 0, -0.999997, 0, 1, 0, 0.999997, 0, -0.00260054, 10.4358, 3.75997, -0.0182343)
|
||||
pixel_size = 0.05
|
||||
texture = ExtResource("15_jyrsd")
|
||||
|
||||
[node name="Debug" type="Node3D" parent="."]
|
||||
|
||||
[node name="RandomObjects" type="Node" parent="."]
|
||||
|
||||
[node name="DebugCube" type="Node" parent="RandomObjects"]
|
||||
script = ExtResource("5_rp302")
|
||||
dir = "res://test/debugCube.tscn"
|
||||
probability = 0.5
|
||||
metadata/_custom_type_script = "uid://d3w6uvg5hmphc"
|
||||
|
||||
[node name="Nothing" type="Node" parent="RandomObjects"]
|
||||
script = ExtResource("5_rp302")
|
||||
dir = "res://Spaceship/Objects/noObject.tscn"
|
||||
probability = 0.5
|
||||
metadata/_custom_type_script = "uid://d3w6uvg5hmphc"
|
||||
|
||||
[node name="PowerCell2" parent="." instance=ExtResource("2_yje2s")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 29.0044, 1.71881, -21.5441)
|
||||
|
||||
[node name="FmodBankLoader" type="FmodBankLoader" parent="."]
|
||||
bank_paths = ["res://assets/FmodBanks/Desktop/Master.strings.bank", "res://assets/FmodBanks/Desktop/Master.bank", "res://assets/FmodBanks/Desktop/Testing.bank"]
|
||||
|
||||
[node name="AouncerVoice" type="FmodEventEmitter3D" parent="."]
|
||||
event_name = "event:/HullBreached"
|
||||
event_guid = "{f64916fe-7a2e-48ef-b129-bd76350c6f66}"
|
||||
attached = false
|
||||
|
||||
[node name="PathPivot" type="Node3D" parent="."]
|
||||
|
||||
[node name="RepairCart" parent="." instance=ExtResource("20_6akxh")]
|
||||
transform = Transform3D(-0.999883, 0, 0.0152885, 0, 1, 0, -0.0152885, 0, -0.999883, -20.0861, 0.105269, 29.5957)
|
||||
|
||||
[node name="RepairCube" parent="." instance=ExtResource("21_ddgy6")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -20.3975, 0.48862, 27)
|
||||
|
||||
[node name="RepairCube2" parent="." instance=ExtResource("21_ddgy6")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -20.3975, 0.48862, 25.9838)
|
||||
|
||||
[node name="RepairCube3" parent="." instance=ExtResource("21_ddgy6")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -19.342, 0.772745, 26.1866)
|
||||
|
||||
[node name="Toolbox" parent="." instance=ExtResource("22_n0f7y")]
|
||||
transform = Transform3D(0.684, 0, 0.729482, 0, 1, 0, -0.729482, 0, 0.684, -28.8088, 0.0330523, 26.6545)
|
||||
|
||||
[node name="PathfindingGridLoader" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -50, 0, -50)
|
||||
script = ExtResource("22_jidkq")
|
||||
lengthX = 100
|
||||
lengthZ = 100
|
||||
point_density = 0.85
|
||||
|
||||
[node name="MechSpiderBase" parent="." node_paths=PackedStringArray("mapLogicRef") instance=ExtResource("23_jidkq")]
|
||||
transform = Transform3D(0.52, 0, 0, 0, 0.52, 0, 0, 0, 0.52, -6.08227, 0, -6.08163)
|
||||
mapLogicRef = NodePath("..")
|
||||
Binary file not shown.
@@ -0,0 +1,84 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://d1dplm1rdcx1h"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bsteyp1ndegj" path="res://script/settingsmenu.gd" id="1_wd8vk"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_msc0b"]
|
||||
bg_color = Color(0.261456, 0.366432, 0.498267, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_gxfgb"]
|
||||
font_size = 18
|
||||
|
||||
[sub_resource type="StyleBoxLine" id="StyleBoxLine_wd8vk"]
|
||||
|
||||
[node name="Settings" type="Control"]
|
||||
z_index = 5
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_wd8vk")
|
||||
|
||||
[node name="Panel" type="Panel" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_msc0b")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 0
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
mouse_filter = 0
|
||||
theme_override_constants/margin_left = 5
|
||||
theme_override_constants/margin_top = 5
|
||||
theme_override_constants/margin_right = 5
|
||||
theme_override_constants/margin_bottom = 5
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/MarginContainer"]
|
||||
layout_mode = 2
|
||||
text = "Settings Menu"
|
||||
label_settings = SubResource("LabelSettings_gxfgb")
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_styles/separator = SubResource("StyleBoxLine_wd8vk")
|
||||
|
||||
[node name="MarginContainer2" type="MarginContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
mouse_filter = 0
|
||||
theme_override_constants/margin_left = 5
|
||||
theme_override_constants/margin_top = 5
|
||||
theme_override_constants/margin_right = 5
|
||||
theme_override_constants/margin_bottom = 5
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/MarginContainer2"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/MarginContainer2/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="VBoxContainer2" type="VBoxContainer" parent="VBoxContainer/MarginContainer2/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="VBoxContainer3" type="VBoxContainer" parent="VBoxContainer/MarginContainer2/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="VBoxContainer4" type="VBoxContainer" parent="VBoxContainer/MarginContainer2/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
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
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user