diff --git a/code/game/objects/items/weapons/picket_signs.dm b/code/game/objects/items/weapons/picket_signs.dm index 53dcfb45e4f..93217cd3425 100644 --- a/code/game/objects/items/weapons/picket_signs.dm +++ b/code/game/objects/items/weapons/picket_signs.dm @@ -8,12 +8,15 @@ attack_verb = list("bashed","smacked") resistance_flags = FLAMMABLE - var/delayed = 0 //used to do delays + new_attack_chain = TRUE + /// The cooldown tracking when we can next wave the sign + COOLDOWN_DECLARE(wave_cooldown) + /// What does the sign say? var/label = "" -/obj/item/picket_sign/attackby__legacy__attackchain(obj/item/W, mob/user, params) - if(is_pen(W) || istype(W, /obj/item/toy/crayon)) +/obj/item/picket_sign/attack_by(obj/item/attacking, mob/user, params) + if(is_pen(attacking) || istype(attacking, /obj/item/toy/crayon)) var/txt = tgui_input_text(user, "What would you like to write on the sign?", "Sign Label", max_length = 30) if(isnull(txt)) return @@ -22,20 +25,91 @@ desc = "It reads: [label]" ..() -/obj/item/picket_sign/attack_self__legacy__attackchain(mob/living/carbon/human/user) - if(delayed) +/obj/item/picket_sign/activate_self(mob/user) + . = ..() + if(!COOLDOWN_FINISHED(src, wave_cooldown)) user.show_message("Your arm is too tired to do that again so soon!") return - delayed = 1 if(label) user.visible_message("[user] waves around \the \"[label]\" sign.") else user.visible_message("[user] waves around blank sign.") user.changeNext_move(CLICK_CD_MELEE) + COOLDOWN_START(src, wave_cooldown, 8 SECONDS) - sleep(8) - delayed = 0 +/obj/item/picket_sign/after_attack(atom/target, mob/user, proximity_flag, click_parameters) + . = ..() + if(user.a_intent != INTENT_HELP) + return + if(!isturf(target)) + return + var/turf/target_turf = target + if(target_turf == get_turf(user)) + to_chat(user, "You cannot place [src] under yourself.") + return + if(locate(/obj/structure/custom_sign) in target_turf) // No putting signs on signs + to_chat(user, "There's already a sign there!") + return + user.visible_message("[user] starts to attach [src] to [target].", "You start to attach [src] to [target].") + if(do_after(user, 2 SECONDS, target = target_turf)) + if(iswallturf(target)) + new /obj/structure/custom_sign/wall_sign(user.loc, label, get_dir(user, target_turf)) + else + new /obj/structure/custom_sign(target_turf, label) + qdel(src) + +/obj/structure/custom_sign + name = "floor sign" + anchored = TRUE + max_integrity = 50 + icon_state = "floor_sign" + /// What does the sign say? + var/label = "" + new_attack_chain = TRUE + +/obj/structure/custom_sign/New(turf/loc, new_label) + . = ..() + if(new_label) + change_label(new_label) + +/obj/structure/custom_sign/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(is_pen(used) || istype(used, /obj/item/toy/crayon)) + var/txt = tgui_input_text(user, "What would you like to write on the sign?", "Sign Label", max_length = 30) + if(isnull(txt)) + return ITEM_INTERACT_COMPLETE + change_label(txt) + add_fingerprint(user) + return ITEM_INTERACT_COMPLETE + ..() + +/obj/structure/custom_sign/proc/change_label(new_label) + label = new_label + name = "[new_label] sign" + desc = "It reads: [new_label]" + +/obj/structure/custom_sign/wrench_act(mob/living/user, obj/item/I) + . = TRUE + user.visible_message("[user] starts to detach [src].", "You start to detach [src].") + if(!I.use_tool(src, user, 2 SECONDS, volume = I.tool_volume)) + return + var/obj/item/picket_sign/picket = new /obj/item/picket_sign(loc) + if(label) + picket.label = label + picket.name = "[label] sign" + picket.desc = "It reads: [label]" + qdel(src) + +/obj/structure/custom_sign/wall_sign + name = "wall sign" + icon_state = "wall_sign" + +/obj/structure/custom_sign/wall_sign/New(turf/loc, new_label, direction) + . = ..() + // Offset 24 pixels in direction of dir. This allows the sign to be embedded in a wall + setDir(direction) + set_pixel_offsets_from_dir(24, -24, 24, -24) + update_icon() /datum/crafting_recipe/picket_sign name = "Picket Sign" diff --git a/icons/obj/items.dmi b/icons/obj/items.dmi index 86d9ba5ea3f..9fb9985bbba 100644 Binary files a/icons/obj/items.dmi and b/icons/obj/items.dmi differ diff --git a/icons/obj/structures.dmi b/icons/obj/structures.dmi index 97a0dc40a65..547f1aaab8f 100644 Binary files a/icons/obj/structures.dmi and b/icons/obj/structures.dmi differ