update codebase to v1.2.0 and fix random bullshit

This commit is contained in:
Lyssa 2024-04-05 13:52:30 +04:00 committed by GitHub
parent 62ae373f9c
commit 9b7a5098be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
55 changed files with 2460 additions and 226 deletions

9
AchievementManager.gd Normal file
View File

@ -0,0 +1,9 @@
class_name Achievement extends Node
func UnlockAchievement(apiname : String):
Steam.setAchievement(apiname)
Steam.storeStats()
func ClearAchievement(apiname : String):
Steam.clearAchievement(apiname)
Steam.storeStats()

10
AmountResource.gd Normal file
View File

@ -0,0 +1,10 @@
class_name AmountResource extends Resource
@export var itemName : String
#item grabbing pool (base game and double or nothing)
@export var amount_active : int
@export var amount_main : int
@export var amount_don : int
#currently in inventory
var amount_player : int
var amount_dealer : int

View File

@ -16,6 +16,9 @@ class_name BriefcaseMachine extends Node
@export var intbranch_L : InteractionBranch
@export var intbranch_R : InteractionBranch
@export var intbranch_lid : InteractionBranch
@export var controller : ControllerManager
@export var btnParent_briefcase : Control
@export var btn_left : Control
var latchRaisedL = false
var latchRaisedR = false
@ -34,6 +37,9 @@ func MainRoutine():
cursor.SetCursor(true, true)
intbranch_L.interactionAllowed = true
intbranch_R.interactionAllowed = true
btnParent_briefcase.visible = true
if (cursor.controller_active): btn_left.grab_focus()
controller.previousFocus = btn_left
func CheckLatches():
if (latchRaisedL == true && latchRaisedR == true):
@ -56,6 +62,7 @@ func OpenLatch(alias : String):
CheckLatches()
func OpenLid():
btnParent_briefcase.visible = false
cursor.SetCursor(false, false)
intbranch_lid.interactionAllowed = false
anim_lid.play("open")

38
BurnerPhone.gd Normal file
View File

@ -0,0 +1,38 @@
class_name BurnerPhone extends Node
@export var sh : ShellSpawner
@export var dia : Dialogue
func SendDialogue():
var sequence = sh.sequenceArray
var len = sequence.size()
var randindex
var firstpart = ""
var secondpart = ""
var fulldia = ""
if (len != 1):
randindex = randi_range(1, len - 1)
if(randindex == 8): randindex -= 1
if (sequence[randindex] == "blank"): secondpart = tr("BLANKROUND")
else: secondpart = tr("LIVEROUND")
match (randindex):
1:
firstpart = tr("SEQUENCE2")
2:
firstpart = tr("SEQUENCE3")
3:
firstpart = tr("SEQUENCE4")
4:
firstpart = tr("SEQUENCE5")
5:
firstpart = tr("SEQUENCE6")
6:
firstpart = tr("SEQUENCE7")
7:
firstpart = tr("SEQUENCE7")
fulldia = tr(firstpart) + "\n" + "... " + tr(secondpart)
else: fulldia = tr("UNFORTUNATE")
dia.ShowText_Forever(fulldia)
await get_tree().create_timer(3, false).timeout
dia.HideText()

View File

@ -8,16 +8,25 @@ class_name ButtonClass extends Node
@export var ui_control : Control
@export var speaker_press : AudioStreamPlayer2D
@export var speaker_hover : AudioStreamPlayer2D
@export var rebind : Node
@export var language : bool
@export var options : OptionsManager
@export var rebindManager : Rebinding
@export var playing : bool
@export var altsound : bool
@export var ui_opacity_inactive : float = 1
@export var ui_opacity_active : float = .78
@export var resetting : bool
var mainActive = true
func _ready():
ui_control = get_parent()
get_parent().connect("focus_entered", OnHover)
get_parent().connect("focus_exited", OnExit)
get_parent().connect("mouse_entered", OnHover)
get_parent().connect("mouse_exited", OnExit)
get_parent().connect("pressed", OnPress)
pass
if (isDynamic): ui.modulate.a = ui_opacity_inactive
func SetFilter(alias : String):
match(alias):
@ -31,13 +40,13 @@ func OnHover():
if (isDynamic):
speaker_hover.pitch_scale = randf_range(.95, 1.0)
speaker_hover.play()
ui.modulate.a = .78
ui.modulate.a = ui_opacity_active
cursor.SetCursorImage("hover")
func OnExit():
if (isActive && mainActive):
if (isDynamic):
ui.modulate.a = 1
ui.modulate.a = ui_opacity_inactive
cursor.SetCursorImage("point")
signal is_pressed
@ -45,4 +54,6 @@ func OnPress():
if (isActive && mainActive):
if (altsound): speaker_press.play()
if (isDynamic && playing): speaker_press.play()
if (rebind != null): rebindManager.GetRebind(rebind)
if (language): options.AdjustLanguage(alias)
emit_signal("is_pressed")

55
ButtonClass_Main.gd Normal file
View File

@ -0,0 +1,55 @@
class_name ButtonClass_Main extends Node
@export var alias : String
@export var alias_signature : String
@export var signatureBranch : SignButton
@export var isSignature : bool
@export var usingInteractionPipe : bool
@export var interaction : InteractionManager
@export var isActive : bool
@export var isDynamic : bool
@export var ui : CanvasItem
@export var ui_3D : GeometryInstance3D
@export var is3D : bool
@export var ui_opacity_inactive : float = 1
@export var ui_opacity_active : float = .78
@export var signature : Signature
@export var overridingMouseRaycast : bool
@export var mouseRaycast : MouseRaycast
@export var mouseRaycastVector : Vector2
@export var usingInteractionBranch : bool
var mainActive = true
func _ready():
get_parent().connect("focus_entered", OnHover)
get_parent().connect("focus_exited", OnExit)
get_parent().connect("pressed", OnPress)
if (isDynamic): SetUI(false)
pass
func SetUI(state : bool):
if (state):
if (!is3D): ui.modulate.a = ui_opacity_active
else: ui_3D.transparency = 0
else:
if (!is3D): ui.modulate.a = ui_opacity_inactive
else: ui_3D.transparency = 1
func OnHover():
if (isActive && mainActive):
if (isDynamic):
SetUI(true)
if (overridingMouseRaycast): mouseRaycast.GetRaycastOverride(mouseRaycastVector)
func OnExit():
if (isActive && mainActive):
if (isDynamic):
SetUI(false)
signal is_pressed
func OnPress():
if (isActive && mainActive):
emit_signal("is_pressed")
if (usingInteractionPipe): interaction.InteractWith(alias)
if (isSignature): interaction.SignatureButtonRemote(signatureBranch, alias_signature)
if (overridingMouseRaycast): interaction.MainInteractionEvent()

104
ControllerManager.gd Normal file
View File

@ -0,0 +1,104 @@
class_name ControllerManager extends Node
@export var dynamicallySwappingDevice : bool
@export var buttons : Array[ButtonClass]
@export var brackets : Array[Control]
@export var cursor : CursorManager
@export var exitingButtons : bool
@export var settingVisibility : bool
@export var mouseRaycast : MouseRaycast
var previousFocus : Control
func _ready():
get_viewport().connect("gui_focus_changed", _on_focus_changed)
var controllers = Input.get_connected_joypads()
func _process(delta):
if (settingVisibility): SetVisibility()
func _on_focus_changed(control:Control):
if (control != null):
previousFocus = control
var controller_currently_enabled = false
func SetMainControllerState(controllerActive : bool):
match controllerActive:
true:
controller_currently_enabled = true
cursor.controller_active = true
SetPrevFocus(true)
cursor.SetCursor(cursor.cursor_visible, false)
false:
controller_currently_enabled = false
cursor.controller_active = false
SetPrevFocus(false)
cursor.SetCursor(cursor.cursor_visible, false)
var printing = false
var checkingForInput = true
func _input(event):
if (dynamicallySwappingDevice && checkingForInput):
#ENABLE CONTROLLER
if(event is InputEventJoypadButton):
cursor.controller_active = true
SetPrevFocus(true)
if (printing): print("JOYPAD BUTTON")
cursor.SetCursor(cursor.cursor_visible, false)
elif(event is InputEventKey):
if (!IsEventAssignedToNavigation(event)): return
cursor.controller_active = true
SetPrevFocus(true)
if (printing):print("EVENT KEY")
cursor.SetCursor(cursor.cursor_visible, false)
#DISABLE CONTROLLER
elif(event is InputEventMouse):
cursor.controller_active = false
SetPrevFocus(false)
if (printing):print("EVENT MOUSE")
cursor.SetCursor(cursor.cursor_visible, false)
elif(event is InputEventMouseButton):
cursor.controller_active = false
SetPrevFocus(false)
if (printing):print("EVENT MOUSE BUTTON")
cursor.SetCursor(cursor.cursor_visible, false)
var navigationBinds = ["ui_up", "ui_down", "ui_left", "ui_right"]
func IsEventAssignedToNavigation(key : InputEventKey):
for b in navigationBinds:
if (key.is_action(b)): return true
return false
func SetRebindFocus(settingToPrevious : bool):
if (!settingToPrevious):
previousFocus.release_focus()
return
if (cursor.controller_active):
if (settingToPrevious):
previousFocus.grab_focus()
var fs1 = false
var fs2 = true
@export var stoppingOverride = true
@export var settingFilter : bool
func SetPrevFocus(grabbing : bool):
if (grabbing && !fs1):
ExitButtons()
if (settingFilter): for b in buttons: b.SetFilter("ignore")
if (previousFocus != null): previousFocus.grab_focus()
fs2 = false
fs1 = true
elif (!grabbing && !fs2):
ExitButtons()
if (previousFocus != null): previousFocus.release_focus()
if (stoppingOverride): mouseRaycast.StopRaycastOverride()
if (settingFilter): for b in buttons: b.SetFilter("stop")
fs1 = false
fs2 = true
func SetVisibility():
for b in brackets: b.visible = cursor.controller_active
func ExitButtons():
if (exitingButtons):
for b in buttons:
if(!b.resetting): b.OnExit()

41
CrtButtonBranch.gd Normal file
View File

@ -0,0 +1,41 @@
class_name CrtButton extends Node
var parent : Node3D
var intbranch : InteractionBranch
@export var y_up : float
@export var y_down : float
@export var dur : float
var elapsed = 0
var moving = false
var cur
var next
func _ready():
parent = get_parent()
intbranch = parent.get_child(0)
func _process(delta):
Lerp()
func Press():
intbranch.interactionAllowed = false
cur = y_up
next = y_down
elapsed = 0
moving = true
await get_tree().create_timer(.06, false).timeout
moving = false
cur = y_down
next = y_up
elapsed = 0
moving = true
await get_tree().create_timer(.06, false).timeout
moving = false
intbranch.interactionAllowed = true
func Lerp():
if (moving):
elapsed += get_process_delta_time()
var c = elapsed / dur
var temp_pos = lerpf(cur, next, c)
parent.transform.origin = Vector3(parent.transform.origin.x, temp_pos, parent.transform.origin.z)

22
CrtIcon.gd Normal file
View File

@ -0,0 +1,22 @@
class_name CrtIcon extends Node
@export var texture_active : CompressedTexture2D
@export var texture_inactive : CompressedTexture2D
@export var activeIndex : int
var instance : GeometryInstance3D
func _ready():
instance = get_parent()
SetState(false)
func CheckState(currentIndex : int):
if (currentIndex == activeIndex): SetState(true)
else: SetState(false)
func SetState(act : bool):
if act:
instance.material_override.albedo_texture = texture_active
else:
instance.material_override.albedo_texture = texture_inactive

166
CrtManager.gd Normal file
View File

@ -0,0 +1,166 @@
class_name CRT extends Node
@export var exit : ExitManager
var viewing = false
@export var intro : IntroManager
@export var bathroom_normal : VisualInstance3D
@export var bathroom_broken : VisualInstance3D
@export var mask : Node3D
@export var objarray_normal : Array[Node3D]
@export var objarray_broken : Array[Node3D]
@export var anim_intro : AnimationPlayer
@export var array_bootup : Array[Node3D]
@export var array_bootuplogo : Array[Node3D]
@export var array_partbranch : Array[PartitionBranch]
@export var array_stats : Array[Node3D]
@export var screenparent_leaderboard : Node3D
@export var screenparent_stats : Node3D
var window_index = 3
@export var iconbranches : Array[CrtIcon]
@export var anim_iconfade : AnimationPlayer
@export var board : Board
@export var speaker_playerwalk : AudioStreamPlayer2D
@export var speaker_bootuploop : AudioStreamPlayer2D
@export var speaker_shutdown : AudioStreamPlayer2D
@export var speaker_consolebeep : AudioStreamPlayer2D
@export var speaker_buttonpress : AudioStreamPlayer2D
@export var speaker_navbeep : AudioStreamPlayer2D
@export var speaker_melody : AudioStreamPlayer2D
@export var speaker_melodyhide : AudioStreamPlayer2D
var selection_range1 = 1
var selection_range2 = 12
func _ready():
screenparent_stats.visible = true
screenparent_leaderboard.visible = false
func _unhandled_input(event):
if (event.is_action_pressed("ui_accept") && viewing):
Interaction("window")
if (event.is_action_pressed("ui_cancel") && viewing):
Interaction("exit")
if (event.is_action_pressed("exit game") && viewing):
Interaction("exit")
if (event.is_action_pressed("ui_left") && viewing):
Interaction("left")
if (event.is_action_pressed("ui_right") && viewing):
Interaction("right")
func SetCRT(state : bool):
if (state):
bathroom_normal.set_layer_mask_value(1, false)
bathroom_broken.visible = true
for obj in objarray_normal: obj.visible = false
for obj in objarray_broken: obj.visible = true
mask.visible = true
else:
bathroom_normal.set_layer_mask_value(1, true)
bathroom_broken.visible = false
for obj in objarray_normal: obj.visible = true
for obj in objarray_broken: obj.visible = false
mask.visible = false
@export var branch_right : InteractionBranch
@export var branch_left : InteractionBranch
@export var branch_window : InteractionBranch
@export var branch_exit : InteractionBranch
var has_exited = false
func Interaction(alias : String):
speaker_buttonpress.pitch_scale = randf_range(.8, 1)
speaker_buttonpress.play()
match alias:
"right":
branch_right.get_parent().get_child(1).Press()
if (selection_range2 <= board.active_entry_count && window_index == 0):
selection_range1 += 12
selection_range2 += 12
"left":
branch_left.get_parent().get_child(1).Press()
if (selection_range1 != 1 && window_index == 0):
selection_range1 -= 12
selection_range2 -= 12
"window":
branch_window.get_parent().get_child(1).Press()
CycleWindow()
"exit":
has_exited = true
branch_exit.get_parent().get_child(1).Press()
viewing = false
board.TurnOffDisplay()
intro.DisableInteractionCrt()
await get_tree().create_timer(.3, false).timeout
intro.RevertCRT()
exit.exitAllowed = true
func CycleWindow():
board.lock.material_override.albedo_color = Color(1, 1, 1, 0)
selection_range1 = 1
selection_range2 = 12
board.ClearDisplay()
window_index += 1
if window_index == 4: window_index = 0
for icon in iconbranches: icon.CheckState(window_index)
if (window_index == 3):
board.nocon.visible = false
screenparent_leaderboard.visible = false
screenparent_stats.visible = true
else:
screenparent_leaderboard.visible = true
screenparent_stats.visible = false
board.nocon.visible = true
if (window_index == 0): board.PassLeaderboard(selection_range1, selection_range2, "top")
if (window_index == 1):
board.lock.visible = true
board.PassLeaderboard(selection_range1, selection_range2, "overview")
if (window_index == 2): board.PassLeaderboard(1, 49, "friends") #range ignored
func Bootup():
has_exited = false
board.lock.material_override.albedo_color = Color(1, 1, 1, 0)
screenparent_stats.visible = true
board.UpdateStats()
window_index = 3
for icon in iconbranches: icon.CheckState(window_index)
for line in array_bootup:
line.visible = true
await get_tree().create_timer(.07, false).timeout
speaker_navbeep.pitch_scale = randf_range(1, 1)
speaker_navbeep.play()
await get_tree().create_timer(.1, false).timeout
for part in array_partbranch:
part.Loop(true)
await get_tree().create_timer(.04, false).timeout
speaker_navbeep.pitch_scale = randf_range(.1, .1)
speaker_navbeep.play()
await get_tree().create_timer(1, false).timeout
for part in array_partbranch: part.Loop(false)
await get_tree().create_timer(1, false).timeout
for line in array_bootup: line.visible = false
await get_tree().create_timer(.2, false).timeout
speaker_melody.pitch_scale = 2
speaker_melody.play()
for line in array_bootuplogo:
line.visible = true
await get_tree().create_timer(.07, false).timeout
await get_tree().create_timer(2, false).timeout
for line in array_bootuplogo: line.visible = false
speaker_melody.stop()
speaker_melodyhide.play()
await get_tree().create_timer(.5, false).timeout
anim_iconfade.play("fade in")
await get_tree().create_timer(.5, false).timeout
for i in array_stats:
i.visible = true
await get_tree().create_timer(.07, false).timeout
speaker_navbeep.pitch_scale = randf_range(.5, .5)
speaker_navbeep.play()
await get_tree().create_timer(.3, false).timeout
intro.EnabledInteractionCRT()
exit.exitAllowed = false
viewing = true

View File

@ -5,15 +5,16 @@ class_name CursorManager extends Node
@export var cursor_hover : CompressedTexture2D
@export var cursor_invalid : CompressedTexture2D
var cursor_visible = false
var controller_active = false
func _ready():
SetCursor(false, false)
func SetCursor(isVisible : bool, playSound : bool):
if (playSound):
speaker.play()
if (playSound): speaker.play()
if (isVisible):
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
if (!controller_active): Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
else: Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
cursor_visible = true
if (!isVisible):
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)

View File

