2023-01-26 12:17:54 -07:00
|
|
|
extends Node
|
|
|
|
var mouseSensitivity = 0.01 # Unless otherwise changed by user in settings
|
2023-01-31 22:21:21 -07:00
|
|
|
var playingGame = false # Should be true while in a map, set by menus
|
|
|
|
var fatigue = 100 # Makes it so you can't run forever, you have limited energy
|
|
|
|
var playerHealth = 100 # If zero, the player dies. Bullets cause damage
|
|
|
|
var playerDead = false # Defined by Global.player_dead()
|
|
|
|
var playerAlive = true # Gets set to false by death.tscn then to true after the death timer is up
|
|
|
|
var playerPleaseRespawn = false # When true, this executes the apporiate commands to respawn the player. Controlled by death.tscn
|
|
|
|
var playerYDeath = -20 # The point in which the player will die from falling off the map, defined in map scripts
|
2023-02-16 13:27:34 -07:00
|
|
|
var playerName # Defined in the settings-file.gd script
|
2023-01-31 22:21:21 -07:00
|
|
|
var deathShield = 0 # Makes you unkillable for a specified amount of time. Used to prevent the kill screen from appearing twice as well
|
2023-02-02 13:28:14 -07:00
|
|
|
var goScene # This is used for the sceneChangerConfirm window. Initalized by a different script prior to sceneChangerConfirm
|
|
|
|
var consoleOpen = false # This specifies whether or not the console is open
|
|
|
|
var consoleCommand # Defined by console.gd
|
|
|
|
var consoleOutput # Defined by console.gd
|
|
|
|
var godMode = false # Defined by console.gd
|
2023-02-14 11:40:02 -07:00
|
|
|
var selfTeddy # Defined as soon as the player script is initalized
|
2023-02-22 21:31:22 -07:00
|
|
|
var multiplayerCurrent = false # Whether the player is using multiplayer
|
|
|
|
var currentMapNode # Defined in map scripts
|
2023-02-25 14:31:15 -07:00
|
|
|
var teddyAuthorityID # Defined from teddy.gd after object is initalized
|
2023-03-02 12:52:49 -07:00
|
|
|
var miniMenuResume = false # Set to true by mainmenu.gd
|
2023-03-05 22:08:14 -07:00
|
|
|
var roundInSession = false # Goes true once the round is started in Teddy.gd
|
|
|
|
var HUDStartLabelText = "" # The text displayed at the bottom of the screen of the server
|
2023-03-06 00:35:22 -07:00
|
|
|
var lastPersonToHitMe = 0 # Defined in the Bullet RPC
|
|
|
|
var HUDPlayerDied = false # Tells the HUD.gd script that a point should be added or deducted
|
|
|
|
var connectedPlayers = [] # Currently connected players by their name (NOT THEIR ID)
|
2023-03-16 13:37:17 -06:00
|
|
|
var connectedPlayersByPeerID = [] # Currently connected players by their ID
|
2023-03-06 19:07:22 -07:00
|
|
|
var respawnTimeModifier = 1.0 # Affects how quickly the player respawns in death.gd
|
2023-03-11 18:50:43 -07:00
|
|
|
var musicName = "" # Name of music for HUD.gd
|
|
|
|
var musicAuthor = "" # Name of music author for HUD.gd
|
|
|
|
var musicUpdated = false # Tells HUD.gd to update labels and change visibility
|
2023-03-12 00:43:49 -07:00
|
|
|
var menuLightSwitch = false # No description provided
|
2023-03-16 13:37:17 -06:00
|
|
|
var gamemode = "Deathmatch" # This is changed in host.gd
|
|
|
|
var chosenRunner # Changed in HUD.gd
|
|
|
|
var iAmRunner = false # Defines whether you're the runner or not. Used in HUD.gd
|
|
|
|
var runnerDead = false
|
2023-01-31 13:34:11 -07:00
|
|
|
|
|
|
|
func _process(delta):
|
2023-02-02 13:28:14 -07:00
|
|
|
if godMode:
|
|
|
|
pass
|
2023-03-16 13:37:17 -06:00
|
|
|
elif Input.is_action_pressed("sprint") and not iAmRunner and roundInSession:
|
2023-01-31 13:34:11 -07:00
|
|
|
if fatigue > 0:
|
|
|
|
fatigue = fatigue - 10 * delta
|
|
|
|
elif not Input.is_action_pressed("sprint"):
|
|
|
|
if fatigue < 100:
|
2023-03-12 00:43:49 -07:00
|
|
|
fatigue = fatigue + 5 * delta
|
2023-01-31 13:34:11 -07:00
|
|
|
if playerAlive:
|
|
|
|
deathShield = deathShield - 10 * delta # Make player not killable until the value falls below 0
|
|
|
|
|
|
|
|
func player_dead():
|
|
|
|
playerDead = true
|
|
|
|
if deathShield <= 0:
|
|
|
|
deathShield = 50
|
|
|
|
if playerAlive:
|
|
|
|
print("Player be deaddddd brooooooo")
|
|
|
|
var scene_trs =load("res://scenes/death.tscn")
|
|
|
|
var scene=scene_trs.instantiate()
|
|
|
|
add_child(scene)
|
2023-02-07 13:22:31 -07:00
|
|
|
|
|
|
|
func reset_variables():
|
|
|
|
print("Variables were reset by something")
|
|
|
|
fatigue = 100
|
|
|
|
playerHealth = 100
|
|
|
|
playerDead = false
|
|
|
|
playerAlive = true
|
|
|
|
playerPleaseRespawn = false
|
2023-02-15 23:41:14 -07:00
|
|
|
|