mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-14 17:45:02 +01:00
1f38cfcce7
## About The Pull Request <details> <summary>About the gizmode</summary> - It creates a code that the user needs to crack. - The interface for the code is much like those RPG maker combination locks: <img width="190" height="107" alt="image" src="https://github.com/user-attachments/assets/8b64d29a-7585-4e61-9308-7d66eb01f32b" /> - You can cycle the selected position and the selected digit, then send the code to test it. - After every cracking attempt, the code is reset and some sort of feedback is provided, including how many attempts are left. - There are 2 versions of this gizmo, the "tutorial" and the "hard-mode". - The "tutorial" code is 2 digits long, and it tells the user whether the digits they inputted are higher, lower or exactly the same as the solution digits ("over/under" feedback). - The "hard-mode" code is 2-3 digits long "bulls and cows" puzzle, essentially. It can only be accessed by solving the tutorial. </details> Also, fixed a bug I noticed where users didn't have a way to interact with item gizmo wires ## Why It's Good For The Game The gizmodes that currently exist are simply way too easy to work with. We gotta spice it up with some real interface hell. ## Changelog 🆑 add: new gizmode fix: you can now interact with item gizmo wires /🆑 --------- Co-authored-by: l0 <-->
75 lines
2.5 KiB
Plaintext
75 lines
2.5 KiB
Plaintext
/// Essentially a small wrapper that holds the puzzle datum and connects it with the operating modes of the machine
|
|
/datum/gizmo_interface
|
|
/// The gizmo master ultra mega controller
|
|
var/datum/gizmo_controller/controller
|
|
/// The puzzle that connects the interface to the activation callbacks and checks if you pulsed the right sequences
|
|
var/datum/gizmo_puzzle/puzzle = /datum/gizmo_puzzle
|
|
|
|
/// List (or list define) for the gizmodes to pick
|
|
var/list/possible_active_modes = GIZMO_COMMON_MODES
|
|
/// Guaranteed active pulses
|
|
var/list/guaranteed_active_gizmodes = list()
|
|
/// The gizmode instances
|
|
var/list/active_gizmodes = list()
|
|
|
|
/// Min modes to select from possible_active_modes
|
|
var/min_modes = 1
|
|
/// Max modes to select from possible_active_modes
|
|
var/max_modes = 2
|
|
|
|
/datum/gizmo_interface/New(datum/gizmo_controller/controller)
|
|
. = ..()
|
|
|
|
src.controller = controller
|
|
|
|
/// Instantiate the active modes, tell them to instantiate and pass their callbacks to the puzzle maker
|
|
/datum/gizmo_interface/proc/generate_interface(atom/movable/holder, datum/callback/pulse_callback)
|
|
var/list/trigger_callbacks = list()
|
|
var/list/modes_to_spawn = list() + guaranteed_active_gizmodes
|
|
|
|
for(var/i in 1 to rand(min_modes, max_modes))
|
|
var/path = pick_weight_take(possible_active_modes)
|
|
if(!path)
|
|
break
|
|
modes_to_spawn += path
|
|
|
|
for(var/path in modes_to_spawn)
|
|
var/datum/gizmodes/mode = new path ()
|
|
mode.generate_modes(trigger_callbacks, src)
|
|
active_gizmodes += mode
|
|
|
|
puzzle = new puzzle ()
|
|
puzzle.generate_code_sequences(trigger_callbacks)
|
|
|
|
/// Moves around. Guaranteed to have a mode that controles the movement
|
|
/datum/gizmo_interface/beyblade
|
|
guaranteed_active_gizmodes = list(/datum/gizmodes/mover)
|
|
min_modes = 0
|
|
max_modes = 1
|
|
|
|
/// Guaranteed to have a lights mode
|
|
/datum/gizmo_interface/toggle
|
|
guaranteed_active_gizmodes = list(/datum/gizmodes/lights)
|
|
|
|
/// Guaranteed to have a mode that will give a voice components secret keywords. Assumes there's a voice interface added by the gizmo_controller
|
|
/datum/gizmo_interface/voice_unlock
|
|
guaranteed_active_gizmodes = list(/datum/gizmodes/voice)
|
|
min_modes = 0
|
|
max_modes = 0
|
|
|
|
/// For the actual voice operated puzzle. Is a bit more forgiving
|
|
/datum/gizmo_interface/voice
|
|
puzzle = /datum/gizmo_puzzle/voice
|
|
|
|
/// Always bad!
|
|
/datum/gizmo_interface/cursed
|
|
possible_active_modes = list(
|
|
/datum/gizmodes/bad = 1,
|
|
)
|
|
max_modes = 1
|
|
|
|
/datum/gizmo_interface/moo
|
|
guaranteed_active_gizmodes = list(/datum/gizmodes/code_crack/moo)
|
|
min_modes = 0
|
|
max_modes = 0
|