mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-20 22:16:51 +00:00
## About The Pull Request - Afterattack is a very simple proc now: All it does is this, and all it's used for is for having a convenient place to put effects an item does after a successful attack (IE, the attack was not blocked)  - An overwhelming majority of afterattack implementations have been moved to `interact_with_atom` or the new `ranged_interact_with_atom` I have manually tested many of the refactored procs but there was 200+ so it's kinda hard ## Why It's Good For The Game Afterattack is one of the worst parts of the attack chain, as it simultaneously serves as a way of doing random interactions NOT AT ALL related to attacks (despite the name) while ALSO serving as the defacto way to do a ranged interaction with an item This means careless coders (most of them) may throw stuff in afterattack without realizing how wide reaching it is, which causes bugs. By making two well defined, separate procs for handing adjacent vs ranged interactions, it becomes WAY WAY WAY more easy to develop for. If you want to do something when you click on something else and you're adjacent, use `interact_with_atom` If you want to do something when you click on something else and you're not adjacent, use 'ranged_interact_with_atom` This does result in some instances of boilerplate as shown here:  But I think it's acceptable, feel free to oppose if you don't I'm sure we can think of another solution ~~Additionally it makes it easier to implement swing combat. That's a bonus I guess~~ ## Changelog 🆑 Melbert refactor: Over 200 item interactions have been refactored to use a newer, easier-to-use system. Report any oddities with using items on other objects you may see (such as surgery, reagent containers like cups and spray bottles, or construction devices), especially using something at range (such as guns or chisels) refactor: Item-On-Modsuit interactions have changed slightly. While on combat mode, you will attempt to "use" the item on the suit instead of inserting it into the suit's storage. This means being on combat mode while the suit's panel is open will block you from inserting items entirely via click (but other methods such as hotkey, clicking on the storage boxes, and mousedrop will still work). refactor: The detective's scanner will now be inserted into storage items if clicked normally, and will scan the storage item if on combat mode /🆑
153 lines
4.2 KiB
Plaintext
153 lines
4.2 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/ranged_interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers)
|
|
return interact_with_atom(interacting_with, user, modifiers)
|
|
|
|
/obj/item/door_remote/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
|