| … | … | @@ -16,6 +16,7 @@ const EVENT_PLAYER_SHOOT_GRAPPLINGHOOK = 'player_shoot_grapplinghook' |
| 16 | 16 | const EVENT_PLAYER_RELEASE_GRAPPLINGHOOK = 'player_release_grapplinghook' |
| 17 | 17 | const EVENT_PLAYER_TOGGLE_LIGHT = 'player_toggle_light' |
| 18 | 18 | const EVENT_PLAYER_MASK_SWITCH = 'player_mask_switch' |
| 19 | const EVENT_PLAYER_REMOVE_MASK = 'player_remove_mask' |
| 19 | 20 | |
| 20 | 21 | export var mouseSensitivity : float = 0.3 |
| 21 | 22 | export var movementSpeed : float = 14 |
| … | … | @@ -221,23 +222,26 @@ func mask_GetMaskNodeFromMaskName(_maskName : String) -> PackedScene: |
| 221 | 222 | |
| 222 | 223 | func mask_PlayerSwitchToNewMask(_newMaskName : String): |
| 223 | 224 | var newMask : bool = true |
| 224 | | if(activeMeshMaskAttachment != null): |
| 225 | if( is_instance_valid(activeMeshMaskAttachment) ): |
| 225 | 226 | var _name = activeMeshMaskAttachment.name |
| 227 | # Check for Keyword for Mask to Delete |
| 226 | 228 | if( _newMaskName.nocasecmp_to("DELETE") == 0): |
| 227 | 229 | newMask = false |
| 228 | 230 | newMaskName = "" |
| 229 | 231 | # Remove Current Mask |
| 230 | 232 | activeMeshMaskAttachment.free() |
| 231 | | return |
| 232 | | if( _newMaskName.nocasecmp_to(_name) == 0): |
| 233 | # Check for Same Mask |
| 234 | elif( _newMaskName.nocasecmp_to(_name) == 0): |
| 233 | 235 | newMask = false |
| 234 | 236 | newMaskName = "" |
| 235 | | return |
| 236 | 237 | else: |
| 238 | newMask = false |
| 239 | newMaskName = "" |
| 237 | 240 | # Remove Current Mask |
| 238 | 241 | activeMeshMaskAttachment.free() |
| 242 | activeMeshMaskAttachment = null |
| 239 | 243 | |
| 240 | | if(newMask): |
| 244 | if(newMask and _newMaskName.nocasecmp_to("DELETE") != 0): |
| 241 | 245 | # Get an Instance of the New Mask |
| 242 | 246 | activeMeshMaskAttachment = mask_GetMaskNodeFromMaskName(_newMaskName).instance() |
| 243 | 247 | # Disable Collision Shape |
| … | … | @@ -394,4 +398,5 @@ func playerCoreNetworkDataUpdate_Types(_translation : Vector3, _currentDirection |
| 394 | 398 | |
| 395 | 399 | |
| 396 | 400 | func _on_Input_player_remove_mask(): |
| 397 | | pass # Replace with function body. |
| 401 | newMaskName = "DELETE" |
| 402 | hyperGossip.broadcast_event(EVENT_PLAYER_REMOVE_MASK, getPlayerLocalCoreNetworkData() ) |