@ -2,6 +2,7 @@ class_name DealerIntelligence extends Node
#ALTHOUGH THE CLASS NAME SUGGESTS THAT THE DEALER HAS INTELLIGENCE, AND IT'S TRUE THERE ARE MANY INTELLIGENT DEALERS,
#CONTRARY TO THOSE THIS ONE IS NOT. HERE THERE IS NO INTELLIGENCE. ONLY LAYERS, HEAPS AND CLUMPS OF SPAGHETTI JUMBLE CODE.
@export var medicine : Medicine
@export var hands : HandManager
@export var itemManager : ItemManager
@export var shellSpawner : ShellSpawner
@ -27,6 +28,8 @@ class_name DealerIntelligence extends Node
@export var sound_dealerarriveCuffed : AudioStream
@export var dealermesh_normal : VisualInstance3D
@export var dealermesh_crushed : VisualInstance3D
@export var sequenceArray_knownShell : Array[bool]
@export var amounts : Amounts
var dealerItemStringArray : Array[String]
var dealerAboutToBreakFree = false
@ -62,6 +65,7 @@ func Animator_GiveHandcuffs():
func BeginDealerTurn():
mainLoopFinished = false
usingHandsaw = false
usingMedicine = false
DealerChoice()
var dealerTarget = ""
@ -70,15 +74,35 @@ var dealerKnowsShell = false
var mainLoopFinished = false
var usingHandsaw = false
var dealerUsedItem = false
var usingMedicine = false
var adrenalineSetup = false
var stealing = false
var adrenaline_itemSlot = ""
var inv_playerside = []
var inv_dealerside = []
func DealerChoice():
var dealerWantsToUse = ""
var dealerFinishedUsingItems = false
var hasHandsaw = false
var hasCigs = false
if (roundManager.requestedWireCut):
await(roundManager.defibCutter.CutWire(roundManager.wireToCut))
if (shellSpawner.sequenceArray.size() == 0):
roundManager.StartRound(true)
return
if (roundManager.endless && !dealerKnowsShell):
dealerKnowsShell = FigureOutShell()
if (dealerKnowsShell):
if (roundManager.shellSpawner.sequenceArray[0] == "blank"):
knownShell = "blank"
dealerTarget = "self"
else:
knownShell = "live"
dealerTarget = "player"
if (roundManager.shellSpawner.sequenceArray.size() == 1):
knownShell = shellSpawner.sequenceArray[0]
if (shellSpawner.sequenceArray[0] == "live"): knownShell = "live"
@ -86,6 +110,44 @@ func DealerChoice():
if (knownShell == "live"): dealerTarget = "player"
else: dealerTarget = "self"
dealerKnowsShell = true
for i in range(itemManager.itemArray_dealer.size()):
if (itemManager.itemArray_dealer[i] == "cigarettes"):
hasCigs = true
break
inv_playerside = []
inv_dealerside = []
itemManager.itemArray_dealer = []
itemManager.itemArray_instances_dealer = []
var usingAdrenaline = false
var ch = itemManager.itemSpawnParent.get_children()
for c in ch.size():
if(ch[c].get_child(0) is PickupIndicator):
var temp_interaction : InteractionBranch = ch[c].get_child(1)
if (temp_interaction.itemName == "adrenaline" && !temp_interaction.isPlayerSide):
usingAdrenaline = true
adrenalineSetup = true
for c in ch.size():
if(ch[c].get_child(0) is PickupIndicator):
var temp_indicator : PickupIndicator = ch[c].get_child(0)
var temp_interaction : InteractionBranch = ch[c].get_child(1)
if (ch[c].transform.origin.z > 0): temp_indicator.whichSide = "right"
else: temp_indicator.whichSide= "left"
if (!temp_interaction.isPlayerSide):
inv_dealerside.append(temp_interaction.itemName)
itemManager.itemArray_dealer.append(temp_interaction.itemName)
itemManager.itemArray_instances_dealer.append(ch[c])
for c in ch.size():
if(ch[c].get_child(0) is PickupIndicator):
var temp_indicator : PickupIndicator = ch[c].get_child(0)
var temp_interaction : InteractionBranch = ch[c].get_child(1)
if (ch[c].transform.origin.z > 0): temp_indicator.whichSide = "right"
else: temp_indicator.whichSide= "left"
if (temp_interaction.isPlayerSide && usingAdrenaline):
itemManager.itemArray_dealer.append(temp_interaction.itemName)
itemManager.itemArray_instances_dealer.append(ch[c])
inv_playerside.append(temp_interaction.itemName)
for i in range(itemManager.itemArray_dealer.size()):
if (itemManager.itemArray_dealer[i] == "magnifying glass" && !dealerKnowsShell && shellSpawner.sequenceArray.size() != 1):
dealerWantsToUse = "magnifying glass"
@ -96,14 +158,21 @@ func DealerChoice():
dealerKnowsShell = true
break
if (itemManager.itemArray_dealer[i] == "cigarettes"):
var breaking = false
if (roundManager.health_opponent < roundManager.roundArray[0].startingHealth):
dealerWantsToUse = "cigarettes"
breaking = true
if (breaking): break
hasCigs = false
break
if (itemManager.itemArray_dealer[i] == "expired medicine" && roundManager.health_opponent < (roundManager.roundArray[0].startingHealth) && !hasCigs && !usingMedicine):
if (roundManager.health_opponent != 1):
dealerWantsToUse = "expired medicine"
usingMedicine = true
break
if (itemManager.itemArray_dealer[i] == "beer" && knownShell != "live" && shellSpawner.sequenceArray.size() != 1):
dealerWantsToUse = "beer"
shellEject_dealer.FadeOutShell()
if (roundManager.endless):
dealerKnowsShell = false
knownShell = ""
break
if (itemManager.itemArray_dealer[i] == "handcuffs" && roundManager.playerCuffed == false && shellSpawner.sequenceArray.size() != 1):
dealerWantsToUse = "handcuffs"
@ -115,6 +184,21 @@ func DealerChoice():
roundManager.barrelSawedOff = true
roundManager.currentShotgunDamage = 2
break
if (itemManager.itemArray_dealer[i] == "burner phone" && roundManager.shellSpawner.sequenceArray.size() > 2):
var sequence = roundManager.shellSpawner.sequenceArray
var len = sequence.size()
var randindex = randi_range(1, len - 1)
if(randindex == 8): randindex -= 1
sequenceArray_knownShell[randindex] = true
dealerWantsToUse = "burner phone"
break
if (itemManager.itemArray_dealer[i] == "inverter" && dealerKnowsShell && knownShell == "blank"):
dealerWantsToUse = "inverter"
knownShell = "live"
dealerKnowsShell = true
roundManager.shellSpawner.sequenceArray[0] = "live"
dealerTarget = "player"
break
if (dealerWantsToUse == ""): mainLoopFinished = true
for i in range(itemManager.itemArray_dealer.size()):
@ -140,11 +224,45 @@ func DealerChoice():
if (roundManager.waitingForDealerReturn):
await get_tree().create_timer(1.8, false).timeout
roundManager.waitingForDealerReturn = false
var returning = false
if (dealerWantsToUse == "expired medicine"):
var medicine_outcome = randf_range(0.0, 1.0)
var dying
if (medicine_outcome < .4): dying = false
else: dying = true
medicine.dealerDying = dying
returning = true
var amountArray : Array[AmountResource] = amounts.array_amounts
for res in amountArray:
if (dealerWantsToUse == res.itemName):
res.amount_dealer -= 1
break
var stealingFromPlayer = true
for i in range(inv_dealerside.size()):
if (inv_dealerside[i] == dealerWantsToUse): stealingFromPlayer = false
var subtracting = true
var temp_stealing = false
for i in range(itemManager.itemArray_instances_dealer.size()):
if (itemManager.itemArray_instances_dealer[i].get_child(1).itemName == dealerWantsToUse && itemManager.itemArray_instances_dealer[i].get_child(1).isPlayerSide && dealerWantsToUse != "adrenaline" && adrenalineSetup && stealingFromPlayer):
temp_stealing = true
await(hands.PickupItemFromTable("adrenaline"))
itemManager.numberOfItemsGrabbed_enemy -= 1
subtracting = false
adrenalineSetup = false
break
if (temp_stealing): hands.stealing = true
await(hands.PickupItemFromTable(dealerWantsToUse))
#if (dealerWantsToUse == "handcuffs"): await get_tree().create_timer(.8, false).timeout #additional delay for initial player handcuff check (continues outside animation)
if (dealerWantsToUse == "cigarettes"): await get_tree().create_timer(1.1, false).timeout #additional delay for health update routine (called in aninator. continues outside animation)
itemManager.itemArray_dealer.erase(dealerWantsToUse)
itemManager.numberOfItemsGrabbed_enemy -= 1
if (subtracting): itemManager.numberOfItemsGrabbed_enemy -= 1
if (returning): return
DealerChoice()
return
if (dealerWantsToUse == ""): dealerFinishedUsingItems = true
@ -161,6 +279,29 @@ func DealerChoice():
dealerKnowsShell = false
pass
func FigureOutShell():
if (sequenceArray_knownShell[0] == true): return true
var seq = shellSpawner.sequenceArray
var mem = sequenceArray_knownShell
var c_live = 0
var c_blank = 0
for shell in seq:
if (shell == "blank"): c_blank += 1
if (shell == "live"): c_live += 1
if (c_live == 0): return true
if (c_blank == 0): return true
for c in mem.size():
if (mem[c] == true):
if(seq[c] == "live"): c_live -= 1
else: c_blank -= 1
if (c_live == 0): return true
if (c_blank == 0): return true
return false
func EndDealerTurn(canDealerGoAgain : bool):
dealerCanGoAgain = canDealerGoAgain
#USINGITEMS: ASSIGN DEALER CAN GO AGAIN FROM ITEMS HERE
@ -278,6 +419,13 @@ func SwapDealerMesh():
pass
func CoinFlip():
var result = randi_range(0, 1)
var result
if (!roundManager.endless):
result = randi_range(0, 1)
else:
var c_live = shellSpawner.sequenceArray.count("live")
var c_blank = shellSpawner.sequenceArray.count("blank")
if (c_live == c_blank): result = randi_range(0, 1)
if (c_live > c_blank): result = 1
if (c_live < c_blank): result = 0
return result
pass

View File

@ -1,5 +1,6 @@
class_name DeathManager extends Node
@export var cam : CameraManager
@export var viewblocker : ColorRect
@export var speakersToDisable : Array[SpeakerController]
@export var animator_playerDefib : AnimationPlayer
@ -21,6 +22,7 @@ class_name DeathManager extends Node
@export var filter : FilterController
@export var animator_pp : AnimationPlayer
@export var speaker_heartbeat : AudioStreamPlayer2D
@export var rm : RoundManager
func _ready():
defibParent.visible = false
@ -109,9 +111,36 @@ func Kill(who : String, trueDeath : bool, returningShotgun : bool):
await get_tree().create_timer(2, false).timeout
if (dealerKilledSelf): dealerAI.EndDealerTurn(dealerAI.dealerCanGoAgain)
func MedicineDeath():
viewblocker.visible = true
cam.cam.rotation_degrees = Vector3(cam.cam.rotation_degrees.x, cam.cam.rotation_degrees.y, 0)
DisableSpeakers()
if (shotgunShooting.roundManager.health_player == 0):
shotgunShooting.roundManager.OutOfHealth("player")
return
await get_tree().create_timer(.4, false).timeout
speaker_playerDefib.play()
await get_tree().create_timer(.85, false).timeout
speaker_heartbeat.play()
animator_pp.play("revival brightness")
defibParent.visible = true
animator_playerDefib.play("RESET")
viewblocker.visible = false
filter.BeginPan(filter.lowPassMaxValue, filter.lowPassDefaultValue)
FadeInSpeakers()
cameraShaker.Shake()
await get_tree().create_timer(.6, false).timeout
animator_playerDefib.play("remove defib device")
await get_tree().create_timer(.4, false).timeout
#await(healthCounter.UpdateDisplayRoutine(false, !shotgunShooting.playerCanGoAgain, false))
defibParent.visible = false
@export var ach : Achievement
func MainDeathRoutine():
var loadingHeaven = false
if (shotgunShooting.roundManager.endless):
if (rm.endscore != null):
if (rm.endscore > 1000000): ach.UnlockAchievement("ach10")
await get_tree().create_timer(.5, false).timeout
get_tree().change_scene_to_file("res://scenes/death.tscn")
return
@ -119,7 +148,7 @@ func MainDeathRoutine():
shotgunShooting.roundManager.playerData.enteringFromTrueDeath = true
loadingHeaven = true
shotgunShooting.roundManager.playerData.playerEnteringFromDeath = true
savefile.SaveGame()
await(savefile.SaveGame())
await get_tree().create_timer(.5, false).timeout
if (!loadingHeaven): get_tree().change_scene_to_file("res://scenes/death.tscn")
else: get_tree().change_scene_to_file("res://scenes/heaven.tscn")

10
Debugging.gd Normal file
View File

@ -0,0 +1,10 @@
class_name Debug extends Node
#@export var timescale : TimeScaleManager
#func _unhandled_input(event):
# if (event.is_action_pressed(",")):
# Engine.time_scale = 1
# timescale.moving = false
# if (event.is_action_pressed(".")):
# Engine.time_scale = 10
# timescale.moving = false

View File

@ -3,6 +3,7 @@ class_name DecisionTextManager extends Node
@export var textArray : Array[TextInteraction]
@export var colliderArray : Array[StaticBody3D]
@export var animator : AnimationPlayer
@export var uiParent : Control
func _ready():
for i in range(colliderArray.size()):
@ -20,3 +21,4 @@ func SetUI(state : bool):
colliderArray[i].collision_layer = 0
colliderArray[i].collision_mask = 0
animator.play("hide text")
uiParent.visible = false

View File

@ -55,7 +55,7 @@ func CutWire(who : String):
cam.BeginLerp("enemy")
await get_tree().create_timer(3, false).timeout
if (!cutDialogueSent):
dia.ShowText_Forever("ARE YOU READY?")
dia.ShowText_Forever(tr("ARE YOU READY"))
await get_tree().create_timer(4, false).timeout
dia.HideText()
await get_tree().create_timer(.2, false).timeout

View File

@ -11,11 +11,14 @@ var dealerLowPitched = false
var elapsed = 0
var moving = false
var looping = false
var origscale_backdrop
func _ready():
origscale_backdrop = dialogueUI_backdrop.scale
speaker_click.stream = soundArray_clicks[3]
func ShowText_ForDuration(activeText : String, showDuration : float):
if(dialogueUI_backdrop.scale != origscale_backdrop): dialogueUI_backdrop.scale = origscale_backdrop
looping = false
dialogueUI.visible_characters = 0
dialogueUI.text = activeText
@ -28,7 +31,12 @@ func ShowText_ForDuration(activeText : String, showDuration : float):
dialogueUI.visible = false
dialogueUI_backdrop.visible = false
var scaling = false
func ShowText_Forever(activeText : String):
if (scaling):
dialogueUI_backdrop.scale = Vector2(17.209, dialogueUI_backdrop.scale.y)
else: dialogueUI_backdrop.scale = origscale_backdrop
looping = false
dialogueUI.visible_characters = 0
dialogueUI.text = activeText
@ -36,9 +44,11 @@ func ShowText_Forever(activeText : String):
dialogueUI_backdrop.visible = true
looping = true
TickText()
scaling = false
func ShowDealerInspectionText():
ShowText_Forever("VERY INTERESTING ...")
if(dialogueUI_backdrop.scale != origscale_backdrop): dialogueUI_backdrop.scale = origscale_backdrop
ShowText_Forever(tr("INTERESTING"))
func HideText():
looping = false

View File

@ -26,10 +26,12 @@ func HideText():
dialogueUI.visible = false
pass
var overriding = false
func TickText():
while(looping):
dialogueUI.visible_characters += 1
speaker_click.pitch_scale = randf_range(.8, 1)
if (!overriding): speaker_click.pitch_scale = randf_range(.8, 1)
else: speaker_click.pitch_scale = randf_range(.2, .4)
speaker_click.play()
if (dialogueUI.visible_ratio >= 1):
looping = false

44
DonUnlockManager.gd Normal file
View File

@ -0,0 +1,44 @@
class_name Unlocker extends Node
const savepath := "user://buckshotroulette_pills.shell"
@export var ach : Achievement
@export var dia : DialogueEnding
@export var ui : Label
@export var anim : AnimationPlayer
var t = "DOUBLE UNLOCK"
func UnlockRoutine():
UnlockMode()
await get_tree().create_timer(1, false).timeout
dia.overriding = true
dia.dialogueUI = ui
dia.HideText()
dia.ShowText_Forever(tr(t))
await get_tree().create_timer(4, false).timeout
anim.play("fade")
await get_tree().create_timer(1, false).timeout
get_tree().change_scene_to_file("res://scenes/menu.tscn")
func UnlockMode():
var data = {
"total_amount_selected" : 0
}
var file = FileAccess.open(savepath, FileAccess.WRITE)
file.store_var(data)
file.close()
func IncrementAmount():
if (FileAccess.file_exists(savepath)):
var file = FileAccess.open(savepath, FileAccess.READ)
var data = file.get_var()
file.close()
print("data: ", data)
var amount = data.total_amount_selected
amount += 1
var new_data = {
"total_amount_selected" : amount
}
var new_file = FileAccess.open(savepath, FileAccess.WRITE)
new_file.store_var(new_data)
new_file.close()
if (amount >= 10): ach.UnlockAchievement("ach4")

17
DotRemover.gd Normal file
View File

@ -0,0 +1,17 @@
class_name DotFix extends Node
var key
var p
func _ready():
p = get_parent()
key = p.text
await get_tree().create_timer(1, false).timeout
Fix()
func Fix():
if key == "TOTAL CASH" && TranslationServer.get_locale() == "EN": p.text = "TOTAL CASH "; return
if key == "SHOTS FIRED" && TranslationServer.get_locale() == "EN": p.text = "SHOTS FIRED "; return
var orig = tr(key)
var modif = orig.replace(".", "").replace(":", "").replace("", "").replace(":", "")
p.text = modif

View File

