| … | … | @@ -0,0 +1,21 @@ |
| 1 | [remap] | |
| 2 | ||
| 3 | importer="wav" | |
| 4 | type="AudioStreamSample" | |
| 5 | path="res://.import/toggleLight_1.wav-3c6b6158e5cc6bccea829ac956df6645.sample" | |
| 6 | ||
| 7 | [deps] | |
| 8 | ||
| 9 | source_file="res://assets/sounds/player/toggleLight_1.wav" | |
| 10 | dest_files=[ "res://.import/toggleLight_1.wav-3c6b6158e5cc6bccea829ac956df6645.sample" ] | |
| 11 | ||
| 12 | [params] | |
| 13 | ||
| 14 | force/8_bit=false | |
| 15 | force/mono=false | |
| 16 | force/max_rate=false | |
| 17 | force/max_rate_hz=44100 | |
| 18 | edit/trim=false | |
| 19 | edit/normalize=false | |
| 20 | edit/loop=false | |
| 21 | compress/mode=0 |
| … | … | @@ -9,6 +9,7 @@ const EVENT_PLAYER_DIRECTION = 'player_direction' |
| 9 | 9 | const EVENT_PLAYER_RESPAWNPLAYER = 'player_respawnplayer' |
| 10 | 10 | const EVENT_PLAYER_SHOOT_GRAPPLINGHOOK = 'player_shoot_grapplinghook' |
| 11 | 11 | const EVENT_PLAYER_RELEASE_GRAPPLINGHOOK = 'player_release_grapplinghook' |
| 12 | const EVENT_PLAYER_TOGGLE_LIGHT = 'player_toggle_light' | |
| 12 | 13 | |
| 13 | 14 | export var mouseSensitivity : float = 0.3 |
| 14 | 15 | export var movementSpeed : float = 14 |
| … | … | @@ -47,6 +48,8 @@ onready var grappleVisualLine : CSGCylinder = $Model/GrappleLineHelper/GrappleVi |
| 47 | 48 | onready var grappleIKTarget : Position3D = $GrapplingHook/IKTarget |
| 48 | 49 | onready var grapplingHandOriginalScale : Vector3 = Vector3.ZERO |
| 49 | 50 | |
| 51 | onready var omniLight : OmniLight = $OmniLight | |
| 52 | ||
| 50 | 53 | var grapplingHook_GrapplePosition : Vector3 = Vector3.ZERO |
| 51 | 54 | var grapplingHook_IsHooked : bool = false |
| 52 | 55 | var playerWantsToShootGrapplingHook : bool = false |
| … | … | @@ -70,6 +73,7 @@ var playerCanJump : bool = false |
| 70 | 73 | var playerWantsToJump : bool = false |
| 71 | 74 | |
| 72 | 75 | var playerWantsNewWorldEnvironment : bool = true |
| 76 | var playerWantsToToggleLight : bool = false | |
| 73 | 77 | |
| 74 | 78 | var f_input : float |
| 75 | 79 | var h_input : float |
| … | … | @@ -208,6 +212,12 @@ func _physics_process(_delta): |
| 208 | 212 | if(playerWantsNewWorldEnvironment): |
| 209 | 213 | playerWantsNewWorldEnvironment = false |
| 210 | 214 | currentMap.updateMapWorldEnvironmentScene() |
| 215 | ||
| 216 | # Check for Toggle Light | |
| 217 | if(playerWantsToToggleLight): | |
| 218 | playerWantsToToggleLight = false | |
| 219 | omniLight.visible = !omniLight.visible | |
| 220 | $Model/Sound_ToggleLight_1.play() | |
| 211 | 221 | |
| 212 | 222 | # Moving the character |
| 213 | 223 | var y_cache : float = kinematicVelocity.y |
| … | … | @@ -380,6 +390,10 @@ func _on_Input_player_release_grapplinghook(): |
| 380 | 390 | if(grapplingHook_IsHooked): |
| 381 | 391 | playerWantsToReleaseGrapplingHook = true |
| 382 | 392 | hyperGossip.broadcast_event(EVENT_PLAYER_RELEASE_GRAPPLINGHOOK, getPlayerLocalCoreNetworkData() ) |
| 393 | ||
| 394 | func _on_Input_player_toggle_light(): | |
| 395 | playerWantsToToggleLight = true | |
| 396 | hyperGossip.broadcast_event(EVENT_PLAYER_TOGGLE_LIGHT, getPlayerLocalCoreNetworkData() ) | |
| 383 | 397 | |
| 384 | 398 | |
| 385 | 399 | func _checkPlayerCanJump(newBody : PhysicsBody, addedBody : bool) -> void: |
| … | … | @@ -1,4 +1,4 @@ |
| 1 | [gd_scene load_steps=36 format=2] | |
| 1 | [gd_scene load_steps=37 format=2] | |
| 2 | 2 | |
| 3 | 3 | [ext_resource path="res://assets/models/tumble/model_tumble.tscn" type="PackedScene" id=1] |
| 4 | 4 | [ext_resource path="res://assets/models/tumble/tumble/sprint-loop.tres" type="Animation" id=2] |
| … | … | @@ -34,6 +34,7 @@ |
| 34 | 34 | [ext_resource path="res://assets/sounds/player/fire_grapplinghook1.mp3" type="AudioStream" id=32] |
| 35 | 35 | [ext_resource path="res://assets/sounds/player/teleport_1.mp3" type="AudioStream" id=33] |
| 36 | 36 | [ext_resource path="res://game/player/grappling_hook/gh_visual_line_1.tscn" type="PackedScene" id=34] |
| 37 | [ext_resource path="res://assets/sounds/player/toggleLight_1.wav" type="AudioStream" id=35] | |
| 37 | 38 | |
| 38 | 39 | [sub_resource type="CylinderShape" id=1] |
| 39 | 40 | radius = 0.3 |
| … | … | @@ -87,6 +88,11 @@ transform = Transform( 1.53846, 0, 0, 0, 1.53846, 0, 0, 0, 1.53846, 0, 0, 0 ) |
| 87 | 88 | stream = ExtResource( 33 ) |
| 88 | 89 | attenuation_filter_cutoff_hz = 20500.0 |
| 89 | 90 | |
| 91 | [node name="Sound_ToggleLight_1" type="AudioStreamPlayer3D" parent="Model"] | |
| 92 | transform = Transform( 1.53846, 0, 0, 0, 1.53846, 0, 0, 0, 1.53846, 0, 0, 0 ) | |
| 93 | stream = ExtResource( 35 ) | |
| 94 | attenuation_filter_cutoff_hz = 20500.0 | |
| 95 | ||
| 90 | 96 | [node name="GrappleLineHelper" type="Spatial" parent="Model"] |
| 91 | 97 | transform = Transform( 1.53846, 0, 0, 0, 1.53846, 0, 0, 0, 1.53846, 0, 0.753, 0 ) |
| 92 | 98 | |
| … | … | @@ -148,4 +154,11 @@ autostart = true |
| 148 | 154 | [node name="IKTarget" type="Position3D" parent="GrapplingHook"] |
| 149 | 155 | transform = Transform( -0.454202, 0.376862, -0.807264, 0.862653, -0.0403142, -0.504187, -0.222553, -0.925392, -0.30679, 0, 0.96284, -1.2328 ) |
| 150 | 156 | |
| 157 | [node name="OmniLight" type="OmniLight" parent="."] | |
| 158 | transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.769087, 0 ) | |
| 159 | visible = false | |
| 160 | light_energy = 5.194 | |
| 161 | shadow_color = Color( 1, 1, 1, 1 ) | |
| 162 | omni_range = 2.23 | |
| 163 | ||
| 151 | 164 | [connection signal="timeout" from="MoveNetworkTimer" to="." method="_on_MoveNetworkTimer_timeout"] |
| … | … | @@ -54,5 +54,6 @@ far = 8192.0 |
| 54 | 54 | [connection signal="player_release_grapplinghook" from="Input" to="." method="_on_Input_player_release_grapplinghook"] |
| 55 | 55 | [connection signal="player_restore_origin" from="Input" to="." method="_on_Input_player_restore_origin"] |
| 56 | 56 | [connection signal="player_shoot_grapplinghook" from="Input" to="." method="_on_Input_player_shoot_grapplinghook"] |
| 57 | [connection signal="player_toggle_light" from="Input" to="." method="_on_Input_player_toggle_light"] | |
| 57 | 58 | |
| 58 | 59 | [editable path="Model"] |
| … | … | @@ -11,6 +11,7 @@ signal player_jump() |
| 11 | 11 | signal player_move(inputDirection) |
| 12 | 12 | signal player_shoot_grapplinghook() |
| 13 | 13 | signal player_release_grapplinghook() |
| 14 | signal player_toggle_light() | |
| 14 | 15 | # signal player_shoot() |
| 15 | 16 | |
| 16 | 17 | var previousInputDirection : Vector3 = Vector3.ZERO |
| … | … | @@ -62,6 +63,9 @@ func _input(event : InputEvent): |
| 62 | 63 | if event.is_action_pressed("restoreOrigin"): |
| 63 | 64 | emit_signal("player_restore_origin") |
| 64 | 65 | |
| 66 | if event.is_action_pressed("toggleLight"): | |
| 67 | emit_signal("player_toggle_light") | |
| 68 | ||
| 65 | 69 | #if Input.is_action_pressed("forward") || Input.is_action_pressed("backward") || Input.is_action_pressed("left") || Input.is_action_pressed("right"): |
| 66 | 70 | # movementDirection = Vector3.ZERO |
| 67 | 71 | # movementDirection = Vector3(Input.get_action_strength("left") - Input.get_action_strength("right"), |
| … | … | @@ -15,6 +15,7 @@ const EVENT_PLAYER_RESPAWNPLAYER = 'player_respawnplayer' |
| 15 | 15 | const EVENT_PLAYER_MAPCHANGE = 'player_mapchange' |
| 16 | 16 | const EVENT_PLAYER_SHOOT_GRAPPLINGHOOK = 'player_shoot_grapplinghook' |
| 17 | 17 | const EVENT_PLAYER_RELEASE_GRAPPLINGHOOK = 'player_release_grapplinghook' |
| 18 | const EVENT_PLAYER_TOGGLE_LIGHT = 'player_toggle_light' | |
| 18 | 19 | |
| 19 | 20 | var PlayerCoreLocal = preload("res://game/player/player_core_local.tscn") |
| 20 | 21 | var PlayerCoreRemote = preload("res://game/player/player_core_remote.tscn") |
| … | … | @@ -80,6 +81,8 @@ func _on_HyperGossip_event(type, data, from): |
| 80 | 81 | updatePlayer_shootGrapplingHook(data, from) |
| 81 | 82 | elif type == EVENT_PLAYER_RELEASE_GRAPPLINGHOOK: |
| 82 | 83 | updatePlayer_releaseGrapplingHook(data, from) |
| 84 | elif type == EVENT_PLAYER_TOGGLE_LIGHT: | |
| 85 | updatePlayer_toggleLight(data, from) | |
| 83 | 86 | |
| 84 | 87 | func get_player_object(id): |
| 85 | 88 | if knownPlayers.has(id): |
| … | … | @@ -131,6 +134,12 @@ func updatePlayer_wantstojump(data, id): |
| 131 | 134 | remotePlayer.playerCoreNetworkDataUpdate(data) |
| 132 | 135 | remotePlayer.playerWantsToJump = true |
| 133 | 136 | |
| 137 | func updatePlayer_toggleLight(data, id): | |
| 138 | var remotePlayer = get_player_object(id) | |
| 139 | ||
| 140 | remotePlayer.playerCoreNetworkDataUpdate(data) | |
| 141 | remotePlayer.playerWantsToToggleLight = true | |
| 142 | ||
| 134 | 143 | func updatePlayer_mapchange(data, _id): |
| 135 | 144 | var newMapName = data.map.name |
| 136 | 145 | # TODO : Do this elsewhere |
| … | … | @@ -160,6 +160,11 @@ toggle_slowmo={ |
| 160 | 160 | "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":90,"physical_scancode":0,"unicode":0,"echo":false,"script":null) |
| 161 | 161 | ] |
| 162 | 162 | } |
| 163 | toggleLight={ | |
| 164 | "deadzone": 0.5, | |
| 165 | "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":88,"physical_scancode":0,"unicode":0,"echo":false,"script":null) | |
| 166 | ] | |
| 167 | } | |
| 163 | 168 | |
| 164 | 169 | [physics] |
| 165 | 170 |