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_L : InteractionBranch
@export var intbranch_R : InteractionBranch @export var intbranch_R : InteractionBranch
@export var intbranch_lid : InteractionBranch @export var intbranch_lid : InteractionBranch
@export var controller : ControllerManager
@export var btnParent_briefcase : Control
@export var btn_left : Control
var latchRaisedL = false var latchRaisedL = false
var latchRaisedR = false var latchRaisedR = false
@ -34,6 +37,9 @@ func MainRoutine():
cursor.SetCursor(true, true) cursor.SetCursor(true, true)
intbranch_L.interactionAllowed = true intbranch_L.interactionAllowed = true
intbranch_R.interactionAllowed = true intbranch_R.interactionAllowed = true
btnParent_briefcase.visible = true
if (cursor.controller_active): btn_left.grab_focus()
controller.previousFocus = btn_left
func CheckLatches(): func CheckLatches():
if (latchRaisedL == true && latchRaisedR == true): if (latchRaisedL == true && latchRaisedR == true):
@ -56,6 +62,7 @@ func OpenLatch(alias : String):
CheckLatches() CheckLatches()
func OpenLid(): func OpenLid():
btnParent_briefcase.visible = false
cursor.SetCursor(false, false) cursor.SetCursor(false, false)
intbranch_lid.interactionAllowed = false intbranch_lid.interactionAllowed = false
anim_lid.play("open") 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 ui_control : Control
@export var speaker_press : AudioStreamPlayer2D @export var speaker_press : AudioStreamPlayer2D
@export var speaker_hover : 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 playing : bool
@export var altsound : 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 var mainActive = true
func _ready(): func _ready():
ui_control = get_parent() 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_entered", OnHover)
get_parent().connect("mouse_exited", OnExit) get_parent().connect("mouse_exited", OnExit)
get_parent().connect("pressed", OnPress) get_parent().connect("pressed", OnPress)
pass if (isDynamic): ui.modulate.a = ui_opacity_inactive
func SetFilter(alias : String): func SetFilter(alias : String):
match(alias): match(alias):
@ -31,13 +40,13 @@ func OnHover():
if (isDynamic): if (isDynamic):
speaker_hover.pitch_scale = randf_range(.95, 1.0) speaker_hover.pitch_scale = randf_range(.95, 1.0)
speaker_hover.play() speaker_hover.play()
ui.modulate.a = .78 ui.modulate.a = ui_opacity_active
cursor.SetCursorImage("hover") cursor.SetCursorImage("hover")
func OnExit(): func OnExit():
if (isActive && mainActive): if (isActive && mainActive):
if (isDynamic): if (isDynamic):
ui.modulate.a = 1 ui.modulate.a = ui_opacity_inactive
cursor.SetCursorImage("point") cursor.SetCursorImage("point")
signal is_pressed signal is_pressed
@ -45,4 +54,6 @@ func OnPress():
if (isActive && mainActive): if (isActive && mainActive):
if (altsound): speaker_press.play() if (altsound): speaker_press.play()
if (isDynamic && playing): speaker_press.play() if (isDynamic && playing): speaker_press.play()
if (rebind != null): rebindManager.GetRebind(rebind)
if (language): options.AdjustLanguage(alias)
emit_signal("is_pressed") 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_hover : CompressedTexture2D
@export var cursor_invalid : CompressedTexture2D @export var cursor_invalid : CompressedTexture2D
var cursor_visible = false var cursor_visible = false
var controller_active = false
func _ready(): func _ready():
SetCursor(false, false) SetCursor(false, false)
func SetCursor(isVisible : bool, playSound : bool): func SetCursor(isVisible : bool, playSound : bool):
if (playSound): if (playSound): speaker.play()
speaker.play()
if (isVisible): 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 cursor_visible = true
if (!isVisible): if (!isVisible):
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN) 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, #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. #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 hands : HandManager
@export var itemManager : ItemManager @export var itemManager : ItemManager
@export var shellSpawner : ShellSpawner @export var shellSpawner : ShellSpawner
@ -27,6 +28,8 @@ class_name DealerIntelligence extends Node
@export var sound_dealerarriveCuffed : AudioStream @export var sound_dealerarriveCuffed : AudioStream
@export var dealermesh_normal : VisualInstance3D @export var dealermesh_normal : VisualInstance3D
@export var dealermesh_crushed : VisualInstance3D @export var dealermesh_crushed : VisualInstance3D
@export var sequenceArray_knownShell : Array[bool]
@export var amounts : Amounts
var dealerItemStringArray : Array[String] var dealerItemStringArray : Array[String]
var dealerAboutToBreakFree = false var dealerAboutToBreakFree = false
@ -62,6 +65,7 @@ func Animator_GiveHandcuffs():
func BeginDealerTurn(): func BeginDealerTurn():
mainLoopFinished = false mainLoopFinished = false
usingHandsaw = false usingHandsaw = false
usingMedicine = false
DealerChoice() DealerChoice()
var dealerTarget = "" var dealerTarget = ""
@ -70,15 +74,35 @@ var dealerKnowsShell = false
var mainLoopFinished = false var mainLoopFinished = false
var usingHandsaw = false var usingHandsaw = false
var dealerUsedItem = false var dealerUsedItem = false
var usingMedicine = false
var adrenalineSetup = false
var stealing = false
var adrenaline_itemSlot = ""
var inv_playerside = []
var inv_dealerside = []
func DealerChoice(): func DealerChoice():
var dealerWantsToUse = "" var dealerWantsToUse = ""
var dealerFinishedUsingItems = false var dealerFinishedUsingItems = false
var hasHandsaw = false var hasHandsaw = false
var hasCigs = false
if (roundManager.requestedWireCut): if (roundManager.requestedWireCut):
await(roundManager.defibCutter.CutWire(roundManager.wireToCut)) await(roundManager.defibCutter.CutWire(roundManager.wireToCut))
if (shellSpawner.sequenceArray.size() == 0): if (shellSpawner.sequenceArray.size() == 0):
roundManager.StartRound(true) roundManager.StartRound(true)
return 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): if (roundManager.shellSpawner.sequenceArray.size() == 1):
knownShell = shellSpawner.sequenceArray[0] knownShell = shellSpawner.sequenceArray[0]
if (shellSpawner.sequenceArray[0] == "live"): knownShell = "live" if (shellSpawner.sequenceArray[0] == "live"): knownShell = "live"
@ -86,6 +110,44 @@ func DealerChoice():
if (knownShell == "live"): dealerTarget = "player" if (knownShell == "live"): dealerTarget = "player"
else: dealerTarget = "self" else: dealerTarget = "self"
dealerKnowsShell = true 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()): for i in range(itemManager.itemArray_dealer.size()):
if (itemManager.itemArray_dealer[i] == "magnifying glass" && !dealerKnowsShell && shellSpawner.sequenceArray.size() != 1): if (itemManager.itemArray_dealer[i] == "magnifying glass" && !dealerKnowsShell && shellSpawner.sequenceArray.size() != 1):
dealerWantsToUse = "magnifying glass" dealerWantsToUse = "magnifying glass"
@ -96,14 +158,21 @@ func DealerChoice():
dealerKnowsShell = true dealerKnowsShell = true
break break
if (itemManager.itemArray_dealer[i] == "cigarettes"): if (itemManager.itemArray_dealer[i] == "cigarettes"):
var breaking = false
if (roundManager.health_opponent < roundManager.roundArray[0].startingHealth): if (roundManager.health_opponent < roundManager.roundArray[0].startingHealth):
dealerWantsToUse = "cigarettes" dealerWantsToUse = "cigarettes"
breaking = true hasCigs = false
if (breaking): break 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): if (itemManager.itemArray_dealer[i] == "beer" && knownShell != "live" && shellSpawner.sequenceArray.size() != 1):
dealerWantsToUse = "beer" dealerWantsToUse = "beer"
shellEject_dealer.FadeOutShell() shellEject_dealer.FadeOutShell()
if (roundManager.endless):
dealerKnowsShell = false
knownShell = ""
break break
if (itemManager.itemArray_dealer[i] == "handcuffs" && roundManager.playerCuffed == false && shellSpawner.sequenceArray.size() != 1): if (itemManager.itemArray_dealer[i] == "handcuffs" && roundManager.playerCuffed == false && shellSpawner.sequenceArray.size() != 1):
dealerWantsToUse = "handcuffs" dealerWantsToUse = "handcuffs"
@ -115,6 +184,21 @@ func DealerChoice():
roundManager.barrelSawedOff = true roundManager.barrelSawedOff = true
roundManager.currentShotgunDamage = 2 roundManager.currentShotgunDamage = 2
break 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 if (dealerWantsToUse == ""): mainLoopFinished = true
for i in range(itemManager.itemArray_dealer.size()): for i in range(itemManager.itemArray_dealer.size()):
@ -140,11 +224,45 @@ func DealerChoice():
if (roundManager.waitingForDealerReturn): if (roundManager.waitingForDealerReturn):
await get_tree().create_timer(1.8, false).timeout await get_tree().create_timer(1.8, false).timeout
roundManager.waitingForDealerReturn = false 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)) 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 == "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) 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.itemArray_dealer.erase(dealerWantsToUse)
itemManager.numberOfItemsGrabbed_enemy -= 1 if (subtracting): itemManager.numberOfItemsGrabbed_enemy -= 1
if (returning): return
DealerChoice() DealerChoice()
return return
if (dealerWantsToUse == ""): dealerFinishedUsingItems = true if (dealerWantsToUse == ""): dealerFinishedUsingItems = true
@ -161,6 +279,29 @@ func DealerChoice():
dealerKnowsShell = false dealerKnowsShell = false
pass 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): func EndDealerTurn(canDealerGoAgain : bool):
dealerCanGoAgain = canDealerGoAgain dealerCanGoAgain = canDealerGoAgain
#USINGITEMS: ASSIGN DEALER CAN GO AGAIN FROM ITEMS HERE #USINGITEMS: ASSIGN DEALER CAN GO AGAIN FROM ITEMS HERE
@ -278,6 +419,13 @@ func SwapDealerMesh():
pass pass
func CoinFlip(): 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 return result
pass

