Files
Bubberstation/code/game/objects/items/control_wand.dm
nevimer 3bddc6c821 Missed Mirror: Remove NTNet from doors (saves 0.2s of init) -- Fixes windoors not wo (#18976)
* Remove NTNet from doors (saves 0.2s of init) -- Fixes windoors not working with remotes, and balloons them (#71735)

## About The Pull Request
Removes NTNet from doors. NTNet as a whole is getting excised, but this
was an enormous cost to initialize. Was only used for door remotes, so
just changes them to act on the door directly.

Windoors were supposed to be controllable, but were broken at some point
to always display an error message in chat.

Closes https://github.com/tgstation/dev-cycles-initiative/issues/3

## Changelog

🆑
fix: Door remotes now open windoors again.
qol: Door remotes now use balloon alerts for failures.
/🆑

(cherry picked from commit db2566f44d)

# Conflicts:
#	code/game/machinery/doors/airlock.dm

* Update airlock.dm

---------

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com>
2023-02-11 23:39:17 -08:00

131 lines
3.4 KiB
Plaintext

#define WAND_OPEN "open"
#define WAND_BOLT "bolt"
#define WAND_EMERGENCY "emergency"
/obj/item/door_remote
icon_state = "gangtool-white"
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/device.dmi'
name = "control wand"
desc = "Remotely controls airlocks."
w_class = WEIGHT_CLASS_TINY
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))
/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
balloon_alert(user, "mode: [desc[mode]]")
// Airlock remote works by sending NTNet packets to whatever it's pointed at.
/obj/item/door_remote/afterattack(atom/target, mob/user)
. = ..()
var/obj/machinery/door/door
if (istype(target, /obj/machinery/door))
door = target
if (!door.opens_with_door_remote)
return
else
for (var/obj/machinery/door/door_on_turf in get_turf(target))
if (door_on_turf.opens_with_door_remote)
door = door_on_turf
break
if (isnull(door))
return
if (!door.check_access_list(access_list) || !door.requiresID())
target.balloon_alert(user, "can't access!")
return
var/obj/machinery/door/airlock/airlock = door
if (!door.hasPower() || (istype(airlock) && !airlock.canAIControl()))
target.balloon_alert(user, mode == WAND_OPEN ? "it won't budge!" : "nothing happens!")
return
switch (mode)
if (WAND_OPEN)
if (door.density)
door.open()
else
door.close()
if (WAND_BOLT)
if (!istype(airlock))
target.balloon_alert(user, "only airlocks!")
return
if (airlock.locked)
airlock.unbolt()
else
airlock.bolt()
if (WAND_EMERGENCY)
if (!istype(airlock))
target.balloon_alert(user, "only airlocks!")
return
airlock.emergency = !airlock.emergency
airlock.update_appearance(UPDATE_ICON)
/obj/item/door_remote/omni
name = "omni door remote"
desc = "This control wand can access any door on the station."
icon_state = "gangtool-yellow"
region_access = REGION_ALL_STATION
/obj/item/door_remote/captain
name = "command door remote"
icon_state = "gangtool-yellow"
region_access = REGION_COMMAND
/obj/item/door_remote/chief_engineer
name = "engineering door remote"
icon_state = "gangtool-orange"
region_access = REGION_ENGINEERING
/obj/item/door_remote/research_director
name = "research door remote"
icon_state = "gangtool-purple"
region_access = REGION_RESEARCH
/obj/item/door_remote/head_of_security
name = "security door remote"
icon_state = "gangtool-red"
region_access = REGION_SECURITY
/obj/item/door_remote/quartermaster
name = "supply door remote"
desc = "Remotely controls airlocks. This remote has additional Vault access."
icon_state = "gangtool-green"
region_access = REGION_SUPPLY
/obj/item/door_remote/chief_medical_officer
name = "medical door remote"
icon_state = "gangtool-blue"
region_access = REGION_MEDBAY
/obj/item/door_remote/civilian
name = "civilian door remote"
icon_state = "gangtool-white"
region_access = REGION_GENERAL
#undef WAND_OPEN
#undef WAND_BOLT
#undef WAND_EMERGENCY