@ -1,5 +1,6 @@
class_name EndingManager extends Node
@export var save : SaveFileManager
@export var roundManager : RoundManager
@export var pp : WorldEnvironment
@export var animator_cam : AnimationPlayer
@ -23,15 +24,26 @@ class_name EndingManager extends Node
@export var cntrl_endingmusic : SpeakerController
@export var animator_anykey : AnimationPlayer
@export var animator_pan : AnimationPlayer
@export var exitm : ExitManager
@export var ach : Achievement
@export var unlocker : Unlocker
@export var board : Board
var waitingForInput = false
func _input(event):
if event is InputEventKey and event.pressed:
#func _input(event):
# if event is InputEventKey and event.pressed:
# if (waitingForInput):
# ExitGame()
# waitingForInput = false
func _unhandled_key_input(event):
if (event.is_pressed()):
if (waitingForInput):
ExitGame()
waitingForInput = false
func BeginEnding():
exitm.exitAllowed = false
cam.moving = false
animator_pan.play("pan to brief")
music_ending.play()
@ -46,7 +58,13 @@ func BeginEnding():
label_congrats.visible = false
await get_tree().create_timer(1.2, false).timeout
animator_viewblocker.play("fade out")
await get_tree().create_timer(6, false).timeout
await get_tree().create_timer(3, false).timeout
ach.UnlockAchievement("ach1")
if (roundManager.endless):
if (!roundManager.doubled): ach.UnlockAchievement("ach5")
if (roundManager.doubled): ach.UnlockAchievement("ach6")
if (roundManager.endscore > 1000000): ach.UnlockAchievement("ach7")
await get_tree().create_timer(3, false).timeout
#SHOW UI
label_congrats.visible = true
animator_congrats.play("wobble it")
@ -80,7 +98,12 @@ func ExitGame():
cntrl_ambience.FadeOut()
isActive = false
await get_tree().create_timer(4, false).timeout
get_tree().quit()
var unlocked = FileAccess.file_exists(unlocker.savepath)
if (unlocked):
get_tree().change_scene_to_file("res://scenes/menu.tscn")
return
else:
unlocker.UnlockRoutine()
var isActive = true
func AmbienceFade():
@ -107,6 +130,7 @@ var endless_overwriting = false
var endless_roundsbeat = 0
var endless_score = 0
var glob_text_congratulations
var cash_gl = 0
func FinalScore():
var playername = roundManager.playerData.playername
var shots_fired = roundManager.playerData.stat_shotsFired
@ -124,18 +148,18 @@ func FinalScore():
if (total_cash < 0): total_cash = 0
if (endless_overwriting): total_cash = endless_score
#if (playername == "sex"): total_cash = 69
#if (playername == "leet"): total_cash = 1337
#if (playername == "snoop" or playername == "weed" or playername == "kush"): total_cash = 420
cash_gl = total_cash
var text_congratulations = "CONGRATULATIONS, " + playername + "!"
var text_shotsFired = "shots fired ........ " + str(shots_fired)
if (endless_overwriting): text_shotsFired = "rounds beat ........ " + str(endless_roundsbeat)
var text_shellsEjected = "shells ejected ..... " + str(shells_ejected)
var text_doorsKicked = "doors kicked ....... " + str(doors_kicked)
var text_cigSmoked = "cigarettes smoked .. " + str(cigarettes_smoked)
var text_beerDrank = "ml of beer drank ... " + str(ml_of_beer_drank)
var text_totalcash = "total cash: " + str(total_cash) + " $"
var text_congratulations = tr("CONGRATULATIONS") % [playername]
var text_shotsFired = tr("SHOTS FIRED") + " " + str(shots_fired)
if (endless_overwriting): text_shotsFired = tr("ROUNDS BEAT") + " " + str(endless_roundsbeat)
var text_shellsEjected = tr("SHELLS EJECTED") + " " + str(shells_ejected)
var text_doorsKicked = tr("DOORS KICKED") + " " + str(doors_kicked)
var text_cigSmoked = tr("CIGS SMOKED") + " " + str(cigarettes_smoked)
var text_beerDrank = tr("ML DRANK") + " " + str(ml_of_beer_drank)
var text_totalcash = tr("TOTAL CASH") + " " + str(total_cash) + " $"
#if (endless_overwriting): text_shotsFired = "rounds beat ........ " + str(endless_roundsbeat)
glob_text_congratulations = text_congratulations
@ -145,3 +169,84 @@ func FinalScore():
label_array[3].text = text_cigSmoked
label_array[4].text = text_beerDrank
label_array[5].text = text_totalcash
IncrementGlobalStats()
if endless_overwriting: board.UploadScore(roundManager.double_or_nothing_rounds_beat, roundManager.double_or_nothing_score, roundManager.double_or_nothing_initial_score)
var playerdata = {}
var statPREV_shots_fired = 0
var statPREV_shells_ejected = 0
var statPREV_doors_kicked = 0
var statPREV_cigs_smoked = 0
var statPREV_rounds_beat = 0
var statPREV_ml_drank = 0
var statPREV_total_cash = 0
var statSAVE_shots_fired
var statSAVE_shells_ejected
var statSAVE_doors_kicked
var statSAVE_cigs_smoked
var statSAVE_rounds_beat
var statSAVE_ml_drank
var statSAVE_total_cash
func IncrementGlobalStats():
LoadPlayerData()
statSAVE_shots_fired = statPREV_shots_fired + roundManager.playerData.stat_shotsFired
statSAVE_shells_ejected = statPREV_shells_ejected + roundManager.playerData.stat_shellsEjected
statSAVE_doors_kicked = statPREV_doors_kicked + roundManager.playerData.stat_doorsKicked
statSAVE_cigs_smoked = statPREV_doors_kicked + roundManager.playerData.stat_cigSmoked
statSAVE_rounds_beat = statPREV_rounds_beat + endless_roundsbeat
statSAVE_ml_drank = statPREV_ml_drank + roundManager.playerData.stat_beerDrank
statSAVE_total_cash = statPREV_total_cash + cash_gl
SavePlayerData()
func SavePlayerData():
playerdata = {
"shots_fired": statSAVE_shots_fired,
"shells_ejected": statSAVE_shells_ejected,
"doors_kicked": statSAVE_doors_kicked,
"cigs_smoked": statSAVE_cigs_smoked,
"rounds_beat": statSAVE_rounds_beat,
"ml_drank": statSAVE_ml_drank,
"total_cash": statSAVE_total_cash
}
var file = FileAccess.open(save.savePath_stats, FileAccess.WRITE)
file.store_var(playerdata)
file.close()
var temp_data
func LoadPlayerData():
if (FileAccess.file_exists(save.savePath_stats)):
var file = FileAccess.open(save.savePath_stats, FileAccess.READ)
temp_data = file.get_var()
statPREV_shots_fired = temp_data.shots_fired
statPREV_shells_ejected = temp_data.shells_ejected
statPREV_doors_kicked = temp_data.doors_kicked
statPREV_cigs_smoked = temp_data.cigs_smoked
statPREV_rounds_beat = temp_data.rounds_beat
statPREV_total_cash = temp_data.total_cash
statPREV_ml_drank = temp_data.ml_drank
file.close()
pass

View File

@ -4,6 +4,7 @@ class_name Endless extends Node
@export var smokerdude : Node3D
@export var display : StandardMaterial3D
@export var displayrounds : CompressedTexture2D
@export var amounts : Amounts
func SetupEndless():
smokerdude.visible = false
@ -20,3 +21,5 @@ func SetupEndless():
roundManager.shellSpawner.skipDialoguePresented = true
roundManager.shellLoadingSpedUp = true
display.albedo_texture = displayrounds
for res in amounts.array_amounts:
res.amount_active = res.amount_don

View File

@ -1,4 +1,4 @@
class_name GameOverManager extends Node
func PlayerWon():
get_tree().change_scene_to_file("res://scenes/win.tscn")
get_tree().change_scene_to_file("res://scenes/win.tscn")

3
GlobalVariables.gd Normal file
View File

@ -0,0 +1,3 @@
extends Node
var controllerEnabled = false

View File

@ -7,6 +7,8 @@ class_name HandManager extends Node
@export var handArray_L : Array[Node3D]
@export var handArray_R : Array[Node3D]
@export var gridOffsetArray : Array[Vector3] #ITEM'S ACTIVE GRID INDEX STORED IN PICKUP INDICATOR: dealerGridIndex
@export var inter : ItemInteraction
@export var cam : CameraManager
@export var handParent_L : Node3D
@export var handParent_R : Node3D
@ -14,9 +16,13 @@ class_name HandManager extends Node
@export var hand_defaultR : Node3D
@export var hand_cigarettepack : Node3D #L
@export var hand_beer : Node3D #L
@export var hand_medicine : Node3D #L
@export var hand_inverter : Node3D #L
@export var hand_adrenaline : Node3D #L
@export var hand_handcuffs : Node3D #R
@export var hand_handsaw : Node3D #R
@export var hand_magnifier : Node3D #R
@export var hand_burnerphone : Node3D #R
@export var lerpDuration : float
@export var handRot_left : Vector3 #hand rotation when grabing from left grids
@ -25,6 +31,7 @@ class_name HandManager extends Node
@export var parentOriginal_rotL : Vector3
@export var parentOriginal_posR : Vector3
@export var parentOriginal_rotR : Vector3
@export var amounts : Amounts
var moving = false
var lerping_L = false
var lerping_R = false
@ -41,6 +48,7 @@ var activeItemToGrab
func _process(delta):
LerpHandMovement()
var stealing = false
func PickupItemFromTable(itemName : String):
dealerAI.Speaker_HandCrack()
var activeIndex
@ -58,13 +66,20 @@ func PickupItemFromTable(itemName : String):
ToggleHandVisible("BOTH", false)
hand_defaultL.visible = true
hand_defaultR.visible = true
if (itemName == "beer" or itemName == "cigarettes"): whichHandToGrabWith = "left"
if (itemName == "beer" or itemName == "cigarettes" or itemName == "expired medicine" or itemName == "inverter" or itemName == "adrenaline"): whichHandToGrabWith = "left"
else: whichHandToGrabWith = "right"
whichGridSide = activeInstance.get_child(0).whichSide
animator_hands.play("RESET")
BeginHandLerp(whichHandToGrabWith, activeIndex, whichGridSide)
if (whichGridSide == "right"): animator_dealerHeadLook.play("dealer look right")
else: animator_dealerHeadLook.play("dealer look left")
if (stealing):
if (whichGridSide == "right"): cam.BeginLerp("player item grid left")
else: cam.BeginLerp("player item grid right")
var amountArray : Array[AmountResource] = amounts.array_amounts
for res in amountArray:
if res.itemName == itemName: res.amount_player -= 1
break
await get_tree().create_timer(lerpDuration -.4, false).timeout
if (whichHandToGrabWith == "right"): hand_defaultR.visible = false
else: hand_defaultL.visible = false
@ -81,23 +96,71 @@ func PickupItemFromTable(itemName : String):
itemManager.numberOfCigs_dealer -= 1
"beer":
hand_beer.visible = true
"expired medicine":
hand_medicine.visible = true
"inverter":
hand_inverter.visible = true
"burner phone":
hand_burnerphone.visible = true
"adrenaline":
hand_adrenaline.visible = true
itemManager.itemArray_instances_dealer.remove_at(matchIndex)
var tempindicator = activeInstance.get_child(0)
var gridname = tempindicator.dealerGridName
itemManager.gridParentArray_enemy_available.append(gridname)
if (!stealing): itemManager.gridParentArray_enemy_available.append(gridname)
if (stealing): inter.RemovePlayerItemFromGrid(activeInstance)
activeInstance.queue_free()
await get_tree().create_timer(.2, false).timeout
ReturnHand()
if (stealing):
cam.BeginLerp("enemy")
if (whichGridSide == "right"): animator_dealerHeadLook.play("dealer look forward from right")
else: animator_dealerHeadLook.play("dealer look forward from left")
await get_tree().create_timer(lerpDuration + .01, false).timeout
HandFailsafe()
var animationName = "dealer use " + itemName
PlaySound(itemName)
animator_hands.play("RESET")
animator_hands.play(animationName)
var length = animator_hands.get_animation(animationName).get_length()
moving = false
await get_tree().create_timer(length, false).timeout
stealing = false
pass
@export var speaker_interaction : AudioStreamPlayer2D
@export var sound_adrenaline : AudioStream
@export var sound_medicine : AudioStream
@export var sound_burnerphone : AudioStream
@export var sound_inverter : AudioStream
func PlaySound(itemName : String):
match itemName:
"adrenaline":
speaker_interaction.stream = sound_adrenaline
speaker_interaction.play()
"expired medicine":
speaker_interaction.stream = sound_medicine
speaker_interaction.play()
"burner phone":
speaker_interaction.stream = sound_burnerphone
speaker_interaction.play()
"inverter":
speaker_interaction.stream = sound_inverter
speaker_interaction.play()
func RemoveItem_Remote(activeInstance : Node3D):
var activeIndex
var whichHandToGrabWith
var whichGridSide
var matchIndex
itemManager.itemArray_dealer.erase(activeInstance.get_child(1).itemName.to_lower())
itemManager.numberOfItemsGrabbed_enemy -= 1
activeIndex = activeInstance.get_child(0).dealerGridIndex
whichGridSide = activeInstance.get_child(0).whichSide
itemManager.itemArray_instances_dealer.erase(activeInstance)
var tempindicator = activeInstance.get_child(0)
var gridname = tempindicator.dealerGridName
itemManager.gridParentArray_enemy_available.append(gridname)
pass
func ToggleHandVisible(selectedHand : String, state : bool):

View File

