fix incorrect decompilation of some things + add endless mode code + settings menu code

i have severe depression
This commit is contained in:
Lyssa 2024-01-28 15:58:35 +04:00 committed by GitHub
parent 92de9a6c11
commit 02a761a64a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 396 additions and 16 deletions

View File

@ -5,18 +5,29 @@ class_name ButtonClass extends Node
@export var isActive : bool
@export var isDynamic : bool
@export var ui : CanvasItem
@export var ui_control : Control
@export var speaker_press : AudioStreamPlayer2D
@export var speaker_hover : AudioStreamPlayer2D
@export var playing : bool
@export var altsound : bool
var mainActive = true
func _ready():
ui_control = get_parent()
get_parent().connect("mouse_entered", OnHover)
get_parent().connect("mouse_exited", OnExit)
get_parent().connect("pressed", OnPress)
pass
func SetFilter(alias : String):
match(alias):
"ignore":
ui_control.mouse_filter = Control.MOUSE_FILTER_IGNORE
"stop":
ui_control.mouse_filter = Control.MOUSE_FILTER_STOP
func OnHover():
if (isActive):
if (isActive && mainActive):
if (isDynamic):
speaker_hover.pitch_scale = randf_range(.95, 1.0)
speaker_hover.play()
@ -24,13 +35,14 @@ func OnHover():
cursor.SetCursorImage("hover")
func OnExit():
if (isActive):
if (isActive && mainActive):
if (isDynamic):
ui.modulate.a = 1
cursor.SetCursorImage("point")
signal is_pressed
func OnPress():
if (isActive):
if (isActive && mainActive):
if (altsound): speaker_press.play()
if (isDynamic && playing): speaker_press.play()
emit_signal("is_pressed")

View File

@ -111,7 +111,11 @@ func Kill(who : String, trueDeath : bool, returningShotgun : bool):
func MainDeathRoutine():
var loadingHeaven = false
if(shotgunShooting.roundManager.wireIsCut_player):
if (shotgunShooting.roundManager.endless):
await get_tree().create_timer(.5, false).timeout
get_tree().change_scene_to_file("res://scenes/death.tscn")
return
if (shotgunShooting.roundManager.wireIsCut_player):
shotgunShooting.roundManager.playerData.enteringFromTrueDeath = true
loadingHeaven = true
shotgunShooting.roundManager.playerData.playerEnteringFromDeath = true

View File

@ -103,6 +103,9 @@ func SetupEnding():
animator_backdrop.play("loop exterior")
animator_cam.play("camera loop car")
var endless_overwriting = false
var endless_roundsbeat = 0
var endless_score = 0
var glob_text_congratulations
func FinalScore():
var playername = roundManager.playerData.playername
@ -120,12 +123,14 @@ func FinalScore():
if (doors_kicked > 2): total_cash -= new_leg_bones_price
if (total_cash < 0): total_cash = 0
if (endless_overwriting): total_cash = endless_score
#if (playername == "sex"): total_cash = 69
#if (playername == "leet"): total_cash = 1337
#if (playername == "snoop" or playername == "weed" or playername == "kush"): total_cash = 420
var text_congratulations = "CONGRATULATIONS, " + playername + "!"
var text_shotsFired = "shots fired ........ " + str(shots_fired)
if (endless_overwriting): text_shotsFired = "rounds beat ........ " + str(endless_roundsbeat)
var text_shellsEjected = "shells ejected ..... " + str(shells_ejected)
var text_doorsKicked = "doors kicked ....... " + str(doors_kicked)
var text_cigSmoked = "cigarettes smoked .. " + str(cigarettes_smoked)

22
EndlessMode.gd Normal file
View File

