Cleaned up files structure

This commit is contained in:
Willow Behar
2024-06-02 15:30:36 -05:00
parent 7fcaffc1ae
commit 7659f63346
2 changed files with 34 additions and 32 deletions

View File

@ -1,6 +1,5 @@
extends Node3D extends Node3D
func _on_pause_menu_paused(): func _on_pause_menu_paused():
$"player".is_paused = true $"player".is_paused = true

View File

@ -4,42 +4,18 @@ extends CharacterBody3D
#Condition Effect #Condition Effect
enum CONDITION {NORMAL, SPRINTING, VAPING, COUGHING, SEVERE_COUGHING} enum CONDITION {NORMAL, SPRINTING, VAPING, COUGHING, SEVERE_COUGHING}
@export var current_condition = CONDITION.NORMAL @export var current_condition = CONDITION.NORMAL
func set_condition(con):
current_condition = con
print("Setting Condition to ", con)
match con:
CONDITION.VAPING:
vapes_per_min += 1
$Head/VapeLight.on()
$"Coughing Timer".start()
$"Severe Coughing Timer".start()
CONDITION.NORMAL:
$Head/VapeLight.off()
$"Coughing Timer".stop()
$"Severe Coughing Timer".stop()
CONDITION.COUGHING:
$Head/VapeLight.off()
$"Coughing Recovery".start()
$"Severe Coughing Timer".stop()
GlobalSettings.Player_Last_Location = global_transform.origin
CONDITION.SEVERE_COUGHING:
$Head/VapeLight.off()
$"Severe Coughing Recovery".start()
$"Coughing Timer".stop()
GlobalSettings.Player_Last_Location = global_transform.origin
var will_cough = false
var timealive = 0
var vapes_per_min = 0
var current_speed
const SPEED_NORMAL = 5.0 const SPEED_NORMAL = 5.0
const SPEED_SPRINTING = 8.0 const SPEED_SPRINTING = 8.0
const SPEED_VAPING = 4.5 const SPEED_VAPING = 4.5
const SPEED_SLOWED = 3.0 const SPEED_SLOWED = 3.0
const SPEED_IMMOBILE = 0.0 const SPEED_IMMOBILE = 0.0
const JUMP_VELOCITY = 4.5 const JUMP_VELOCITY = 4.5
var current_speed
var will_cough = false
var timealive = 0
var vapes_per_min = 0
#Looking Variables #Looking Variables
var mouse_sensitivity = 0.02 var mouse_sensitivity = 0.02
@ -99,6 +75,8 @@ func _process(delta):
vapes_per_min = 0 vapes_per_min = 0
func _input(event): func _input(event):
if event.is_action("ui_text_backspace"):
respawn()
if not is_paused: if not is_paused:
if event is InputEventMouseMotion: if event is InputEventMouseMotion:
rotate_y(-event.relative.x * mouse_sensitivity) rotate_y(-event.relative.x * mouse_sensitivity)
@ -122,6 +100,30 @@ func _input(event):
if current_condition == CONDITION.SPRINTING: if current_condition == CONDITION.SPRINTING:
set_condition(CONDITION.NORMAL) set_condition(CONDITION.NORMAL)
func set_condition(con):
current_condition = con
print("Setting Condition to ", con)
match con:
CONDITION.VAPING:
vapes_per_min += 1
$Head/VapeLight.on()
$"Coughing Timer".start()
$"Severe Coughing Timer".start()
CONDITION.NORMAL:
$Head/VapeLight.off()
$"Coughing Timer".stop()
$"Severe Coughing Timer".stop()
CONDITION.COUGHING:
$Head/VapeLight.off()
$"Coughing Recovery".start()
$"Severe Coughing Timer".stop()
GlobalSettings.Player_Last_Location = global_transform.origin
CONDITION.SEVERE_COUGHING:
$Head/VapeLight.off()
$"Severe Coughing Recovery".start()
$"Coughing Timer".stop()
GlobalSettings.Player_Last_Location = global_transform.origin
func recover(): func recover():
will_cough = false will_cough = false
match current_condition: match current_condition:
@ -130,6 +132,9 @@ func recover():
CONDITION.SEVERE_COUGHING: CONDITION.SEVERE_COUGHING:
set_condition(CONDITION.NORMAL) set_condition(CONDITION.NORMAL)
func respawn():
global_position = GlobalSettings.SpawnPoint
#Timers #Timers
func _on_coughing_timer_timeout(): func _on_coughing_timer_timeout():
will_cough = true will_cough = true
@ -146,5 +151,3 @@ func _on_coughing_recovery_timeout():
func _on_severe_coughing_recovery_timeout(): func _on_severe_coughing_recovery_timeout():
recover() recover()