@ -32,7 +32,9 @@ func SetupHealth():
if (roundManager.roundArray[roundManager.currentRound].isFirstRound):
if (setting):
ui_playername.text = roundManager.playerData.playername.to_upper()
ui_playerwin.text = roundManager.playerData.playername.to_upper() + " WINS!"
var playername_upper = roundManager.playerData.playername.to_upper()
ui_playerwin.text = tr("PLAYERWIN") % [playername_upper]
#ui_playerwin.text = roundManager.playerData.playername.to_upper() + " " + tr("PLAYERWIN")
setting = false
roundManager.health_player = roundManager.roundArray[roundManager.currentRound].startingHealth
roundManager.health_opponent = roundManager.roundArray[roundManager.currentRound].startingHealth
@ -60,6 +62,7 @@ func FlickerLastDigit():
var playerShotSelf = false
var trueDeathSetup = false
var checkingPlayer = false
var skipping_careful = false
func UpdateDisplayRoutine(isRaisingHealth : bool, goingToPreviousSocket : bool, showPlayerWin : bool):
var indicating = true
if (roundManager.dealerCuffed && playerShotSelf):
@ -102,11 +105,12 @@ func UpdateDisplayRoutine(isRaisingHealth : bool, goingToPreviousSocket : bool,
roundManager.health_player = 1
#if (roundManager.shellSpawner.sequenceArray[0] == null): await get_tree().create_timer(.8, false).timeout
await get_tree().create_timer(.7, false).timeout
if (roundManager.health_player == 1 && !dialogueEntered_player && !roundManager.wireIsCut_player):
if (!roundManager.wireIsCut_player): dialogue.ShowText_ForDuration("CAREFUL, NOW ...", 3)
else: dialogue.ShowText_ForDuration("OH MY ...", 3)
if (roundManager.health_player == 1 && !dialogueEntered_player && !roundManager.wireIsCut_player && !skipping_careful):
if (!roundManager.wireIsCut_player): dialogue.ShowText_ForDuration(tr("CAREFUL"), 3)
else: dialogue.ShowText_ForDuration("...", 3)
await get_tree().create_timer(3, false).timeout
dialogueEntered_player = true
if skipping_careful: skipping_careful = false
var lerpingCamera = true
if (roundManager.shellSpawner.sequenceArray.size() == 0):
#lerpingCamera = false
@ -117,11 +121,17 @@ func UpdateDisplayRoutine(isRaisingHealth : bool, goingToPreviousSocket : bool,
await get_tree().create_timer(.4, false).timeout
#why can I not add functions with arguments into godot animator :sob:
var overriding_medicine_adding = false
var overriding_medicine = false
func UpdateDisplayRoutineCigarette_Enemy():
var maxHealth = roundManager.roundArray[0].startingHealth
var changingHealth = false
var prevhealth = roundManager.health_opponent
if (!roundManager.wireIsCut_dealer): roundManager.health_opponent += 1
if (!roundManager.wireIsCut_dealer && !overriding_medicine): roundManager.health_opponent += 1
if (overriding_medicine && !roundManager.wireIsCut_dealer):
if(overriding_medicine_adding): roundManager.health_opponent += 2
else:
roundManager.health_opponent -= 1
if (roundManager.health_opponent > maxHealth): roundManager.health_opponent = maxHealth
var newhealth = roundManager.health_opponent
if (newhealth != prevhealth): changingHealth = true
@ -132,10 +142,13 @@ func UpdateDisplayRoutineCigarette_Player():
var maxHealth = roundManager.roundArray[0].startingHealth
var changingHealth = false
var prevhealth = roundManager.health_player
if (!roundManager.wireIsCut_player): roundManager.health_player += 1
if (!roundManager.wireIsCut_player && !overriding_medicine): roundManager.health_player += 1
if (overriding_medicine && !roundManager.wireIsCut_player):
if(overriding_medicine_adding): roundManager.health_player += 2
if (roundManager.health_player > maxHealth): roundManager.health_player = maxHealth
var newhealth = roundManager.health_player
if (newhealth != prevhealth): changingHealth = true
if (overriding_medicine && !overriding_medicine_adding): changingHealth = true
UpdateDisplayRoutineCigarette_Main(changingHealth, false)
pass
@ -151,7 +164,11 @@ func UpdateDisplayRoutineCigarette_Main(isChanging : bool, isAddingEnemy : bool)
defibCutter.BlipError("player")
playingsound = false
UpdateDisplay()
if (isChanging && playingsound): speaker_beep.play()
if (!overriding_medicine):
if (isChanging && playingsound): speaker_beep.play()
else:
if (isChanging && overriding_medicine_adding): speaker_beep.play()
else: if(isChanging && !overriding_medicine_adding): speaker_noise.play()
await get_tree().create_timer(.7, false).timeout
if (!isAddingEnemy):
camera.BeginLerp("home")
@ -159,7 +176,7 @@ func UpdateDisplayRoutineCigarette_Main(isChanging : bool, isAddingEnemy : bool)
else:
camera.BeginLerp("enemy")
animator_dealerHands.play("RESET")
pass
overriding_medicine = false
func SwapSkullSymbols():
for sym in skullSymbols:

View File

@ -1,5 +1,6 @@
class_name Heaven extends Node
@export var controller : ControllerManager
@export var cursor : CursorManager
@export var viewblocker : Control
@export var speaker_music : AudioStreamPlayer2D
@ -8,16 +9,25 @@ class_name Heaven extends Node
@export var interactionManager : InteractionManager
@export var buttonArray : Array[ButtonClass]
@export var speaker_button : AudioStreamPlayer2D
@export var ui : Array[Control]
@export var ach : Achievement
func _ready():
Signals()
BeginLoop()
CheckControllerState()
await get_tree().create_timer(1, false).timeout
ach.UnlockAchievement("ach2")
func Signals():
buttonArray[0].is_pressed.connect(Button_Retry)
buttonArray[1].is_pressed.connect(Button_Exit)
pass
func CheckControllerState():
if (GlobalVariables.controllerEnabled):
controller.SetMainControllerState(true)
func Button_Retry():
Button_Main("retry")
@ -29,6 +39,7 @@ func Button_Main(tag : String):
speaker_button.play()
cursor.SetCursor(false, false)
animator.play("fade out")
for u in ui: u.visible = false
for cl in buttonArray:
cl.isActive = false
await get_tree().create_timer(3.12, false).timeout
@ -38,6 +49,10 @@ func Button_Main(tag : String):
"exit":
get_tree().quit()
@export var bracket_door : Node3D
@export var btn_door : Control
@export var btn_retry : Control
@export var btn_exit : Control
func BeginLoop():
await get_tree().create_timer(1, false).timeout
speaker_music.play()
@ -45,15 +60,22 @@ func BeginLoop():
animator.play("camera pan down")
animator.queue("camera idle")
await get_tree().create_timer(11.1, false).timeout
if (cursor.controller_active): btn_door.grab_focus()
controller.previousFocus = btn_door
btn_door.visible = true
cursor.SetCursor(true, true)
intbranch_heavendoor.interactionAllowed = true
func Fly():
btn_door.visible = false
bracket_door.visible = false
intbranch_heavendoor.interactionAllowed = false
cursor.SetCursor(false, false)
animator.play("move")
await get_tree().create_timer(15.6, false).timeout
cursor.SetCursor(true, true)
if (cursor.controller_active): btn_retry.grab_focus()
controller.previousFocus = btn_retry
interactionManager.checking = false
for cl in buttonArray:
cl.isActive = true

View File

@ -5,10 +5,12 @@ class_name InteractionBranch extends Node
@export var interactionAllowed : bool
@export var isGrid : bool
@export var gridIndex : int
@export var isPlayerSide : bool
@export var itemGridIndex : int
@export var interactionInvalid : bool
@export var signatureButton_letterAlias : String
@export var signatureButton_specialAlias : String
@export var crtButton_alias : String
@export var assignedSignatureButton : SignButton
func _ready():

View File

@ -10,6 +10,7 @@ class_name InteractionManager extends Node
@export var decision : DecisionTextManager
@export var itemManager : ItemManager
@export var itemInteraction : ItemInteraction
@export var crt : CRT
var activeParent
var activeInteractionBranch
var checking = true
@ -22,11 +23,14 @@ func _process(delta):
func _input(event):
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
if (activeInteractionBranch != null && activeInteractionBranch.interactionAllowed && !activeInteractionBranch.interactionInvalid):
var childArray = activeInteractionBranch.get_parent().get_children()
for i in range(childArray.size()): if (childArray[i] is PickupIndicator): childArray[i].SnapToMax()
if (!activeInteractionBranch.isGrid): InteractWith(activeInteractionBranch.interactionAlias)
else: InteractWithGrid(activeInteractionBranch.gridIndex)
MainInteractionEvent()
func MainInteractionEvent():
if (activeInteractionBranch != null && activeInteractionBranch.interactionAllowed && !activeInteractionBranch.interactionInvalid):
var childArray = activeInteractionBranch.get_parent().get_children()
for i in range(childArray.size()): if (childArray[i] is PickupIndicator): childArray[i].SnapToMax()
if (!activeInteractionBranch.isGrid): InteractWith(activeInteractionBranch.interactionAlias)
else: InteractWithGrid(activeInteractionBranch.gridIndex)
func CheckIfHovering():
if (activeInteractionBranch != null && activeInteractionBranch.interactionAllowed):
@ -41,7 +45,6 @@ func InteractWith(alias : String):
match(alias):
"shotgun":
shotgun.GrabShotgun()
pass
"text dealer":
shotgun.Shoot("dealer")
decision.SetUI(false)
@ -80,6 +83,17 @@ func InteractWith(alias : String):
shotgun.roundManager.Response(true)
"double no":
shotgun.roundManager.Response(false)
"crt":
intro.Interaction_CRT()
"crt button":
if (activeInteractionBranch.crtButton_alias != ""):
#activeInteractionBranch.get_parent().get_child(1).Press()
crt.Interaction(activeInteractionBranch.crtButton_alias)
func SignatureButtonRemote(assignedBranch : SignButton, alias : String):
sign.GetInput(alias, alias)
assignedBranch.Press()
pass
func InteractWithGrid(tempGridIndex : int):
itemManager.PlaceDownItem(tempGridIndex)

View File

@ -27,12 +27,27 @@ class_name IntroManager extends Node
@export var speaker_pillchoice : AudioStreamPlayer2D
@export var intbranch_pillyes : InteractionBranch
@export var intbranch_pillno : InteractionBranch
@export var intbranch_crt : InteractionBranch
@export var speaker_pillselect : AudioStreamPlayer2D
@export var anim_revert : AnimationPlayer
@export var endlessmode : Endless
@export var btn_bathroomdoor : Control
@export var btn_pills : Control
@export var btn_pillsYes : Control
@export var btn_pillsNo : Control
@export var btn_backroom : Control
@export var btn_screen : Control #append this with controller UI element
@export var controller : ControllerManager
@export var unlocker : Unlocker
@export var crtManager : CRT
@export var col_pillchoice : Array[CollisionShape3D]
@export var anim_pillflicker : AnimationPlayer
var allowingPills = false
func _ready():
parent_pills.visible = false
allowingPills = false
SetControllerState()
await get_tree().create_timer(.5, false).timeout
if (roundManager.playerData.playerEnteringFromDeath && !roundManager.playerData.enteringFromTrueDeath):
RevivalBathroomStart()
@ -42,8 +57,27 @@ func _ready():
parent_pills.visible = false
allowingPills = false
if (!roundManager.playerData.playerEnteringFromDeath && !roundManager.playerData.enteringFromTrueDeath):
parent_pills.visible = true
allowingPills = true
if (FileAccess.file_exists(unlocker.savepath)):
parent_pills.visible = true
crtManager.SetCRT(true)
allowingPills = true
var counting = false
var count_current = 0
var count_max = 60
var fs1 = false
func _process(delta):
if (counting): CountTimer()
func CountTimer():
if (counting): count_current += get_process_delta_time()
if (count_current > count_max && !fs1):
ach.UnlockAchievement("ach14")
fs1 = true
func SetControllerState():
if (GlobalVariables.controllerEnabled):
controller.SetMainControllerState(true)
func MainBathroomStart():
RestRoomIdle()
@ -54,7 +88,14 @@ func MainBathroomStart():
Hint()
cursor.SetCursor(true, true)
intbranch_bathroomdoor.interactionAllowed = true
if (allowingPills): intbranch_pillbottle.interactionAllowed = true
if (allowingPills):
intbranch_pillbottle.interactionAllowed = true
intbranch_crt.interactionAllowed = true
if (cursor.controller_active): btn_bathroomdoor.grab_focus()
controller.previousFocus = btn_bathroomdoor
if (allowingPills): btn_pills.visible = true; btn_screen.visible = true
btn_bathroomdoor.visible = true
anim_pillflicker.play("flicker pill")
func Hint():
await get_tree().create_timer(1, false).timeout
@ -78,10 +119,11 @@ func RevivalBathroomStart():
MainTrackLoad()
await get_tree().create_timer(.5, false).timeout
animator_smokerdude.play("revive player")
dia.ShowText_Forever("YOU'RE LUCKY IT LEFT YOU\nWITH A CHARGE!")
dia.ShowText_Forever(tr("YOURE LUCKY"))
var n = roundManager.playerData.playername
var firstpart = "GET UP, " + n + "."
var secondpart = "\nTHE NIGHT IS YOUNG."
var firstpart = tr("GET UP") % [n]
#tr("GAME_STATUS_%d" % status_index)
var secondpart = "\n"+tr("THE NIGHT")
var full = firstpart + secondpart
await get_tree().create_timer(4, false).timeout
dia.ShowText_Forever(full)
@ -95,7 +137,15 @@ func RevivalBathroomStart():
dia.speaker_click.stream = dia.soundArray_clicks[3]
await get_tree().create_timer(3, false).timeout
cursor.SetCursor(true, true)
if (allowingPills): intbranch_pillbottle.interactionAllowed = true
if (allowingPills):
intbranch_pillbottle.interactionAllowed = true
intbranch_crt.interactionAllowed = true
btn_pills.visible = true
btn_screen.visible = true
anim_pillflicker.play("flicker pill")
if (cursor.controller_active): btn_bathroomdoor.grab_focus()
controller.previousFocus = btn_bathroomdoor
btn_bathroomdoor.visible = true
intbranch_bathroomdoor.interactionAllowed = true
pass
@ -107,9 +157,14 @@ func MainTrackLoad():
speaker_amb_restroom.play()
func Interaction_PillBottle():
anim_pillflicker.play("RESET")
cursor.SetCursor(false, false)
intbranch_bathroomdoor.interactionAllowed = false
intbranch_pillbottle.interactionAllowed = false
intbranch_crt.interactionAllowed = false
btn_pills.visible = false
btn_screen.visible = false
btn_bathroomdoor.visible = false
animator_camera.play("camera check pills")
await get_tree().create_timer(.6, false).timeout
speaker_pillchoice.play()
@ -117,16 +172,59 @@ func Interaction_PillBottle():
animator_pillchoice.play("show")
await get_tree().create_timer(.7, false).timeout
cursor.SetCursor(true, true)
if (cursor.controller_active): btn_pillsNo.grab_focus()
controller.previousFocus = btn_pillsNo
for c in col_pillchoice: c.disabled = false
btn_pillsNo.visible = true
btn_pillsYes.visible = true
intbranch_pillyes.interactionAllowed = true
intbranch_pillno.interactionAllowed = true
func SelectedPill(selected : bool):
@export var intbs_crtbuttons : Array[InteractionBranch]
func Interaction_CRT():
StartSound()
anim_pillflicker.play("RESET")
cursor.SetCursor(false, false)
intbranch_bathroomdoor.interactionAllowed = false
intbranch_pillbottle.interactionAllowed = false
intbranch_crt.interactionAllowed = false
btn_pills.visible = false
btn_bathroomdoor.visible = false
btn_screen.visible = false
animator_camera.play("camera check crt")
await get_tree().create_timer(2.6, false).timeout
crtManager.Bootup()
await get_tree().create_timer(0.54, false).timeout
func StartSound():
crtManager.speaker_playerwalk.play()
await get_tree().create_timer(2.04, false).timeout
crtManager.speaker_bootuploop.play()
func EnabledInteractionCRT():
cursor.SetCursor(true, true)
for b in intbs_crtbuttons: b.interactionAllowed = true
func DisableInteractionCrt():
cursor.SetCursor(false, false)
for b in intbs_crtbuttons: b.interactionAllowed = false
@export var ach : Achievement
@export var pill_unlock : Unlocker
func SelectedPill(selected : bool):
if (selected):
pill_unlock.IncrementAmount()
anim_pillflicker.play("RESET")
cursor.SetCursor(false, false)
for c in col_pillchoice: c.disabled = true
animator_pp.play("brightness fade out")
anim_revert.play("revert")
animator_pillchoice.play("hide")
speaker_pillchoice.stop()
speaker_pillselect.play()
btn_pillsYes.visible = false
btn_pillsNo.visible = false
intbranch_pillyes.interactionAllowed = false
intbranch_pillno.interactionAllowed = false
await get_tree().create_timer(2.05, false).timeout
@ -134,27 +232,69 @@ func SelectedPill(selected : bool):
parent_pills.visible = false
endlessmode.SetupEndless()
RestRoomIdle()
if selected: crtManager.SetCRT(false)
animator_pp.play("brightness fade in")
await get_tree().create_timer(.6, false).timeout
cursor.SetCursor(true, true)
if (selected): ach.UnlockAchievement("ach3")
intbranch_bathroomdoor.interactionAllowed = true
if(!selected): intbranch_pillbottle.interactionAllowed = true
btn_bathroomdoor.visible = true
if(!selected):
intbranch_pillbottle.interactionAllowed = true
intbranch_crt.interactionAllowed = true
btn_pills.visible = true
btn_screen.visible = true
anim_pillflicker.play("flicker pill")
if (cursor.controller_active): btn_bathroomdoor.grab_focus()
controller.previousFocus = btn_bathroomdoor
pass
func RevertCRT():
animator_pp.play("brightness fade out")
#anim_revert.play("revert")
btn_pillsYes.visible = false
btn_pillsNo.visible = false
intbranch_pillyes.interactionAllowed = false
intbranch_pillno.interactionAllowed = false
await get_tree().create_timer(2.05, false).timeout
RestRoomIdle()
animator_pp.play("brightness fade in")
anim_pillflicker.play("flicker pill")
await get_tree().create_timer(.6, false).timeout
cursor.SetCursor(true, true)
intbranch_bathroomdoor.interactionAllowed = true
btn_bathroomdoor.visible = true
intbranch_pillbottle.interactionAllowed = true
intbranch_crt.interactionAllowed = true
btn_pills.visible = true
btn_screen.visible = true
if (cursor.controller_active): btn_bathroomdoor.grab_focus()
controller.previousFocus = btn_bathroomdoor
func Interaction_BackroomDoor():
roundManager.playerData.stat_doorsKicked += 1
animator_camera.play("camera enter backroom")
intbranch_backroomdoor.interactionAllowed = false
btn_backroom.visible = false
cursor.SetCursor(false, false)
counting = false
func Interaction_BathroomDoor():
intbranch_bathroomdoor.interactionAllowed = false
cursor.SetCursor(false, false)
btn_pills.visible = false
btn_screen.visible = false
btn_bathroomdoor.visible = false
animator_camera.play("camera exit bathroom")
await get_tree().create_timer(5, false).timeout
cursor.SetCursor(true, true)
if (cursor.controller_active): btn_backroom.grab_focus()
controller.previousFocus = btn_backroom
btn_backroom.visible = true
intbranch_backroomdoor.interactionAllowed = true
intbranch_pillbottle.interactionAllowed = false
intbranch_crt.interactionAllowed = false
counting = true
pass

3
ItemAmounts.gd Normal file
View File

@ -0,0 +1,3 @@
class_name Amounts extends Node
@export var array_amounts : Array[AmountResource]

View File

@ -1,5 +1,6 @@
class_name ItemInteraction extends Node
@export var medicine : Medicine
@export var roundManager : RoundManager
@export var dealerIntelligence : DealerIntelligence
@export var cursor : CursorManager
@ -8,12 +9,24 @@ class_name ItemInteraction extends Node
@export var lerpDuration : float
@export var pos_hand : Vector3
@export var rot_hand : Vector3
@export var pos_hand_stealing : Vector3
@export var rot_hand_stealing : Vector3
var pos_hand_main : Vector3
var rot_hand_main : Vector3
@export var animator_dealerHands : AnimationPlayer
@export var animator_playerHands : AnimationPlayer
@export var camera : CameraManager
@export var shellEject_player : ShellEjectManager
@export var speaker_pickup : AudioStreamPlayer2D
@export var speaker_breakcuffs : AudioStreamPlayer2D
@export var speaker_interaction : AudioStreamPlayer2D
@export var sound_use_burnerphone : AudioStream
@export var sound_use_inverter : AudioStream
@export var sound_use_medicine : AudioStream
@export var sound_use_adrenaline : AudioStream
@export var amounts : Amounts
@export var items: ItemManager
@export var hands : HandManager
var temp_itemParent
var pos_current
@ -25,19 +38,31 @@ var temp_indicator
var elapsed = 0
var moving = false
func _ready():
pos_hand_main = pos_hand
rot_hand_main = rot_hand
func _process(delta):
LerpMovement()
var stealing = false
var stealing_fs = false
func PickupItemFromTable(itemParent : Node3D, passedItemName : String):
if (stealing): items.Counter(false)
#SET INTERACTION PERMISSIONS, HIDE CURSOR
perm.SetIndicators(false)
perm.SetInteractionPermissions(false)
perm.RevertDescriptionUI()
cursor.SetCursor(false, false)
roundManager.ClearDeskUI(true)
#GET VARIABLES
temp_itemParent = itemParent
temp_indicator = itemParent.get_child(0)
temp_interaction = itemParent.get_child(1)
#STEAL
if (stealing && stealing_fs):
hands.RemoveItem_Remote(temp_itemParent)
items.RevertItemSteal()
#PLAY PICKUP SOUND
speaker_pickup.stream = temp_indicator.sound_pickup
speaker_pickup.pitch_scale = randf_range(.93, 1.0)
@ -50,6 +75,7 @@ func PickupItemFromTable(itemParent : Node3D, passedItemName : String):
temp_indicator.interactionAllowed = false
temp_indicator.SnapToMax()
temp_interaction.interactionAllowed = false
var temp_name = temp_interaction.itemName
#LERP
pos_current = temp_itemParent.transform.origin
rot_current = temp_itemParent.rotation_degrees
@ -59,12 +85,34 @@ func PickupItemFromTable(itemParent : Node3D, passedItemName : String):
moving = true
await get_tree().create_timer(lerpDuration -.1, false).timeout
moving = false
RemovePlayerItemFromGrid(temp_itemParent)
if (!stealing): RemovePlayerItemFromGrid(temp_itemParent)
temp_itemParent.queue_free() #check where player grid index is given, and remove item from player item array, unoccupy given grid
if (stealing):
camera.BeginLerp("home")
stealing_fs = false
await get_tree().create_timer(.4, false).timeout
pos_hand = pos_hand_main
rot_hand = rot_hand_main
var amountArray : Array[AmountResource] = amounts.array_amounts
for res in amountArray:
if (res.itemName == temp_name):
res.amount_dealer -= 1
break
InteractWith(passedItemName)
stealing = false
func InteractWith(itemName : String):
#INTERACTION
var amountArray : Array[AmountResource] = amounts.array_amounts
for res in amountArray:
if (res.itemName == itemName):
res.amount_player -= 1
break
var isdup = false
for it in roundManager.playerCurrentTurnItemArray:
if (it == itemName): isdup = true; break
if (!isdup): roundManager.playerCurrentTurnItemArray.append(itemName)
match (itemName):
"handcuffs":
animator_dealerHands.play("dealer get handcuffed")
@ -107,6 +155,53 @@ func InteractWith(itemName : String):
roundManager.currentShotgunDamage = 2
await get_tree().create_timer(4.28 + .2, false).timeout
EnablePermissions()
"expired medicine":
PlaySound(sound_use_medicine)
animator_playerHands.play("player use expired pills")
medicine.UseMedicine()
#await get_tree().create_timer(4.28 +.2 + 4.3, false).timeout
#EnablePermissions()
"inverter":
PlaySound(sound_use_inverter)
animator_playerHands.play("player use inverter")
if (roundManager.shellSpawner.sequenceArray[0] == "live"): roundManager.shellSpawner.sequenceArray[0] = "blank"
else: roundManager.shellSpawner.sequenceArray[0] = "live"
await get_tree().create_timer(3.2, false).timeout
EnablePermissions()
"burner phone":
PlaySound(sound_use_burnerphone)
animator_playerHands.play("player use burner phone")
await get_tree().create_timer(7.9, false).timeout
EnablePermissions()
"adrenaline":
PlaySound(sound_use_adrenaline)
animator_playerHands.play("player use adrenaline")
await get_tree().create_timer(5.3 + .2, false).timeout
items.SetupItemSteal()
#EnablePermissions()
CheckAchievement_koni()
CheckAchievement_full()
@export var ach : Achievement
func CheckAchievement_koni():
if ("cigarettes" in roundManager.playerCurrentTurnItemArray and "beer" in roundManager.playerCurrentTurnItemArray and "expired medicine" in roundManager.playerCurrentTurnItemArray): ach.UnlockAchievement("ach9")
func CheckAchievement_full():
var all = ["handsaw", "magnifying glass", "beer", "cigarettes", "handcuffs", "expired medicine", "burner phone", "adrenaline", "inverter"]
var pl = roundManager.playerCurrentTurnItemArray
if (all.size() == pl.size()): ach.UnlockAchievement("ach12")
@export var anim_pp : AnimationPlayer
@export var filter : FilterController
func AdrenalineHit():
anim_pp.play("adrenaline brightness")
filter.BeginPan(filter.lowPassDefaultValue, filter.lowPassMaxValue)
await get_tree().create_timer(6, false).timeout
filter.BeginPan(filter.effect_lowPass.cutoff_hz, filter.lowPassDefaultValue)
func PlaySound(clip : AudioStream):
speaker_interaction.stream = clip
speaker_interaction.play()
func EnablePermissions():
perm.SetStackInvalidIndicators()
@ -114,6 +209,17 @@ func EnablePermissions():
perm.SetInteractionPermissions(true)
perm.RevertDescriptionUI()
cursor.SetCursor(true, true)
roundManager.SetupDeskUI()
func DisableShotgun():
perm.DisableShotgun()
func DisablePermissions():
perm.SetIndicators(false)
perm.SetInteractionPermissions(false)
perm.RevertDescriptionUI()
cursor.SetCursor(false, false)
roundManager.ClearDeskUI(true)
func PlaySound_BreakHandcuffs():
speaker_breakcuffs.play()

View File

@ -2,6 +2,7 @@ class_name ItemManager extends Node
@export var grid : GridIndicator
@export var cursor : CursorManager
@export var controller : ControllerManager
@export var roundManager : RoundManager
@export var dialogue : Dialogue
@export var camera : CameraManager
@ -27,9 +28,15 @@ var gridParentArray_enemy_available : Array[Node3D]
@export var anim_spook : AnimationPlayer
@export var speakercontroller_musicmain : SpeakerController
@export var speaker_god : AudioStreamPlayer2D
@export var amounts : Amounts
@export var interaction : ItemInteraction
@export var btnParent_stealing : Control
@export var btnparent_ff_stealing : Control
var itemGrabSoundIndex = 0
var itemArray_dealer : Array[String]
var itemArray_instances_dealer : Array[Node3D]
var itemArray_instances_dealer_previous : Array[Node3D]
var itemArray_dealer_previous : Array[String]
var itemArray_player : Array[String]
var hasBegun = false
var items_dynamicIndicatorArray : Array[PickupIndicator]
@ -58,12 +65,33 @@ var temp_interaction
func _ready():
playerItemStringArray = []
availableItemsToGrabArray_player = availableItemArray
availableItemsToGrabArray_dealer = availableItemArray
#availableItemsToGrabArray_player = availableItemArray
#availableItemsToGrabArray_dealer = availableItemArray
ResetDealerGrid()
func _process(delta):
LerpItem()
CheckTimer()
ItemStealTimeout()
@export var btnParent_intake : Control
@export var btn_intake : Control
@export var btn_grids : Array[Control]
func SetIntakeFocus(state : bool):
btnParent_intake.visible = true
if (state):
for grid in btn_grids: grid.visible = false
btn_intake.visible = true
if (cursor.controller_active): btn_intake.grab_focus()
controller.previousFocus = btn_intake
else:
for grid in btn_grids: grid.visible = true
#btn_intake.visible = false
func ClearIntakeFocus():
btnParent_intake.visible = false
for grid in btn_grids: grid.visible = false
btn_intake.visible = false
func ItemClear_Remote():
var itemParentChildrenArray = itemSpawnParent.get_children()
@ -108,7 +136,7 @@ func BeginItemGrabbing():
await get_tree().create_timer(.8, false).timeout
if (!roundManager.playerData.hasReadItemSwapIntroduction):
dialogue.ShowText_ForDuration("LET'S MAKE THIS A LITTLE\nMORE INTERESTING ...", 3)
dialogue.ShowText_ForDuration(tr("MORE INTERESTING"), 3)
await get_tree().create_timer(3, false).timeout
camera.BeginLerp("home")
await get_tree().create_timer(.8, false).timeout
@ -123,9 +151,10 @@ func BeginItemGrabbing():
if (!roundManager.playerData.hasReadItemDistributionIntro):
var stringIndex = roundManager.roundArray[roundManager.currentRound].numberOfItemsToGrab
var string = stringNumberArray[stringIndex]
dialogue.ShowText_Forever(string+" ITEMS EACH.")
string = str(stringIndex)
dialogue.ShowText_Forever(string+" "+tr("ITEMS EACH"))
await get_tree().create_timer(2.5, false).timeout
dialogue.ShowText_Forever("MORE ITEMS BEFORE\nEVERY LOAD.")
dialogue.ShowText_Forever(tr("MORE ITEMS"))
await get_tree().create_timer(2.5, false).timeout
dialogue.HideText()
roundManager.playerData.hasReadItemDistributionIntro = true
@ -133,12 +162,14 @@ func BeginItemGrabbing():
if (!roundManager.playerData.hasReadItemDistributionIntro2 && roundManager.roundArray[roundManager.currentRound].hasIntro2):
var stringIndex = roundManager.roundArray[roundManager.currentRound].numberOfItemsToGrab
var string = stringNumberArray[stringIndex]
dialogue.ShowText_Forever(string+" ITEMS EACH.")
string = str(stringIndex)
dialogue.ShowText_Forever(string+" "+tr("ITEMS EACH"))
await get_tree().create_timer(2.5, false).timeout
dialogue.HideText()
roundManager.playerData.hasReadItemDistributionIntro2 = true
#ALLOW ITEM GRAB
cursor.SetCursor(true, true)
SetIntakeFocus(true)
interaction_intake.interactionAllowed = true
pass
@ -147,6 +178,7 @@ func EndItemGrabbing():
GridParents(false)
interaction_intake.interactionAllowed = false
cursor.SetCursor(false, false)
ClearIntakeFocus()
await get_tree().create_timer(.45, false).timeout
comp.CycleCompartment("hide briefcase")
await get_tree().create_timer(1, false).timeout
@ -159,6 +191,7 @@ func EndItemGrabbing():
func GrabSpook():
interaction_intake.interactionAllowed = false
cursor.SetCursor(false, false)
ClearIntakeFocus()
PlayItemGrabSound()
speakercontroller_musicmain.SnapVolume(false)
speaker_god.play()
@ -171,9 +204,10 @@ func GrabSpook():
speakercontroller_musicmain.FadeIn()
await get_tree().create_timer(.8, false).timeout
cursor.SetCursor(true, true)
SetIntakeFocus(true)
interaction_intake.interactionAllowed = true
var randindex = -1
var randindex = 4
var spook_counter = 0
var spook_fired = false
func GrabItem():
@ -188,22 +222,30 @@ func GrabItem():
PlayItemGrabSound()
interaction_intake.interactionAllowed = false
var selectedResource : ItemResource
if (numberOfCigs_player >= 2):
availableItemsToGrabArray_player.erase("cigarettes")
else:
var hasInArray = false
for i in range(availableItemsToGrabArray_player.size()):
if (availableItemsToGrabArray_dealer[i] == "cigarettes"):
hasInArray = true
break
if (!hasInArray): availableItemsToGrabArray_player.append("cigarettes")
#SET PLAYER AVAILABLE ITEMS ACCORDING TO MAX COUNTS
var amountArray : Array[AmountResource] = amounts.array_amounts
availableItemsToGrabArray_player = []
for res in amountArray:
if (res.amount_active == 0): continue
if (res.amount_player != res.amount_active):
availableItemsToGrabArray_player.append(res.itemName)
#for res in amountArray: availableItemsToGrabArray_player.append(res.itemName)
randindex = randi_range(0, availableItemsToGrabArray_player.size() - 1)
numberOfItemsGrabbed += 1
#SPAWN ITEM
for i in range(instanceArray.size()):
if (availableItemsToGrabArray_player[randindex] == instanceArray[i].itemName):
selectedResource = instanceArray[i]
var itemInstance = selectedResource.instance.instantiate()
for res in amountArray:
if (selectedResource.itemName == res.itemName):
res.amount_player += 1
break
activeItem = itemInstance
itemSpawnParent.add_child(itemInstance)
itemInstance.transform.origin = selectedResource.pos_inBriefcase
@ -231,13 +273,21 @@ func GrabItem():
moving = true
await get_tree().create_timer(lerpDuration - .2, false).timeout
if (!roundManager.playerData.indicatorShown): grid.ShowGridIndicator()
if (numberOfOccupiedGrids != 8):
GridParents(true)
SetIntakeFocus(false)
else:
#NOT ENOUGH SPACE. PUT ITEM BACK AND END ITEM GRABBING
dialogue.ShowText_Forever("OUT OF SPACE.")
for res in amountArray:
if (selectedResource.itemName == res.itemName):
res.amount_player -= 1
break
dialogue.ShowText_Forever(tr("NO SPACE"))
await get_tree().create_timer(1.8, false).timeout
dialogue.ShowText_Forever("HOW UNFORTUNATE ...")
dialogue.ShowText_Forever(tr("UNFORTUNATE"))
await get_tree().create_timer(2.2, false).timeout
dialogue.HideText()
pos_current = activeItem.transform.origin
@ -247,6 +297,7 @@ func GrabItem():
elapsed = 0
moving = true
cursor.SetCursor(false, false)
ClearIntakeFocus()
PlayItemGrabSound()
await get_tree().create_timer(lerpDuration, false).timeout
moving = false
@ -258,14 +309,14 @@ func PlaceDownItem(gridIndex : int):
numberOfOccupiedGrids += 1
gridOccupiedArray[gridIndex] = true
moving = false
#activeItem.get_parent().remove_child(activeItem)
#gridParentArray[gridIndex].add_child(activeItem)
var temp_indicator = activeItem.get_child(0)
if (temp_interaction.itemName == "cigarettes"): numberOfCigs_player += 1
pos_current = activeItem.transform.origin
rot_current = activeItem.rotation_degrees
pos_next = gridParentArray[gridIndex].transform.origin + activeItem_offset_pos
rot_next = gridParentArray[gridIndex].rotation_degrees + activeItem_offset_rot
temp_interaction.isPlayerSide = true
temp_indicator.dealerGridIndex = gridIndex + 8
elapsed = 0
moving = true
temp_interaction.itemGridIndex = gridIndex
@ -281,8 +332,10 @@ func PlaceDownItem(gridIndex : int):
else:
#GRAB NEXT ITEM
GridParents(false)
ClearIntakeFocus()
await get_tree().create_timer(lerpDuration, false).timeout
interaction_intake.interactionAllowed = true
SetIntakeFocus(true)
pass
var firstItem = true
@ -290,33 +343,39 @@ func GrabItems_Enemy():
var selectedResource
for i in range(roundManager.roundArray[roundManager.currentRound].numberOfItemsToGrab):
if (numberOfItemsGrabbed_enemy != 8):
if (numberOfCigs_dealer >= 2):
availableItemsToGrabArray_dealer.erase("cigarettes")
else:
var hasInArray = false
for k in range(availableItemsToGrabArray_dealer.size()):
if (availableItemsToGrabArray_dealer[k] == "cigarettes"):
hasInArray = true
break
if (!hasInArray): availableItemsToGrabArray_dealer.append("cigarettes")
var amountArray : Array[AmountResource] = amounts.array_amounts
availableItemsToGrabArray_dealer = []
for res in amountArray:
if (res.amount_active == 0):
continue
if (res.amount_dealer != res.amount_active):
availableItemsToGrabArray_dealer.append(res.itemName)
var randindex = randi_range(0, availableItemsToGrabArray_dealer.size() - 1)
var selectedItem = availableItemsToGrabArray_dealer[randindex]
#SPAWN ITEM
for c in range(instanceArray_dealer.size()):
if (availableItemArray[randindex] == instanceArray_dealer[c].itemName):
if (selectedItem == instanceArray_dealer[c].itemName):
selectedResource = instanceArray_dealer[c]
#ADD STRING TO DEALER ITEM ARRAY
itemArray_dealer.append(instanceArray_dealer[c].itemName)
itemArray_dealer.append(instanceArray_dealer[c].itemName.to_lower())
break
var itemInstance = selectedResource.instance.instantiate()
var temp_itemIndicator = itemInstance.get_child(0)
temp_itemIndicator.isDealerItem = true
for res in amountArray:
if (selectedResource.itemName == res.itemName):
res.amount_dealer += 1
break
#ADD INSTANCE TO DEALER ITEM ARRAY (mida vittu this code is getting out of hand)
itemArray_instances_dealer.append(itemInstance)
activeItem_enemy = itemInstance
itemSpawnParent.add_child(activeItem_enemy)
#PLACE ITEM ON RANDOM GRID
var randgrid = randi_range(0, gridParentArray_enemy_available.size() - 1)
#higher than z0 is right
var gridname = gridParentArray_enemy_available[randgrid]
activeItem_enemy.transform.origin = gridParentArray_enemy_available[randgrid].transform.origin + selectedResource.pos_offset
activeItem_enemy.rotation_degrees = gridParentArray_enemy_available[randgrid].rotation_degrees + selectedResource.rot_offset
@ -327,13 +386,92 @@ func GrabItems_Enemy():
if (activeItem_enemy.get_child(1).itemName == "cigarettes"): numberOfCigs_dealer += 1
gridParentArray_enemy_available.erase(gridname)
numberOfItemsGrabbed_enemy += 1
pass
pass
func UseItem_Dealer(itemName : String):
match (itemName):
"beer":
pass
var PREVIOUS_items_dyanmicIndicatorArray : Array[PickupIndicator]
var PREVIOUS_items_dynamicInteractionArray : Array[InteractionBranch]
func SetupItemSteal():
PREVIOUS_items_dyanmicIndicatorArray = []
PREVIOUS_items_dynamicInteractionArray = []
PREVIOUS_items_dyanmicIndicatorArray = items_dynamicIndicatorArray
PREVIOUS_items_dynamicInteractionArray = items_dynamicInteractionArray
items_dynamicIndicatorArray = []
items_dynamicInteractionArray = []
interaction.pos_hand = interaction.pos_hand_stealing
interaction.rot_hand = interaction.rot_hand_stealing
interaction.stealing = true
var ch = itemSpawnParent.get_children()
for c in ch.size():
if(ch[c].get_child(0) is PickupIndicator):
var temp_indicator : PickupIndicator = ch[c].get_child(0)
var temp_interaction : InteractionBranch = ch[c].get_child(1)
items_dynamicIndicatorArray.append(temp_indicator)
items_dynamicInteractionArray.append(temp_interaction)
camera.BeginLerp("enemy items")
await get_tree().create_timer(.7, false).timeout
interaction.stealing_fs = true
interaction.EnablePermissions()
interaction.DisableShotgun()
roundManager.ClearDeskUI(true)
btnParent_stealing.visible = true
if (cursor.controller_active): btnparent_ff_stealing.grab_focus()
controller.previousFocus = btnparent_ff_stealing
for c in ch.size():
if(ch[c].get_child(0) is PickupIndicator):
var temp_indicator : PickupIndicator = ch[c].get_child(0)
var temp_interaction : InteractionBranch = ch[c].get_child(1)
Counter(true)
func RevertItemSteal():
btnParent_stealing.visible = false
items_dynamicIndicatorArray = PREVIOUS_items_dyanmicIndicatorArray
items_dynamicInteractionArray = PREVIOUS_items_dynamicInteractionArray
func RevertItemSteal_Timeout():
btnParent_stealing.visible = false
interaction.stealing = false
interaction.DisablePermissions()
items_dynamicIndicatorArray = PREVIOUS_items_dyanmicIndicatorArray
items_dynamicInteractionArray = PREVIOUS_items_dynamicInteractionArray
var ch = itemSpawnParent.get_children()
for c in ch.size():
if(ch[c].get_child(0) is PickupIndicator):
var temp_indicator : PickupIndicator = ch[c].get_child(0)
temp_indicator.Revert()
camera.BeginLerp("home")
await get_tree().create_timer(.4, false).timeout
interaction.stealing_fs = false
interaction.pos_hand = interaction.pos_hand_main
interaction.rot_hand = interaction.rot_hand_main
interaction.EnablePermissions()
func Counter(starting : bool):
if (starting):
timer_steal_current = 0
counting = true
checking = true
fs = false
else:
timer_steal_current = 0
counting = false
checking = false
fs = true
var timer_steal_current = 0.0
var timer_steal_max = 7.0
var counting = false
var checking = false
func ItemStealTimeout():
if (counting): timer_steal_current += get_process_delta_time()
var fs = false
func CheckTimer():
if ((timer_steal_current > timer_steal_max) && checking && !fs):
RevertItemSteal_Timeout()
fs = true
pass
func ResetDealerGrid():
@ -399,6 +537,11 @@ func ClearAllItems():
for i in range (instancesToDelete.size()):
instancesToDelete[i].queue_free()
itemArray_instances_dealer = []
var amountArray : Array[AmountResource] = amounts.array_amounts
for res in amountArray:
res.amount_dealer = 0
res.amount_player = 0
func GridParents(setState : bool):
if (setState):
@ -415,7 +558,6 @@ func PlayItemGrabSound():
speaker_itemgrab.play()
if (itemGrabSoundIndex != soundArray_itemGrab.size() - 1): itemGrabSoundIndex += 1
else: itemGrabSoundIndex = 0
pass
func LerpItem():
if (moving):
@ -439,5 +581,3 @@ func LerpItem():

16
JankPreventer.gd Normal file
View File

@ -0,0 +1,16 @@
extends Node
@export var isHeaven : bool = false
func _ready():
await get_tree().create_timer(1, false).timeout
Prevent()
func Prevent():
var loc = TranslationServer.get_locale()
if (!isHeaven):
await get_tree().create_timer(1, false).timeout
if (loc == "ES" or loc == "JA"): self.get_parent().visible = false
else:
if (loc == "DE" or loc == "ES" or loc == "ES LATAM" or loc == "BR" or loc == "PT" or loc == "PL" or loc == "TR"): self.get_parent().text = "< >"
else: self.get_parent().text = "< >"

3
KeyRebindBranch.gd Normal file
View File

@ -0,0 +1,3 @@
class_name RebindBranch extends Node
var originalBind_keyboard : InputEvent
var originalBind_controller : InputEvent

133
KeyRebinding.gd Normal file
View File

@ -0,0 +1,133 @@
class_name Rebinding extends Node
@export var options : OptionsManager
@export var mouseblocker : Control
@export var cursor : CursorManager
@export var controller : ControllerManager
@export var rebindKeyArray : Array[Label]
@export var menu : MenuManager
func UpdateBindList():
var map = InputMap
for action in InputMap.get_actions():
var action_bindname = action
var bindkeys = InputMap.action_get_events(action)
if (bindkeys.size() < 2): continue
var bindkey_keyboard = bindkeys[0].as_text()
var bindkey_controller = bindkeys[1].as_text()
for ui in rebindKeyArray:
if (ui.name == action_bindname):
var keylabel = ui.get_parent().get_child(1)
var bindbranch : RebindBranch = ui.get_parent().get_child(2)
bindbranch.originalBind_keyboard = bindkeys[0]
bindbranch.originalBind_controller = bindkeys[1]
#print("-------------------------------------------------")
#print("KEYBOARD bind branch: ", bindbranch.originalBind_keyboard)
#print("CONTROLLER bind branch: ", bindbranch.originalBind_controller)
var firstindex = bindkey_controller.rfind("(")
bindkey_keyboard = bindkey_keyboard.trim_suffix("(Physical)")
bindkey_keyboard = bindkey_keyboard.replace(" ", "")
bindkey_controller = bindkey_controller.left(firstindex)
keylabel.text = bindkey_keyboard + ", " + bindkey_controller
options.ParseInputMapDictionary()
var globalparent
var previousKey
func GetRebind(parent : Node):
menu.failsafed = false
globalparent = parent
controller.checkingForInput = false
controller.SetRebindFocus(false)
var ui_inputName = parent.get_child(0)
var ui_inputKey = parent.get_child(1)
previousKey = ui_inputKey.text
mouseblocker.visible = true
cursor.SetCursor(false, false)
ui_inputKey.text = tr("PRESS ANY BUTTON REMAP")
checkingForCancel = true
waitingForAnyInput = true
var waitingForAnyInput
func _input(event):
#if (event is InputEventKey): print("event keycode: ", event.as_text_key_label())
#if (event is InputEventJoypadMotion): print("event axis value: ", event.axis_value)
# and !event is InputEventJoypadMotion below
if (waitingForAnyInput and !event is InputEventMouseMotion and event.is_pressed()):
if (event is InputEventMouseButton && event.double_click): event.double_click = false
#if (event is InputEventJoypadMotion): event.axis_value = 0
#if (event is InputEventKey): print("KEY. SCANCODE: ", event.scancode)
#if (event is InputEventJoypadButton): print("CONTROLLER. ")
#return
var newEventToBind = event
var parent = globalparent
var ui_inputName = parent.get_child(0).name
var branch = parent.get_child(2)
var originalkey_keyboard = branch.originalBind_keyboard
var originalkey_controller = branch.originalBind_controller
var activeKeyName = originalkey_controller
var actionIndex = 1
var assigningKeyboard = !event is InputEventJoypadButton and !event is InputEventJoypadMotion
var checkingMouse = event is InputEventMouseButton
if (assigningKeyboard):
activeKeyName = originalkey_keyboard
actionIndex = 0
var binds = InputMap.action_get_events(ui_inputName)
var firstEvent = originalkey_keyboard
var secondEvent = originalkey_controller
if (assigningKeyboard): firstEvent = newEventToBind
else: secondEvent = newEventToBind
InputMap.action_erase_events(ui_inputName)
InputMap.action_add_event(ui_inputName, firstEvent)
InputMap.action_add_event(ui_inputName, secondEvent)
#CHECK IF OVERWRITING KEY
var currentAction = ui_inputName
var currentBind = newEventToBind
var bindIndex = 1
if (assigningKeyboard): bindIndex = 0
#print("--------------------------------------------------")
for action in InputMap.get_actions():
if (action != currentAction):
var bindkeys = InputMap.action_get_events(action)
if (bindkeys.size() < 2): continue
#print("ACTIVE ACTION....", action, " ....BIND KEYS BIND INDEX.... ", bindkeys[bindIndex].as_text(), " ....CURRENT BIND.... ", currentBind.as_text())
if (bindkeys[bindIndex].as_text() == currentBind.as_text()):
SwapBind(bindkeys[0], bindkeys[1], action, assigningKeyboard, originalkey_keyboard, originalkey_controller)
UpdateBindList()
ReturnFromRebind()
func SwapBind(firstevent : InputEvent, secondevent : InputEvent, _action : String, _assigningKeyboard : bool, original_keyboard : InputEvent, original_cntrl : InputEvent):
InputMap.action_erase_events(_action)
if (_assigningKeyboard): firstevent = original_keyboard
else: secondevent = original_cntrl
InputMap.action_add_event(_action, firstevent)
InputMap.action_add_event(_action, secondevent)
func ReturnFromRebind():
waitingForAnyInput = false
await get_tree().create_timer(.1, false).timeout
var parent = globalparent
controller.checkingForInput = true
controller.SetRebindFocus(true)
mouseblocker.visible = false
cursor.SetCursor(true, false)
menu.failsafed = true
var checkingForCancel
func CancelRebind():
var parent = globalparent
parent.get_child(1).text = previousKey
controller.checkingForInput = true
controller.SetRebindFocus(true)
mouseblocker.visible = false
cursor.SetCursor(true, false)
checkingForCancel = false
#await get_tree().create_timer(1, false).timeout
menu.failsafed = true
var cancelAllowed = false
func _unhandled_input(event):
if (event.is_action_pressed("ui_cancel") && checkingForCancel && cancelAllowed):
CancelRebind()

244
LeaderboardManager.gd Normal file
View File

@ -0,0 +1,244 @@
class_name Board extends Node
@export var ach : Achievement
@export var crt : CRT
@export var save : SaveFileManager
@export var display_instances : Array[Label3D]
@export var display_instances_alt : Array[Node3D]
var display_instances_act = []
@export var display_overview : Node3D
@export var text_globalpos : Label3D
@export var nocon : Node3D
@export var lock : Node3D
var leaderboard_handle
var details_max: int = Steam.setLeaderboardDetailsMax(2)
var activeArray = []
var active_result_array
var active_entry_count = 0
func _ready():
display_instances_act = display_instances
ClearDisplay()
Steam.leaderboard_find_result.connect(_on_leaderboard_find_result)
Steam.leaderboard_score_uploaded.connect(_on_leaderboard_score_uploaded)
Steam.leaderboard_scores_downloaded.connect(_on_leaderboard_scores_downloaded)
GetLeaderboard()
func _process(delta):
CheckTimeout()
func PassLeaderboard(range1 : int, range2 : int, alias : String):
active_range1 = range1
active_range2 = range2
active_alias = alias
SetupLeaderboard()
var initialsetup = false
var active_alias = ""
var active_range1 = 0
var active_range2 = 0
func SetupLeaderboard():
if (!initialsetup):
GetLeaderboard()
Steam.setLeaderboardDetailsMax(2)
initialsetup = true
return
DownloadEntries(active_range1, active_range2, active_alias)
Timeout(true)
func Timeout(s : bool):
if s:
t = 0
checking = true
else:
t = 0
checking = false
func ClearDisplay():
display_overview.visible = false
text_globalpos.text = ""
for disp in display_instances_act:
var score : Label3D = disp.get_child(0)
disp.text = ""
score.text = ""
func TurnOffDisplay():
crt.speaker_bootuploop.stop()
crt.speaker_shutdown.play()
nocon.visible = false
display_overview.visible = false
text_globalpos.text = ""
for disp in display_instances_act:
var score : Label3D = disp.get_child(0)
disp.text = ""
score.text = ""
for i in crt.array_bootup: i.visible = false
for i in crt.array_bootuplogo: i.visible = false
for i in crt.array_partbranch: i.ResetPartition()
for i in crt.array_stats: i.visible = false
crt.anim_iconfade.play("RESET")
func UpdateDisplay():
if (crt.has_exited): return
var fs = false
Timeout(false)
nocon.material_override.albedo_color = Color(1, 1, 1, 0)
lock.material_override.albedo_color = Color(1, 1, 1, 0)
display_instances_act = display_instances
var temp_rank = 0
var array = active_result_array
if (checking_friends):
for result in active_result_array:
temp_rank += 1
result.global_rank = temp_rank
if (checking_overview):
var id = Steam.getSteamID()
var pos_current
var pos_max
pos_max = active_entry_count
display_overview.visible = true
for result in active_result_array:
if (result.steam_id == id):
pos_current = result.global_rank
break
if (pos_current == null):
lock.material_override.albedo_color = Color(1, 1, 1, 1)
display_overview.visible = false
text_globalpos.text = "(" + str(pos_current) + "/" + str(pos_max) + ")"
display_instances_act = display_instances_alt
var incrementer = 0
for i in range(display_instances_act.size()):
if i >= active_result_array.size() or active_result_array[i] == null: continue
var details = active_result_array[i].details
if (details.size() != 2):
details = [0, 0]
var active_score = active_result_array[i].score
var init = details[0]
var beaten = details[1]
var sc = init
for s in range(beaten - 1): sc *= 2
var check = 0
active_score = sc
if (!fs):
ach.UnlockAchievement("ach16")
crt.speaker_navbeep.pitch_scale = .5
crt.speaker_navbeep.play()
fs = true
var scoretext : Label3D = display_instances_act[i].get_child(0)
var active_id = active_result_array[i].steam_id
var active_rank = active_result_array[i].global_rank
var playername = Steam.getFriendPersonaName(active_id)
var mainstring = "#" + str(active_rank) + " " + playername
var char_limit = 18
if mainstring.length() > char_limit:
mainstring = mainstring.left(char_limit - 1) + "-"
display_instances_act[i].text = str(mainstring)
scoretext.text = str(active_score)
var temp_data
@export var stat_shotsFired : Label3D
@export var stat_shellsEjected : Label3D
@export var stat_doorsKicked : Label3D
@export var stat_cigSmoked : Label3D
@export var stat_roundsBeat : Label3D
@export var stat_mlDrank : Label3D
@export var stat_totalCash : Label3D
func UpdateStats():
if (FileAccess.file_exists(save.savePath_stats)):
var file = FileAccess.open(save.savePath_stats, FileAccess.READ)
temp_data = file.get_var()
stat_shotsFired.text = str(temp_data.shots_fired)
stat_shellsEjected.text = str(temp_data.shells_ejected)
stat_doorsKicked.text = str(temp_data.doors_kicked)
stat_cigSmoked.text = str(temp_data.cigs_smoked)
stat_roundsBeat.text = str(temp_data.rounds_beat)
stat_mlDrank.text = str(temp_data.ml_drank)
stat_totalCash.text = str(temp_data.total_cash)
func GetLeaderboard():
Steam.findLeaderboard("double_or_nothing")
func UploadScore(rounds_beat, visible_score, initial_score):
var ar = PackedInt32Array([initial_score, rounds_beat])
var score_to_upload = initial_score * rounds_beat
Steam.uploadLeaderboardScore(score_to_upload, true, ar, leaderboard_handle)
func _on_leaderboard_score_uploaded(success: int, this_handle: int, this_score: Dictionary) -> void:
if success == 1:
print("successfully uploaded score: ", this_score)
else: print("failed to upload score")
func _on_leaderboard_find_result(handle: int, found: int) -> void:
if found == 1:
leaderboard_handle = handle
print("Leaderboard handle found: %s" % leaderboard_handle)
SetupLeaderboard()
else:
print("No handle was found")
var checking_friends = false
var checking_overview = false
func DownloadEntries(range1 : int, range2 : int, alias : String):
match alias:
"top":
checking_friends = false
checking_overview = false
Steam.downloadLeaderboardEntries(range1, range2, Steam.LEADERBOARD_DATA_REQUEST_GLOBAL)
"overview":
checking_friends = false
checking_overview = true
Steam.downloadLeaderboardEntries(-4, 4, Steam.LEADERBOARD_DATA_REQUEST_GLOBAL_AROUND_USER)
"friends":
checking_friends = true
checking_overview = false
Steam.downloadLeaderboardEntries(range1, range2, Steam.LEADERBOARD_DATA_REQUEST_FRIENDS)
var t = 0
var max = 2
var checking = false
func CheckTimeout():
if (checking):
t += get_process_delta_time()
if t > max:
nocon.material_override.albedo_color = Color(1, 1, 1, 1)
var print_cur = 0
var print_max = 48
func _on_leaderboard_scores_downloaded(message: String, this_leaderboard_handle: int, result: Array) -> void:
print("scores downloaded message: %s" % message)
var leaderboard_handle: int = this_leaderboard_handle
active_result_array = result
active_entry_count = Steam.getLeaderboardEntryCount(leaderboard_handle)
for this_result in result: if (print_cur <= print_max): print("leaderboard result (", print_cur, "/", print_max, ")", this_result); print_cur += 1
UpdateDisplay()

1
LocalizationManager.gd Normal file
View File

@ -0,0 +1 @@
class_name LocalizationManager extends Node

75
MedicineManager.gd Normal file
View File

@ -0,0 +1,75 @@
class_name Medicine extends Node
@export var rm : RoundManager
@export var interaction : ItemInteraction
@export var cam : CameraManager
@export var death : DeathManager
@export var counter : HealthCounter
@export var anim_dealerhands : AnimationPlayer
@export var dealerai : DealerIntelligence
@export var speaker_medicine : AudioStreamPlayer2D
@export var death_dealer : AudioStream
@export var death_player : AudioStream
var dealerDying = false
func UseMedicine():
cam.moving = false
var dying = GetFlip()
if (dying):Perms(8.78)
else: Perms(6.78)
await get_tree().create_timer(3.05, false).timeout
death.DisableSpeakers()
await get_tree().create_timer(1.25 + .1, false).timeout
if (dying):
counter.skipping_careful = true
rm.health_player -= 1
speaker_medicine.stream = death_player
speaker_medicine.play()
await(death.MedicineDeath())
counter.overriding_medicine = true
counter.overriding_medicine_adding = false
counter.UpdateDisplayRoutineCigarette_Player()
else:
death.FadeInSpeakers()
counter.overriding_medicine = true
counter.overriding_medicine_adding = true
counter.UpdateDisplayRoutineCigarette_Player()
func UseMedicine_Dealer():
var dying = dealerDying
if (dying):
await get_tree().create_timer(5, false).timeout
speaker_medicine.stream = death_dealer
speaker_medicine.play()
anim_dealerhands.play("dealer death medicine")
await get_tree().create_timer(.41, false).timeout
death.cameraShaker.Shake()
await get_tree().create_timer(.6, false).timeout
#rm.health_opponent -= 1
counter.overriding_medicine = true
counter.overriding_medicine_adding = false
counter.UpdateDisplayRoutineCigarette_Enemy()
await get_tree().create_timer(.5, false).timeout
anim_dealerhands.play("RESET")
await get_tree().create_timer(2, false).timeout
dealerDying = false
dealerai.DealerChoice()
else:
await get_tree().create_timer(4.07, false).timeout
counter.overriding_medicine = true
counter.overriding_medicine_adding = true
counter.UpdateDisplayRoutineCigarette_Enemy()
await get_tree().create_timer(2, false).timeout
dealerDying = false
dealerai.DealerChoice()
func Perms(d : float):
await get_tree().create_timer(d, false).timeout
interaction.EnablePermissions()
func GetFlip():
var value = randf_range(0.0, 1.0)
if (value < .4): return false
else: return true

View File

@ -7,46 +7,69 @@ class_name MenuManager extends Node
@export var speaker_start : AudioStreamPlayer2D
@export var buttons : Array[ButtonClass]
@export var buttons_options : Array[ButtonClass]
@export var screen_main : Array[Control]
@export var screen_creds : Array[Control]
@export var screen_options : Array[Control]
@export var screens : Array[Control]
@export var parent_main : Control
@export var parent_creds : Control
@export var parent_suboptions : Control
@export var parent_audiovideo : Control
@export var parent_language : Control
@export var parent_controller : Control
@export var parent_rebinding : Control
@export var title : Node3D
@export var waterfalls : Array[AnimationPlayer]
@export var optionmanager : OptionsManager
@export var controller : ControllerManager
@export var mouseblocker : Control
@export var anim_creds : AnimationPlayer
func _ready():
Show("main")
buttons[0].connect("is_pressed", Start)
buttons[1].connect("is_pressed", Credits)
buttons[2].connect("is_pressed", Exit)
buttons[3].connect("is_pressed", Return)
buttons[4].connect("is_pressed", Options)
buttons[5].connect("is_pressed", Return)
buttons[1].connect("is_pressed", SubOptions)
buttons[2].connect("is_pressed", Credits)
buttons[3].connect("is_pressed", Exit)
buttons[4].connect("is_pressed", ReturnToLastScreen)
buttons[5].connect("is_pressed", ReturnToLastScreen)
buttons[6].connect("is_pressed", ReturnToLastScreen)
buttons[7].connect("is_pressed", Options_AudioVideo)
buttons[8].connect("is_pressed", Options_Language)
buttons[9].connect("is_pressed", Options_Controller)
buttons[10].connect("is_pressed", ReturnToLastScreen)
buttons[11].connect("is_pressed", ReturnToLastScreen)
buttons[16].connect("is_pressed", RebindControls)
buttons[17].connect("is_pressed", ReturnToLastScreen)
buttons[18].connect("is_pressed", ResetControls)
buttons[19].connect("is_pressed", DiscordLink)
buttons_options[0].connect("is_pressed", IncreaseVol)
buttons_options[1].connect("is_pressed", DecreaseVol)
buttons_options[2].connect("is_pressed", SetFull)
buttons_options[3].connect("is_pressed", SetWindowed)
buttons_options[4].connect("is_pressed", ControllerEnable)
buttons_options[5].connect("is_pressed", ControllerDisable)
Intro()
var failsafed = true
func _input(event):
if (event.is_action_pressed("ui_cancel") && failsafed):
if (currentScreen != "main"): ReturnToLastScreen()
if (event.is_action_pressed("exit game") && failsafed):
if (currentScreen != "main"): ReturnToLastScreen()
func Intro():
cursor.SetCursor(false, false)
await get_tree().create_timer(.5, false).timeout
speaker_music.play()
animator_intro.play("splash screen")
await get_tree().create_timer(9, false).timeout
mouseblocker.visible = false
cursor.SetCursor(true, false)
for i in buttons_options:
i.isActive = false
i.SetFilter("ignore")
buttons[0].isActive = true
buttons[0].SetFilter("stop")
buttons[1].isActive = true
buttons[1].SetFilter("stop")
buttons[2].isActive = true
buttons[2].SetFilter("stop")
buttons[4].isActive = true
buttons[4].SetFilter("stop")
pass
controller.settingFilter = true
controller.SetMainControllerState(controller.controller_currently_enabled)
if (cursor.controller_active): firstFocus_main.grab_focus()
controller.previousFocus = firstFocus_main
assigningFocus = true
func Buttons(state : bool):
if (!state):
@ -58,29 +81,70 @@ func Buttons(state : bool):
i.isActive = true
i.SetFilter("stop")
@export var firstFocus_main : Control
@export var firstFocus_subOptions : Control
@export var firstFocus_credits : Control
@export var firstFocus_audioVideo : Control
@export var firstFocus_language : Control
@export var firstFocus_controller : Control
@export var firstFocus_rebinding : Control
var assigningFocus = false
var lastScreen = "main"
var currentScreen = "main"
func Show(what : String):
lastScreen = currentScreen
currentScreen = what
var focus
title.visible = false
for i in screen_main: i.visible = false
for i in screen_creds: i.visible = false
for i in screen_options: i.visible = false
if (what == "credits"): for i in screen_creds: i.visible = true
else: if (what == "main"):
for i in screen_main: i.visible = true
title.visible = true
else: if (what == "options"):
for i in screen_options: i.visible = true
else:
pass
for screen in screens: screen.visible = false
if (what == "main" or what == "sub options"): title.visible = true
match(what):
"main":
parent_main.visible = true
focus = firstFocus_main
"sub options":
parent_suboptions.visible = true
focus = firstFocus_subOptions
"credits":
parent_creds.visible = true
focus = firstFocus_credits
anim_creds.play("RESET")
anim_creds.play("show credits")
"audio video":
parent_audiovideo.visible = true
focus = firstFocus_audioVideo
"language":
parent_language.visible = true
focus = firstFocus_language
"controller":
parent_controller.visible = true
focus = firstFocus_controller
"rebind controls":
parent_rebinding.visible = true
focus = firstFocus_rebinding
if (assigningFocus):
if (cursor.controller_active): focus.grab_focus()
controller.previousFocus = focus
func ReturnToLastScreen():
if (currentScreen) == "sub options": lastScreen = "main"
if (currentScreen) == "rebind controls": lastScreen = "sub options"
if (currentScreen == "audio video" or currentScreen == "language" or currentScreen == "controller" or currentScreen == "rebind controls"): optionmanager.SaveSettings()
Show(lastScreen)
ResetButtons()
func ResetButtons():
for b in buttons:
b.ui.modulate.a = 1
#for b in buttons:
# b.ui.modulate.a = 1
cursor.SetCursorImage("point")
func Start():
Buttons(false)
ResetButtons()
Show("e")
for screen in screens: screen.visible = false
title.visible = false
controller.previousFocus = null
speaker_music.stop()
animator_intro.play("snap")
for w in waterfalls: w.pause()
@ -91,11 +155,7 @@ func Start():
get_tree().change_scene_to_file("res://scenes/main.tscn")
func Credits():
ResetButtons()
Show("credits")
Buttons(false)
buttons[3].isActive = true
buttons[3].SetFilter("stop")
ResetButtons()
func Exit():
@ -107,32 +167,28 @@ func Exit():
await get_tree().create_timer(.5, false).timeout
get_tree().quit()
func Return():
Show("main")
Buttons(false)
buttons[0].isActive = true
buttons[0].SetFilter("stop")
buttons[1].isActive = true
buttons[1].SetFilter("stop")
buttons[2].isActive = true
buttons[2].SetFilter("stop")
buttons[4].isActive = true
buttons[4].SetFilter("stop")
for i in buttons_options: i.isActive = false
for i in buttons_options: i.SetFilter("ignore")
optionmanager.SaveSettings()
func ResetControls():
optionmanager.ResetControls()
ResetButtons()
func Options():
Show("options")
Buttons(false)
buttons[5].isActive = true
buttons[5].SetFilter("stop")
for i in buttons_options:
i.isActive = true
i.SetFilter("stop")
func DiscordLink():
OS.shell_open("https://discord.gg/cr-channel-1158444754325999747")
func RebindControls():
Show("rebind controls")
ResetButtons()
func SubOptions():
Show("sub options")
ResetButtons()
func Options_AudioVideo():
Show("audio video")
ResetButtons()
func Options_Language():
Show("language")
ResetButtons()
func Options_Controller():
Show("controller")
ResetButtons()
pass
func IncreaseVol():
optionmanager.Adjust("increase")
func DecreaseVol():
@ -141,3 +197,7 @@ func SetWindowed():
optionmanager.Adjust("windowed")
func SetFull():
optionmanager.Adjust("fullscreen")
func ControllerEnable():
optionmanager.Adjust("controller enable")
func ControllerDisable():
optionmanager.Adjust("controller disable")

View File

@ -1,11 +1,15 @@
class_name MouseRaycast extends Camera3D
@export var checkingOverride : bool
@export var cursor : CursorManager
var mouse = Vector2()
var result = null
var controller_overriding = false
func _input(event):
if event is InputEventMouse:
mouse = event.position
if(!controller_overriding): mouse = event.position
func _process(delta):
get_selection()
@ -15,3 +19,10 @@ func get_selection():
var start = project_ray_origin(mouse)
var end = project_position(mouse, 20000)
result = worldspace.intersect_ray(PhysicsRayQueryParameters3D.create(start, end))
func GetRaycastOverride(pos_override : Vector2):
controller_overriding = true
mouse = pos_override
func StopRaycastOverride():
controller_overriding = false

View File

@ -1,18 +1,62 @@
class_name OptionsManager extends Node
@export var controller : ControllerManager
@export var defaultOption_language : String = "EN"
@export var defaultOption_windowed : bool
@export var defaultOption_controllerActive : bool
var defaultOption_inputmap_keyboard = {
"ui_accept": InputMap.action_get_events("ui_accept")[0],
"ui_cancel": InputMap.action_get_events("ui_cancel")[0],
"ui_left": InputMap.action_get_events("ui_left")[0],
"ui_right": InputMap.action_get_events("ui_right")[0],
"ui_up": InputMap.action_get_events("ui_up")[0],
"ui_down": InputMap.action_get_events("ui_down")[0],
"reset": InputMap.action_get_events("reset")[0],
"exit game": InputMap.action_get_events("exit game")[0]
}
var defaultOption_inputmap_controller = {
"ui_accept": InputMap.action_get_events("ui_accept")[1],
"ui_cancel": InputMap.action_get_events("ui_cancel")[1],
"ui_left": InputMap.action_get_events("ui_left")[1],
"ui_right": InputMap.action_get_events("ui_right")[1],
"ui_up": InputMap.action_get_events("ui_up")[1],
"ui_down": InputMap.action_get_events("ui_down")[1],
"reset": InputMap.action_get_events("reset")[1],
"exit game": InputMap.action_get_events("exit game")[1]
}
@export var ui_windowed : CanvasItem
@export var ui_fullscreen : CanvasItem
@export var ui_deviceController : CanvasItem
@export var ui_deviceMouse : CanvasItem
@export var button_windowed : ButtonClass
@export var button_fullscreen : ButtonClass
@export var menu : MenuManager
@export var ui_volume : Label
const savePath := "user://buckshotroulette_options.save"
const savePath := "user://buckshotroulette_options_12.shell"
var data = {}
var data_inputmap = {}
var setting_inputmap_keyboard = {}
var setting_inputmap_controller = {}
var setting_volume = 1
var setting_windowed = false
var setting_language = "EN"
var setting_controllerEnabled = false
func _ready():
LoadSettings()
if (!receivedFile):
setting_windowed = defaultOption_windowed
setting_controllerEnabled = defaultOption_controllerActive
setting_language = defaultOption_language
setting_inputmap_keyboard = defaultOption_inputmap_keyboard
setting_inputmap_controller = defaultOption_inputmap_controller
ApplySettings_window()
ApplySettings_controller()
ApplySettings_language()
ApplySettings_inputmap()
func Adjust(alias : String):
match(alias):
@ -30,14 +74,28 @@ func Adjust(alias : String):
setting_volume = 0
UpdateDisplay()
ApplySettings_volume()
"controller enable":
setting_controllerEnabled = true
ApplySettings_controller()
"controller disable":
setting_controllerEnabled = false
ApplySettings_controller()
"windowed":
setting_windowed = true
ApplySettings_window()
"fullscreen":
setting_windowed = false
ApplySettings_window()
if (alias != "increase" && alias != "decrease"): menu.ResetButtons()
func AdjustLanguage(alias : String):
setting_language = alias
ApplySettings_language()
menu.ResetButtons()
return
func ApplySettings_volume():
AudioServer.set_bus_volume_db(0, linear_to_db(setting_volume))
UpdateDisplay()
@ -46,38 +104,109 @@ func ApplySettings_volume():
func UpdateDisplay():
ui_volume.text = str(snapped(setting_volume * 100, .01)) + "%"
func ApplySettings_window():
if (!setting_windowed):
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN)
ui_fullscreen.modulate.a = 1
ui_windowed.modulate.a = .5
button_fullscreen.mainActive = false
button_fullscreen.mainActive = true
button_windowed.mainActive = true
else:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
ui_fullscreen.modulate.a = .5
ui_windowed.modulate.a = 1
button_fullscreen.mainActive = true
button_windowed.mainActive = false
button_windowed.mainActive = true
pass
func ApplySettings_controller():
if (setting_controllerEnabled):
controller.SetMainControllerState(true)
ui_deviceController.modulate.a = 1
ui_deviceMouse.modulate.a = .5
GlobalVariables.controllerEnabled = true
else:
controller.SetMainControllerState(false)
ui_deviceController.modulate.a = .5
ui_deviceMouse.modulate.a = 1
GlobalVariables.controllerEnabled = false
func ParseInputMapDictionary():
setting_inputmap_keyboard = {
"ui_accept": var_to_str(InputMap.action_get_events("ui_accept")[0]),
"ui_cancel": var_to_str(InputMap.action_get_events("ui_cancel")[0]),
"ui_left": var_to_str(InputMap.action_get_events("ui_left")[0]),
"ui_right": var_to_str(InputMap.action_get_events("ui_right")[0]),
"ui_up": var_to_str(InputMap.action_get_events("ui_up")[0]),
"ui_down": var_to_str(InputMap.action_get_events("ui_down")[0]),
"reset": var_to_str(InputMap.action_get_events("reset")[0]),
"exit game": var_to_str(InputMap.action_get_events("exit game")[0])
}
setting_inputmap_controller = {
"ui_accept": var_to_str(InputMap.action_get_events("ui_accept")[1]),
"ui_cancel": var_to_str(InputMap.action_get_events("ui_cancel")[1]),
"ui_left": var_to_str(InputMap.action_get_events("ui_left")[1]),
"ui_right": var_to_str(InputMap.action_get_events("ui_right")[1]),
"ui_up": var_to_str(InputMap.action_get_events("ui_up")[1]),
"ui_down": var_to_str(InputMap.action_get_events("ui_down")[1]),
"reset": var_to_str(InputMap.action_get_events("reset")[1]),
"exit game": var_to_str(InputMap.action_get_events("exit game")[1])
}
func ResetControls():
setting_inputmap_keyboard = defaultOption_inputmap_keyboard
setting_inputmap_controller = defaultOption_inputmap_controller
ApplySettings_inputmap()
keyrebinding.UpdateBindList()
@export var keyrebinding : Rebinding
var setting = false
func ApplySettings_inputmap():
for key in setting_inputmap_keyboard:
var value = setting_inputmap_keyboard[key]
if (setting): value = str_to_var(value)
InputMap.action_erase_events(key)
InputMap.action_add_event(key, value)
for key in setting_inputmap_controller:
var value = setting_inputmap_controller[key]
if (setting): value = str_to_var(value)
InputMap.action_add_event(key, value)
keyrebinding.UpdateBindList()
setting = false
func ApplySettings_language():
TranslationServer.set_locale(setting_language)
func SaveSettings():
data = {
#"has_read_introduction": roundManager.playerData.hasReadIntroduction,
"setting_volume": setting_volume,
"setting_windowed": setting_windowed
"setting_windowed": setting_windowed,
"setting_language" : setting_language,
"setting_controllerEnabled" : setting_controllerEnabled,
"setting_inputmap_keyboard": setting_inputmap_keyboard,
"setting_inputmap_controller": setting_inputmap_controller
}
var file = FileAccess.open(savePath, FileAccess.WRITE)
file.store_var(data)
file.close()
var receivedFile = false
func LoadSettings():
if (FileAccess.file_exists(savePath)):
var file = FileAccess.open(savePath, FileAccess.READ)
data = file.get_var()
setting_volume = data.setting_volume
setting_windowed = data.setting_windowed
setting_language = data.setting_language
setting_controllerEnabled = data.setting_controllerEnabled
setting_inputmap_keyboard = data.setting_inputmap_keyboard
setting_inputmap_controller = data.setting_inputmap_controller
file.close()
setting = true
ApplySettings_volume()
ApplySettings_window()
ApplySettings_language()
ApplySettings_controller()
ApplySettings_inputmap()
receivedFile = true

42
PartitionBranch.gd Normal file
View File

@ -0,0 +1,42 @@
class_name PartitionBranch extends Node
var p : Label3D
var d = .1
var sp : AudioStreamPlayer2D
var nums = [9, 9, 9, 9, 9, 9, 9, 9]
var finished = false
func _ready():
p = get_parent()
p.text = " ' ' ' ' ' ' ' "
sp = get_parent().get_child(1)
func Loop(s : bool):
if (s): looping = true; LoopPartitions()
else:
looping = false
#sp.pitch_scale = .05
#sp.play()
var looping = false
func LoopPartitions():
while (looping):
for i in range(nums.size()):
if (nums[i] == 0): continue
nums[i] = randi_range(0, 9)
p.text = str(nums[0]) + " ' " + str(nums[1]) + " ' " + str(nums[2]) + " ' " + str(nums[3]) + " ' " + str(nums[4]) + " ' " + str(nums[5]) + " ' " + str(nums[6]) + " ' " + str(nums[7])
sp.pitch_scale = randf_range(.9, 1.1)
sp.play()
await get_tree().create_timer(d, false).timeout
for num in nums:
if num != 0: finished = false; break
finished = true
if finished: Loop(false)
func ResetPartition():
looping = false
p.text = " ' ' ' ' ' ' ' "
nums = [9, 9, 9, 9, 9, 9, 9, 9]
finished = false

View File

@ -22,6 +22,17 @@ func SetIndicators(state : bool):
indicatorArray[i].interactionAllowed = false
indicatorArray[i].moving = false
func DisableShotgun():
for i in range (interactionBranchArray.size()):
if (interactionBranchArray[i].interactionAlias == "shotgun"):
interactionBranchArray[i].interactionAllowed = false
break
for i in range (indicatorArray.size()):
if (indicatorArray[i].itemName == "SHOTGUN"):
indicatorArray[i].interactionAllowed = false
break
func SetInteractionPermissions(state : bool):
if (state):
for i in range(interactionBranchArray.size()):
@ -50,7 +61,10 @@ func SetItemInteraction(state : bool):
var tempBranch : InteractionBranch = children[i].get_child(1)
tempBranch.interactionAllowed = state
@export var inter : ItemInteraction
func SetStackInvalidIndicators():
if (inter.stealing): stackDisabledItemArray_bools[5] = true
else: stackDisabledItemArray_bools[5] = false
if (roundManager.dealerCuffed): stackDisabledItemArray_bools[4] = true
else: stackDisabledItemArray_bools[4] = false
if (roundManager.barrelSawedOff): stackDisabledItemArray_bools[0] = true

View File

@ -9,6 +9,7 @@ class_name RoundManager extends Node
@export var death : DeathManager
@export var playerData : PlayerData
@export var cursor : CursorManager
@export var controller : ControllerManager
@export var perm : PermissionManager
@export var health_player : int
@export var health_opponent : int
@ -56,6 +57,7 @@ var waitingForDealerReturn = false
var barrelSawedOff = false
var defibCutterReady = false
var trueDeathActive = false
var playerCurrentTurnItemArray = []
func _ready():
HideDealer()
@ -64,6 +66,12 @@ func _ready():
func _process(delta):
LerpScore()
InitialTimer()
var counting = false
var initial_time = 0
func InitialTimer():
if (counting): initial_time += get_process_delta_time()
func BeginMainGame():
MainBatchSetup(true)
@ -87,7 +95,7 @@ func MainBatchSetup(dealerEnterAtStart : bool):
await get_tree().create_timer(2, false).timeout
var greeting = true
if (!playerData.hasSignedWaiver):
shellLoader.dialogue.ShowText_Forever("PLEASE SIGN THE WAIVER.")
shellLoader.dialogue.ShowText_Forever(tr("WAIVER"))
await get_tree().create_timer(2.3, false).timeout
shellLoader.dialogue.HideText()
camera.BeginLerp("home")
@ -95,12 +103,12 @@ func MainBatchSetup(dealerEnterAtStart : bool):
return
if (!dealerHasGreeted && greeting):
var tempstring
if (!playerData.enteringFromTrueDeath): tempstring = "WELCOME BACK."
if (!playerData.enteringFromTrueDeath): tempstring = tr("WELCOME")
else:
shellSpawner.dialogue.dealerLowPitched = true
tempstring = "..."
if (!playerData.playerEnteringFromDeath):
shellLoader.dialogue.ShowText_Forever("WELCOME TO\nBUCKSHOT ROULETTE.")
shellLoader.dialogue.ShowText_Forever("...")
await get_tree().create_timer(2.3, false).timeout
shellLoader.dialogue.HideText()
dealerHasGreeted = true
@ -121,8 +129,14 @@ func MainBatchSetup(dealerEnterAtStart : bool):
healthCounter.SetupHealth()
lerping = true
#await get_tree().create_timer(1.5, false).timeout
if (!endless): ParseMainGameAmounts()
StartRound(false)
@export var amounts : Amounts
func ParseMainGameAmounts():
for res in amounts.array_amounts:
res.amount_active = res.amount_main
func GenerateRandomBatches():
for b in batchArray:
for i in range(b.roundArray.size()):
@ -134,7 +148,7 @@ func GenerateRandomBatches():
b.roundArray[i].amountBlank = amount_blank
b.roundArray[i].amountLive = amount_live
b.roundArray[i].numberOfItemsToGrab = randi_range(1, 4)
b.roundArray[i].numberOfItemsToGrab = randi_range(2, 5)
b.roundArray[i].usingItems = true
var flip = randi_range(0, 1)
if flip == 1: b.roundArray[i].shufflingArray = true
@ -187,16 +201,20 @@ func StartRound(gettingNext : bool):
#var origdelay = shellLoader.dialogue.incrementDelay
#shellLoader.dialogue.incrementDelay = .1
if (!playerData.cutterDialogueRead):
shellLoader.dialogue.ShowText_Forever("LONG LAST, WE ARRIVE\nAT THE FINAL SHOWDOWN.")
shellLoader.dialogue.scaling = true
shellLoader.dialogue.ShowText_Forever(tr("FINAL SHOW1"))
await get_tree().create_timer(4, false).timeout
shellLoader.dialogue.ShowText_Forever("NO MORE DEFIBRILLATORS.\nNO MORE BLOOD TRANSFUSIONS.")
shellLoader.dialogue.scaling = true
shellLoader.dialogue.ShowText_Forever(tr("FINAL SHOW2"))
await get_tree().create_timer(4, false).timeout
shellLoader.dialogue.ShowText_Forever("NOW, ME AND YOU, WE ARE DANCING\nON THE EDGE OF LIFE AND DEATH.")
shellLoader.dialogue.scaling = true
shellLoader.dialogue.ShowText_Forever(tr("FINAL SHOW3"))
await get_tree().create_timer(4.8, false).timeout
shellLoader.dialogue.scaling = false
shellLoader.dialogue.HideText()
playerData.cutterDialogueRead = true
else:
shellLoader.dialogue.ShowText_Forever("I BETTER NOT\nSEE YOU AGAIN.")
shellLoader.dialogue.ShowText_Forever(tr("BETTER NOT"))
await get_tree().create_timer(3, false).timeout
shellLoader.dialogue.HideText()
await(deficutter.InitialSetup())
@ -303,10 +321,32 @@ func BeginPlayerTurn():
if (requestedWireCut):
await(defibCutter.CutWire(wireToCut))
await get_tree().create_timer(.6, false).timeout
playerCurrentTurnItemArray = []
perm.SetStackInvalidIndicators()
cursor.SetCursor(true, true)
perm.SetIndicators(true)
perm.SetInteractionPermissions(true)
SetupDeskUI()
@export var deskUI_parent : Control
@export var deskUI_shotgun : Control
@export var deskUI_briefcase : Control
@export var deskUI_grids : Array[Control]
func SetupDeskUI():
deskUI_parent.visible = true
deskUI_shotgun.visible = true
if (roundArray[currentRound].usingItems):
for b in deskUI_grids: b.visible = true
if (cursor.controller_active): deskUI_shotgun.grab_focus()
controller.previousFocus = deskUI_shotgun
func ClearDeskUI(includingParent : bool):
if (includingParent): deskUI_parent.visible = false
deskUI_shotgun.visible = false
for b in deskUI_grids: b.visible = false
controller.previousFocus = null
pass
func OutOfHealth(who : String):
if (who == "player"):
@ -320,6 +360,11 @@ var prevscore = 0
var mainscore = 0
var elapsed = 0
var dur = 3
var double_or_nothing_rounds_beat = 0
var double_or_nothing_score = 0
var double_or_nothing_initial_score = 0
var doubled = false
var lerpingscore = false
var startscore
var endscore
@ -329,14 +374,26 @@ var endscore
@export var speaker_show : AudioStreamPlayer2D
@export var speaker_hide : AudioStreamPlayer2D
@export var btnParent_doubleor : Control
@export var btn_yes : Control
func BeginScoreLerp():
startscore = prevscore
if (!doubling):
endscore = randi_range(50000, 70000)
double_or_nothing_rounds_beat += 1
var ten_minutes_seconds = 600
var ten_minutes_score_loss = 40000
var score_deduction = initial_time / ten_minutes_seconds * ten_minutes_score_loss
endscore = 70000 - int(score_deduction)
if (endscore < 10): endscore = 10
prevscore = endscore
double_or_nothing_score = prevscore
double_or_nothing_initial_score = prevscore
else:
doubled = true
endscore = prevscore * 2
prevscore = endscore
double_or_nothing_rounds_beat += 1
double_or_nothing_score = prevscore
doubling = true
speaker_slot.play()
camera.BeginLerp("yes no")
@ -357,9 +414,17 @@ func BeginScoreLerp():
cursor.SetCursor(true, true)
intbranch_no.interactionAllowed = true
intbranch_yes.interactionAllowed = true
btnParent_doubleor.visible = true
if (cursor.controller_active): btn_yes.grab_focus()
controller.previousFocus = btn_yes
pass
func RevertDoubleUI():
btnParent_doubleor.visible = false
@export var ach : Achievement
func Response(rep : bool):
RevertDoubleUI()
intbranch_no.interactionAllowed = false
intbranch_yes.interactionAllowed = false
cursor.SetCursor(false, false)
@ -389,7 +454,6 @@ func LerpScore():
if (lerpingscore):
elapsed += get_process_delta_time()
var c = clampf(elapsed / dur, 0.0, 1.0)
print("c: ", c)
var score = lerp(startscore, endscore, c)
ui_score.text = str(int(score))
@ -422,6 +486,7 @@ func EndMainBatch():
if (endless): musicManager.EndTrack()
await get_tree().create_timer(.4, false).timeout
if (endless):
counting = false
BeginScoreLerp()
return
#gameover.PlayerWon()

View File

@ -1,6 +1,8 @@
class_name SaveFileManager extends Node
const savePath := "user://buckshotroulette.save"
const savePath := "user://buckshotroulette_main_12.shell"
const savePath_pills := "user://buckshotroulette_pills.shell"
const savePath_stats := "user://buckshotroulette_playerstats.shell"
var data = {}
@export var roundManager : RoundManager
@export var isMainMenu : bool
@ -36,20 +38,6 @@ func SaveGame():
}
var file = FileAccess.open(savePath, FileAccess.WRITE)
file.store_var(data)
#file.store_var(roundManager.playerData.hasReadIntroduction)
#file.store_var(roundManager.playerData.hasReadItemSwapIntroduction)
#file.store_var(roundManager.playerData.hasReadItemDistributionIntro)
#file.store_var(roundManager.playerData.currentBatchIndex)
#file.store_var(roundManager.playerData.playerEnteringFromDeath)
#file.store_var(roundManager.playerData.testValue)
#file.store_var(roundManager.playerData.hasReadItemDistributionIntro2)
#file.store_var(roundManager.playerData.numberOfDialogueRead)
#file.store_var(roundManager.playerData.skippingShellDescription)
#file.store_var(roundManager.playerData.indicatorShown)
#file.store_var(roundManager.playerData.cutterDialogueRead)
#file.store_var(roundManager.playerData.enteringFromTrueDeath)
#file.store_var(roundManager.playerData.hasSignedWaiver)
#file.store_string(roundManager.playerData.playername)
file.close()
func LoadGame():
@ -78,20 +66,6 @@ func LoadGame():
roundManager.playerData.stat_doorsKicked = data.stat_doorsKicked
roundManager.playerData.stat_cigSmoked = data.stat_cigSmoked
roundManager.playerData.stat_beerDrank = data.stat_beerDrank
#roundManager.playerData.hasReadIntroduction = file.get_var(roundManager.playerData.hasReadIntroduction)
#roundManager.playerData.hasReadItemSwapIntroduction = file.get_var(roundManager.playerData.hasReadItemSwapIntroduction)
#roundManager.playerData.hasReadItemDistributionIntro = file.get_var(roundManager.playerData.hasReadItemDistributionIntro)
#roundManager.playerData.currentBatchIndex = file.get_var(roundManager.playerData.currentBatchIndex)
#roundManager.playerData.playerEnteringFromDeath = file.get_var(roundManager.playerData.playerEnteringFromDeath)
#roundManager.playerData.testValue = file.get_var(roundManager.playerData.testValue)
#roundManager.playerData.hasReadItemDistributionIntro2 = file.get_var(roundManager.playerData.testValue)
#roundManager.playerData.numberOfDialogueRead = file.get_var(roundManager.playerData.numberOfDialogueRead)
#roundManager.playerData.skippingShellDescription = file.get_var(roundManager.playerData.skippingShellDescription)
#roundManager.playerData.indicatorShown = file.get_var(roundManager.playerData.indicatorShown)
#roundManager.playerData.cutterDialogueRead = file.get_var(roundManager.playerData.cutterDialogueRead)
#roundManager.playerData.enteringFromTrueDeath = file.get_var(roundManager.playerData.enteringFromTrueDeath)
#roundManager.playerData.hasSignedWaiver = file.get_var(roundManager.playerData.hasSignedWaiver)
#roundManager.playerData.playername = file.get_as_text(roundManager.playerData.playername)
file.close()
func ClearSave():