@ -0,0 +1,22 @@
class_name Endless extends Node
@export var roundManager : RoundManager
@export var smokerdude : Node3D
@export var display : StandardMaterial3D
@export var displayrounds : CompressedTexture2D
func SetupEndless():
smokerdude.visible = false
roundManager.endless = true
roundManager.playerData.hasReadIntroduction = true
roundManager.playerData.hasReadItemSwapIntroduction = true
roundManager.playerData.hasReadItemDistributionIntro = true
roundManager.playerData.hasReadItemDistributionIntro2 = true
roundManager.playerData.numberOfDialogueRead = 3
roundManager.playerData.skippingShellDescription = true
roundManager.playerData.indicatorShown = true
roundManager.playerData.cutterDialogueRead = true
roundManager.playerData.seenGod = true
roundManager.shellSpawner.skipDialoguePresented = true
roundManager.shellLoadingSpedUp = true
display.albedo_texture = displayrounds

View File

@ -85,7 +85,7 @@ func UpdateDisplayRoutine(isRaisingHealth : bool, goingToPreviousSocket : bool,
if (indicating):
if (isRaisingHealth): speaker_beep.play()
else: speaker_noise.play()
if ((roundManager.health_opponent <= 2 or roundManager.health_player <= 2) && roundManager.playerData.currentBatchIndex == 2):
if ((roundManager.health_opponent <= 2 or roundManager.health_player <= 2) && roundManager.playerData.currentBatchIndex == 2 && !roundManager.endless):
if (roundManager.defibCutterReady && !trueDeathSetup):
#roundManager.musicManager.EndTrack()
speaker_truedeath.play()
@ -175,7 +175,7 @@ func Bootup():
for i in range(uiArray.size()):
uiArray[i].visible = true
await get_tree().create_timer(.85, false).timeout
if (roundManager.playerData.currentBatchIndex == 2 && !settingUpBroken):
if (roundManager.playerData.currentBatchIndex == 2 && !settingUpBroken && !roundManager.endless):
speaker_beep.pitch_scale = .09
SwapSkullSymbols()
settingUpBroken = true

View File

@ -70,6 +70,16 @@ func InteractWith(alias : String):
"signature machine button":
sign.GetInput(activeInteractionBranch.signatureButton_letterAlias, activeInteractionBranch.signatureButton_specialAlias)
activeInteractionBranch.assignedSignatureButton.Press()
"pill bottle":
intro.Interaction_PillBottle()
"pill choice no":
intro.SelectedPill(false)
"pill choice yes":
intro.SelectedPill(true)
"double yes":
shotgun.roundManager.Response(true)
"double no":
shotgun.roundManager.Response(false)
func InteractWithGrid(tempGridIndex : int):
itemManager.PlaceDownItem(tempGridIndex)

View File

@ -3,6 +3,8 @@ class_name IntroManager extends Node
@export var cameraParent : Node3D
@export var intbranch_bathroomdoor : InteractionBranch
@export var intbranch_backroomdoor: InteractionBranch
@export var intbranch_pillbottle : InteractionBranch
@export var parent_pills : Node3D
@export var cursor : CursorManager
@export var roundManager : RoundManager
@export var speaker_amb_restroom : AudioStreamPlayer2D
@ -21,14 +23,27 @@ class_name IntroManager extends Node
@export var dia : Dialogue
@export var blockout : Blockout
@export var animator_hint : AnimationPlayer
@export var animator_pillchoice : AnimationPlayer
@export var speaker_pillchoice : AudioStreamPlayer2D
@export var intbranch_pillyes : InteractionBranch
@export var intbranch_pillno : InteractionBranch
@export var speaker_pillselect : AudioStreamPlayer2D
@export var anim_revert : AnimationPlayer
@export var endlessmode : Endless
var allowingPills = false
func _ready():
await get_tree().create_timer(.5, false).timeout
if (roundManager.playerData.playerEnteringFromDeath && !roundManager.playerData.enteringFromTrueDeath):
RevivalBathroomStart()
else:
MainBathroomStart()
pass
if (roundManager.playerData.playerEnteringFromDeath or roundManager.playerData.enteringFromTrueDeath):
parent_pills.visible = false
allowingPills = false
if (!roundManager.playerData.playerEnteringFromDeath && !roundManager.playerData.enteringFromTrueDeath):
parent_pills.visible = true
allowingPills = true
func MainBathroomStart():
RestRoomIdle()
@ -39,6 +54,7 @@ func MainBathroomStart():
Hint()
cursor.SetCursor(true, true)
intbranch_bathroomdoor.interactionAllowed = true
if (allowingPills): intbranch_pillbottle.interactionAllowed = true
func Hint():
await get_tree().create_timer(1, false).timeout
@ -79,6 +95,7 @@ func RevivalBathroomStart():
dia.speaker_click.stream = dia.soundArray_clicks[3]
await get_tree().create_timer(3, false).timeout
cursor.SetCursor(true, true)
if (allowingPills): intbranch_pillbottle.interactionAllowed = true
intbranch_bathroomdoor.interactionAllowed = true
pass
@ -89,6 +106,41 @@ func MainTrackLoad():
bpmlight.BeginMainLoop()
speaker_amb_restroom.play()
func Interaction_PillBottle():
cursor.SetCursor(false, false)
intbranch_bathroomdoor.interactionAllowed = false
intbranch_pillbottle.interactionAllowed = false
animator_camera.play("camera check pills")
await get_tree().create_timer(.6, false).timeout
speaker_pillchoice.play()
await get_tree().create_timer(.3, false).timeout
animator_pillchoice.play("show")
await get_tree().create_timer(.7, false).timeout
cursor.SetCursor(true, true)
intbranch_pillyes.interactionAllowed = true
intbranch_pillno.interactionAllowed = true
func SelectedPill(selected : bool):
cursor.SetCursor(false, false)
animator_pp.play("brightness fade out")
anim_revert.play("revert")
animator_pillchoice.play("hide")
speaker_pillchoice.stop()
speaker_pillselect.play()
intbranch_pillyes.interactionAllowed = false
intbranch_pillno.interactionAllowed = false
await get_tree().create_timer(2.05, false).timeout
if(selected):
parent_pills.visible = false
endlessmode.SetupEndless()
RestRoomIdle()
animator_pp.play("brightness fade in")
await get_tree().create_timer(.6, false).timeout
cursor.SetCursor(true, true)
intbranch_bathroomdoor.interactionAllowed = true
if(!selected): intbranch_pillbottle.interactionAllowed = true
pass
func Interaction_BackroomDoor():
roundManager.playerData.stat_doorsKicked += 1
animator_camera.play("camera enter backroom")
@ -102,6 +154,7 @@ func Interaction_BathroomDoor():
await get_tree().create_timer(5, false).timeout
cursor.SetCursor(true, true)
intbranch_backroomdoor.interactionAllowed = true
intbranch_pillbottle.interactionAllowed = false
pass

View File

@ -6,10 +6,13 @@ class_name MenuManager extends Node
@export var speaker_music : AudioStreamPlayer2D
@export var speaker_start : AudioStreamPlayer2D
@export var buttons : Array[ButtonClass]
@export var buttons_options : Array[ButtonClass]
@export var screen_main : Array[Control]
@export var screen_creds : Array[Control]
@export var screen_options : Array[Control]
@export var title : Node3D
@export var waterfalls : Array[AnimationPlayer]
@export var optionmanager : OptionsManager
func _ready():
Show("main")
@ -17,6 +20,12 @@ func _ready():
buttons[1].connect("is_pressed", Credits)
buttons[2].connect("is_pressed", Exit)
buttons[3].connect("is_pressed", Return)
buttons[4].connect("is_pressed", Options)
buttons[5].connect("is_pressed", Return)
buttons_options[0].connect("is_pressed", IncreaseVol)
buttons_options[1].connect("is_pressed", DecreaseVol)
buttons_options[2].connect("is_pressed", SetFull)
buttons_options[3].connect("is_pressed", SetWindowed)
Intro()
func Intro():
@ -26,24 +35,40 @@ func Intro():
animator_intro.play("splash screen")
await get_tree().create_timer(9, false).timeout
cursor.SetCursor(true, false)
for i in buttons_options:
i.isActive = false
i.SetFilter("ignore")
buttons[0].isActive = true
buttons[0].SetFilter("stop")
buttons[1].isActive = true
buttons[1].SetFilter("stop")
buttons[2].isActive = true
buttons[2].SetFilter("stop")
buttons[4].isActive = true
buttons[4].SetFilter("stop")
pass
func Buttons(state : bool):
if (!state):
for i in buttons: i.isActive = false
else: for i in buttons: i.isActive = true
for i in buttons:
i.isActive = false
i.SetFilter("ignore")
else:
for i in buttons:
i.isActive = true
i.SetFilter("stop")
func Show(what : String):
title.visible = false
for i in screen_main: i.visible = false
for i in screen_creds: i.visible = false
for i in screen_options: i.visible = false
if (what == "credits"): for i in screen_creds: i.visible = true
else: if (what == "main"):
for i in screen_main: i.visible = true
title.visible = true
else: if (what == "options"):
for i in screen_options: i.visible = true
else:
pass
@ -70,6 +95,7 @@ func Credits():
Show("credits")
Buttons(false)
buttons[3].isActive = true
buttons[3].SetFilter("stop")
ResetButtons()
func Exit():
@ -83,6 +109,35 @@ func Exit():
func Return():
Show("main")
Buttons(true)
buttons[3].isActive = false
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()
func Options():
Show("options")
Buttons(false)
buttons[5].isActive = true
buttons[5].SetFilter("stop")
for i in buttons_options:
i.isActive = true
i.SetFilter("stop")
ResetButtons()
func IncreaseVol():
optionmanager.Adjust("increase")
func DecreaseVol():
optionmanager.Adjust("decrease")
func SetWindowed():
optionmanager.Adjust("windowed")
func SetFull():
optionmanager.Adjust("fullscreen")

83
OptionsManager.gd Normal file
View File

@ -0,0 +1,83 @@
class_name OptionsManager extends Node
@export var ui_windowed : CanvasItem
@export var ui_fullscreen : CanvasItem
@export var button_windowed : ButtonClass
@export var button_fullscreen : ButtonClass
@export var menu : MenuManager
@export var ui_volume : Label
const savePath := "user://buckshotroulette_options.save"
var data = {}
var setting_volume = 1
var setting_windowed = false
func _ready():
LoadSettings()
func Adjust(alias : String):
match(alias):
"increase":
if setting_volume != 1:
setting_volume = setting_volume + 0.05
if setting_volume > 1:
setting_volume = 1
UpdateDisplay()
ApplySettings_volume()
"decrease":
if setting_volume != 0:
setting_volume = setting_volume - 0.05
if setting_volume < 0:
setting_volume = 0
UpdateDisplay()
ApplySettings_volume()
"windowed":
setting_windowed = true
ApplySettings_window()
"fullscreen":
setting_windowed = false
ApplySettings_window()
if (alias != "increase" && alias != "decrease"): menu.ResetButtons()
func ApplySettings_volume():
AudioServer.set_bus_volume_db(0, linear_to_db(setting_volume))
UpdateDisplay()
pass
func UpdateDisplay():
ui_volume.text = str(snapped(setting_volume * 100, .01)) + "%"
func ApplySettings_window():
if (!setting_windowed):
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN)
ui_fullscreen.modulate.a = 1
ui_windowed.modulate.a = .5
button_fullscreen.mainActive = false
button_windowed.mainActive = true
else:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
ui_fullscreen.modulate.a = .5
ui_windowed.modulate.a = 1
button_fullscreen.mainActive = true
button_windowed.mainActive = false
pass
func SaveSettings():
data = {
#"has_read_introduction": roundManager.playerData.hasReadIntroduction,
"setting_volume": setting_volume,
"setting_windowed": setting_windowed
}
var file = FileAccess.open(savePath, FileAccess.WRITE)
file.store_var(data)
file.close()
func LoadSettings():
if (FileAccess.file_exists(savePath)):
var file = FileAccess.open(savePath, FileAccess.READ)
data = file.get_var()
setting_volume = data.setting_volume
setting_windowed = data.setting_windowed
file.close()
ApplySettings_volume()
ApplySettings_window()