View File

@ -1,5 +1,6 @@
class_name DeathManager extends Node class_name DeathManager extends Node
@export var cam : CameraManager
@export var viewblocker : ColorRect @export var viewblocker : ColorRect
@export var speakersToDisable : Array[SpeakerController] @export var speakersToDisable : Array[SpeakerController]
@export var animator_playerDefib : AnimationPlayer @export var animator_playerDefib : AnimationPlayer
@ -21,6 +22,7 @@ class_name DeathManager extends Node
@export var filter : FilterController @export var filter : FilterController
@export var animator_pp : AnimationPlayer @export var animator_pp : AnimationPlayer
@export var speaker_heartbeat : AudioStreamPlayer2D @export var speaker_heartbeat : AudioStreamPlayer2D
@export var rm : RoundManager
func _ready(): func _ready():
defibParent.visible = false defibParent.visible = false
@ -109,9 +111,36 @@ func Kill(who : String, trueDeath : bool, returningShotgun : bool):
await get_tree().create_timer(2, false).timeout await get_tree().create_timer(2, false).timeout
if (dealerKilledSelf): dealerAI.EndDealerTurn(dealerAI.dealerCanGoAgain) 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(): func MainDeathRoutine():
var loadingHeaven = false var loadingHeaven = false
if (shotgunShooting.roundManager.endless): if (shotgunShooting.roundManager.endless):
if (rm.endscore != null):
if (rm.endscore > 1000000): ach.UnlockAchievement("ach10")
await get_tree().create_timer(.5, false).timeout await get_tree().create_timer(.5, false).timeout
get_tree().change_scene_to_file("res://scenes/death.tscn") get_tree().change_scene_to_file("res://scenes/death.tscn")
return return
@ -119,7 +148,7 @@ func MainDeathRoutine():
shotgunShooting.roundManager.playerData.enteringFromTrueDeath = true shotgunShooting.roundManager.playerData.enteringFromTrueDeath = true
loadingHeaven = true loadingHeaven = true
shotgunShooting.roundManager.playerData.playerEnteringFromDeath = true shotgunShooting.roundManager.playerData.playerEnteringFromDeath = true
savefile.SaveGame() await(savefile.SaveGame())
await get_tree().create_timer(.5, false).timeout await get_tree().create_timer(.5, false).timeout
if (!loadingHeaven): get_tree().change_scene_to_file("res://scenes/death.tscn") if (!loadingHeaven): get_tree().change_scene_to_file("res://scenes/death.tscn")
else: get_tree().change_scene_to_file("res://scenes/heaven.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 textArray : Array[TextInteraction]
@export var colliderArray : Array[StaticBody3D] @export var colliderArray : Array[StaticBody3D]
@export var animator : AnimationPlayer @export var animator : AnimationPlayer
@export var uiParent : Control
func _ready(): func _ready():
for i in range(colliderArray.size()): for i in range(colliderArray.size()):
@ -20,3 +21,4 @@ func SetUI(state : bool):
colliderArray[i].collision_layer = 0 colliderArray[i].collision_layer = 0
colliderArray[i].collision_mask = 0 colliderArray[i].collision_mask = 0
animator.play("hide text") animator.play("hide text")
uiParent.visible = false

View File

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

View File

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

View File

@ -26,10 +26,12 @@ func HideText():
dialogueUI.visible = false dialogueUI.visible = false
pass pass
var overriding = false
func TickText(): func TickText():
while(looping): while(looping):
dialogueUI.visible_characters += 1 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() speaker_click.play()
if (dialogueUI.visible_ratio >= 1): if (dialogueUI.visible_ratio >= 1):
looping = false 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 class_name EndingManager extends Node
@export var save : SaveFileManager
@export var roundManager : RoundManager @export var roundManager : RoundManager
@export var pp : WorldEnvironment @export var pp : WorldEnvironment
@export var animator_cam : AnimationPlayer @export var animator_cam : AnimationPlayer
@ -23,15 +24,26 @@ class_name EndingManager extends Node
@export var cntrl_endingmusic : SpeakerController @export var cntrl_endingmusic : SpeakerController
@export var animator_anykey : AnimationPlayer @export var animator_anykey : AnimationPlayer
@export var animator_pan : 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 var waitingForInput = false
func _input(event): #func _input(event):
if event is InputEventKey and event.pressed: # if event is InputEventKey and event.pressed:
# if (waitingForInput):
# ExitGame()
# waitingForInput = false
func _unhandled_key_input(event):
if (event.is_pressed()):
if (waitingForInput): if (waitingForInput):
ExitGame() ExitGame()
waitingForInput = false waitingForInput = false
func BeginEnding(): func BeginEnding():
exitm.exitAllowed = false
cam.moving = false cam.moving = false
animator_pan.play("pan to brief") animator_pan.play("pan to brief")
music_ending.play() music_ending.play()
@ -46,7 +58,13 @@ func BeginEnding():
label_congrats.visible = false label_congrats.visible = false
await get_tree().create_timer(1.2, false).timeout await get_tree().create_timer(1.2, false).timeout
animator_viewblocker.play("fade out") 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 #SHOW UI
label_congrats.visible = true label_congrats.visible = true
animator_congrats.play("wobble it") animator_congrats.play("wobble it")
@ -80,7 +98,12 @@ func ExitGame():
cntrl_ambience.FadeOut() cntrl_ambience.FadeOut()
isActive = false isActive = false
await get_tree().create_timer(4, false).timeout 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 var isActive = true
func AmbienceFade(): func AmbienceFade():
@ -107,6 +130,7 @@ var endless_overwriting = false
var endless_roundsbeat = 0 var endless_roundsbeat = 0
var endless_score = 0 var endless_score = 0
var glob_text_congratulations var glob_text_congratulations
var cash_gl = 0
func FinalScore(): func FinalScore():
var playername = roundManager.playerData.playername var playername = roundManager.playerData.playername
var shots_fired = roundManager.playerData.stat_shotsFired var shots_fired = roundManager.playerData.stat_shotsFired
@ -124,18 +148,18 @@ func FinalScore():
if (total_cash < 0): total_cash = 0 if (total_cash < 0): total_cash = 0
if (endless_overwriting): total_cash = endless_score if (endless_overwriting): total_cash = endless_score
#if (playername == "sex"): total_cash = 69 cash_gl = total_cash
#if (playername == "leet"): total_cash = 1337
#if (playername == "snoop" or playername == "weed" or playername == "kush"): total_cash = 420
var text_congratulations = "CONGRATULATIONS, " + playername + "!" var text_congratulations = tr("CONGRATULATIONS") % [playername]
var text_shotsFired = "shots fired ........ " + str(shots_fired) var text_shotsFired = tr("SHOTS FIRED") + " " + str(shots_fired)
if (endless_overwriting): text_shotsFired = "rounds beat ........ " + str(endless_roundsbeat) if (endless_overwriting): text_shotsFired = tr("ROUNDS BEAT") + " " + str(endless_roundsbeat)
var text_shellsEjected = "shells ejected ..... " + str(shells_ejected) var text_shellsEjected = tr("SHELLS EJECTED") + " " + str(shells_ejected)
var text_doorsKicked = "doors kicked ....... " + str(doors_kicked) var text_doorsKicked = tr("DOORS KICKED") + " " + str(doors_kicked)
var text_cigSmoked = "cigarettes smoked .. " + str(cigarettes_smoked) var text_cigSmoked = tr("CIGS SMOKED") + " " + str(cigarettes_smoked)
var text_beerDrank = "ml of beer drank ... " + str(ml_of_beer_drank) var text_beerDrank = tr("ML DRANK") + " " + str(ml_of_beer_drank)
var text_totalcash = "total cash: " + str(total_cash) + " $" var text_totalcash = tr("TOTAL CASH") + " " + str(total_cash) + " $"
#if (endless_overwriting): text_shotsFired = "rounds beat ........ " + str(endless_roundsbeat)
glob_text_congratulations = text_congratulations glob_text_congratulations = text_congratulations
@ -145,3 +169,84 @@ func FinalScore():
label_array[3].text = text_cigSmoked label_array[3].text = text_cigSmoked
label_array[4].text = text_beerDrank label_array[4].text = text_beerDrank
label_array[5].text = text_totalcash 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 smokerdude : Node3D
@export var display : StandardMaterial3D @export var display : StandardMaterial3D
@export var displayrounds : CompressedTexture2D @export var displayrounds : CompressedTexture2D
@export var amounts : Amounts
func SetupEndless(): func SetupEndless():
smokerdude.visible = false smokerdude.visible = false
@ -20,3 +21,5 @@ func SetupEndless():
roundManager.shellSpawner.skipDialoguePresented = true roundManager.shellSpawner.skipDialoguePresented = true
roundManager.shellLoadingSpedUp = true roundManager.shellLoadingSpedUp = true
display.albedo_texture = displayrounds display.albedo_texture = displayrounds
for res in amounts.array_amounts:
res.amount_active = res.amount_don

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_L : Array[Node3D]
@export var handArray_R : 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 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_L : Node3D
@export var handParent_R : Node3D @export var handParent_R : Node3D
@ -14,9 +16,13 @@ class_name HandManager extends Node
@export var hand_defaultR : Node3D @export var hand_defaultR : Node3D
@export var hand_cigarettepack : Node3D #L @export var hand_cigarettepack : Node3D #L
@export var hand_beer : 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_handcuffs : Node3D #R
@export var hand_handsaw : Node3D #R @export var hand_handsaw : Node3D #R
@export var hand_magnifier : Node3D #R @export var hand_magnifier : Node3D #R
@export var hand_burnerphone : Node3D #R
@export var lerpDuration : float @export var lerpDuration : float
@export var handRot_left : Vector3 #hand rotation when grabing from left grids @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_rotL : Vector3
@export var parentOriginal_posR : Vector3 @export var parentOriginal_posR : Vector3
@export var parentOriginal_rotR : Vector3 @export var parentOriginal_rotR : Vector3
@export var amounts : Amounts
var moving = false var moving = false
var lerping_L = false var lerping_L = false
var lerping_R = false var lerping_R = false
@ -41,6 +48,7 @@ var activeItemToGrab
func _process(delta): func _process(delta):
LerpHandMovement() LerpHandMovement()
var stealing = false
func PickupItemFromTable(itemName : String): func PickupItemFromTable(itemName : String):
dealerAI.Speaker_HandCrack() dealerAI.Speaker_HandCrack()
var activeIndex var activeIndex
@ -58,13 +66,20 @@ func PickupItemFromTable(itemName : String):
ToggleHandVisible("BOTH", false) ToggleHandVisible("BOTH", false)
hand_defaultL.visible = true hand_defaultL.visible = true
hand_defaultR.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" else: whichHandToGrabWith = "right"
whichGridSide = activeInstance.get_child(0).whichSide whichGridSide = activeInstance.get_child(0).whichSide
animator_hands.play("RESET") animator_hands.play("RESET")
BeginHandLerp(whichHandToGrabWith, activeIndex, whichGridSide) BeginHandLerp(whichHandToGrabWith, activeIndex, whichGridSide)
if (whichGridSide == "right"): animator_dealerHeadLook.play("dealer look right") if (whichGridSide == "right"): animator_dealerHeadLook.play("dealer look right")
else: animator_dealerHeadLook.play("dealer look left") 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 await get_tree().create_timer(lerpDuration -.4, false).timeout
if (whichHandToGrabWith == "right"): hand_defaultR.visible = false if (whichHandToGrabWith == "right"): hand_defaultR.visible = false
else: hand_defaultL.visible = false else: hand_defaultL.visible = false
@ -81,23 +96,71 @@ func PickupItemFromTable(itemName : String):
itemManager.numberOfCigs_dealer -= 1 itemManager.numberOfCigs_dealer -= 1
"beer": "beer":
hand_beer.visible = true 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) itemManager.itemArray_instances_dealer.remove_at(matchIndex)
var tempindicator = activeInstance.get_child(0) var tempindicator = activeInstance.get_child(0)
var gridname = tempindicator.dealerGridName 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() activeInstance.queue_free()
await get_tree().create_timer(.2, false).timeout await get_tree().create_timer(.2, false).timeout
ReturnHand() ReturnHand()
if (stealing):
cam.BeginLerp("enemy")
if (whichGridSide == "right"): animator_dealerHeadLook.play("dealer look forward from right") if (whichGridSide == "right"): animator_dealerHeadLook.play("dealer look forward from right")
else: animator_dealerHeadLook.play("dealer look forward from left") else: animator_dealerHeadLook.play("dealer look forward from left")
await get_tree().create_timer(lerpDuration + .01, false).timeout await get_tree().create_timer(lerpDuration + .01, false).timeout
HandFailsafe() HandFailsafe()
var animationName = "dealer use " + itemName var animationName = "dealer use " + itemName
PlaySound(itemName)
animator_hands.play("RESET") animator_hands.play("RESET")
animator_hands.play(animationName) animator_hands.play(animationName)
var length = animator_hands.get_animation(animationName).get_length() var length = animator_hands.get_animation(animationName).get_length()
moving = false moving = false
await get_tree().create_timer(length, false).timeout 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 pass
func ToggleHandVisible(selectedHand : String, state : bool): func ToggleHandVisible(selectedHand : String, state : bool):

