Skip to content

Commit

Permalink
[MIRROR] Removes unused code for HTML UIs (#1932)
Browse files Browse the repository at this point in the history
* Removes unused code for HTML UIs

* Merge conflicts

* Update dancing_pole.dm

* Deprecated proc

* More of those

---------

Co-authored-by: John Willard <[email protected]>
Co-authored-by: Mal <[email protected]>
  • Loading branch information
3 people authored and StealsThePRs committed Apr 15, 2024
1 parent 453b13e commit 7f401c8
Show file tree
Hide file tree
Showing 31 changed files with 94 additions and 203 deletions.
7 changes: 2 additions & 5 deletions code/__DEFINES/interaction_flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@
#define INTERACT_MACHINE_OPEN_SILICON (1<<4)
/// must be silicon to interact
#define INTERACT_MACHINE_REQUIRES_SILICON (1<<5)
/// This flag determines if a machine set_machine's the user when the user uses it, making updateUsrDialog make the user re-call interact() on it.
/// This is exclusively used for non-TGUI UIs, and its instances should be removed when moved to TGUI.
#define INTERACT_MACHINE_SET_MACHINE (1<<6)
/// the user must have vision to interact (blind people need not apply)
#define INTERACT_MACHINE_REQUIRES_SIGHT (1<<7)
#define INTERACT_MACHINE_REQUIRES_SIGHT (1<<6)
/// the user must be able to read to interact
#define INTERACT_MACHINE_REQUIRES_LITERACY (1<<8)
#define INTERACT_MACHINE_REQUIRES_LITERACY (1<<7)
16 changes: 16 additions & 0 deletions code/__DEFINES/obj_flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


#define EMAGGED (1<<0)
<<<<<<< HEAD

Check failure on line 5 in code/__DEFINES/obj_flags.dm

View workflow job for this annotation

GitHub Actions / Run Linters

got '<<', expected one of: newline, '/', identifier
#define IN_USE (1<<1) // If we have a user using us, this will be set on. We will check if the user has stopped using us, and thus stop updating and LAGGING EVERYTHING!
#define CAN_BE_HIT (1<<2) //can this be bludgeoned by items?
#define DANGEROUS_POSSESSION (1<<3) //Admin possession yes/no
Expand All @@ -16,6 +17,21 @@
#define INFINITE_RESKIN (1<<12) // We can reskin this item infinitely
#define CONDUCTS_ELECTRICITY (1<<13) //! Can this object conduct electricity?
#define NO_DECONSTRUCTION (1<<14) //! Atoms don't spawn anything when deconstructed. They just vanish
=======
#define CAN_BE_HIT (1<<1) //can this be bludgeoned by items?
#define DANGEROUS_POSSESSION (1<<2) //Admin possession yes/no
#define UNIQUE_RENAME (1<<3) // can you customize the description/name of the thing?
#define BLOCK_Z_OUT_DOWN (1<<4) // Should this object block z falling from loc?
#define BLOCK_Z_OUT_UP (1<<5) // Should this object block z uprise from loc?
#define BLOCK_Z_IN_DOWN (1<<6) // Should this object block z falling from above?
#define BLOCK_Z_IN_UP (1<<7) // Should this object block z uprise from below?
#define BLOCKS_CONSTRUCTION (1<<8) //! Does this object prevent things from being built on it?
#define BLOCKS_CONSTRUCTION_DIR (1<<9) //! Does this object prevent same-direction things from being built on it?
#define IGNORE_DENSITY (1<<10) //! Can we ignore density when building on this object? (for example, directional windows and grilles)
#define INFINITE_RESKIN (1<<11) // We can reskin this item infinitely
#define CONDUCTS_ELECTRICITY (1<<12) //! Can this object conduct electricity?
#define NO_DEBRIS_AFTER_DECONSTRUCTION (1<<13) //! Atoms don't spawn anything when deconstructed. They just vanish
>>>>>>> 9d06343b826 ([MIRROR] Removes unused code for HTML UIs (#1932))

// If you add new ones, be sure to add them to /obj/Initialize as well for complete mapping support

Expand Down
29 changes: 17 additions & 12 deletions code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,14 @@ DEFINE_BITFIELD(interaction_flags_atom, list(
))

DEFINE_BITFIELD(interaction_flags_machine, list(
"INTERACT_MACHINE_ALLOW_SILICON" = INTERACT_MACHINE_ALLOW_SILICON,
"INTERACT_MACHINE_OFFLINE" = INTERACT_MACHINE_OFFLINE,
"INTERACT_MACHINE_OPEN" = INTERACT_MACHINE_OPEN,
"INTERACT_MACHINE_OFFLINE" = INTERACT_MACHINE_OFFLINE,
"INTERACT_MACHINE_WIRES_IF_OPEN" = INTERACT_MACHINE_WIRES_IF_OPEN,
"INTERACT_MACHINE_ALLOW_SILICON" = INTERACT_MACHINE_ALLOW_SILICON,
"INTERACT_MACHINE_OPEN_SILICON" = INTERACT_MACHINE_OPEN_SILICON,
"INTERACT_MACHINE_REQUIRES_SILICON" = INTERACT_MACHINE_REQUIRES_SILICON,
"INTERACT_MACHINE_REQUIRES_SIGHT" = INTERACT_MACHINE_REQUIRES_SIGHT,
"INTERACT_MACHINE_REQUIRES_LITERACY" = INTERACT_MACHINE_REQUIRES_LITERACY,
"INTERACT_MACHINE_REQUIRES_SILICON" = INTERACT_MACHINE_REQUIRES_SILICON,
"INTERACT_MACHINE_SET_MACHINE" = INTERACT_MACHINE_SET_MACHINE,
"INTERACT_MACHINE_WIRES_IF_OPEN" = INTERACT_MACHINE_WIRES_IF_OPEN,
))

DEFINE_BITFIELD(interaction_flags_item, list(
Expand Down Expand Up @@ -282,20 +281,26 @@ DEFINE_BITFIELD(movement_type, list(
))

DEFINE_BITFIELD(obj_flags, list(
"BLOCK_Z_IN_DOWN" = BLOCK_Z_IN_DOWN,
"BLOCK_Z_IN_UP" = BLOCK_Z_IN_UP,
"EMAGGED" = EMAGGED,
"CAN_BE_HIT" = CAN_BE_HIT,
"DANGEROUS_POSSESSION" = DANGEROUS_POSSESSION,
"UNIQUE_RENAME" = UNIQUE_RENAME,
"BLOCK_Z_OUT_DOWN" = BLOCK_Z_OUT_DOWN,
"BLOCK_Z_OUT_UP" = BLOCK_Z_OUT_UP,
"BLOCKS_CONSTRUCTION_DIR" = BLOCKS_CONSTRUCTION_DIR,
"BLOCK_Z_IN_DOWN" = BLOCK_Z_IN_DOWN,
"BLOCK_Z_IN_UP" = BLOCK_Z_IN_UP,
"BLOCKS_CONSTRUCTION" = BLOCKS_CONSTRUCTION,
"CAN_BE_HIT" = CAN_BE_HIT,
"CONDUCTS_ELECTRICITY" = CONDUCTS_ELECTRICITY,
"DANGEROUS_POSSESSION" = DANGEROUS_POSSESSION,
"EMAGGED" = EMAGGED,
"BLOCKS_CONSTRUCTION_DIR" = BLOCKS_CONSTRUCTION_DIR,
"IGNORE_DENSITY" = IGNORE_DENSITY,
<<<<<<< HEAD
"IN_USE" = IN_USE,
"NO_DECONSTRUCTION" = NO_DECONSTRUCTION,
"UNIQUE_RENAME" = UNIQUE_RENAME,
=======
"INFINITE_RESKIN" = INFINITE_RESKIN,
"CONDUCTS_ELECTRICITY" = CONDUCTS_ELECTRICITY,
"NO_DEBRIS_AFTER_DECONSTRUCTION" = NO_DEBRIS_AFTER_DECONSTRUCTION,
>>>>>>> 9d06343b826 ([MIRROR] Removes unused code for HTML UIs (#1932))
))

DEFINE_BITFIELD(pass_flags, list(
Expand Down
2 changes: 0 additions & 2 deletions code/controllers/subsystem/tgui.dm
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ SUBSYSTEM_DEF(tgui)
for(var/datum/tgui/ui in user.tgui_open_uis)
if(ui.window && ui.window.id == window_id)
ui.close(can_be_suspended = FALSE)
// Unset machine just to be sure.
user.unset_machine()
// Close window directly just to be sure.
user << browse(null, "window=[window_id]")

Expand Down
4 changes: 0 additions & 4 deletions code/datums/browser.dm
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,3 @@
src.Topic(href, params2list(href), hsrc) // this will direct to the atom's
return // Topic() proc via client.Topic()

// no atomref specified (or not found)
// so just reset the user mob's machine var
if(src?.mob)
src.mob.unset_machine()
5 changes: 0 additions & 5 deletions code/game/atom/_atom.dm
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,6 @@
/atom/proc/return_analyzable_air()
return null

///Check if this atoms eye is still alive (probably)
/atom/proc/check_eye(mob/user)
SIGNAL_HANDLER
return

/atom/proc/Bumped(atom/movable/bumped_atom)
set waitfor = FALSE
SEND_SIGNAL(src, COMSIG_ATOM_BUMPED, bumped_atom)
Expand Down
6 changes: 1 addition & 5 deletions code/game/machinery/_machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@
if(drop)
dump_inventory_contents()
update_appearance()
updateUsrDialog()

/**
* Drop every movable atom in the machine's contents list, including any components and circuit.
Expand Down Expand Up @@ -423,7 +422,6 @@
if(target && !target.has_buckled_mobs() && (!isliving(target) || !mobtarget.buckled))
set_occupant(target)
target.forceMove(src)
updateUsrDialog()
update_appearance()

///updates the use_power var for this machine and updates its static power usage from its area to reflect the new value
Expand Down Expand Up @@ -668,10 +666,8 @@

//Return a non FALSE value to interrupt attack_hand propagation to subtypes.
/obj/machinery/interact(mob/user)
if(interaction_flags_machine & INTERACT_MACHINE_SET_MACHINE)
user.set_machine(src)
update_last_used(user)
. = ..()
return ..()

/obj/machinery/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
add_fingerprint(usr)
Expand Down
27 changes: 13 additions & 14 deletions code/game/machinery/camera/camera.dm
Original file line number Diff line number Diff line change
Expand Up @@ -216,19 +216,19 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/camera/xray, 0)
return
if(. & EMP_PROTECT_SELF)
return
if(prob(150 / severity))
network = list()
GLOB.cameranet.removeCamera(src)
set_machine_stat(machine_stat | EMPED)
set_light(0)
emped++ //Increase the number of consecutive EMP's
update_appearance()
addtimer(CALLBACK(src, PROC_REF(post_emp_reset), emped, network), reset_time)
for(var/mob/M as anything in GLOB.player_list)
if (M.client?.eye == src)
M.unset_machine()
M.reset_perspective(null)
to_chat(M, span_warning("The screen bursts into static!"))
if(!prob(150 / severity))
return
network = list()
GLOB.cameranet.removeCamera(src)
set_machine_stat(machine_stat | EMPED)
set_light(0)
emped++ //Increase the number of consecutive EMP's
update_appearance()
addtimer(CALLBACK(src, PROC_REF(post_emp_reset), emped, network), reset_time)
for(var/mob/M as anything in GLOB.player_list)
if (M.client?.eye == src)
M.reset_perspective(null)
to_chat(M, span_warning("The screen bursts into static!"))

/obj/machinery/camera/proc/on_saboteur(datum/source, disrupt_duration)
SIGNAL_HANDLER
Expand Down Expand Up @@ -371,7 +371,6 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/camera/xray, 0)
//I guess that doesn't matter since they can't use it anyway?
for(var/mob/O as anything in GLOB.player_list)
if (O.client?.eye == src)
O.unset_machine()
O.reset_perspective(null)
to_chat(O, span_warning("The screen bursts into static!"))

Expand Down
31 changes: 17 additions & 14 deletions code/game/machinery/computer/camera_advanced.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@
/obj/machinery/proc/remove_eye_control(mob/living/user)
CRASH("[type] does not implement ai eye handling")

/obj/machinery/computer/camera_advanced/proc/give_eye_control(mob/user)
if(isnull(user?.client))
return
GrantActions(user)
current_user = user
eyeobj.eye_user = user
eyeobj.name = "Camera Eye ([user.name])"
user.remote_control = eyeobj
user.reset_perspective(eyeobj)
eyeobj.setLoc(eyeobj.loc)
if(should_supress_view_changes)
user.client.view_size.supress()
RegisterSignal(user, COMSIG_MOVABLE_MOVED, PROC_REF(check_eye))

/obj/machinery/computer/camera_advanced/remove_eye_control(mob/living/user)
if(isnull(user?.client))
return
Expand All @@ -92,8 +106,10 @@
current_user = null
unset_machine(user)
playsound(src, 'sound/machines/terminal_off.ogg', 25, FALSE)
UnregisterSignal(user, COMSIG_MOVABLE_MOVED)

/obj/machinery/computer/camera_advanced/check_eye(mob/user)
/obj/machinery/computer/camera_advanced/proc/check_eye(mob/user)
SIGNAL_HANDLER
if(!can_use(user) || (issilicon(user) && !user.has_unlimited_silicon_privilege))
unset_machine(user)

Expand Down Expand Up @@ -167,19 +183,6 @@
/obj/machinery/computer/camera_advanced/attack_ai(mob/user)
return //AIs would need to disable their own camera procs to use the console safely. Bugs happen otherwise.

/obj/machinery/computer/camera_advanced/proc/give_eye_control(mob/user)
if(isnull(user?.client))
return
GrantActions(user)
current_user = user
eyeobj.eye_user = user
eyeobj.name = "Camera Eye ([user.name])"
user.remote_control = eyeobj
user.reset_perspective(eyeobj)
eyeobj.setLoc(eyeobj.loc)
if(should_supress_view_changes)
user.client.view_size.supress()

/mob/camera/ai_eye/remote
name = "Inactive Camera Eye"
ai_detector_visible = FALSE
Expand Down
1 change: 0 additions & 1 deletion code/game/machinery/telecomms/computers/telemonitor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
/obj/machinery/computer/telecomms/monitor
name = "telecommunications monitoring console"
desc = "Monitors the details of the telecommunications network it's synced with."

circuit = /obj/item/circuitboard/computer/comm_monitor

icon_screen = "comm_monitor"
Expand Down
4 changes: 0 additions & 4 deletions code/game/objects/items/flamethrower.dm
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,6 @@
sleep(0.1 SECONDS)
previousturf = T
operating = FALSE
for(var/mob/M in viewers(1, loc))
if((M.client && M.machine == src))
attack_self(M)


/obj/item/flamethrower/proc/default_ignite(turf/target, release_amount = 0.05)
//TODO: DEFERRED Consider checking to make sure tank pressure is high enough before doing this...
Expand Down
8 changes: 4 additions & 4 deletions code/game/objects/items/paiwire.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
icon = 'icons/obj/stack_objects.dmi'
icon_state = "wire1"
item_flags = NOBLUDGEON
var/obj/machinery/machine //what machine we're currently hacking.
///The current machine being hacked by the pAI cable.
var/obj/machinery/hacking_machine

/obj/item/pai_cable/Destroy()
machine = null
hacking_machine = null
return ..()


/obj/item/pai_cable/proc/plugin(obj/machinery/M, mob/living/user)
if(!user.transferItemToLoc(src, M))
return
user.visible_message(span_notice("[user] inserts [src] into a data port on [M]."), span_notice("You insert [src] into a data port on [M]."), span_hear("You hear the satisfying click of a wire jack fastening into place."))
machine = M
hacking_machine = M
79 changes: 1 addition & 78 deletions code/game/objects/objs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -117,88 +117,13 @@ GLOBAL_LIST_EMPTY(objects_by_id_tag)
else
return null

/obj/proc/updateUsrDialog()
if(!(obj_flags & IN_USE))
return

var/is_in_use = FALSE
var/list/nearby = viewers(1, src)
for(var/mob/M in nearby)
if ((M.client && M.machine == src))
is_in_use = TRUE
ui_interact(M)
if(issilicon(usr) || isAdminGhostAI(usr))
if (!(usr in nearby))
if (usr.client && usr.machine == src) // && M.machine == src is omitted because if we triggered this by using the dialog, it doesn't matter if our machine changed in between triggering it and this - the dialog is probably still supposed to refresh.
is_in_use = TRUE
ui_interact(usr)

// check for TK users

if(ishuman(usr))
var/mob/living/carbon/human/H = usr
if(!(usr in nearby))
if(usr.client && usr.machine == src)
if(H.dna.check_mutation(/datum/mutation/human/telekinesis))
is_in_use = TRUE
ui_interact(usr)
if (is_in_use)
obj_flags |= IN_USE
else
obj_flags &= ~IN_USE

/obj/proc/updateDialog(update_viewers = TRUE,update_ais = TRUE)
// Check that people are actually using the machine. If not, don't update anymore.
if(obj_flags & IN_USE)
var/is_in_use = FALSE
if(update_viewers)
for(var/mob/M in viewers(1, src))
if ((M.client && M.machine == src))
is_in_use = TRUE
src.interact(M)
var/ai_in_use = FALSE
if(update_ais)
ai_in_use = AutoUpdateAI(src)

if(update_viewers && update_ais) //State change is sure only if we check both
if(!ai_in_use && !is_in_use)
obj_flags &= ~IN_USE


/obj/attack_ghost(mob/user)
. = ..()
if(.)
return
SEND_SIGNAL(src, COMSIG_ATOM_UI_INTERACT, user)
ui_interact(user)

/mob/proc/unset_machine()
SIGNAL_HANDLER
if(!machine)
return
UnregisterSignal(machine, COMSIG_QDELETING)
machine.on_unset_machine(src)
machine = null

//called when the user unsets the machine.
/atom/movable/proc/on_unset_machine(mob/user)
return

/mob/proc/set_machine(obj/O)
if(QDELETED(src) || QDELETED(O))
return
if(machine)
unset_machine()
machine = O
RegisterSignal(O, COMSIG_QDELETING, PROC_REF(unset_machine))
if(istype(O))
O.obj_flags |= IN_USE

/obj/item/proc/updateSelfDialog()
var/mob/M = src.loc
if(istype(M) && M.client && M.machine == src)
src.attack_self(M)

/obj/singularity_pull(S, current_size)
..()
if(move_resist == INFINITY)
Expand All @@ -209,9 +134,6 @@ GLOBAL_LIST_EMPTY(objects_by_id_tag)
/obj/get_dumping_location()
return get_turf(src)

/obj/proc/check_uplink_validity()
return 1

/obj/vv_get_dropdown()
. = ..()
VV_DROPDOWN_OPTION("", "---")
Expand Down Expand Up @@ -333,6 +255,7 @@ GLOBAL_LIST_EMPTY(objects_by_id_tag)

// Should move all contained objects to it's location.
/obj/proc/dump_contents()
SHOULD_CALL_PARENT(FALSE)
CRASH("Unimplemented.")

/obj/handle_ricochet(obj/projectile/P)
Expand Down
Loading

0 comments on commit 7f401c8

Please sign in to comment.