Files
Bubberstation/code/game/objects/items/control_wand.dm
MrMelbert 8486f2f7e2 Storage / table interactions at the bottom of the interaction chain (#85512)
Because the wings were in fact made of wax 

## About The Pull Request

Storage goes to the very bottom of the interaction chain, hardcoded in
on `/atom`.
This is not preferred, obviously, but it ends up being a lot less
snowflaking overall.

Tables also go at the very bottom by extending `base_item_interaction`. 

Fixes #83742
Fixes #84434 
Fixes #83982
Fixes #85516
Fixes #84990
Fixes #84890
Closes #85036
Closes #84025 (RMB places it on the table.)
Closes #86616

Other changes:

Refactored pod storage to be less jank. Patches some exploits around it.

## Why It's Good For The Game

Should make a lot more interactions a lot more reliable... hopefully

## Changelog

🆑 Melbert
refactor: Storage and Tables are now a lower priority action, meaning
some uses of items on storage should work... better, now. Here's hoping
at least, report any oddities.
refactor: Note: For an overwhelming majority of items, **combat mode**
will attempt to attack/insert into the target, while **non-combat-mode**
will attempt to use on a target. This means screwdrivering or emagging a
MODsuit must be done on non-combat-mode, as combat mode will simply put
the screwdriver or emag into its storage. Same applies to tables, though
when in doubt, RMB may help (for things which are also weapons, like
mops).
refactor: Refactored escape pod storage, now they actually properly show
as unlocked on red alert and above.
/🆑
2024-09-12 23:48:19 +02:00

155 lines
4.3 KiB
Plaintext

#define WAND_OPEN "open"
#define WAND_BOLT "bolt"
#define WAND_EMERGENCY "emergency"
/obj/item/door_remote
icon_state = "remote"
base_icon_state = "remote"
inhand_icon_state = "electronic"
lefthand_file = 'icons/mob/inhands/items/devices_lefthand.dmi'
righthand_file = 'icons/mob/inhands/items/devices_righthand.dmi'
icon = 'icons/obj/devices/remote.dmi'
name = "control wand"
desc = "A remote for controlling a set of airlocks."
w_class = WEIGHT_CLASS_TINY
var/department = "civilian"
var/mode = WAND_OPEN
var/region_access = REGION_GENERAL
var/list/access_list
/obj/item/door_remote/Initialize(mapload)
. = ..()
access_list = SSid_access.get_region_access_list(list(region_access))
update_icon_state()
/obj/item/door_remote/attack_self(mob/user)
var/static/list/desc = list(WAND_OPEN = "Open Door", WAND_BOLT = "Toggle Bolts", WAND_EMERGENCY = "Toggle Emergency Access")
switch(mode)
if(WAND_OPEN)
mode = WAND_BOLT
if(WAND_BOLT)
mode = WAND_EMERGENCY
if(WAND_EMERGENCY)
mode = WAND_OPEN
update_icon_state()
balloon_alert(user, "mode: [desc[mode]]")
/obj/item/door_remote/interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers)
if(!istype(interacting_with, /obj/machinery/door) && !isturf(interacting_with))
return NONE
return ranged_interact_with_atom(interacting_with, user, modifiers)
/obj/item/door_remote/ranged_interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers)
var/obj/machinery/door/door
if (istype(interacting_with, /obj/machinery/door))
door = interacting_with
if (!door.opens_with_door_remote)
return ITEM_INTERACT_BLOCKING
else
for (var/obj/machinery/door/door_on_turf in get_turf(interacting_with))
if (door_on_turf.opens_with_door_remote)
door = door_on_turf
break
if (isnull(door))
return ITEM_INTERACT_BLOCKING
if (!door.check_access_list(access_list) || !door.requiresID())
interacting_with.balloon_alert(user, "can't access!")
return ITEM_INTERACT_BLOCKING
var/obj/machinery/door/airlock/airlock = door
if (!door.hasPower() || (istype(airlock) && !airlock.canAIControl()))
interacting_with.balloon_alert(user, mode == WAND_OPEN ? "it won't budge!" : "nothing happens!")
return ITEM_INTERACT_BLOCKING
switch (mode)
if (WAND_OPEN)
if (door.density)
door.open()
else
door.close()
if (WAND_BOLT)
if (!istype(airlock))
interacting_with.balloon_alert(user, "only airlocks!")
return ITEM_INTERACT_BLOCKING
if (airlock.locked)
airlock.unbolt()
log_combat(user, airlock, "unbolted", src)
else
airlock.bolt()
log_combat(user, airlock, "bolted", src)
if (WAND_EMERGENCY)
if (!istype(airlock))
interacting_with.balloon_alert(user, "only airlocks!")
return ITEM_INTERACT_BLOCKING
airlock.emergency = !airlock.emergency
airlock.update_appearance(UPDATE_ICON)
return ITEM_INTERACT_SUCCESS
/obj/item/door_remote/update_icon_state()
var/icon_state_mode
switch(mode)
if(WAND_OPEN)
icon_state_mode = "open"
if(WAND_BOLT)
icon_state_mode = "bolt"
if(WAND_EMERGENCY)
icon_state_mode = "emergency"
icon_state = "[base_icon_state]_[department]_[icon_state_mode]"
return ..()
/obj/item/door_remote/omni
name = "omni door remote"
desc = "This control wand can access any door on the station."
department = "omni"
region_access = REGION_ALL_STATION
/obj/item/door_remote/captain
name = "command door remote"
department = "command"
region_access = REGION_COMMAND
/obj/item/door_remote/chief_engineer
name = "engineering door remote"
department = "engi"
region_access = REGION_ENGINEERING
/obj/item/door_remote/research_director
name = "research door remote"
department = "sci"
region_access = REGION_RESEARCH
/obj/item/door_remote/head_of_security
name = "security door remote"
department = "security"
region_access = REGION_SECURITY
/obj/item/door_remote/quartermaster
name = "supply door remote"
desc = "Remotely controls airlocks. This remote has additional Vault access."
department = "cargo"
region_access = REGION_SUPPLY
/obj/item/door_remote/chief_medical_officer
name = "medical door remote"
department = "med"
region_access = REGION_MEDBAY
/obj/item/door_remote/civilian
name = "civilian door remote"
department = "civilian"
region_access = REGION_GENERAL
#undef WAND_OPEN
#undef WAND_BOLT
#undef WAND_EMERGENCY