diff --git a/code/__HELPERS/traits.dm b/code/__HELPERS/traits.dm index a1ef0b53949..1f7bf5fe9a2 100644 --- a/code/__HELPERS/traits.dm +++ b/code/__HELPERS/traits.dm @@ -206,6 +206,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai //***** ITEM TRAITS *****// #define TRAIT_BUTCHERS_HUMANS "butchers_humans" #define TRAIT_CMAGGED "cmagged" +/// Forces open doors after a delay specific to the item +#define TRAIT_FORCES_OPEN_DOORS_ITEM "forces_open_doors_item_varient" /// A surgical tool; when in hand in help intent (and with a surgery in progress) won't attack the user #define TRAIT_SURGICAL "surgical_tool" diff --git a/code/_globalvars/traits.dm b/code/_globalvars/traits.dm index f985eb67f4b..5889271442c 100644 --- a/code/_globalvars/traits.dm +++ b/code/_globalvars/traits.dm @@ -70,12 +70,14 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_ELITE_CHALLENGER" = TRAIT_ELITE_CHALLENGER, "TRAIT_SOAPY_MOUTH" = TRAIT_SOAPY_MOUTH, "TRAIT_UNREVIVABLE" = TRAIT_UNREVIVABLE, - "TRAIT_SHOW_WIRE_INFO" = TRAIT_SHOW_WIRE_INFO + "TRAIT_SHOW_WIRE_INFO" = TRAIT_SHOW_WIRE_INFO, + "TRAIT_CAN_BE_EATEN_BY_LIZARDS" = TRAIT_EDIBLE_BUG ), /obj/item = list( "TRAIT_SHOW_WIRE_INFO" = TRAIT_SHOW_WIRE_INFO, "TRAIT_BUTCHER_HUMANS" = TRAIT_BUTCHERS_HUMANS, - "TRAIT_CMAGGED" = TRAIT_CMAGGED + "TRAIT_CMAGGED" = TRAIT_CMAGGED, + "TRAIT_FORCES_OPEN_DOORS" = TRAIT_FORCES_OPEN_DOORS_ITEM ) )) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 361c605d9a5..26548e91c18 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -1161,20 +1161,8 @@ GLOBAL_LIST_EMPTY(airlock_emissive_underlays) /obj/machinery/door/airlock/try_to_crowbar(mob/living/user, obj/item/I) if(operating) return - if(istype(I, /obj/item/twohanded/fireaxe)) //let's make this more specific //FUCK YOU - var/obj/item/twohanded/fireaxe/F = I - if(F.wielded) - if(density && !prying_so_hard) - playsound(src, 'sound/machines/airlock_alien_prying.ogg', 100, 1) //is it aliens or just the CE being a dick? - prying_so_hard = TRUE //so you dont pry the door when you are already trying to pry it - var/result = do_after(user, 5 SECONDS, target = src) - prying_so_hard = FALSE - if(result) - open(TRUE) - if(density && !open(TRUE)) - to_chat(user, "Despite your attempts, [src] refuses to open.") - else - to_chat(user, "You need to be wielding the fire axe to do that!") + if(HAS_TRAIT(I, TRAIT_FORCES_OPEN_DOORS_ITEM)) + force_open_with_item(user, I) return var/beingcrowbarred = FALSE if(I.tool_behaviour == TOOL_CROWBAR && I.tool_use_check(user, 0)) @@ -1220,6 +1208,33 @@ GLOBAL_LIST_EMPTY(airlock_emissive_underlays) if(density && !open(1)) to_chat(user, "Despite your attempts, [src] refuses to open.") +/obj/machinery/door/airlock/proc/force_open_with_item(mob/living/user, obj/item/I) + /// Used with an istype check to find out if it's a wielded item or not + var/obj/item/twohanded/twohanded_item = I + /// Time it takes to open an airlock with an item with the TRAIT_FORCES_OPEN_DOORS_ITEM trait, 5 seconds for wielded items, 10 seconds for nonwielded items + var/time_to_open_airlock = 10 SECONDS + /// Can we open the airlock while unpowered? Wielded item's can't, but unwielded items can + var/can_force_open_while_unpowered = TRUE + if(istype(twohanded_item)) + can_force_open_while_unpowered = FALSE + time_to_open_airlock = 5 SECONDS + if(!twohanded_item.wielded) + to_chat(user, "You need to be wielding [I] to do that!") + return + if(!density || prying_so_hard) + return + playsound(src, 'sound/machines/airlock_alien_prying.ogg', 100, 1) //is it aliens or just the CE being a dick? + if(!arePowerSystemsOn() && can_force_open_while_unpowered) + open(TRUE) + return + prying_so_hard = TRUE //so you dont pry the door when you are already trying to pry it + var/result = do_after(user, time_to_open_airlock, target = src) + prying_so_hard = FALSE + if(result) + open(TRUE) + if(density && !open(TRUE)) + to_chat(user, "Despite your attempts, [src] refuses to open.") + /obj/machinery/door/airlock/open(forced=0) if(operating || welded || locked || emagged) return 0 diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index bb4339ddc4b..067d7a15ed9 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -256,12 +256,12 @@ if(HAS_TRAIT(src, TRAIT_CMAGGED) && I.can_clean()) //If the cmagged door is being hit with cleaning supplies, don't open it, it's being cleaned! return - if(user.a_intent != INTENT_HARM && istype(I, /obj/item/twohanded/fireaxe)) + if(user.a_intent != INTENT_HARM && HAS_TRAIT(I, TRAIT_FORCES_OPEN_DOORS_ITEM)) try_to_crowbar(user, I) - return 1 + return TRUE else if(!(I.flags & NOBLUDGEON) && user.a_intent != INTENT_HARM) try_to_activate_door(user) - return 1 + return TRUE return ..() /obj/machinery/door/crowbar_act(mob/user, obj/item/I) diff --git a/code/game/objects/items/weapons/twohanded.dm b/code/game/objects/items/weapons/twohanded.dm index d272bdd57bf..952b4286429 100644 --- a/code/game/objects/items/weapons/twohanded.dm +++ b/code/game/objects/items/weapons/twohanded.dm @@ -204,6 +204,10 @@ armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = 100, ACID = 30) resistance_flags = FIRE_PROOF +/obj/item/twohanded/fireaxe/Initialize(mapload) + . = ..() + ADD_TRAIT(src, TRAIT_FORCES_OPEN_DOORS_ITEM, ROUNDSTART_TRAIT) + /obj/item/twohanded/fireaxe/update_icon_state() //Currently only here to fuck with the on-mob icons. icon_state = "fireaxe[wielded]" diff --git a/code/modules/antagonists/changeling/powers/mutations.dm b/code/modules/antagonists/changeling/powers/mutations.dm index 23bb8861e63..6880ac78ddc 100644 --- a/code/modules/antagonists/changeling/powers/mutations.dm +++ b/code/modules/antagonists/changeling/powers/mutations.dm @@ -123,37 +123,22 @@ throw_range = 0 throw_speed = 0 +/obj/item/melee/arm_blade/Initialize(mapload) + . = ..() + ADD_TRAIT(src, TRAIT_FORCES_OPEN_DOORS_ITEM, ROUNDSTART_TRAIT) + /obj/item/melee/arm_blade/afterattack(atom/target, mob/user, proximity) if(!proximity) return if(istype(target, /obj/structure/table)) var/obj/structure/table/T = target T.deconstruct(FALSE) + return - else if(istype(target, /obj/machinery/computer)) + if(istype(target, /obj/machinery/computer)) var/obj/machinery/computer/C = target C.attack_alien(user) //muh copypasta - else if(istype(target, /obj/machinery/door/airlock)) - var/obj/machinery/door/airlock/A = target - - if(!A.requiresID() || A.allowed(user)) //This is to prevent stupid shit like hitting a door with an arm blade, the door opening because you have acces and still getting a "the airlocks motors resist our efforts to force it" message. - return - - if(A.locked) - to_chat(user, "The airlock's bolts prevent it from being forced.") - return - - if(A.arePowerSystemsOn()) - user.visible_message("[user] jams [src] into the airlock and starts prying it open!", "We start forcing the airlock open.", \ - "You hear a metal screeching sound.") - playsound(A, 'sound/machines/airlock_alien_prying.ogg', 150, 1) - if(!do_after(user, 100, target = A)) - return - - //user.say("Heeeeeeeeeerrre's Johnny!") - user.visible_message("[user] forces the airlock to open with [user.p_their()] [name]!", "We force the airlock to open.", "You hear a metal screeching sound.") - A.open(2) /***************************************\ |***********COMBAT TENTACLES*************|