Milestones have effects

This commit is contained in:
Rob Kelly 2025-04-19 17:13:36 -06:00
parent 5dba027b4c
commit ed303fce4b
7 changed files with 167 additions and 6 deletions

View File

@ -34,6 +34,11 @@ func idle() -> void:
_idle() _idle()
## Is this tool available to the player?
func unlocked() -> bool:
return true
func _physics_process(delta: float) -> void: func _physics_process(delta: float) -> void:
if hud_tool: if hud_tool:
var weight := 1 - exp(-hud_accel * delta) var weight := 1 - exp(-hud_accel * delta)

View File

@ -15,6 +15,10 @@ const BRUSH_SCALE := 0.2
@onready var resting_position: Marker3D = %RestingPosition @onready var resting_position: Marker3D = %RestingPosition
func unlocked() -> bool:
return Game.manager.toothbrush_unlocked
func _fire() -> void: func _fire() -> void:
if raycast.is_colliding() and not Game.manager.is_tank_full(): if raycast.is_colliding() and not Game.manager.is_tank_full():
brush_animation.play("brush") brush_animation.play("brush")

View File

@ -23,8 +23,11 @@ signal player_dead
const MAX_ALERT := 6 const MAX_ALERT := 6
const BASE_TANK_LIMIT := 96000
const BIG_TANK_LIMIT := 198000
## Maximum amount of grunk the player can carry in their tank. ## Maximum amount of grunk the player can carry in their tank.
@export var grunk_tank_limit := 120000 @export var grunk_tank_limit := BASE_TANK_LIMIT
# TODO figure this out # TODO figure this out
@export var grunk_quota := 2000000 @export var grunk_quota := 2000000
@ -32,10 +35,19 @@ const MAX_ALERT := 6
## Grunk collection milestones ## Grunk collection milestones
@export var vault_milestones: Dictionary[int, Milestone] @export var vault_milestones: Dictionary[int, Milestone]
@export_group("Progress")
@export var mp3_player_unlocked := false
@export var toothbrush_unlocked := false
@export var stickers_unlocked := false
var debug_emit_alert_signal: int: var debug_emit_alert_signal: int:
set(value): set(value):
alert_raised.emit(value) alert_raised.emit(value)
var debug_unlock_milestone: Milestone:
set(value):
milestone_reached.emit(value)
## Amount of grunk the player is currently carrying. ## Amount of grunk the player is currently carrying.
var grunk_tank := 0.0 var grunk_tank := 0.0
@ -123,6 +135,18 @@ func next_milestone_amount() -> int:
return -1 return -1
func _on_milestone(milestone: Milestone) -> void:
if milestone.mp3_player:
mp3_player_unlocked = true
elif milestone.toothbrush:
toothbrush_unlocked = true
elif milestone.stickers:
stickers_unlocked = true
elif milestone.big_tank:
grunk_tank_limit = BIG_TANK_LIMIT
# TODO the rest
## Called by Player on death. ## Called by Player on death.
func on_player_death() -> void: func on_player_death() -> void:
player_dead.emit() player_dead.emit()

View File

