Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows + Frames can be attacked in help intent #16186

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions code/game/objects/structures/window.dm
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,15 @@
take_damage(damage * 2, BRUTE, MELEE)
return TRUE

/obj/structure/window/attackby(obj/item/I, mob/user, params)
/obj/structure/window/attackby(obj/item/attacking_item, mob/user, params)
. = ..()
if(.)
return
return TRUE

if(I.item_flags & NOBLUDGEON)
if(attacking_item.item_flags & NOBLUDGEON)
return

else if(isscrewdriver(I) && deconstructable)
else if(isscrewdriver(attacking_item) && deconstructable)
dismantle = TRUE
if(reinf && state >= 1)
state = 3 - state
Expand All @@ -184,12 +184,19 @@
else if(!reinf || (static_frame && state == 0))
deconstruct(TRUE)

else if(iscrowbar(I) && reinf && state <= 1 && deconstructable)
else if(iscrowbar(attacking_item) && reinf && state <= 1 && deconstructable)
dismantle = TRUE
state = 1 - state
playsound(loc, 'sound/items/crowbar.ogg', 25, 1)
to_chat(user, (state ? span_notice("You have pried the window into the frame.") : span_notice("You have pried the window out of the frame.")))

if(user.a_intent == INTENT_HARM)
return
Comment on lines +193 to +194
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

???

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Harm intent is handled on the parent call.


if(!(obj_flags & CAN_BE_HIT))
return

return attacking_item.attack_obj(src, user)

/obj/structure/window/deconstruct(disassembled = TRUE)
if(disassembled)
Expand Down
16 changes: 12 additions & 4 deletions code/game/objects/structures/window_frame.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@
new /obj/alien/weeds(loc)
return ..()

/obj/structure/window_frame/attackby(obj/item/I, mob/user, params)
/obj/structure/window_frame/attackby(obj/item/attacking_item, mob/user, params)
. = ..()
if(.)
return

if(istype(I, sheet_type))
var/obj/item/stack/sheet/sheet = I
if(istype(attacking_item, sheet_type))
var/obj/item/stack/sheet/sheet = attacking_item
if(sheet.get_amount() < 2)
to_chat(user, span_warning("You need more [I] to install a new window."))
to_chat(user, span_warning("You need more [attacking_item] to install a new window."))
return
user.visible_message(span_notice("[user] starts installing a new glass window on the frame."), \
span_notice("You start installing a new window on the frame."))
Expand All @@ -85,6 +85,14 @@
new window_type(loc) //This only works on Theseus windows!
qdel(src)

if(user.a_intent == INTENT_HARM)
return

if(!(obj_flags & CAN_BE_HIT))
return

return attacking_item.attack_obj(src, user)

/obj/structure/window_frame/grab_interact(obj/item/grab/grab, mob/user, base_damage = BASE_OBJ_SLAM_DAMAGE, is_sharp = FALSE)
. = ..()
if(.)
Expand Down
Loading