View File

@ -9,6 +9,7 @@ class_name ShellEjectManager extends Node
@export var animator_fader : AnimationPlayer
@export var isDealerSide : bool
@export var smoke : SmokeController
@export var ai : DealerIntelligence
var hasFaded = false
@ -26,6 +27,7 @@ func EjectShell():
if (shellSpawner.sequenceArray[0] == "live"):
smoke.SpawnSmoke("chamber")
shellSpawner.sequenceArray.remove_at(0)
ai.sequenceArray_knownShell.remove_at(0)
hasFaded = false
pass
@ -37,6 +39,7 @@ func BeerEjection_player():
mesh.visible = true
animator.play("ejecting shell_player1")
shellSpawner.sequenceArray.remove_at(0)
ai.sequenceArray_knownShell.remove_at(0)
hasFaded = false
pass
@ -48,6 +51,7 @@ func BeerEjection_dealer():
mesh.visible = true
animator.play("eject shell beer")
shellSpawner.sequenceArray.remove_at(0)
ai.sequenceArray_knownShell.remove_at(0)
hasFaded = false
pass
@ -61,6 +65,7 @@ func DeathEjection():
if (shellSpawner.sequenceArray[0] == "live"):
smoke.SpawnSmoke("chamber")
shellSpawner.sequenceArray.remove_at(0)
ai.sequenceArray_knownShell.remove_at(0)
hasFaded = false
pass

