diff --git a/code/game/objects/structures/signs.dm b/code/game/objects/structures/signs.dm index cfd229cf341..41e2c2e7035 100644 --- a/code/game/objects/structures/signs.dm +++ b/code/game/objects/structures/signs.dm @@ -7,26 +7,16 @@ w_class = ITEMSIZE_NORMAL /obj/structure/sign/ex_act(severity) - switch(severity) - if(1.0) - qdel(src) - return - if(2.0) - qdel(src) - return - if(3.0) - qdel(src) - return - else - return + qdel(src) -/obj/structure/sign/attackby(obj/item/tool as obj, mob/user as mob) //deconstruction +/obj/structure/sign/attackby(obj/item/tool, mob/user) //deconstruction if(tool.isscrewdriver() && !istype(src, /obj/structure/sign/double)) - to_chat(user, "You unfasten the sign with your [tool].") - unfasten() + playsound(get_turf(user), tool.usesound, 50, 1) + unfasten(user) else ..() -/obj/structure/sign/proc/unfasten() +/obj/structure/sign/proc/unfasten(mob/user) + user.visible_message(SPAN_NOTICE("\The [user] unfastens \the [src]."), SPAN_NOTICE("You unfasten \the [src].")) var/obj/item/sign/S = new(src.loc) S.name = name S.desc = desc @@ -320,11 +310,157 @@ icon_state = "doorwreath" layer = 5 +//Flag item +/obj/item/flag + name = "boxed flag" + desc = "A flag neatly folded into a wooden container." + icon = 'icons/obj/decals.dmi' + icon_state = "flag_boxed" + var/flag_path + var/flag_size = 0 + +//Flag on wall +/obj/structure/sign/flag + name = "blank flag" + desc = "Nothing to see here." + icon_state = "flag" + var/icon/ripped_outline = icon('icons/obj/decals.dmi', "ripped") + var/obj/structure/sign/flag/linked_flag //For double flags + var/obj/item/flag/flagtype //For returning your flag + var/ripped = FALSE //If we've been torn down + /obj/structure/sign/flag/blank name = "blank banner" desc = "A blank blue flag." icon_state = "flag" + +/obj/item/flag/afterattack(var/atom/A, var/mob/user, var/adjacent, var/clickparams) + if (!adjacent) + return + + if((!iswall(A) && !istype(A, /obj/structure/window)) || !isturf(user.loc)) + to_chat(user, SPAN_WARNING("You can't place this here!")) + return + + var/placement_dir = get_dir(user, A) + if (!(placement_dir in cardinal)) + to_chat(user, SPAN_WARNING("You must stand directly in front of the location you wish to place that on.")) + return + + var/obj/structure/sign/flag/P = new(user.loc) + + switch(placement_dir) + if(NORTH) + P.pixel_y = 32 + if(SOUTH) + P.pixel_y = -32 + if(EAST) + P.pixel_x = 32 + if(WEST) + P.pixel_x = -32 + + P.dir = placement_dir + if(flag_size) + P.icon_state = "[flag_path]_l" + var/obj/structure/sign/flag/P2 = new(user.loc) + P.linked_flag = P2 + P2.linked_flag = P + P2.icon_state = "[flag_path]_r" + P2.dir = P.dir + switch(P2.dir) + if(NORTH) + P2.pixel_y = P.pixel_y + P2.pixel_x = 32 + if(SOUTH) + P2.pixel_y = P.pixel_y + P2.pixel_x = 32 + if(EAST) + P2.pixel_x = P.pixel_x + P2.pixel_y = -32 + if(WEST) + P2.pixel_x = P.pixel_x + P2.pixel_y = 32 + P2.name = name + P2.desc = desc + P2.desc_info = desc_info + P2.desc_fluff = desc_fluff + P2.flagtype = type + else + P.icon_state = "[flag_path]" + P.name = name + P.desc = desc + P.desc_info = desc_info + P.desc_fluff = desc_fluff + P.flagtype = type + qdel(src) + +/obj/structure/sign/flag/Destroy() + if(linked_flag?.linked_flag == src) //Catches other instances where one half might be destroyed, say by a broken wall, to avoid runtimes. + linked_flag.linked_flag = null //linked_flag + . = ..() + +/obj/structure/sign/flag/ex_act(severity) + switch(severity) + if(1) + qdel(src) + if(2) + if(prob(50)) + qdel(src) + else + rip() + if(3) + rip() + +/obj/structure/sign/flag/unfasten(mob/user) + if(!ripped) + user.visible_message(SPAN_NOTICE("\The [user] unfastens \the [src] and folds it back up."), SPAN_NOTICE("You unfasten \the [src] and fold it back up.")) + var/obj/item/flag/F = new flagtype(get_turf(user)) + user.put_in_hands(F) + else + user.visible_message(SPAN_NOTICE("\The [user] unfastens the tattered remnants of \the [src]."), SPAN_NOTICE("You unfasten the tattered remains of \the [src].")) + if(linked_flag) + qdel(linked_flag) //otherwise you're going to get weird duping nonsense + qdel(src) + +/obj/structure/sign/flag/attack_hand(mob/user) + if(alert("Do you want to rip \the [src] from its place?","You think...","Yes","No") == "Yes") + if(!Adjacent(user)) //Cannot bring up dialogue and walk away + return FALSE + if(!do_after(user, 2 SECONDS, act_target = src)) + return FALSE + visible_message(SPAN_WARNING("\The [user] rips \the [src] in a single, decisive motion!" )) + playsound(src.loc, 'sound/items/poster_ripped.ogg', 100, 1) + add_fingerprint(user) + rip() + +/obj/structure/sign/flag/proc/rip(var/rip_linked = TRUE) + var/icon/I = new('icons/obj/decals.dmi', icon_state) + var/icon/mask = new('icons/obj/decals.dmi', "ripped") + I.AddAlphaMask(mask) + icon = I + name = "ripped flag" + desc = "You can't make out anything from the flag's original print. It's ruined." + ripped = TRUE + if(linked_flag && rip_linked) + linked_flag.rip(FALSE) //Prevents an infinite ripping loop + +/obj/structure/sign/flag/attackby(obj/item/W, mob/user) + ..() + + if(W.isFlameSource()) + + visible_message(SPAN_WARNING("\The [user] starts to burn \the [src] down!")) + if(!do_after(user, 2 SECONDS, act_target = src)) + return FALSE + visible_message(SPAN_WARNING("\The [user] burns \the [src] down!")) + playsound(src.loc, 'sound/items/cigs_lighters/zippo_on.ogg', 100, 1) + new /obj/effect/decal/cleanable/ash(src.loc) + if(linked_flag) + qdel(linked_flag) + qdel(src) + return TRUE + /obj/structure/sign/flag/blank/left icon_state = "flag_l" @@ -679,14 +815,6 @@ /obj/structure/sign/flag/zenghu/right icon_state = "zenghu_r" -/obj/item/flag - name = "boxed flag" - desc = "A flag neatly folded into a wooden container." - icon = 'icons/obj/decals.dmi' - icon_state = "flag_boxed" - var/flag_path - var/flag_size = 0 - /obj/structure/sign/flag/zavodskoi name = "Zavodskoi Interstellar flag" desc = "The logo of Zavodskoi Interstellar on a flag." @@ -936,92 +1064,4 @@ icon_state = "vysoka_l" /obj/structure/sign/flag/vysoka/right - icon_state = "vysoka_r" - -/obj/item/flag/afterattack(var/atom/A, var/mob/user, var/adjacent, var/clickparams) - if (!adjacent) - return - - if((!iswall(A) && !istype(A, /obj/structure/window)) || !isturf(user.loc)) - to_chat(user, SPAN_WARNING("You can't place this here!")) - return - - var/placement_dir = get_dir(user, A) - if (!(placement_dir in cardinal)) - to_chat(user, SPAN_WARNING("You must stand directly in front of the location you wish to place that on.")) - return - - var/obj/structure/sign/flag/P = new(user.loc) - - switch(placement_dir) - if(NORTH) - P.pixel_y = 32 - if(SOUTH) - P.pixel_y = -32 - if(EAST) - P.pixel_x = 32 - if(WEST) - P.pixel_x = -32 - - P.dir = placement_dir - if(flag_size) - P.icon_state = "[flag_path]_l" - var/obj/structure/sign/flag/P2 = new(user.loc) - P2.icon_state = "[flag_path]_r" - P2.dir = P.dir - switch(P2.dir) - if(NORTH) - P2.pixel_y = P.pixel_y - P2.pixel_x = 32 - if(SOUTH) - P2.pixel_y = P.pixel_y - P2.pixel_x = 32 - if(EAST) - P2.pixel_x = P.pixel_x - P2.pixel_y = -32 - if(WEST) - P2.pixel_x = P.pixel_x - P2.pixel_y = 32 - P2.name = name - P2.desc = desc - P2.desc_info = desc_info - P2.desc_fluff = desc_fluff - else - P.icon_state = "[flag_path]" - P.name = name - P.desc = desc - P.desc_info = desc_info - P.desc_fluff = desc_fluff - qdel(src) - - -/obj/structure/sign/flag/attack_hand(mob/user as mob) - - if(alert("Do you want to rip \the [src] from its place?","You think...","Yes","No") == "Yes") - - if(!do_after(user, 2 SECONDS, act_target = src)) - return 0 - - visible_message(SPAN_WARNING("\The [user] rips \the [src] in a single, decisive motion!" )) - playsound(src.loc, 'sound/items/poster_ripped.ogg', 100, 1) - icon_state = "poster_ripped" - name = "ripped poster" - desc = "You can't make out anything from the flag's original print. It's ruined." - add_fingerprint(user) - -/obj/structure/sign/flag/attackby(obj/item/W, mob/user) - ..() - - if(W.isFlameSource()) - - visible_message(SPAN_WARNING("\The [user] starts to burn \the [src] down!")) - - if(!do_after(user, 2 SECONDS, act_target = src)) - return 0 - visible_message(SPAN_WARNING("\The [user] burns \the [src] down!")) - playsound(src.loc, 'sound/items/cigs_lighters/zippo_on.ogg', 100, 1) - new /obj/effect/decal/cleanable/ash(src.loc) - - qdel(src) - return TRUE - + icon_state = "vysoka_r" \ No newline at end of file diff --git a/html/changelogs/doxxmedearly-flag_fixes.yml b/html/changelogs/doxxmedearly-flag_fixes.yml new file mode 100644 index 00000000000..07ace05f74b --- /dev/null +++ b/html/changelogs/doxxmedearly-flag_fixes.yml @@ -0,0 +1,6 @@ +author: Doxxmedearly +delete-after: True +changes: + - bugfix: "You can no longer tear down a flag from a distance by leaving the dialogue box up." + - bugfix: "Torn flags are no longer invisible." + - bugfix: "When you use a screwdriver to take down a flag, you get the proper item back (if it's not torn up!), meaning you can place them again easily." diff --git a/icons/obj/decals.dmi b/icons/obj/decals.dmi index 61b4aa6d867..2776bdbd475 100644 Binary files a/icons/obj/decals.dmi and b/icons/obj/decals.dmi differ