@ -8,6 +8,15 @@ script = ExtResource("2_b83gw")
name = "[no reward]" name = "[no reward]"
message = "Check the MANUAL for SWEET TIPZ message = "Check the MANUAL for SWEET TIPZ
from the GRUNKIN' MASTERS!" from the GRUNKIN' MASTERS!"
bonus_track = false
mp3_player = false
toothbrush = false
seminar = false
big_tank = false
stickers = false
quota = false
mystery = false
fiesta = false
metadata/_custom_type_script = "uid://ufxoxupdvyd5" metadata/_custom_type_script = "uid://ufxoxupdvyd5"
[sub_resource type="Resource" id="Resource_b83gw"] [sub_resource type="Resource" id="Resource_b83gw"]
@ -15,6 +24,15 @@ script = ExtResource("2_b83gw")
name = "MP3 PLAYER" name = "MP3 PLAYER"
message = "MP3 PLAYER DECRYPTED. Enjoy some message = "MP3 PLAYER DECRYPTED. Enjoy some
light music whilst you GRUNK." light music whilst you GRUNK."
bonus_track = false
mp3_player = true
toothbrush = false
seminar = false
big_tank = false
stickers = false
quota = false
mystery = false
fiesta = false
metadata/_custom_type_script = "uid://ufxoxupdvyd5" metadata/_custom_type_script = "uid://ufxoxupdvyd5"
[sub_resource type="Resource" id="Resource_o6um0"] [sub_resource type="Resource" id="Resource_o6um0"]
@ -22,6 +40,15 @@ script = ExtResource("2_b83gw")
name = "TOOTHBRUSH" name = "TOOTHBRUSH"
message = "TOOTHBRUSH DECRYPTED. message = "TOOTHBRUSH DECRYPTED.
Enjoy teethbrushing in moderation!" Enjoy teethbrushing in moderation!"
bonus_track = false
mp3_player = false
toothbrush = true
seminar = false
big_tank = false
stickers = false
quota = false
mystery = false
fiesta = false
metadata/_custom_type_script = "uid://ufxoxupdvyd5" metadata/_custom_type_script = "uid://ufxoxupdvyd5"
[sub_resource type="Resource" id="Resource_vebb4"] [sub_resource type="Resource" id="Resource_vebb4"]
@ -29,6 +56,15 @@ script = ExtResource("2_b83gw")
name = "BONUS TRACK" name = "BONUS TRACK"
message = "BONUS TRACK DELIVERED message = "BONUS TRACK DELIVERED
[TODO]" [TODO]"
bonus_track = true
mp3_player = false
toothbrush = false
seminar = false
big_tank = false
stickers = false
quota = false
mystery = false
fiesta = false
metadata/_custom_type_script = "uid://ufxoxupdvyd5" metadata/_custom_type_script = "uid://ufxoxupdvyd5"
[sub_resource type="Resource" id="Resource_aolyc"] [sub_resource type="Resource" id="Resource_aolyc"]
@ -36,6 +72,15 @@ script = ExtResource("2_b83gw")
name = "WELLNESS SEMINAR" name = "WELLNESS SEMINAR"
message = "SEMINAR DECRYPTED. message = "SEMINAR DECRYPTED.
The FUTURE of WELLNESS is TODAY!" The FUTURE of WELLNESS is TODAY!"
bonus_track = false
mp3_player = false
toothbrush = false
seminar = true
big_tank = false
stickers = false
quota = false
mystery = false
fiesta = false
metadata/_custom_type_script = "uid://ufxoxupdvyd5" metadata/_custom_type_script = "uid://ufxoxupdvyd5"
[sub_resource type="Resource" id="Resource_36cpv"] [sub_resource type="Resource" id="Resource_36cpv"]
@ -43,6 +88,15 @@ script = ExtResource("2_b83gw")
name = "EL TANK GRANDE" name = "EL TANK GRANDE"
message = "\"EL TANK GRANDE\" DECRYPTED. message = "\"EL TANK GRANDE\" DECRYPTED.
GRUNK carrying capacity increased." GRUNK carrying capacity increased."
bonus_track = false
mp3_player = false
toothbrush = false
seminar = false
big_tank = true
stickers = false
quota = false
mystery = false
fiesta = false
metadata/_custom_type_script = "uid://ufxoxupdvyd5" metadata/_custom_type_script = "uid://ufxoxupdvyd5"
[sub_resource type="Resource" id="Resource_pfnwj"] [sub_resource type="Resource" id="Resource_pfnwj"]
@ -50,6 +104,15 @@ script = ExtResource("2_b83gw")
name = "STICKER PACK" name = "STICKER PACK"
message = "NOW PRINTING... You can use message = "NOW PRINTING... You can use
STICKERS to EXPRESS your \"SELF\"" STICKERS to EXPRESS your \"SELF\""
bonus_track = false
mp3_player = false
toothbrush = false
seminar = false
big_tank = false
stickers = true
quota = false
mystery = false
fiesta = false
metadata/_custom_type_script = "uid://ufxoxupdvyd5" metadata/_custom_type_script = "uid://ufxoxupdvyd5"
[sub_resource type="Resource" id="Resource_p7jc6"] [sub_resource type="Resource" id="Resource_p7jc6"]
@ -57,23 +120,49 @@ script = ExtResource("2_b83gw")
name = "QUOTA" name = "QUOTA"
message = "QUOTA SATISFIED. message = "QUOTA SATISFIED.
FINE WORK GRUNKER !" FINE WORK GRUNKER !"
bonus_track = false
mp3_player = false
toothbrush = false
seminar = false
big_tank = false
stickers = false
quota = true
mystery = false
fiesta = false
metadata/_custom_type_script = "uid://ufxoxupdvyd5" metadata/_custom_type_script = "uid://ufxoxupdvyd5"
[sub_resource type="Resource" id="Resource_2eyq5"] [sub_resource type="Resource" id="Resource_2eyq5"]
script = ExtResource("2_b83gw") script = ExtResource("2_b83gw")
name = "???" name = "???"
message = "????? ?" message = "????? ?"
bonus_track = false
mp3_player = false
toothbrush = false
seminar = false
big_tank = false
stickers = false
quota = false
mystery = true
fiesta = false
metadata/_custom_type_script = "uid://ufxoxupdvyd5" metadata/_custom_type_script = "uid://ufxoxupdvyd5"
[sub_resource type="Resource" id="Resource_2qxxw"] [sub_resource type="Resource" id="Resource_2qxxw"]
script = ExtResource("2_b83gw") script = ExtResource("2_b83gw")
name = "TACO FIESTA" name = "taco fiesta"
message = "ENJOY THE FIESTA GRUNKER !" message = "ENJOY THE FIESTA GRUNKER !"
bonus_track = false
mp3_player = false
toothbrush = false
seminar = false
big_tank = false
stickers = false
quota = false
mystery = false
fiesta = true
metadata/_custom_type_script = "uid://ufxoxupdvyd5" metadata/_custom_type_script = "uid://ufxoxupdvyd5"
[node name="GameManager" type="Node"] [node name="GameManager" type="Node"]
script = ExtResource("1_08e4a") script = ExtResource("1_08e4a")
grunk_tank_limit = 96000
vault_milestones = Dictionary[int, ExtResource("2_b83gw")]({ vault_milestones = Dictionary[int, ExtResource("2_b83gw")]({
0: SubResource("Resource_h4r54"), 0: SubResource("Resource_h4r54"),
100000: SubResource("Resource_b83gw"), 100000: SubResource("Resource_b83gw"),
@ -91,3 +180,5 @@ vault_milestones = Dictionary[int, ExtResource("2_b83gw")]({
4200000: SubResource("Resource_vebb4"), 4200000: SubResource("Resource_vebb4"),
6400000: SubResource("Resource_2qxxw") 6400000: SubResource("Resource_2qxxw")
}) })
[connection signal="milestone_reached" from="." to="." method="_on_milestone"]

View File

@ -3,3 +3,14 @@ class_name Milestone extends Resource
@export var name: String @export var name: String
@export_multiline var message: String @export_multiline var message: String
@export_group("Effects")
@export var bonus_track := false
@export var mp3_player := false
@export var toothbrush := false
@export var seminar := false
@export var big_tank := false
@export var stickers := false
@export var quota := false
@export var mystery := false
@export var fiesta := false

View File

@ -75,6 +75,7 @@ static var instance: Player
func _ready() -> void: func _ready() -> void:
Game.manager.milestone_reached.connect(_on_milestone)
instance = self instance = self
@ -157,6 +158,20 @@ func get_grabbed() -> void:
camera_pivot.reset_pitch(0.4) camera_pivot.reset_pitch(0.4)
#endregion
#region Event Handlers
func _on_milestone(milestone: Milestone) -> void:
if milestone.mp3_player:
pass # TODO equip mp3 player
if milestone.toothbrush:
tool_mount.set_active(toothbrush)
if milestone.stickers:
pass # TODO equip stickers
func _signal_death() -> void: func _signal_death() -> void:
# Called from the death animation # Called from the death animation
Game.manager.on_player_death() Game.manager.on_player_death()

View File

@ -18,7 +18,11 @@ func get_active() -> Tool:
## Sets the given tool as active. ## Sets the given tool as active.
## ##
## The tool should be a child of this mount. ## The tool should be a child of this mount.
func set_active(tool: Tool) -> void: ## If the tool is not unlocked and `force` is false, this will have no effect.
func set_active(tool: Tool, force: bool = false) -> void:
if not force and not tool.unlocked():
return
for c: Node3D in get_children(): for c: Node3D in get_children():
c.visible = false c.visible = false
# TODO unequip animation? # TODO unequip animation?
@ -32,5 +36,12 @@ func set_active(tool: Tool) -> void:
## Use this for "select next/prev tool" functions. ## Use this for "select next/prev tool" functions.
func set_active_relative(delta: int) -> void: func set_active_relative(delta: int) -> void:
var active_idx := _active.get_index() var active_idx := _active.get_index()
var new_idx := wrapi(active_idx + delta, 0, get_child_count()) while true:
set_active(get_child(new_idx) as Tool) var new_idx := wrapi(active_idx + delta, 0, get_child_count())
var tool := get_child(new_idx) as Tool
if tool.unlocked():
set_active(tool)
return
# If the next tool is not unlocked, try the one after
# NOTE: this will loop forever if the player has no tools unlocked!
active_idx = new_idx