View File

@ -41,7 +41,10 @@ func LoadShells():
if (roundManager.playerData.numberOfDialogueRead < 3):
if (diaindex == loadingDialogues.size()):
diaindex = 0
dialogue.ShowText_ForDuration(loadingDialogues[diaindex], 3)
var stringshow
if (diaindex == 0): stringshow = tr("SHELL INSERT1")
if (diaindex == 1): stringshow = tr("SHELL INSERT2")
dialogue.ShowText_ForDuration(stringshow, 3)
diaindex += 1
await get_tree().create_timer(3, false).timeout
roundManager.playerData.numberOfDialogueRead += 1
@ -86,9 +89,11 @@ func LoadShells():
DealerHandsDropShotgun()
camera.BeginLerp("home")
#ALLOW INTERACTION
roundManager.playerCurrentTurnItemArray = []
await get_tree().create_timer(.6, false).timeout
perm.SetStackInvalidIndicators()
cursor.SetCursor(true, true)
perm.SetIndicators(true)
perm.SetInteractionPermissions(true)
roundManager.SetupDeskUI()
pass

View File

@ -12,6 +12,7 @@ class_name ShellSpawner extends Node
@export var speaker_latchOpen : AudioStreamPlayer2D
@export var speaker_audioIndicator : AudioStreamPlayer2D
@export var soundArray_indicators : Array[AudioStream]
@export var ai : DealerIntelligence
var spawnedShell
var locationIndex
@ -59,17 +60,19 @@ func MainShellRoutine():
#DIALOGUE
var text_lives
var text_blanks
if (temp_live == 1): text_lives = "LIVE ROUND."
else: text_lives = "LIVE ROUNDS."
if (temp_blank == 1): text_blanks = "BLANK."
else: text_blanks = "BLANKS."
if (temp_live == 1): text_lives = tr("LIVEROUND")
else: text_lives = tr("LIVEROUNDS")
if (temp_blank == 1): text_blanks = tr("BLANKROUND")
else: text_blanks = tr("BLANKROUNDS")
var finalstring : String = str(temp_live) + " " + text_lives + " " + str(temp_blank) + " " + text_blanks
var maindur = 1.3
if (roundManager.playerData.currentBatchIndex == 2):
roundManager.playerData.skippingShellDescription = true
if (!roundManager.playerData.skippingShellDescription): dialogue.ShowText_Forever(finalstring)
if (!roundManager.playerData.skippingShellDescription):
if (CheckBackdropScaling()): dialogue.scaling = true
dialogue.ShowText_Forever(finalstring)
if (roundManager.playerData.skippingShellDescription && !skipDialoguePresented):
dialogue.ShowText_Forever("YOU KNOW THE DRILL.")
dialogue.ShowText_Forever(tr("DRILL"))
maindur = 2.5
skipDialoguePresented = true
if(!roundManager.playerData.skippingShellDescription): await get_tree().create_timer(2.5, false).timeout
@ -88,6 +91,14 @@ func MainShellRoutine():
return
pass
func CheckBackdropScaling():
var curloc = TranslationServer.get_locale()
var localesToScale = ["FR", "IT", "DE", "ES", "ES LATAM", "BR", "PT"]
for l in localesToScale:
if (curloc == l):
return true
return false
func SpawnShells(numberOfShells : int, numberOfLives : int, numberOfBlanks : int, shufflingArray : bool):
#DELETE PREVIOUS SHELLS
for i in range(spawnedShellObjectArray.size()):
@ -97,6 +108,7 @@ func SpawnShells(numberOfShells : int, numberOfLives : int, numberOfBlanks : int
#SETUP SHELL ARRAY
sequenceArray = []
tempSequence = []
ai.sequenceArray_knownShell = []
for i in range(numberOfLives):
tempSequence.append("live")
for i in range(numberOfBlanks):
@ -105,6 +117,7 @@ func SpawnShells(numberOfShells : int, numberOfLives : int, numberOfBlanks : int
tempSequence.shuffle()
for i in range(tempSequence.size()):
sequenceArray.append(tempSequence[i])
ai.sequenceArray_knownShell.append(false)
pass
locationIndex = 0

View File

@ -26,10 +26,15 @@ class_name ShotgunShooting extends Node
@export var mat_splatter : GeometryInstance3D
@export var speaker_splatter : AudioStreamPlayer2D
@export var anim_splatter : AnimationPlayer
@export var ach : Achievement
var playerCanGoAgain
@export var btnParent_shootingChoice : Control
@export var btn_you : Control
@export var controller : ControllerManager
func GrabShotgun():
roundManager.ClearDeskUI(true)
perm.SetIndicators(false)
perm.SetInteractionPermissions(false)
perm.RevertDescriptionUI()
@ -37,6 +42,9 @@ func GrabShotgun():
animator_shotgun.play("player grab shotgun")
shotgunshaker.StartShaking()
decisionText.SetUI(true)
btnParent_shootingChoice.visible = true
if (cursorManager.controller_active): btn_you.grab_focus()
controller.previousFocus = btn_you
await get_tree().create_timer(.5, false).timeout
var disablingDelayShit = false
@ -112,6 +120,8 @@ func Shoot(who : String):
roundManager.health_opponent -= roundManager.currentShotgunDamage
if (roundManager.health_opponent < 0): roundManager.health_opponent = 0
if (currentRoundInChamber == "live" && who == "self"):
CheckAchievement_why()
CheckAchievement_style()
roundManager.waitingForHealthCheck2 = true
if (shellSpawner.sequenceArray.size() == 1):
whatTheFuck = true
@ -123,7 +133,9 @@ func Shoot(who : String):
playerCanGoAgain = false
healthCounter.checkingPlayer = true
await(death.Kill("player", false, true))
if (currentRoundInChamber == "blank" && who == "self"): playerCanGoAgain = true
if (currentRoundInChamber == "blank" && who == "self"):
playerCanGoAgain = true
CheckAchievement_coinflip()
if (currentRoundInChamber == "live" && who == "dealer"):
playerCanGoAgain = false
dealerShot = true
@ -179,6 +191,17 @@ func FinalizeShooting(playerCanGoAgain : bool, placeShotgunOnTable : bool, waitF
await get_tree().create_timer(2, false).timeout
if(roundManager.health_opponent != 0): roundManager.EndTurn(playerCanGoAgain)
func CheckAchievement_coinflip():
var setting = false
if ("magnifying glass" not in roundManager.playerCurrentTurnItemArray and "burner phone" not in roundManager.playerCurrentTurnItemArray): setting = true
if ((shellSpawner.sequenceArray.count("live") == shellSpawner.sequenceArray.count("blank")) && setting): ach.UnlockAchievement("ach8")
func CheckAchievement_why():
if ("magnifying glass" in roundManager.playerCurrentTurnItemArray): ach.UnlockAchievement("ach13")
func CheckAchievement_style():
if ("handsaw" in roundManager.playerCurrentTurnItemArray): ach.UnlockAchievement("ach15")
func PlayShootingSound():
var currentRoundInChamber = shellSpawner.sequenceArray[0]
if (currentRoundInChamber == "live"):
@ -187,7 +210,8 @@ func PlayShootingSound():
roundManager.playerData.stat_shotsFired += 1
animator_muzzleFlash.play("muzzle flash fire")
animator_muzzleFlash_model.play("fire")
else: speaker_blank.play()
else:
speaker_blank.play()
pass
var fired = false

View File

@ -19,6 +19,10 @@ class_name Signature extends Node
@export var speaker_shutdown : AudioStreamPlayer2D
@export var speaker_keypress : AudioStreamPlayer2D
@export var speaker_punch : AudioStreamPlayer2D
@export var btn_waiver : Control
@export var btnParent_signature : Control
@export var btn_signature_a : Control
@export var controller : ControllerManager
var fullstring = ""
var lettercount = 0
@ -51,11 +55,15 @@ func AwaitPickup():
await get_tree().create_timer(.6, false).timeout
cursor.SetCursor(true, true)
intrbranch_waiver.interactionAllowed = true
btn_waiver.visible = true
if (cursor.controller_active): btn_waiver.grab_focus()
controller.previousFocus = btn_waiver
func PickUpWaiver():
speaker_bootup.play()
parent_signatureMachineMainParent.visible = true
intrbranch_waiver.interactionAllowed = false
btn_waiver.visible = false
cursor.SetCursor(false, false)
anim_waiver.play("pickup waiver")
for letter in letterArray: letter.text = ""
@ -66,6 +74,9 @@ func PickUpWaiver():
await get_tree().create_timer(2.77, false).timeout #.9 anim speed
for intbr in intbranches : intbr.interactionAllowed = true
cursor.SetCursor(true, true)
btnParent_signature.visible = true
if (cursor.controller_active): btn_signature_a.grab_focus()
controller.previousFocus = btn_signature_a
func GetInput(letterAlias : String, specialAlias : String):
speaker_keypress.pitch_scale = randf_range(.95, 1)
@ -88,6 +99,7 @@ func Input_Letter(alias : String):
UpdateLEDArray()
pass
@export var ach : Achievement
func Input_Enter():
var chararray = []
fullstring = ""
@ -98,7 +110,9 @@ func Input_Enter():
lettercount = chararray.size()
if (fullstring == ""): return
if (fullstring == "dealer"): return
if (fullstring == "god"): return
if (fullstring == "god"):
ach.UnlockAchievement("ach11")
return
if (fullstring != ""):
for br in intbranches:
var el = br.get_parent().get_child(2)
@ -106,6 +120,7 @@ func Input_Enter():
el.set_collision_layer_value(1, false)
el.set_collision_mask_value(1, false)
cursor.SetCursor(false, false)
btnParent_signature.visible = false
await get_tree().create_timer(.25, false).timeout
for i in range(lettercount):
letterArray_signature_joined[i].text = chararray[i].to_upper()
@ -114,12 +129,13 @@ func Input_Enter():
await get_tree().create_timer(.17, false).timeout
speaker_punch.pitch_scale = randf_range(.95, 1)
speaker_punch.play()
roundManager.counting = true
await get_tree().create_timer(.17, false).timeout
parent_shotgun.transform.origin = origpos_shotgun
anim_waiver.play("put away waiver")
speaker_bootup.stop()
speaker_shutdown.play()
roundManager.playerData.playername = fullstring
roundManager.playerData.playername = " " + fullstring
roundManager.playerData.hasSignedWaiver = true
ReturnToMainBatch()
await get_tree().create_timer(1.72, false).timeout

18
Steam.gd Normal file
View File

@ -0,0 +1,18 @@
extends Node
var appid : int = 2835570
func _ready():
process_priority = 1000
set_process_internal(true)
InitializeSteam()
func _process(_delta: float) -> void:
Steam.run_callbacks()
func InitializeSteam():
OS.set_environment("SteamAppId", str(appid))
OS.set_environment("SteamGameId", str(appid))
var INIT: Dictionary = Steam.steamInit(false)
print("steam init: ", str(INIT))

View File

@ -8,18 +8,9 @@ var elapsed = 0
var from
var to
func _process(delta):
LerpTimeScale()
#func _unhandled_input(event):
# if (event.is_action_pressed("debug_left")):
# moving = false
# Engine.time_scale = 1
# if (event.is_action_pressed("debug_right")):
# moving = false
# Engine.time_scale = 10
func BeginTimeScaleLerp(start : float, end : float):
moving = false
elapsed = 0

47
UserExit.gd Normal file
View File

@ -0,0 +1,47 @@
class_name ExitManager extends Node
@export var controller : ControllerManager
@export var cursor : CursorManager
@export var anim : AnimationPlayer
@export var label : Label
var exitAllowed = false
var total = 0
func _ready():
await get_tree().create_timer(.5, false).timeout
exitAllowed = true
func _process(delta):
if exitAllowed:
if (Input.is_action_just_pressed("exit game")):
ShowUI()
if Input.is_action_pressed("exit game"):
total += delta
if Input.is_action_just_released("exit game"):
total = 0
CheckExit()
func ShowUI():
var bind
var bind_keyboard
var bind_controller
var events = InputMap.action_get_events("exit game")
bind_keyboard = events[0].as_text()
bind_controller = events[1].as_text()
var firstindex = bind_controller.rfind("(")
bind_keyboard = bind_keyboard.trim_suffix("(Physical)")
bind_keyboard = bind_keyboard.replace(" ", "")
bind_controller = bind_controller.left(firstindex)
if (cursor.controller_active): bind = str(bind_controller)
else: bind = str(bind_keyboard)
label.text = tr("HOLD TO EXIT") % str(bind)
anim.play("RESET")
anim.play("fade out")
func CheckExit():
if (total > 2 && exitAllowed):
ExitGame()
exitAllowed = false
func ExitGame():
get_tree().change_scene_to_file("res://scenes/menu.tscn")

4
VisibilityPipe.gd Normal file
View File

@ -0,0 +1,4 @@
class_name VisibilityPipe extends Node
@export var checkers : Array[Control]
@export var activeTarget : Node3D