View File

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

View File

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

View File

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

View File

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

View File

@ -27,12 +27,27 @@ class_name IntroManager extends Node
@export var speaker_pillchoice : AudioStreamPlayer2D @export var speaker_pillchoice : AudioStreamPlayer2D
@export var intbranch_pillyes : InteractionBranch @export var intbranch_pillyes : InteractionBranch
@export var intbranch_pillno : InteractionBranch @export var intbranch_pillno : InteractionBranch
@export var intbranch_crt : InteractionBranch
@export var speaker_pillselect : AudioStreamPlayer2D @export var speaker_pillselect : AudioStreamPlayer2D
@export var anim_revert : AnimationPlayer @export var anim_revert : AnimationPlayer
@export var endlessmode : Endless @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 var allowingPills = false
func _ready(): func _ready():
parent_pills.visible = false
allowingPills = false
SetControllerState()
await get_tree().create_timer(.5, false).timeout await get_tree().create_timer(.5, false).timeout
if (roundManager.playerData.playerEnteringFromDeath && !roundManager.playerData.enteringFromTrueDeath): if (roundManager.playerData.playerEnteringFromDeath && !roundManager.playerData.enteringFromTrueDeath):
RevivalBathroomStart() RevivalBathroomStart()
@ -42,8 +57,27 @@ func _ready():
parent_pills.visible = false parent_pills.visible = false
allowingPills = false allowingPills = false
if (!roundManager.playerData.playerEnteringFromDeath && !roundManager.playerData.enteringFromTrueDeath): if (!roundManager.playerData.playerEnteringFromDeath && !roundManager.playerData.enteringFromTrueDeath):
parent_pills.visible = true if (FileAccess.file_exists(unlocker.savepath)):
allowingPills = true 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(): func MainBathroomStart():
RestRoomIdle() RestRoomIdle()
@ -54,7 +88,14 @@ func MainBathroomStart():
Hint() Hint()
cursor.SetCursor(true, true) cursor.SetCursor(true, true)
intbranch_bathroomdoor.interactionAllowed = 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(): func Hint():
await get_tree().create_timer(1, false).timeout await get_tree().create_timer(1, false).timeout
@ -78,10 +119,11 @@ func RevivalBathroomStart():
MainTrackLoad() MainTrackLoad()
await get_tree().create_timer(.5, false).timeout await get_tree().create_timer(.5, false).timeout
animator_smokerdude.play("revive player") 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 n = roundManager.playerData.playername
var firstpart = "GET UP, " + n + "." var firstpart = tr("GET UP") % [n]
var secondpart = "\nTHE NIGHT IS YOUNG." #tr("GAME_STATUS_%d" % status_index)
var secondpart = "\n"+tr("THE NIGHT")
var full = firstpart + secondpart var full = firstpart + secondpart
await get_tree().create_timer(4, false).timeout await get_tree().create_timer(4, false).timeout
dia.ShowText_Forever(full) dia.ShowText_Forever(full)
@ -95,7 +137,15 @@ func RevivalBathroomStart():
dia.speaker_click.stream = dia.soundArray_clicks[3] dia.speaker_click.stream = dia.soundArray_clicks[3]
await get_tree().create_timer(3, false).timeout await get_tree().create_timer(3, false).timeout
cursor.SetCursor(true, true) 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 intbranch_bathroomdoor.interactionAllowed = true
pass pass
@ -107,9 +157,14 @@ func MainTrackLoad():
speaker_amb_restroom.play() speaker_amb_restroom.play()
func Interaction_PillBottle(): func Interaction_PillBottle():
anim_pillflicker.play("RESET")
cursor.SetCursor(false, false) cursor.SetCursor(false, false)
intbranch_bathroomdoor.interactionAllowed = false intbranch_bathroomdoor.interactionAllowed = false
intbranch_pillbottle.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") animator_camera.play("camera check pills")
await get_tree().create_timer(.6, false).timeout await get_tree().create_timer(.6, false).timeout
speaker_pillchoice.play() speaker_pillchoice.play()
@ -117,16 +172,59 @@ func Interaction_PillBottle():
animator_pillchoice.play("show") animator_pillchoice.play("show")
await get_tree().create_timer(.7, false).timeout await get_tree().create_timer(.7, false).timeout
cursor.SetCursor(true, true) 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_pillyes.interactionAllowed = true
intbranch_pillno.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) 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") animator_pp.play("brightness fade out")
anim_revert.play("revert") anim_revert.play("revert")
animator_pillchoice.play("hide") animator_pillchoice.play("hide")
speaker_pillchoice.stop() speaker_pillchoice.stop()
speaker_pillselect.play() speaker_pillselect.play()
btn_pillsYes.visible = false
btn_pillsNo.visible = false
intbranch_pillyes.interactionAllowed = false intbranch_pillyes.interactionAllowed = false
intbranch_pillno.interactionAllowed = false intbranch_pillno.interactionAllowed = false
await get_tree().create_timer(2.05, false).timeout await get_tree().create_timer(2.05, false).timeout
@ -134,27 +232,69 @@ func SelectedPill(selected : bool):
parent_pills.visible = false parent_pills.visible = false
endlessmode.SetupEndless() endlessmode.SetupEndless()
RestRoomIdle() RestRoomIdle()
if selected: crtManager.SetCRT(false)
animator_pp.play("brightness fade in") animator_pp.play("brightness fade in")
await get_tree().create_timer(.6, false).timeout await get_tree().create_timer(.6, false).timeout
cursor.SetCursor(true, true) cursor.SetCursor(true, true)
if (selected): ach.UnlockAchievement("ach3")
intbranch_bathroomdoor.interactionAllowed = true 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 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(): func Interaction_BackroomDoor():
roundManager.playerData.stat_doorsKicked += 1 roundManager.playerData.stat_doorsKicked += 1
animator_camera.play("camera enter backroom") animator_camera.play("camera enter backroom")
intbranch_backroomdoor.interactionAllowed = false intbranch_backroomdoor.interactionAllowed = false
btn_backroom.visible = false
cursor.SetCursor(false, false) cursor.SetCursor(false, false)
counting = false
func Interaction_BathroomDoor(): func Interaction_BathroomDoor():
intbranch_bathroomdoor.interactionAllowed = false intbranch_bathroomdoor.interactionAllowed = false
cursor.SetCursor(false, false) cursor.SetCursor(false, false)
btn_pills.visible = false
btn_screen.visible = false
btn_bathroomdoor.visible = false
animator_camera.play("camera exit bathroom") animator_camera.play("camera exit bathroom")
await get_tree().create_timer(5, false).timeout await get_tree().create_timer(5, false).timeout
cursor.SetCursor(true, true) 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_backroomdoor.interactionAllowed = true
intbranch_pillbottle.interactionAllowed = false intbranch_pillbottle.interactionAllowed = false
intbranch_crt.interactionAllowed = false
counting = true
pass 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 class_name ItemInteraction extends Node
@export var medicine : Medicine
@export var roundManager : RoundManager @export var roundManager : RoundManager
@export var dealerIntelligence : DealerIntelligence @export var dealerIntelligence : DealerIntelligence
@export var cursor : CursorManager @export var cursor : CursorManager
@ -8,12 +9,24 @@ class_name ItemInteraction extends Node
@export var lerpDuration : float @export var lerpDuration : float
@export var pos_hand : Vector3 @export var pos_hand : Vector3
@export var rot_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_dealerHands : AnimationPlayer
@export var animator_playerHands : AnimationPlayer @export var animator_playerHands : AnimationPlayer
@export var camera : CameraManager @export var camera : CameraManager
@export var shellEject_player : ShellEjectManager @export var shellEject_player : ShellEjectManager
@export var speaker_pickup : AudioStreamPlayer2D @export var speaker_pickup : AudioStreamPlayer2D
@export var speaker_breakcuffs : 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 temp_itemParent
var pos_current var pos_current
@ -25,19 +38,31 @@ var temp_indicator
var elapsed = 0 var elapsed = 0
var moving = false var moving = false
func _ready():
pos_hand_main = pos_hand
rot_hand_main = rot_hand
func _process(delta): func _process(delta):
LerpMovement() LerpMovement()
var stealing = false
var stealing_fs = false
func PickupItemFromTable(itemParent : Node3D, passedItemName : String): func PickupItemFromTable(itemParent : Node3D, passedItemName : String):
if (stealing): items.Counter(false)
#SET INTERACTION PERMISSIONS, HIDE CURSOR #SET INTERACTION PERMISSIONS, HIDE CURSOR
perm.SetIndicators(false) perm.SetIndicators(false)
perm.SetInteractionPermissions(false) perm.SetInteractionPermissions(false)
perm.RevertDescriptionUI() perm.RevertDescriptionUI()
cursor.SetCursor(false, false) cursor.SetCursor(false, false)
roundManager.ClearDeskUI(true)
#GET VARIABLES #GET VARIABLES
temp_itemParent = itemParent temp_itemParent = itemParent
temp_indicator = itemParent.get_child(0) temp_indicator = itemParent.get_child(0)
temp_interaction = itemParent.get_child(1) temp_interaction = itemParent.get_child(1)
#STEAL
if (stealing && stealing_fs):
hands.RemoveItem_Remote(temp_itemParent)
items.RevertItemSteal()
#PLAY PICKUP SOUND #PLAY PICKUP SOUND
speaker_pickup.stream = temp_indicator.sound_pickup speaker_pickup.stream = temp_indicator.sound_pickup
speaker_pickup.pitch_scale = randf_range(.93, 1.0) 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.interactionAllowed = false
temp_indicator.SnapToMax() temp_indicator.SnapToMax()
temp_interaction.interactionAllowed = false temp_interaction.interactionAllowed = false
var temp_name = temp_interaction.itemName
#LERP #LERP
pos_current = temp_itemParent.transform.origin pos_current = temp_itemParent.transform.origin
rot_current = temp_itemParent.rotation_degrees rot_current = temp_itemParent.rotation_degrees
@ -59,12 +85,34 @@ func PickupItemFromTable(itemParent : Node3D, passedItemName : String):
moving = true moving = true
await get_tree().create_timer(lerpDuration -.1, false).timeout await get_tree().create_timer(lerpDuration -.1, false).timeout
moving = false 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 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) InteractWith(passedItemName)
stealing = false
func InteractWith(itemName : String): func InteractWith(itemName : String):
#INTERACTION #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): match (itemName):
"handcuffs": "handcuffs":
animator_dealerHands.play("dealer get handcuffed") animator_dealerHands.play("dealer get handcuffed")
@ -107,6 +155,53 @@ func InteractWith(itemName : String):
roundManager.currentShotgunDamage = 2 roundManager.currentShotgunDamage = 2
await get_tree().create_timer(4.28 + .2, false).timeout await get_tree().create_timer(4.28 + .2, false).timeout
EnablePermissions() 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(): func EnablePermissions():
perm.SetStackInvalidIndicators() perm.SetStackInvalidIndicators()
@ -114,6 +209,17 @@ func EnablePermissions():
perm.SetInteractionPermissions(true) perm.SetInteractionPermissions(true)
perm.RevertDescriptionUI() perm.RevertDescriptionUI()
cursor.SetCursor(true, true) 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(): func PlaySound_BreakHandcuffs():
speaker_breakcuffs.play() speaker_breakcuffs.play()