10
ResetManager.gd Normal file
View File

@ -0,0 +1,10 @@
class_name ResetManager extends Node
@export var save : SaveFileManager
var fs = false
func _unhandled_input(event):
if (event.is_action_pressed("reset") && !fs):
save.ClearSave()
get_tree().change_scene_to_file("res://scenes/death.tscn")
fs = true

View File

@ -36,7 +36,14 @@ var mainBatchIndex : int
@export var gameover : GameOverManager
@export var musicManager : MusicManager
@export var deficutter : DefibCutter
@export var anim_doubleor : AnimationPlayer
@export var anim_yes : AnimationPlayer
@export var anim_no : AnimationPlayer
@export var intbranch_yes : InteractionBranch
@export var intbranch_no : InteractionBranch
@export var speaker_slot : AudioStreamPlayer2D
var endless = false
var shellLoadingSpedUp = false
var dealerItems : Array[String]
var currentShotgunDamage = 1
@ -55,6 +62,9 @@ func _ready():
#await get_tree().create_timer(.2, false).timeout
pass
func _process(delta):
LerpScore()
func BeginMainGame():
MainBatchSetup(true)
@ -113,8 +123,25 @@ func MainBatchSetup(dealerEnterAtStart : bool):
#await get_tree().create_timer(1.5, false).timeout
StartRound(false)
func GenerateRandomBatches():
for b in batchArray:
for i in range(b.roundArray.size()):
b.roundArray[i].startingHealth = randi_range(2, 4)
var total_shells = randi_range(2, 8)
var amount_live = max(1, total_shells / 2)
var amount_blank = total_shells - amount_live
b.roundArray[i].amountBlank = amount_blank
b.roundArray[i].amountLive = amount_live
b.roundArray[i].numberOfItemsToGrab = randi_range(1, 4)
b.roundArray[i].usingItems = true
var flip = randi_range(0, 1)
if flip == 1: b.roundArray[i].shufflingArray = true
#APPEND ROUNDS FROM BATCH
func SetupRoundArray():
if (endless): GenerateRandomBatches()
roundArray = []
for i in range(batchArray.size()):
if (batchArray[i].batchIndex == mainBatchIndex):
@ -137,6 +164,7 @@ func RoundIndicator():
speaker_roundHum.play()
await get_tree().create_timer(.8, false).timeout
roundIndicator.visible = true
brief.ending.endless_roundsbeat += 1
animator_roundIndicator.play("round blinking")
await get_tree().create_timer(2, false).timeout
roundIndicatorParent.visible = false
@ -152,7 +180,7 @@ func StartRound(gettingNext : bool):
#UNCUFF BOTH PARTIES BEFORE ITEM DISTRIBUTION
await (handcuffs.RemoveAllCuffsRoutine())
#FINAL SHOWDOWN DIALOGUE
if (playerData.currentBatchIndex == 2 && !defibCutterReady):
if (playerData.currentBatchIndex == 2 && !defibCutterReady && !endless):
shellLoader.dialogue.dealerLowPitched = true
camera.BeginLerp("enemy")
await get_tree().create_timer(.6, false).timeout
@ -287,6 +315,100 @@ func OutOfHealth(who : String):
await get_tree().create_timer(1, false).timeout
EndMainBatch()
var doubling = false
var prevscore = 0
var mainscore = 0
var elapsed = 0
var dur = 3
var lerpingscore = false
var startscore
var endscore
@export var ui_score : Label3D
@export var ui_doubleornothing : Label3D
@export var speaker_key : AudioStreamPlayer2D
@export var speaker_show : AudioStreamPlayer2D
@export var speaker_hide : AudioStreamPlayer2D
func BeginScoreLerp():
startscore = prevscore
if (!doubling):
endscore = randi_range(50000, 70000)
prevscore = endscore
else:
endscore = prevscore * 2
prevscore = endscore
doubling = true
speaker_slot.play()
camera.BeginLerp("yes no")
await get_tree().create_timer(1.1, false).timeout
ui_score.visible = true
ui_score.text = str(startscore)
await get_tree().create_timer(.5, false).timeout
elapsed = 0
lerpingscore = true
await get_tree().create_timer(3.08, false).timeout
await get_tree().create_timer(.46, false).timeout
ui_score.visible = false
ui_doubleornothing.visible = true
anim_doubleor.play("show")
speaker_show.play()
await get_tree().create_timer(.5, false).timeout
await get_tree().create_timer(1, false).timeout
cursor.SetCursor(true, true)
intbranch_no.interactionAllowed = true
intbranch_yes.interactionAllowed = true
pass
func Response(rep : bool):
intbranch_no.interactionAllowed = false
intbranch_yes.interactionAllowed = false
cursor.SetCursor(false, false)
ui_doubleornothing.visible = false
if (rep): anim_yes.play("press")
else: anim_no.play("press")
speaker_key.play()
await get_tree().create_timer(.4, false).timeout
anim_doubleor.play("hide")
speaker_hide.play()
await get_tree().create_timer(.4, false).timeout
if (!rep):
speaker_slot.stop()
await get_tree().create_timer(.7, false).timeout
brief.ending.endless_score = endscore
brief.ending.endless_overwriting = true
camera.BeginLerp("enemy")
brief.MainRoutine()
else:
speaker_slot.stop()
await get_tree().create_timer(.7, false).timeout
#camera.BeginLerp("enemy")
RestartBatch()
pass
func LerpScore():
if (lerpingscore):
elapsed += get_process_delta_time()
var c = clampf(elapsed / dur, 0.0, 1.0)
print("c: ", c)
var score = lerp(startscore, endscore, c)
ui_score.text = str(int(score))
func RestartBatch():
playerData.currentBatchIndex = 0
if (barrelSawedOff):
await get_tree().create_timer(.6, false).timeout
await(segmentManager.GrowBarrel())
MainBatchSetup(false)
if (!dealerAtTable):
if (!dealerCuffed): animator_dealerHands.play("dealer hands on table")
else: animator_dealerHands.play("dealer hands on table cuffed")
animator_dealer.play("dealer return to table")
for i in range(ejectManagers.size()):
ejectManagers[i].FadeOutShell()
#TRACK MANAGER
await get_tree().create_timer(2, false).timeout
musicManager.LoadTrack_FadeIn()
func EndMainBatch():
#ADD TO BATCH INDEX
ignoring = true
@ -297,7 +419,11 @@ func EndMainBatch():
healthCounter.speaker_truedeath.stop()
healthCounter.DisableCounter()
defibCutter.BlipError_Both()
if (endless): musicManager.EndTrack()
await get_tree().create_timer(.4, false).timeout
if (endless):
BeginScoreLerp()
return
#gameover.PlayerWon()
camera.BeginLerp("enemy")
await get_tree().create_timer(.7, false).timeout

