Files
1f38cfcce7 Add new gizmode (#96314)
## 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 <-->
2026-06-17 11:02:09 +02:00

47 lines
2.0 KiB
Plaintext

/// The master datum that handles every bit of gizmo code
/// Just so you will understand the full insanity of this:
/// object > gizmo_controller > gizmo_puzzle + gizmo_interface > gizmode > gizpulse > callbacks
/datum/gizmo_controller
/// Can hold different interacting modes (wires, voice) and connected interfaces
var/list/interfaces = list(GIZMO_INTERFACE_WIRES = /datum/gizmo_interface)
/// Instanted interfaces. really just here so I can check this shit in vv
var/list/instances = list()
/// Generate interfaces for interacting with the gizmo
/datum/gizmo_controller/proc/generate_interfaces(atom/movable/holder)
for(var/interface_define, interface_type in interfaces)
var/list/callbacks = list()
var/datum/gizmo_interface/interface_instance = new interface_type (src)
interface_instance.generate_interface(holder, callbacks)
instances += interface_instance
switch(interface_define)
if(GIZMO_INTERFACE_WIRES)
holder.set_wires(new /datum/wires/gizmo(holder, interface_instance.puzzle))
if(GIZMO_INTERFACE_VOICE)
holder.AddComponent(/datum/component/gizmo_voice, interface_instance.puzzle)
/// Wired with an interface that moves
/datum/gizmo_controller/beyblade
interfaces = list(GIZMO_INTERFACE_WIRES = /datum/gizmo_interface/beyblade)
/// Wired with an interface that toggles the icon_state and/or glows
/datum/gizmo_controller/toggle
interfaces = list(GIZMO_INTERFACE_WIRES = /datum/gizmo_interface/toggle)
/// Voice controller with a voice puzzle and interface. Comes with a wire interface that gives you the hint to use the voice interface
/datum/gizmo_controller/voice
interfaces = list(GIZMO_INTERFACE_WIRES = /datum/gizmo_interface/voice_unlock, GIZMO_INTERFACE_VOICE = /datum/gizmo_interface/voice)
/// For held gizmo's
/datum/gizmo_controller/item
/// Always horrible agony!
/datum/gizmo_controller/cursed
interfaces = list(GIZMO_INTERFACE_WIRES = /datum/gizmo_interface/cursed)
/// Hard-mode code-crack
/datum/gizmo_controller/moo
interfaces = list(GIZMO_INTERFACE_WIRES = /datum/gizmo_interface/moo)