View File

@ -2,6 +2,7 @@ class_name ItemManager extends Node
@export var grid : GridIndicator @export var grid : GridIndicator
@export var cursor : CursorManager @export var cursor : CursorManager
@export var controller : ControllerManager
@export var roundManager : RoundManager @export var roundManager : RoundManager
@export var dialogue : Dialogue @export var dialogue : Dialogue
@export var camera : CameraManager @export var camera : CameraManager
@ -27,9 +28,15 @@ var gridParentArray_enemy_available : Array[Node3D]
@export var anim_spook : AnimationPlayer @export var anim_spook : AnimationPlayer
@export var speakercontroller_musicmain : SpeakerController @export var speakercontroller_musicmain : SpeakerController
@export var speaker_god : AudioStreamPlayer2D @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 itemGrabSoundIndex = 0
var itemArray_dealer : Array[String] var itemArray_dealer : Array[String]
var itemArray_instances_dealer : Array[Node3D] 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 itemArray_player : Array[String]
var hasBegun = false var hasBegun = false
var items_dynamicIndicatorArray : Array[PickupIndicator] var items_dynamicIndicatorArray : Array[PickupIndicator]
@ -58,12 +65,33 @@ var temp_interaction
func _ready(): func _ready():
playerItemStringArray = [] playerItemStringArray = []
availableItemsToGrabArray_player = availableItemArray #availableItemsToGrabArray_player = availableItemArray
availableItemsToGrabArray_dealer = availableItemArray #availableItemsToGrabArray_dealer = availableItemArray
ResetDealerGrid() ResetDealerGrid()
func _process(delta): func _process(delta):
LerpItem() 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(): func ItemClear_Remote():
var itemParentChildrenArray = itemSpawnParent.get_children() var itemParentChildrenArray = itemSpawnParent.get_children()
@ -108,7 +136,7 @@ func BeginItemGrabbing():
await get_tree().create_timer(.8, false).timeout await get_tree().create_timer(.8, false).timeout
if (!roundManager.playerData.hasReadItemSwapIntroduction): 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 await get_tree().create_timer(3, false).timeout
camera.BeginLerp("home") camera.BeginLerp("home")
await get_tree().create_timer(.8, false).timeout await get_tree().create_timer(.8, false).timeout
@ -123,9 +151,10 @@ func BeginItemGrabbing():
if (!roundManager.playerData.hasReadItemDistributionIntro): if (!roundManager.playerData.hasReadItemDistributionIntro):
var stringIndex = roundManager.roundArray[roundManager.currentRound].numberOfItemsToGrab var stringIndex = roundManager.roundArray[roundManager.currentRound].numberOfItemsToGrab
var string = stringNumberArray[stringIndex] 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 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 await get_tree().create_timer(2.5, false).timeout
dialogue.HideText() dialogue.HideText()
roundManager.playerData.hasReadItemDistributionIntro = true roundManager.playerData.hasReadItemDistributionIntro = true
@ -133,12 +162,14 @@ func BeginItemGrabbing():
if (!roundManager.playerData.hasReadItemDistributionIntro2 && roundManager.roundArray[roundManager.currentRound].hasIntro2): if (!roundManager.playerData.hasReadItemDistributionIntro2 && roundManager.roundArray[roundManager.currentRound].hasIntro2):
var stringIndex = roundManager.roundArray[roundManager.currentRound].numberOfItemsToGrab var stringIndex = roundManager.roundArray[roundManager.currentRound].numberOfItemsToGrab
var string = stringNumberArray[stringIndex] 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 await get_tree().create_timer(2.5, false).timeout
dialogue.HideText() dialogue.HideText()
roundManager.playerData.hasReadItemDistributionIntro2 = true roundManager.playerData.hasReadItemDistributionIntro2 = true
#ALLOW ITEM GRAB #ALLOW ITEM GRAB
cursor.SetCursor(true, true) cursor.SetCursor(true, true)
SetIntakeFocus(true)
interaction_intake.interactionAllowed = true interaction_intake.interactionAllowed = true
pass pass
@ -147,6 +178,7 @@ func EndItemGrabbing():
GridParents(false) GridParents(false)
interaction_intake.interactionAllowed = false interaction_intake.interactionAllowed = false
cursor.SetCursor(false, false) cursor.SetCursor(false, false)
ClearIntakeFocus()
await get_tree().create_timer(.45, false).timeout await get_tree().create_timer(.45, false).timeout
comp.CycleCompartment("hide briefcase") comp.CycleCompartment("hide briefcase")
await get_tree().create_timer(1, false).timeout await get_tree().create_timer(1, false).timeout
@ -159,6 +191,7 @@ func EndItemGrabbing():
func GrabSpook(): func GrabSpook():
interaction_intake.interactionAllowed = false interaction_intake.interactionAllowed = false
cursor.SetCursor(false, false) cursor.SetCursor(false, false)
ClearIntakeFocus()
PlayItemGrabSound() PlayItemGrabSound()
speakercontroller_musicmain.SnapVolume(false) speakercontroller_musicmain.SnapVolume(false)
speaker_god.play() speaker_god.play()
@ -171,9 +204,10 @@ func GrabSpook():
speakercontroller_musicmain.FadeIn() speakercontroller_musicmain.FadeIn()
await get_tree().create_timer(.8, false).timeout await get_tree().create_timer(.8, false).timeout
cursor.SetCursor(true, true) cursor.SetCursor(true, true)
SetIntakeFocus(true)
interaction_intake.interactionAllowed = true interaction_intake.interactionAllowed = true
var randindex = -1 var randindex = 4
var spook_counter = 0 var spook_counter = 0
var spook_fired = false var spook_fired = false
func GrabItem(): func GrabItem():
@ -188,22 +222,30 @@ func GrabItem():
PlayItemGrabSound() PlayItemGrabSound()
interaction_intake.interactionAllowed = false interaction_intake.interactionAllowed = false
var selectedResource : ItemResource var selectedResource : ItemResource
if (numberOfCigs_player >= 2):
availableItemsToGrabArray_player.erase("cigarettes") #SET PLAYER AVAILABLE ITEMS ACCORDING TO MAX COUNTS
else: var amountArray : Array[AmountResource] = amounts.array_amounts
var hasInArray = false availableItemsToGrabArray_player = []
for i in range(availableItemsToGrabArray_player.size()): for res in amountArray:
if (availableItemsToGrabArray_dealer[i] == "cigarettes"): if (res.amount_active == 0): continue
hasInArray = true if (res.amount_player != res.amount_active):
break availableItemsToGrabArray_player.append(res.itemName)
if (!hasInArray): availableItemsToGrabArray_player.append("cigarettes") #for res in amountArray: availableItemsToGrabArray_player.append(res.itemName)
randindex = randi_range(0, availableItemsToGrabArray_player.size() - 1) randindex = randi_range(0, availableItemsToGrabArray_player.size() - 1)
numberOfItemsGrabbed += 1 numberOfItemsGrabbed += 1
#SPAWN ITEM #SPAWN ITEM
for i in range(instanceArray.size()): for i in range(instanceArray.size()):
if (availableItemsToGrabArray_player[randindex] == instanceArray[i].itemName): if (availableItemsToGrabArray_player[randindex] == instanceArray[i].itemName):
selectedResource = instanceArray[i] selectedResource = instanceArray[i]
var itemInstance = selectedResource.instance.instantiate() var itemInstance = selectedResource.instance.instantiate()
for res in amountArray:
if (selectedResource.itemName == res.itemName):
res.amount_player += 1
break
activeItem = itemInstance activeItem = itemInstance
itemSpawnParent.add_child(itemInstance) itemSpawnParent.add_child(itemInstance)
itemInstance.transform.origin = selectedResource.pos_inBriefcase itemInstance.transform.origin = selectedResource.pos_inBriefcase
@ -231,13 +273,21 @@ func GrabItem():
moving = true moving = true
await get_tree().create_timer(lerpDuration - .2, false).timeout await get_tree().create_timer(lerpDuration - .2, false).timeout
if (!roundManager.playerData.indicatorShown): grid.ShowGridIndicator() if (!roundManager.playerData.indicatorShown): grid.ShowGridIndicator()
if (numberOfOccupiedGrids != 8): if (numberOfOccupiedGrids != 8):
GridParents(true) GridParents(true)
SetIntakeFocus(false)
else: else:
#NOT ENOUGH SPACE. PUT ITEM BACK AND END ITEM GRABBING #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 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 await get_tree().create_timer(2.2, false).timeout
dialogue.HideText() dialogue.HideText()
pos_current = activeItem.transform.origin pos_current = activeItem.transform.origin
@ -247,6 +297,7 @@ func GrabItem():
elapsed = 0 elapsed = 0
moving = true moving = true
cursor.SetCursor(false, false) cursor.SetCursor(false, false)
ClearIntakeFocus()
PlayItemGrabSound() PlayItemGrabSound()
await get_tree().create_timer(lerpDuration, false).timeout await get_tree().create_timer(lerpDuration, false).timeout
moving = false moving = false
@ -258,14 +309,14 @@ func PlaceDownItem(gridIndex : int):
numberOfOccupiedGrids += 1 numberOfOccupiedGrids += 1
gridOccupiedArray[gridIndex] = true gridOccupiedArray[gridIndex] = true
moving = false moving = false
#activeItem.get_parent().remove_child(activeItem)
#gridParentArray[gridIndex].add_child(activeItem)
var temp_indicator = activeItem.get_child(0) var temp_indicator = activeItem.get_child(0)
if (temp_interaction.itemName == "cigarettes"): numberOfCigs_player += 1 if (temp_interaction.itemName == "cigarettes"): numberOfCigs_player += 1
pos_current = activeItem.transform.origin pos_current = activeItem.transform.origin
rot_current = activeItem.rotation_degrees rot_current = activeItem.rotation_degrees
pos_next = gridParentArray[gridIndex].transform.origin + activeItem_offset_pos pos_next = gridParentArray[gridIndex].transform.origin + activeItem_offset_pos
rot_next = gridParentArray[gridIndex].rotation_degrees + activeItem_offset_rot rot_next = gridParentArray[gridIndex].rotation_degrees + activeItem_offset_rot
temp_interaction.isPlayerSide = true
temp_indicator.dealerGridIndex = gridIndex + 8
elapsed = 0 elapsed = 0
moving = true moving = true
temp_interaction.itemGridIndex = gridIndex temp_interaction.itemGridIndex = gridIndex
@ -281,8 +332,10 @@ func PlaceDownItem(gridIndex : int):
else: else:
#GRAB NEXT ITEM #GRAB NEXT ITEM
GridParents(false) GridParents(false)
ClearIntakeFocus()
await get_tree().create_timer(lerpDuration, false).timeout await get_tree().create_timer(lerpDuration, false).timeout
interaction_intake.interactionAllowed = true interaction_intake.interactionAllowed = true
SetIntakeFocus(true)
pass pass
var firstItem = true var firstItem = true
@ -290,33 +343,39 @@ func GrabItems_Enemy():
var selectedResource var selectedResource
for i in range(roundManager.roundArray[roundManager.currentRound].numberOfItemsToGrab): for i in range(roundManager.roundArray[roundManager.currentRound].numberOfItemsToGrab):
if (numberOfItemsGrabbed_enemy != 8): 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 randindex = randi_range(0, availableItemsToGrabArray_dealer.size() - 1)
var selectedItem = availableItemsToGrabArray_dealer[randindex]
#SPAWN ITEM #SPAWN ITEM
for c in range(instanceArray_dealer.size()): for c in range(instanceArray_dealer.size()):
if (availableItemArray[randindex] == instanceArray_dealer[c].itemName): if (selectedItem == instanceArray_dealer[c].itemName):
selectedResource = instanceArray_dealer[c] selectedResource = instanceArray_dealer[c]
#ADD STRING TO DEALER ITEM ARRAY #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 itemInstance = selectedResource.instance.instantiate()
var temp_itemIndicator = itemInstance.get_child(0) var temp_itemIndicator = itemInstance.get_child(0)
temp_itemIndicator.isDealerItem = true 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) #ADD INSTANCE TO DEALER ITEM ARRAY (mida vittu this code is getting out of hand)
itemArray_instances_dealer.append(itemInstance) itemArray_instances_dealer.append(itemInstance)
activeItem_enemy = itemInstance activeItem_enemy = itemInstance
itemSpawnParent.add_child(activeItem_enemy) itemSpawnParent.add_child(activeItem_enemy)
#PLACE ITEM ON RANDOM GRID #PLACE ITEM ON RANDOM GRID
var randgrid = randi_range(0, gridParentArray_enemy_available.size() - 1) var randgrid = randi_range(0, gridParentArray_enemy_available.size() - 1)
#higher than z0 is right
var gridname = gridParentArray_enemy_available[randgrid] var gridname = gridParentArray_enemy_available[randgrid]
activeItem_enemy.transform.origin = gridParentArray_enemy_available[randgrid].transform.origin + selectedResource.pos_offset 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 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 if (activeItem_enemy.get_child(1).itemName == "cigarettes"): numberOfCigs_dealer += 1
gridParentArray_enemy_available.erase(gridname) gridParentArray_enemy_available.erase(gridname)
numberOfItemsGrabbed_enemy += 1 numberOfItemsGrabbed_enemy += 1
pass
pass
func UseItem_Dealer(itemName : String):
match (itemName): var PREVIOUS_items_dyanmicIndicatorArray : Array[PickupIndicator]
"beer": var PREVIOUS_items_dynamicInteractionArray : Array[InteractionBranch]
pass 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 pass
func ResetDealerGrid(): func ResetDealerGrid():
@ -400,6 +538,11 @@ func ClearAllItems():
instancesToDelete[i].queue_free() instancesToDelete[i].queue_free()
itemArray_instances_dealer = [] 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): func GridParents(setState : bool):
if (setState): if (setState):
for i in range(gridParentArray.size()): for i in range(gridParentArray.size()):
@ -415,7 +558,6 @@ func PlayItemGrabSound():
speaker_itemgrab.play() speaker_itemgrab.play()
if (itemGrabSoundIndex != soundArray_itemGrab.size() - 1): itemGrabSoundIndex += 1 if (itemGrabSoundIndex != soundArray_itemGrab.size() - 1): itemGrabSoundIndex += 1
else: itemGrabSoundIndex = 0 else: itemGrabSoundIndex = 0
pass
func LerpItem(): func LerpItem():
if (moving): 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 speaker_start : AudioStreamPlayer2D
@export var buttons : Array[ButtonClass] @export var buttons : Array[ButtonClass]
@export var buttons_options : Array[ButtonClass] @export var buttons_options : Array[ButtonClass]
@export var screen_main : Array[Control] @export var screens : Array[Control]
@export var screen_creds : Array[Control] @export var parent_main : Control
@export var screen_options : Array[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 title : Node3D
@export var waterfalls : Array[AnimationPlayer] @export var waterfalls : Array[AnimationPlayer]
@export var optionmanager : OptionsManager @export var optionmanager : OptionsManager
@export var controller : ControllerManager
@export var mouseblocker : Control
@export var anim_creds : AnimationPlayer
func _ready(): func _ready():
Show("main") Show("main")
buttons[0].connect("is_pressed", Start) buttons[0].connect("is_pressed", Start)
buttons[1].connect("is_pressed", Credits) buttons[1].connect("is_pressed", SubOptions)
buttons[2].connect("is_pressed", Exit) buttons[2].connect("is_pressed", Credits)
buttons[3].connect("is_pressed", Return) buttons[3].connect("is_pressed", Exit)
buttons[4].connect("is_pressed", Options) buttons[4].connect("is_pressed", ReturnToLastScreen)
buttons[5].connect("is_pressed", Return) 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[0].connect("is_pressed", IncreaseVol)
buttons_options[1].connect("is_pressed", DecreaseVol) buttons_options[1].connect("is_pressed", DecreaseVol)
buttons_options[2].connect("is_pressed", SetFull) buttons_options[2].connect("is_pressed", SetFull)
buttons_options[3].connect("is_pressed", SetWindowed) buttons_options[3].connect("is_pressed", SetWindowed)
buttons_options[4].connect("is_pressed", ControllerEnable)
buttons_options[5].connect("is_pressed", ControllerDisable)
Intro() 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(): func Intro():
cursor.SetCursor(false, false) cursor.SetCursor(false, false)
await get_tree().create_timer(.5, false).timeout await get_tree().create_timer(.5, false).timeout
speaker_music.play() speaker_music.play()
animator_intro.play("splash screen") animator_intro.play("splash screen")
await get_tree().create_timer(9, false).timeout await get_tree().create_timer(9, false).timeout
mouseblocker.visible = false
cursor.SetCursor(true, false) cursor.SetCursor(true, false)
for i in buttons_options: controller.settingFilter = true
i.isActive = false controller.SetMainControllerState(controller.controller_currently_enabled)
i.SetFilter("ignore") if (cursor.controller_active): firstFocus_main.grab_focus()
buttons[0].isActive = true controller.previousFocus = firstFocus_main
buttons[0].SetFilter("stop") assigningFocus = true
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
func Buttons(state : bool): func Buttons(state : bool):
if (!state): if (!state):
@ -58,29 +81,70 @@ func Buttons(state : bool):
i.isActive = true i.isActive = true
i.SetFilter("stop") 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): func Show(what : String):
lastScreen = currentScreen
currentScreen = what
var focus
title.visible = false title.visible = false
for i in screen_main: i.visible = false for screen in screens: screen.visible = false
for i in screen_creds: i.visible = false if (what == "main" or what == "sub options"): title.visible = true
for i in screen_options: i.visible = false match(what):
if (what == "credits"): for i in screen_creds: i.visible = true "main":
else: if (what == "main"): parent_main.visible = true
for i in screen_main: i.visible = true focus = firstFocus_main
title.visible = true "sub options":
else: if (what == "options"): parent_suboptions.visible = true
for i in screen_options: i.visible = true focus = firstFocus_subOptions
else: "credits":
pass 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(): func ResetButtons():
for b in buttons: #for b in buttons:
b.ui.modulate.a = 1 # b.ui.modulate.a = 1
cursor.SetCursorImage("point") cursor.SetCursorImage("point")
func Start(): func Start():
Buttons(false) Buttons(false)
ResetButtons() ResetButtons()
Show("e") for screen in screens: screen.visible = false
title.visible = false
controller.previousFocus = null
speaker_music.stop() speaker_music.stop()
animator_intro.play("snap") animator_intro.play("snap")
for w in waterfalls: w.pause() for w in waterfalls: w.pause()
@ -91,11 +155,7 @@ func Start():
get_tree().change_scene_to_file("res://scenes/main.tscn") get_tree().change_scene_to_file("res://scenes/main.tscn")
func Credits(): func Credits():
ResetButtons()
Show("credits") Show("credits")
Buttons(false)
buttons[3].isActive = true
buttons[3].SetFilter("stop")
ResetButtons() ResetButtons()
func Exit(): func Exit():
@ -107,32 +167,28 @@ func Exit():
await get_tree().create_timer(.5, false).timeout await get_tree().create_timer(.5, false).timeout
get_tree().quit() get_tree().quit()
func Return(): func ResetControls():
Show("main") optionmanager.ResetControls()
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()
ResetButtons() ResetButtons()
func Options(): func DiscordLink():
Show("options") OS.shell_open("https://discord.gg/cr-channel-1158444754325999747")
Buttons(false) func RebindControls():
buttons[5].isActive = true Show("rebind controls")
buttons[5].SetFilter("stop")
for i in buttons_options:
i.isActive = true
i.SetFilter("stop")
ResetButtons() 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(): func IncreaseVol():
optionmanager.Adjust("increase") optionmanager.Adjust("increase")
func DecreaseVol(): func DecreaseVol():
@ -141,3 +197,7 @@ func SetWindowed():
optionmanager.Adjust("windowed") optionmanager.Adjust("windowed")
func SetFull(): func SetFull():
optionmanager.Adjust("fullscreen") 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 class_name MouseRaycast extends Camera3D
@export var checkingOverride : bool
@export var cursor : CursorManager
var mouse = Vector2() var mouse = Vector2()
var result = null var result = null
var controller_overriding = false
func _input(event): func _input(event):
if event is InputEventMouse: if event is InputEventMouse:
mouse = event.position if(!controller_overriding): mouse = event.position
func _process(delta): func _process(delta):
get_selection() get_selection()
@ -15,3 +19,10 @@ func get_selection():
var start = project_ray_origin(mouse) var start = project_ray_origin(mouse)
var end = project_position(mouse, 20000) var end = project_position(mouse, 20000)
result = worldspace.intersect_ray(PhysicsRayQueryParameters3D.create(start, end)) 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 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_windowed : CanvasItem
@export var ui_fullscreen : CanvasItem @export var ui_fullscreen : CanvasItem
@export var ui_deviceController : CanvasItem
@export var ui_deviceMouse : CanvasItem
@export var button_windowed : ButtonClass @export var button_windowed : ButtonClass
@export var button_fullscreen : ButtonClass @export var button_fullscreen : ButtonClass
@export var menu : MenuManager @export var menu : MenuManager
@export var ui_volume : Label @export var ui_volume : Label
const savePath := "user://buckshotroulette_options.save"
const savePath := "user://buckshotroulette_options_12.shell"
var data = {} var data = {}
var data_inputmap = {}
var setting_inputmap_keyboard = {}
var setting_inputmap_controller = {}
var setting_volume = 1 var setting_volume = 1
var setting_windowed = false var setting_windowed = false
var setting_language = "EN"
var setting_controllerEnabled = false
func _ready(): func _ready():
LoadSettings() 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): func Adjust(alias : String):
match(alias): match(alias):
@ -30,14 +74,28 @@ func Adjust(alias : String):
setting_volume = 0 setting_volume = 0
UpdateDisplay() UpdateDisplay()
ApplySettings_volume() ApplySettings_volume()
"controller enable":
setting_controllerEnabled = true
ApplySettings_controller()
"controller disable":
setting_controllerEnabled = false
ApplySettings_controller()
"windowed": "windowed":
setting_windowed = true setting_windowed = true
ApplySettings_window() ApplySettings_window()
"fullscreen": "fullscreen":
setting_windowed = false setting_windowed = false
ApplySettings_window() ApplySettings_window()
if (alias != "increase" && alias != "decrease"): menu.ResetButtons() if (alias != "increase" && alias != "decrease"): menu.ResetButtons()
func AdjustLanguage(alias : String):
setting_language = alias
ApplySettings_language()
menu.ResetButtons()
return
func ApplySettings_volume(): func ApplySettings_volume():
AudioServer.set_bus_volume_db(0, linear_to_db(setting_volume)) AudioServer.set_bus_volume_db(0, linear_to_db(setting_volume))
UpdateDisplay() UpdateDisplay()
@ -46,38 +104,109 @@ func ApplySettings_volume():
func UpdateDisplay(): func UpdateDisplay():
ui_volume.text = str(snapped(setting_volume * 100, .01)) + "%" ui_volume.text = str(snapped(setting_volume * 100, .01)) + "%"
func ApplySettings_window(): func ApplySettings_window():
if (!setting_windowed): if (!setting_windowed):
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN) DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN)
ui_fullscreen.modulate.a = 1 ui_fullscreen.modulate.a = 1
ui_windowed.modulate.a = .5 ui_windowed.modulate.a = .5
button_fullscreen.mainActive = false button_fullscreen.mainActive = true
button_windowed.mainActive = true button_windowed.mainActive = true
else: else:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED) DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
ui_fullscreen.modulate.a = .5 ui_fullscreen.modulate.a = .5
ui_windowed.modulate.a = 1 ui_windowed.modulate.a = 1
button_fullscreen.mainActive = true button_fullscreen.mainActive = true
button_windowed.mainActive = false button_windowed.mainActive = true
pass 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(): func SaveSettings():
data = { data = {
#"has_read_introduction": roundManager.playerData.hasReadIntroduction, #"has_read_introduction": roundManager.playerData.hasReadIntroduction,
"setting_volume": setting_volume, "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) var file = FileAccess.open(savePath, FileAccess.WRITE)
file.store_var(data) file.store_var(data)
file.close() file.close()
var receivedFile = false
func LoadSettings(): func LoadSettings():
if (FileAccess.file_exists(savePath)): if (FileAccess.file_exists(savePath)):
var file = FileAccess.open(savePath, FileAccess.READ) var file = FileAccess.open(savePath, FileAccess.READ)
data = file.get_var() data = file.get_var()
setting_volume = data.setting_volume setting_volume = data.setting_volume
setting_windowed = data.setting_windowed 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() file.close()
setting = true
ApplySettings_volume() ApplySettings_volume()
ApplySettings_window() 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].interactionAllowed = false
indicatorArray[i].moving = 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): func SetInteractionPermissions(state : bool):
if (state): if (state):
for i in range(interactionBranchArray.size()): for i in range(interactionBranchArray.size()):
@ -50,7 +61,10 @@ func SetItemInteraction(state : bool):
var tempBranch : InteractionBranch = children[i].get_child(1) var tempBranch : InteractionBranch = children[i].get_child(1)
tempBranch.interactionAllowed = state tempBranch.interactionAllowed = state
@export var inter : ItemInteraction
func SetStackInvalidIndicators(): func SetStackInvalidIndicators():
if (inter.stealing): stackDisabledItemArray_bools[5] = true
else: stackDisabledItemArray_bools[5] = false
if (roundManager.dealerCuffed): stackDisabledItemArray_bools[4] = true if (roundManager.dealerCuffed): stackDisabledItemArray_bools[4] = true
else: stackDisabledItemArray_bools[4] = false else: stackDisabledItemArray_bools[4] = false
if (roundManager.barrelSawedOff): stackDisabledItemArray_bools[0] = true if (roundManager.barrelSawedOff): stackDisabledItemArray_bools[0] = true