View File

@ -172,7 +172,7 @@ func FinalizeShooting(playerCanGoAgain : bool, placeShotgunOnTable : bool, waitF
#delaying = false
if (roundManager.shellSpawner.sequenceArray.size() == 0 && dealerShotTrue): await get_tree().create_timer(2, false).timeout
#abc
if ((roundManager.health_opponent <= 2 or roundManager.health_player <= 2) && roundManager.playerData.currentBatchIndex == 2):
if ((roundManager.health_opponent <= 2 or roundManager.health_player <= 2) && roundManager.playerData.currentBatchIndex == 2 && !roundManager.endless):
if (roundManager.health_opponent <= 2 && !roundManager.wireIsCut_dealer):
await get_tree().create_timer(2, false).timeout
if (roundManager.health_player <= 2 && !roundManager.wireIsCut_player):
@ -197,7 +197,7 @@ var whoshot = ""
func CheckIfFinalShot():
temphealth_dealer = roundManager.health_opponent - roundManager.currentShotgunDamage
temphealth_player = roundManager.health_player - roundManager.currentShotgunDamage
if (!fired && roundManager.playerData.currentBatchIndex == 2):
if (!fired && roundManager.playerData.currentBatchIndex == 2 && !roundManager.endless):
if (temphealth_player <= 2 && whoshot == "player"):
roundManager.musicManager.EndTrack()
fired = true