Skip to content

Commit f8ad96b

Browse files
[MIRROR] Made admin only shells not interactable to non-admins (#341)
* Made admin only shells not interactable to non-admins (#60949) Admins don't need to id lock their shells * Made admin only shells not interactable to non-admins Co-authored-by: Watermelon914 <[email protected]>
1 parent d2f6651 commit f8ad96b

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

code/datums/components/shell.dm

+35-1
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,22 @@
9191

9292
/datum/component/shell/proc/on_object_deconstruct()
9393
SIGNAL_HANDLER
94-
if(!attached_circuit.admin_only)
94+
if(!attached_circuit?.admin_only)
9595
remove_circuit()
9696

9797
/datum/component/shell/proc/on_attack_ghost(datum/source, mob/dead/observer/ghost)
9898
SIGNAL_HANDLER
99+
if(!is_authorized(ghost))
100+
return
101+
99102
if(attached_circuit)
100103
INVOKE_ASYNC(attached_circuit, /datum.proc/ui_interact, ghost)
101104

102105
/datum/component/shell/proc/on_examine(datum/source, mob/user, list/examine_text)
103106
SIGNAL_HANDLER
107+
if(!is_authorized(user))
108+
return
109+
104110
if(!attached_circuit)
105111
examine_text += span_notice("There is no integrated circuit attached.")
106112
return
@@ -127,6 +133,9 @@
127133
*/
128134
/datum/component/shell/proc/on_attack_by(atom/source, obj/item/item, mob/living/attacker)
129135
SIGNAL_HANDLER
136+
if(!is_authorized(attacker))
137+
return
138+
130139
if(istype(item, /obj/item/stock_parts/cell))
131140
source.balloon_alert(attacker, "can't put cell in directly!")
132141
return
@@ -178,6 +187,9 @@
178187

179188
/datum/component/shell/proc/on_multitool_act(atom/source, mob/user, obj/item/tool)
180189
SIGNAL_HANDLER
190+
if(!is_authorized(user))
191+
return
192+
181193
if(!attached_circuit)
182194
return
183195

@@ -195,6 +207,9 @@
195207
*/
196208
/datum/component/shell/proc/on_screwdriver_act(atom/source, mob/user, obj/item/tool)
197209
SIGNAL_HANDLER
210+
if(!is_authorized(user))
211+
return
212+
198213
if(!attached_circuit)
199214
return
200215

@@ -283,6 +298,8 @@
283298

284299
/datum/component/shell/proc/on_atom_usb_cable_try_attach(atom/source, obj/item/usb_cable/usb_cable, mob/user)
285300
SIGNAL_HANDLER
301+
if(!is_authorized(user))
302+
return
286303

287304
if (!(shell_flags & SHELL_FLAG_USB_PORT))
288305
source.balloon_alert(user, "this shell has no usb ports")
@@ -294,3 +311,20 @@
294311

295312
usb_cable.attached_circuit = attached_circuit
296313
return COMSIG_USB_CABLE_CONNECTED_TO_CIRCUIT
314+
315+
/**
316+
* Determines if a user is authorized to see the existance of this shell. Returns false if they are not
317+
*
318+
* Arguments:
319+
* * user - The user to check if they are authorized
320+
*/
321+
/datum/component/shell/proc/is_authorized(mob/user)
322+
if(shell_flags & SHELL_FLAG_CIRCUIT_FIXED)
323+
return FALSE
324+
325+
if(attached_circuit?.admin_only)
326+
if(check_rights_for(user.client, R_VAREDIT))
327+
return TRUE
328+
return FALSE
329+
330+
return TRUE

0 commit comments

Comments
 (0)