| … | … | @@ -0,0 +1,57 @@ |
| 1 | extends Spatial | |
| 2 | ||
| 3 | export var teleportation_destination : String = "map_test" | |
| 4 | ||
| 5 | onready var mapsNode : Node = get_tree().get_current_scene().get_node("Maps") | |
| 6 | onready var currentMapNode : Node = get_tree().get_current_scene().get_node("Maps").get_child(0) | |
| 7 | ||
| 8 | ||
| 9 | # Declare member variables here. Examples: | |
| 10 | # var a = 2 | |
| 11 | # var b = "text" | |
| 12 | ||
| 13 | ||
| 14 | # Called when the node enters the scene tree for the first time. | |
| 15 | func _ready(): | |
| 16 | pass # Replace with function body. | |
| 17 | ||
| 18 | func _on_Teleporter_gameplay_entered(): | |
| 19 | pass | |
| 20 | ||
| 21 | ||
| 22 | func tryMapChange(mapChangeName : String, sendGossip : bool, playerNode): | |
| 23 | var mapCurrentName = currentMapNode.name | |
| 24 | var mapNode = null | |
| 25 | if(mapCurrentName != teleportation_destination): | |
| 26 | currentMapNode.queue_free() | |
| 27 | if(mapChangeName == "map_test"): | |
| 28 | print("") | |
| 29 | mapNode = get_tree().get_current_scene().map_test | |
| 30 | elif(mapChangeName == "map_cyber"): | |
| 31 | print("") | |
| 32 | mapNode = get_tree().get_current_scene().map_cyber | |
| 33 | elif(mapChangeName == "map_cyber1"): | |
| 34 | print("") | |
| 35 | mapNode = get_tree().get_current_scene().map_cyber1 | |
| 36 | var newMap = mapNode.instance() | |
| 37 | mapsNode.add_child(newMap) | |
| 38 | # Find a Respawn Point | |
| 39 | playerNode.currentSpawnLocation = playerNode.getSpawnLocation() | |
| 40 | playerNode.playerWantsToRespawn = true | |
| 41 | ||
| 42 | if(sendGossip): | |
| 43 | var data : Dictionary = { | |
| 44 | "map": { | |
| 45 | "name": mapChangeName | |
| 46 | } | |
| 47 | } | |
| 48 | #hyperGossip.broadcast_event(EVENT_PLAYER_MAPCHANGE, data) | |
| 49 | ||
| 50 | ||
| 51 | func _on_CollisionShape_gameplay_entered(): | |
| 52 | pass # Replace with function body. | |
| 53 | ||
| 54 | ||
| 55 | func _on_Hitbox_body_shape_entered(body_rid, body, body_shape_index, local_shape_index): | |
| 56 | if(body is KinematicBody): | |
| 57 | tryMapChange(teleportation_destination, true, body) |
| … | … | @@ -16,9 +16,9 @@ func getSpawnLocation() -> Vector3: |
| 16 | 16 | |
| 17 | 17 | func addGrapplingHookCollisionMaskToMap(): |
| 18 | 18 | var _name = self.name |
| 19 | var currentMap : Node = get_tree().get_current_scene().get_node("CurrentMap").find_node(_name, true, false) | |
| 20 | var assetMap : Spatial = currentMap.find_node("asset_" + currentMap.name) | |
| 21 | checkAndSetChildrenGrapplingHookMask(assetMap, 0) | |
| 19 | # var currentMap : Node = get_tree().get_current_scene().get_node("Maps").find_node(_name, true, false) | |
| 20 | # var assetMap : Spatial = currentMap.find_node("asset_" + currentMap.name) | |
| 21 | checkAndSetChildrenGrapplingHookMask(self, 0) | |
| 22 | 22 | |
| 23 | 23 | func checkAndSetChildrenGrapplingHookMask(var _Node, indentLevel : int): |
| 24 | 24 | var _strIndents : String = "" |
| … | … | @@ -149,7 +149,7 @@ shader_param/_clouds_texture = ExtResource( 15 ) |
| 149 | 149 | radial_segments = 8 |
| 150 | 150 | rings = 8 |
| 151 | 151 | |
| 152 | [node name="map_cyber" type="Node"] | |
| 152 | [node name="map_cyber" type="Spatial"] | |
| 153 | 153 | script = ExtResource( 4 ) |
| 154 | 154 | |
| 155 | 155 | [node name="asset_map_cyber" parent="." instance=ExtResource( 2 )] |
| … | … | @@ -1,8 +1,9 @@ |
| 1 | [gd_scene load_steps=6 format=2] | |
| 1 | [gd_scene load_steps=7 format=2] | |
| 2 | 2 | |
| 3 | 3 | [ext_resource path="res://assets/maps/map_test/asset_map_test.tscn" type="PackedScene" id=1] |
| 4 | 4 | [ext_resource path="res://game/maps/map_core.gd" type="Script" id=2] |
| 5 | 5 | [ext_resource path="res://game/map_decorations/spawnpad_nocollision.tscn" type="PackedScene" id=3] |
| 6 | [ext_resource path="res://game/map_decorations/teleport.scn" type="PackedScene" id=4] | |
| 6 | 7 | |
| 7 | 8 | [sub_resource type="ProceduralSky" id=34] |
| 8 | 9 | sky_top_color = Color( 0.4, 0.741176, 0.92549, 1 ) |
| … | … | @@ -41,7 +42,7 @@ glow_hdr_threshold = 0.44 |
| 41 | 42 | glow_hdr_luminance_cap = 11.62 |
| 42 | 43 | glow_hdr_scale = 1.16 |
| 43 | 44 | |
| 44 | [node name="map_test" type="Node"] | |
| 45 | [node name="map_test" type="Spatial"] | |
| 45 | 46 | script = ExtResource( 2 ) |
| 46 | 47 | |
| 47 | 48 | [node name="asset_map_test" parent="." instance=ExtResource( 1 )] |
| … | … | @@ -58,6 +59,11 @@ directional_shadow_depth_range = 1 |
| 58 | 59 | [node name="WorldEnvironment" type="WorldEnvironment" parent="."] |
| 59 | 60 | environment = SubResource( 9 ) |
| 60 | 61 | |
| 62 | [node name="Teleporters" type="Node" parent="."] | |
| 63 | ||
| 64 | [node name="Teleporter_1" parent="Teleporters" instance=ExtResource( 4 )] | |
| 65 | transform = Transform( 0.655427, 0, -0.755259, 0, 1, 0, 0.755259, 0, 0.655427, -15.0371, -3.75616, -37.6492 ) | |
| 66 | ||
| 61 | 67 | [node name="PlayerSpawnNodes" type="Node" parent="."] |
| 62 | 68 | |
| 63 | 69 | [node name="Spawnpad_1" parent="PlayerSpawnNodes" instance=ExtResource( 3 )] |
| … | … | @@ -82,7 +82,7 @@ var Particles_Land = preload("res://game/player/particles.tscn") |
| 82 | 82 | |
| 83 | 83 | func _ready(): |
| 84 | 84 | # Get Current Map |
| 85 | currentMap = get_tree().get_current_scene().get_node("CurrentMap").get_child(0) | |
| 85 | currentMap = get_tree().get_current_scene().get_node("Maps").get_child(0) | |
| 86 | 86 | |
| 87 | 87 | # Backup Origin |
| 88 | 88 | originalOrigin = self.translation |
| … | … | @@ -103,8 +103,7 @@ func directionUpdate(_direction : Vector3): |
| 103 | 103 | self.currentDirection = _direction |
| 104 | 104 | |
| 105 | 105 | func getSpawnLocation() -> Vector3: |
| 106 | var spawnLocation : Vector3 = currentMap.getSpawnLocation() | |
| 107 | return spawnLocation | |
| 106 | return get_tree().get_current_scene().getSpawnLocation() | |
| 108 | 107 | |
| 109 | 108 | |
| 110 | 109 | func _process(_delta): |
| … | … | @@ -124,6 +123,7 @@ func grapplingHook_CheckActivation(): |
| 124 | 123 | # Activate hook |
| 125 | 124 | if(playerWantsToShootGrapplingHook): |
| 126 | 125 | playerWantsToShootGrapplingHook = false |
| 126 | playerWantsToReleaseGrapplingHook = false | |
| 127 | 127 | grapplingHook_IsHooked = true |
| 128 | 128 | grappleVisualLine.show() |
| 129 | 129 | $Model/Sound_Shoot_GrapplingHook_2.play() |
| … | … | @@ -7,16 +7,12 @@ onready var velocityValue : Label = $Panel/MarginContainer/GridContainer/Velocit |
| 7 | 7 | onready var speedValue : Label = $Panel/MarginContainer/GridContainer/Speed_Value |
| 8 | 8 | onready var onfloorValue : Label = $Panel/MarginContainer/GridContainer/OnFloor_Value |
| 9 | 9 | |
| 10 | ||
| 10 | 11 | const EVENT_PLAYER_MAPCHANGE = 'player_mapchange' |
| 11 | 12 | |
| 12 | 13 | var actualMapNode : Node |
| 13 | 14 | var hyperGossip : HyperGossip |
| 14 | 15 | |
| 15 | # TODO : I don't know where these should go, no real dynamic detection of nodes like this | |
| 16 | var map_test = preload("res://game/maps/map_test/map_test.tscn") | |
| 17 | var map_cyber = preload("res://game/maps/map_cyber/map_cyber.tscn") | |
| 18 | var map_cyber1 = preload("res://game/maps/map_cyber1/map_cyber1.scn") | |
| 19 | ||
| 20 | 16 | |
| 21 | 17 | func _ready(): |
| 22 | 18 | inputValue.text = String(Vector3.ZERO) |
| … | … | @@ -24,7 +20,7 @@ func _ready(): |
| 24 | 20 | onfloorValue.text = "N/A" |
| 25 | 21 | |
| 26 | 22 | # Update Actual Map Node |
| 27 | actualMapNode = get_tree().get_current_scene().get_node("CurrentMap").find_node("*", true, false) | |
| 23 | actualMapNode = get_tree().get_current_scene().get_node("Maps").get_child(0) | |
| 28 | 24 | |
| 29 | 25 | # Get HyperGossip |
| 30 | 26 | hyperGossip = get_tree().get_current_scene().get_node("HyperGodot").get_node("HyperGossip") |
| … | … | @@ -75,11 +71,11 @@ func tryMapChange(mapChangeName : String, sendGossip : bool): |
| 75 | 71 | if(mapCurrentName != mapChangeName): |
| 76 | 72 | actualMapNode.queue_free() |
| 77 | 73 | if(mapChangeName == "map_test"): |
| 78 | mapNode = map_test | |
| 74 | mapNode = get_tree().get_current_scene().map_test | |
| 79 | 75 | elif(mapChangeName == "map_cyber"): |
| 80 | mapNode = map_cyber | |
| 76 | mapNode = get_tree().get_current_scene().map_cyber | |
| 81 | 77 | elif(mapChangeName == "map_cyber1"): |
| 82 | mapNode = map_cyber1 | |
| 78 | mapNode = get_tree().get_current_scene().map_cyber1 | |
| 83 | 79 | var newMap = mapNode.instance() |
| 84 | 80 | currentMapNode.add_child(newMap) |
| 85 | 81 | # Update Current Map |
| … | … | @@ -187,4 +187,4 @@ nodes/walk_scale/node = SubResource( 23 ) |
| 187 | 187 | nodes/walk_scale/position = Vector2( -640, 360 ) |
| 188 | 188 | nodes/wall_run/node = SubResource( 50 ) |
| 189 | 189 | nodes/wall_run/position = Vector2( 720, -60 ) |
| 190 | node_connections = [ "output", 0, "wall_run", "TimeScale 3", 0, "strafe", "falling_scale", 0, "Animation 6", "air_blend", 0, "jump_scale", "air_blend", 1, "falling_scale", "air_blend", 2, "landing_scale", "iwr_blend", 0, "Animation 2", "iwr_blend", 1, "walk_scale", "iwr_blend", 2, "run_scale", "jump_scale", 0, "jump", "air_transition", 0, "air_blend", "air_transition", 1, "aim_transition", "aim_transition", 0, "TimeScale 3", "aim_transition", 1, "iwr_blend", "landing_scale", 0, "Animation 7", "Blend2", 0, "Animation 8", "Blend2", 1, "Animation 9", "run_scale", 0, "Animation 4", "roll", 0, "air_transition", "roll", 1, "roll_scale", "roll_scale", 0, "Animation", "Blend2 2", 0, "Animation 11", "Blend2 2", 1, "Animation 10", "walk_scale", 0, "Animation 3", "wall_run", 0, "Blend2", "wall_run", 1, "Blend2 2", "wall_run", 2, "roll" ] | |
| 190 | node_connections = [ "output", 0, "wall_run", "roll", 0, "air_transition", "roll", 1, "roll_scale", "air_transition", 0, "air_blend", "air_transition", 1, "aim_transition", "landing_scale", 0, "Animation 7", "walk_scale", 0, "Animation 3", "run_scale", 0, "Animation 4", "aim_transition", 0, "TimeScale 3", "aim_transition", 1, "iwr_blend", "jump_scale", 0, "jump", "air_blend", 0, "jump_scale", "air_blend", 1, "falling_scale", "air_blend", 2, "landing_scale", "roll_scale", 0, "Animation", "iwr_blend", 0, "Animation 2", "iwr_blend", 1, "walk_scale", "iwr_blend", 2, "run_scale", "wall_run", 0, "Blend2", "wall_run", 1, "Blend2 2", "wall_run", 2, "roll", "Blend2 2", 0, "Animation 11", "Blend2 2", 1, "Animation 10", "TimeScale 3", 0, "strafe", "falling_scale", 0, "Animation 6", "Blend2", 0, "Animation 8", "Blend2", 1, "Animation 9" ] |
| … | … | @@ -0,0 +1,38 @@ |
| 1 | extends Node | |
| 2 | ||
| 3 | onready var map_test = preload("res://game/maps/map_test/map_test.tscn") | |
| 4 | onready var map_cyber = preload("res://game/maps/map_cyber/map_cyber.tscn") | |
| 5 | onready var map_cyber1 = preload("res://game/maps/map_cyber1/map_cyber1.scn") | |
| 6 | ||
| 7 | # Declare member variables here. Examples: | |
| 8 | # var a = 2 | |
| 9 | # var b = "text" | |
| 10 | ||
| 11 | func fartPussy(): | |
| 12 | pass | |
| 13 | ||
| 14 | ||
| 15 | # Called when the node enters the scene tree for the first time. | |
| 16 | func _ready(): | |
| 17 | pass # Replace with function body. | |
| 18 | ||
| 19 | ||
| 20 | # Called every frame. 'delta' is the elapsed time since the previous frame. | |
| 21 | #func _process(delta): | |
| 22 | # pass | |
| 23 | ||
| 24 | func getSpawnLocation() -> Vector3: | |
| 25 | # Get Number of Maps | |
| 26 | var childCount : int = self.get_child(0).get_child_count() | |
| 27 | # Get Random Map | |
| 28 | var mapNode = self.get_child(0).get_child( randi() % childCount ) | |
| 29 | ||
| 30 | # Get Random Spawn Location from Map | |
| 31 | var playerSpawnNodes = mapNode.find_node("PlayerSpawnNodes", true, false) | |
| 32 | # Get Number of Spawn Nodes | |
| 33 | childCount = playerSpawnNodes.get_child_count() | |
| 34 | # Get Random Spawn Node | |
| 35 | var spawnNode : Spatial = playerSpawnNodes.get_child( randi() % childCount ) | |
| 36 | ||
| 37 | # Return! | |
| 38 | return spawnNode.translation |
| … | … | @@ -1,4 +1,4 @@ |
| 1 | [gd_scene load_steps=7 format=2] | |
| 1 | [gd_scene load_steps=10 format=2] | |
| 2 | 2 | |
| 3 | 3 | [ext_resource path="res://game/maps/map_test/map_test.tscn" type="PackedScene" id=1] |
| 4 | 4 | [ext_resource path="res://game/player/player_core_local.tscn" type="PackedScene" id=2] |
| … | … | @@ -6,12 +6,20 @@ |
| 6 | 6 | [ext_resource path="res://hypergodot/hyper_gateway/hyper_gateway.gd" type="Script" id=4] |
| 7 | 7 | [ext_resource path="res://hypergodot/hyper_debugui/hyper_debugui.tscn" type="PackedScene" id=5] |
| 8 | 8 | [ext_resource path="res://hypergodot/hyper_godot_core.gd" type="Script" id=6] |
| 9 | [ext_resource path="res://main.gd" type="Script" id=7] | |
| 10 | [ext_resource path="res://game/maps/map_cyber1/map_cyber1.scn" type="PackedScene" id=8] | |
| 11 | [ext_resource path="res://game/maps/map_cyber/map_cyber.tscn" type="PackedScene" id=9] | |
| 9 | 12 | |
| 10 | 13 | [node name="Main" type="Node"] |
| 14 | script = ExtResource( 7 ) | |
| 11 | 15 | |
| 12 | [node name="CurrentMap" type="Node" parent="."] | |
| 16 | [node name="Maps" type="Node" parent="."] | |
| 13 | 17 | |
| 14 | [node name="map_test" parent="CurrentMap" instance=ExtResource( 1 )] | |
| 18 | [node name="map_test" parent="Maps" instance=ExtResource( 1 )] | |
| 19 | ||
| 20 | [node name="map_cyber" parent="Maps" instance=ExtResource( 9 )] | |
| 21 | ||
| 22 | [node name="map_cyber1" parent="Maps" instance=ExtResource( 8 )] | |
| 15 | 23 | |
| 16 | 24 | [node name="Players" type="Node" parent="."] |
| 17 | 25 |