View File

@ -9,6 +9,7 @@ class_name RoundManager extends Node
@export var death : DeathManager @export var death : DeathManager
@export var playerData : PlayerData @export var playerData : PlayerData
@export var cursor : CursorManager @export var cursor : CursorManager
@export var controller : ControllerManager
@export var perm : PermissionManager @export var perm : PermissionManager
@export var health_player : int @export var health_player : int
@export var health_opponent : int @export var health_opponent : int
@ -56,6 +57,7 @@ var waitingForDealerReturn = false
var barrelSawedOff = false var barrelSawedOff = false
var defibCutterReady = false var defibCutterReady = false
var trueDeathActive = false var trueDeathActive = false
var playerCurrentTurnItemArray = []
func _ready(): func _ready():
HideDealer() HideDealer()
@ -64,6 +66,12 @@ func _ready():
func _process(delta): func _process(delta):
LerpScore() LerpScore()
InitialTimer()
var counting = false
var initial_time = 0
func InitialTimer():
if (counting): initial_time += get_process_delta_time()
func BeginMainGame(): func BeginMainGame():
MainBatchSetup(true) MainBatchSetup(true)
@ -87,7 +95,7 @@ func MainBatchSetup(dealerEnterAtStart : bool):
await get_tree().create_timer(2, false).timeout await get_tree().create_timer(2, false).timeout
var greeting = true var greeting = true
if (!playerData.hasSignedWaiver): 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 await get_tree().create_timer(2.3, false).timeout
shellLoader.dialogue.HideText() shellLoader.dialogue.HideText()
camera.BeginLerp("home") camera.BeginLerp("home")
@ -95,12 +103,12 @@ func MainBatchSetup(dealerEnterAtStart : bool):
return return
if (!dealerHasGreeted && greeting): if (!dealerHasGreeted && greeting):
var tempstring var tempstring
if (!playerData.enteringFromTrueDeath): tempstring = "WELCOME BACK." if (!playerData.enteringFromTrueDeath): tempstring = tr("WELCOME")
else: else:
shellSpawner.dialogue.dealerLowPitched = true shellSpawner.dialogue.dealerLowPitched = true
tempstring = "..." tempstring = "..."
if (!playerData.playerEnteringFromDeath): if (!playerData.playerEnteringFromDeath):
shellLoader.dialogue.ShowText_Forever("WELCOME TO\nBUCKSHOT ROULETTE.") shellLoader.dialogue.ShowText_Forever("...")
await get_tree().create_timer(2.3, false).timeout await get_tree().create_timer(2.3, false).timeout
shellLoader.dialogue.HideText() shellLoader.dialogue.HideText()
dealerHasGreeted = true dealerHasGreeted = true
@ -121,8 +129,14 @@ func MainBatchSetup(dealerEnterAtStart : bool):
healthCounter.SetupHealth() healthCounter.SetupHealth()
lerping = true lerping = true
#await get_tree().create_timer(1.5, false).timeout #await get_tree().create_timer(1.5, false).timeout
if (!endless): ParseMainGameAmounts()
StartRound(false) StartRound(false)
@export var amounts : Amounts
func ParseMainGameAmounts():
for res in amounts.array_amounts:
res.amount_active = res.amount_main
func GenerateRandomBatches(): func GenerateRandomBatches():
for b in batchArray: for b in batchArray:
for i in range(b.roundArray.size()): for i in range(b.roundArray.size()):
@ -134,7 +148,7 @@ func GenerateRandomBatches():
b.roundArray[i].amountBlank = amount_blank b.roundArray[i].amountBlank = amount_blank
b.roundArray[i].amountLive = amount_live 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 b.roundArray[i].usingItems = true
var flip = randi_range(0, 1) var flip = randi_range(0, 1)
if flip == 1: b.roundArray[i].shufflingArray = true if flip == 1: b.roundArray[i].shufflingArray = true
@ -187,16 +201,20 @@ func StartRound(gettingNext : bool):
#var origdelay = shellLoader.dialogue.incrementDelay #var origdelay = shellLoader.dialogue.incrementDelay
#shellLoader.dialogue.incrementDelay = .1 #shellLoader.dialogue.incrementDelay = .1
if (!playerData.cutterDialogueRead): 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 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 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 await get_tree().create_timer(4.8, false).timeout
shellLoader.dialogue.scaling = false
shellLoader.dialogue.HideText() shellLoader.dialogue.HideText()
playerData.cutterDialogueRead = true playerData.cutterDialogueRead = true
else: 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 await get_tree().create_timer(3, false).timeout
shellLoader.dialogue.HideText() shellLoader.dialogue.HideText()
await(deficutter.InitialSetup()) await(deficutter.InitialSetup())
@ -303,10 +321,32 @@ func BeginPlayerTurn():
if (requestedWireCut): if (requestedWireCut):
await(defibCutter.CutWire(wireToCut)) await(defibCutter.CutWire(wireToCut))
await get_tree().create_timer(.6, false).timeout await get_tree().create_timer(.6, false).timeout
playerCurrentTurnItemArray = []
perm.SetStackInvalidIndicators() perm.SetStackInvalidIndicators()
cursor.SetCursor(true, true) cursor.SetCursor(true, true)
perm.SetIndicators(true) perm.SetIndicators(true)
perm.SetInteractionPermissions(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): func OutOfHealth(who : String):
if (who == "player"): if (who == "player"):
@ -320,6 +360,11 @@ var prevscore = 0
var mainscore = 0 var mainscore = 0
var elapsed = 0 var elapsed = 0
var dur = 3 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 lerpingscore = false
var startscore var startscore
var endscore var endscore
@ -329,14 +374,26 @@ var endscore
@export var speaker_show : AudioStreamPlayer2D @export var speaker_show : AudioStreamPlayer2D
@export var speaker_hide : AudioStreamPlayer2D @export var speaker_hide : AudioStreamPlayer2D
@export var btnParent_doubleor : Control
@export var btn_yes : Control
func BeginScoreLerp(): func BeginScoreLerp():
startscore = prevscore startscore = prevscore
if (!doubling): 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 prevscore = endscore
double_or_nothing_score = prevscore
double_or_nothing_initial_score = prevscore
else: else:
doubled = true
endscore = prevscore * 2 endscore = prevscore * 2
prevscore = endscore prevscore = endscore
double_or_nothing_rounds_beat += 1
double_or_nothing_score = prevscore
doubling = true doubling = true
speaker_slot.play() speaker_slot.play()
camera.BeginLerp("yes no") camera.BeginLerp("yes no")
@ -357,9 +414,17 @@ func BeginScoreLerp():
cursor.SetCursor(true, true) cursor.SetCursor(true, true)
intbranch_no.interactionAllowed = true intbranch_no.interactionAllowed = true
intbranch_yes.interactionAllowed = true intbranch_yes.interactionAllowed = true
btnParent_doubleor.visible = true
if (cursor.controller_active): btn_yes.grab_focus()
controller.previousFocus = btn_yes
pass pass
func RevertDoubleUI():
btnParent_doubleor.visible = false
@export var ach : Achievement
func Response(rep : bool): func Response(rep : bool):
RevertDoubleUI()
intbranch_no.interactionAllowed = false intbranch_no.interactionAllowed = false
intbranch_yes.interactionAllowed = false intbranch_yes.interactionAllowed = false
cursor.SetCursor(false, false) cursor.SetCursor(false, false)
@ -389,7 +454,6 @@ func LerpScore():
if (lerpingscore): if (lerpingscore):
elapsed += get_process_delta_time() elapsed += get_process_delta_time()
var c = clampf(elapsed / dur, 0.0, 1.0) var c = clampf(elapsed / dur, 0.0, 1.0)
print("c: ", c)
var score = lerp(startscore, endscore, c) var score = lerp(startscore, endscore, c)
ui_score.text = str(int(score)) ui_score.text = str(int(score))
@ -422,6 +486,7 @@ func EndMainBatch():
if (endless): musicManager.EndTrack() if (endless): musicManager.EndTrack()
await get_tree().create_timer(.4, false).timeout await get_tree().create_timer(.4, false).timeout
if (endless): if (endless):
counting = false
BeginScoreLerp() BeginScoreLerp()
return return
#gameover.PlayerWon() #gameover.PlayerWon()

View File

@ -1,6 +1,8 @@
class_name SaveFileManager extends Node 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 = {} var data = {}
@export var roundManager : RoundManager @export var roundManager : RoundManager
@export var isMainMenu : bool @export var isMainMenu : bool
@ -36,20 +38,6 @@ func SaveGame():
} }
var file = FileAccess.open(savePath, FileAccess.WRITE) var file = FileAccess.open(savePath, FileAccess.WRITE)
file.store_var(data) 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() file.close()
func LoadGame(): func LoadGame():
@ -78,20 +66,6 @@ func LoadGame():
roundManager.playerData.stat_doorsKicked = data.stat_doorsKicked roundManager.playerData.stat_doorsKicked = data.stat_doorsKicked
roundManager.playerData.stat_cigSmoked = data.stat_cigSmoked roundManager.playerData.stat_cigSmoked = data.stat_cigSmoked
roundManager.playerData.stat_beerDrank = data.stat_beerDrank 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() file.close()
func ClearSave(): func ClearSave():

View File

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

View File

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

View File

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

View File

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

View File

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