Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makes it possible to change the arithmetic comp's mode using another comp #17845

Merged
merged 5 commits into from
Feb 8, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 34 additions & 0 deletions code/modules/mechanics/MechanicMadness.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3212,6 +3212,7 @@ ADMIN_INTERACT_PROCS(/obj/item/mechanics/trigger/button, proc/press)
SEND_SIGNAL(src,COMSIG_MECHCOMP_ADD_INPUT,"Set A", PROC_REF(setA))
SEND_SIGNAL(src,COMSIG_MECHCOMP_ADD_INPUT,"Set B", PROC_REF(setB))
SEND_SIGNAL(src,COMSIG_MECHCOMP_ADD_INPUT,"Evaluate", PROC_REF(evaluate))
SEND_SIGNAL(src,COMSIG_MECHCOMP_ADD_INPUT,"Set Mode", PROC_REF(compSetMode))
SEND_SIGNAL(src,COMSIG_MECHCOMP_ADD_CONFIG,"Set A",PROC_REF(setAManually))
SEND_SIGNAL(src,COMSIG_MECHCOMP_ADD_CONFIG,"Set B",PROC_REF(setBManually))
SEND_SIGNAL(src,COMSIG_MECHCOMP_ADD_CONFIG,"Set Mode",PROC_REF(setMode))
Expand Down Expand Up @@ -3267,6 +3268,39 @@ ADMIN_INTERACT_PROCS(/obj/item/mechanics/trigger/button, proc/press)
tooltip_rebuild = 1
if (autoEval)
src.evaluate()
proc/compSetMode(var/datum/mechanicsMessage/input)
LIGHT_UP_HOUSING
tooltip_rebuild = 1
switch(input.signal)
if("add")
mode = "add"
if("sub")
mode = "sub"
if("div")
mode = "div"
if("mul")
mode = "mul"
if("mod")
mode = "mod"
if("pow")
mode = "pow"
if("rng")
mode = "rng"
if("gt")
mode = "gt"
if("lt")
mode = "lt"
if("gte")
mode = "gte"
if("lte")
mode = "lte"
if("eq")
mode = "eq"
if("neq")
mode = "neq"
else
return
TobleroneSwordfish marked this conversation as resolved.
Show resolved Hide resolved

proc/evaluate()
switch(mode)
if("add")
Expand Down