mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 04:30:44 +01:00
## About The Pull Request 50 files, plus additonal file that was necessary because I slightly refactored windoor construction. This ended up like three and a half times larger than most of the other ones, I really wasn't meaning for that to happen. Maybe its because I more vigorously enforced the empty line after every return thing. The only way to find out is to read 1700 lines of changes, and I don't feel like doing that again. I pinky promise it all works, and I've tested every item changed individually. Changes beyond conversion: You can't welder down reinforced falsewalls anymore, pretty sure it was an oversight because they're supposed to be taken down by wirecutters You can right click to close gun lockers with an empty hand, because otherwise you can't close the lockers at all if there's a gun in them Meatspikes no longer runtime on construction due to the old trick of balloon alert + qdel Windoor assembly no longer SUCKS DICK!!, it's no longer storing essentially a boolean in an undocumented number in a string, it no longer requires a VERB to flip its direction. on a related note, the creator of the windoor assembly construction steps has been sent to live on a farm far out in the country Also, a quick note about how these prs are gonna fuck everything up until they're all together. There's a lot more places where `attackby()` is directly called than I would have assumed, and given as those are being changed to call `item_interaction()` potentially(usually) in a different pr than the pr in which that atom's `attackby()` is actually converted, that function's not going to work at all until both are merged. The good news is that almost every instance this is happening, it's pure convenience, where the user would have access to both items anyway and could just manually call the attack chain by clicking them together. Instances where this is not the case are being skipped over until they can be packaged together to avoid the issue, but I'm not bothering to do this on ones where the desync won't make an interaction actually unusable, because that would require me to turn a 1700 line pr into a 3500 line pr and I really was aiming for like 500 ## Why It's Good For The Game Ignore the paragraph about how I expect this to create a hostage situation where the only fix to the bugs I make is to merge my other prs, and instead think about how cool swing combat would be and how much you want it ## Changelog 🆑 fix: you now can only use a wirecutter to take down a reinforced falsewall fix: meatspikes no longer runtime on construction fix: you no longer have to use a verb that you can't use to flip windoor assemblies qol: you can right click a gun locker to close it code: 50 files have been moved from attackby() to item_interaction() /🆑
375 lines
12 KiB
Plaintext
375 lines
12 KiB
Plaintext
#define CART_HAS_MINIMUM_REAGENT_VOLUME !(reagents.total_volume < 1)
|
|
|
|
/obj/structure/mop_bucket
|
|
name = "mop bucket"
|
|
desc = "Fill it with water, but don't forget a mop!"
|
|
icon = 'icons/obj/service/janitor.dmi'
|
|
icon_state = "mopbucket"
|
|
density = TRUE
|
|
var/amount_per_transfer_from_this = 5 //shit I dunno, adding this so syringes stop runtime erroring. --NeoFite
|
|
/// The icon used for the water overlay
|
|
var/water_icon = "mopbucket_water"
|
|
|
|
/obj/structure/mop_bucket/Initialize(mapload)
|
|
. = ..()
|
|
create_reagents(100, OPENCONTAINER)
|
|
register_context()
|
|
|
|
/obj/structure/mop_bucket/add_context(atom/source, list/context, obj/item/held_item, mob/living/user)
|
|
. = ..()
|
|
|
|
if(istype(held_item, /obj/item/mop))
|
|
context[SCREENTIP_CONTEXT_RMB] = "Wet [held_item]"
|
|
return CONTEXTUAL_SCREENTIP_SET
|
|
|
|
if(istype(held_item, /obj/item/reagent_containers))
|
|
context[SCREENTIP_CONTEXT_LMB] = "Fill mop bucket"
|
|
return CONTEXTUAL_SCREENTIP_SET
|
|
|
|
return .
|
|
|
|
/obj/structure/mop_bucket/item_interaction_secondary(mob/living/user, obj/item/tool, list/modifiers)
|
|
if(istype(tool, /obj/item/mop))
|
|
if(tool.reagents.total_volume >= tool.reagents.maximum_volume)
|
|
balloon_alert(user, "already soaked!")
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
if(!CART_HAS_MINIMUM_REAGENT_VOLUME)
|
|
balloon_alert(user, "empty!")
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
reagents.trans_to(tool, tool.reagents.maximum_volume, transferred_by = user)
|
|
balloon_alert(user, "doused mop")
|
|
playsound(src, 'sound/effects/slosh.ogg', 25, vary = TRUE)
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
return NONE
|
|
|
|
/obj/structure/mop_bucket/update_overlays()
|
|
. = ..()
|
|
if(reagents.total_volume > 0)
|
|
. += water_icon
|
|
|
|
/obj/structure/mop_bucket/janitorialcart
|
|
name = "janitorial cart"
|
|
desc = "This is the alpha and omega of sanitation."
|
|
icon_state = "cart"
|
|
water_icon = "cart_water"
|
|
var/obj/item/storage/bag/trash/mybag
|
|
var/obj/item/mop/mymop
|
|
var/obj/item/pushbroom/mybroom
|
|
var/obj/item/reagent_containers/spray/cleaner/myspray
|
|
var/obj/item/lightreplacer/myreplacer
|
|
var/list/obj/item/clothing/suit/caution/held_signs = list()
|
|
var/max_signs = 4
|
|
|
|
/obj/structure/mop_bucket/janitorialcart/Initialize(mapload)
|
|
. = ..()
|
|
reagents.maximum_volume *= 2.5
|
|
GLOB.janitor_devices += src
|
|
|
|
/obj/structure/mop_bucket/janitorialcart/Destroy()
|
|
GLOB.janitor_devices -= src
|
|
QDEL_NULL(myreplacer)
|
|
QDEL_NULL(myspray)
|
|
QDEL_NULL(mybroom)
|
|
QDEL_NULL(mymop)
|
|
QDEL_NULL(mybag)
|
|
QDEL_LIST(held_signs)
|
|
return ..()
|
|
|
|
/obj/structure/mop_bucket/janitorialcart/Entered(atom/movable/arrived, atom/old_loc, list/atom/old_locs)
|
|
if(istype(arrived, /obj/item/storage/bag/trash))
|
|
mybag = arrived
|
|
else if(istype(arrived, /obj/item/mop))
|
|
mymop = arrived
|
|
else if(istype(arrived, /obj/item/pushbroom))
|
|
mybroom = arrived
|
|
else if(istype(arrived, /obj/item/reagent_containers/spray/cleaner))
|
|
myspray = arrived
|
|
else if(istype(arrived, /obj/item/lightreplacer))
|
|
myreplacer = arrived
|
|
else if(istype(arrived, /obj/item/clothing/suit/caution))
|
|
held_signs += arrived
|
|
update_appearance(UPDATE_OVERLAYS)
|
|
return ..()
|
|
|
|
/obj/structure/mop_bucket/janitorialcart/Exited(atom/movable/gone, direction)
|
|
if(gone == mybag)
|
|
mybag = null
|
|
else if(gone == mymop)
|
|
mymop = null
|
|
else if(gone == mybroom)
|
|
mybroom = null
|
|
else if(gone == myspray)
|
|
myspray = null
|
|
else if(gone == myreplacer)
|
|
myreplacer = null
|
|
else if(gone in held_signs)
|
|
held_signs -= gone
|
|
if(!QDELING(src))
|
|
update_appearance(UPDATE_OVERLAYS)
|
|
return ..()
|
|
|
|
/obj/structure/mop_bucket/janitorialcart/examine(mob/user)
|
|
. = ..()
|
|
if(contents.len)
|
|
. += span_bold(span_info("\nIt is carrying:"))
|
|
for(var/thing in sort_names(contents))
|
|
if(thing in held_signs)
|
|
continue //we'll do this after.
|
|
. += "\t[icon2html(thing, user)] \a [thing]"
|
|
if(held_signs.len)
|
|
var/obj/item/clothing/suit/caution/sign_obj = held_signs[1]
|
|
if(held_signs.len > 1)
|
|
. += "\t[icon2html(sign_obj, user)] [convert_integer_to_words(length(held_signs))] [sign_obj.name]\s"
|
|
else
|
|
. += "\t[icon2html(sign_obj, user)] \a [sign_obj]"
|
|
. += span_notice("\n<b>Left-click</b> to [contents.len > 1 ? "search [src]" : "remove [contents[1]]"].")
|
|
if(mybag)
|
|
. += span_notice("<b>Right-click</b> with a <b>[weight_class_to_text(mybag.atom_storage.max_specific_storage)] item</b> to put it in [mybag].")
|
|
if(mymop)
|
|
. += span_notice("<b>Right-click</b> to quickly remove [mymop].")
|
|
if(CART_HAS_MINIMUM_REAGENT_VOLUME)
|
|
. += span_notice("<b>Right-click</b> with a <b>mop</b> to wet it.")
|
|
. += span_info("<b>Crowbar</b> it to dump its mop bucket onto [get_turf(src)].")
|
|
|
|
/obj/structure/mop_bucket/janitorialcart/add_context(atom/source, list/context, obj/item/held_item, mob/living/user)
|
|
. = ..()
|
|
|
|
if(isnull(held_item) && contents.len)
|
|
if(mymop)
|
|
context[SCREENTIP_CONTEXT_RMB] = "Remove [mymop]"
|
|
. = CONTEXTUAL_SCREENTIP_SET
|
|
if(contents.len == 1)
|
|
context[SCREENTIP_CONTEXT_LMB] = "Remove [contents[1]]"
|
|
. = CONTEXTUAL_SCREENTIP_SET
|
|
context[SCREENTIP_CONTEXT_LMB] = "Search cart"
|
|
. = CONTEXTUAL_SCREENTIP_SET
|
|
|
|
if(istype(held_item, /obj/item/mop) && !mymop)
|
|
context[SCREENTIP_CONTEXT_LMB] = "Insert [held_item]"
|
|
. = CONTEXTUAL_SCREENTIP_SET
|
|
if(istype(held_item, /obj/item/pushbroom) && !mybroom)
|
|
context[SCREENTIP_CONTEXT_LMB] = "Insert [held_item]"
|
|
. = CONTEXTUAL_SCREENTIP_SET
|
|
if(istype(held_item, /obj/item/storage/bag/trash) && !mybag)
|
|
context[SCREENTIP_CONTEXT_LMB] = "Insert [held_item]"
|
|
. = CONTEXTUAL_SCREENTIP_SET
|
|
if(istype(held_item, /obj/item/reagent_containers/spray/cleaner) && !myspray)
|
|
context[SCREENTIP_CONTEXT_LMB] = "Insert [held_item]"
|
|
. = CONTEXTUAL_SCREENTIP_SET
|
|
if(istype(held_item, /obj/item/clothing/suit/caution) && held_signs.len < max_signs)
|
|
context[SCREENTIP_CONTEXT_LMB] = "Insert [held_item]"
|
|
. = CONTEXTUAL_SCREENTIP_SET
|
|
if(istype(held_item, /obj/item/lightreplacer) && !myreplacer)
|
|
context[SCREENTIP_CONTEXT_LMB] = "Insert [held_item]"
|
|
. = CONTEXTUAL_SCREENTIP_SET
|
|
if(istype(held_item) && held_item.tool_behaviour == TOOL_CROWBAR && CART_HAS_MINIMUM_REAGENT_VOLUME)
|
|
context[SCREENTIP_CONTEXT_LMB] = "Dump [src]'s mop bucket on [get_turf(src)]"
|
|
. = CONTEXTUAL_SCREENTIP_SET
|
|
if(!isnull(held_item) && mybag?.atom_storage?.max_specific_storage >= held_item.w_class)
|
|
context[SCREENTIP_CONTEXT_RMB] = "Insert [held_item] into [mybag]"
|
|
. = CONTEXTUAL_SCREENTIP_SET
|
|
|
|
return . || NONE
|
|
|
|
/obj/structure/mop_bucket/janitorialcart/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
|
|
if(istype(tool, /obj/item/mop))
|
|
if(mymop)
|
|
balloon_alert(user, "already has \a [mymop]!")
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
if(!user.transferItemToLoc(tool, src))
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
balloon_alert(user, "placed [tool]")
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
if(istype(tool, /obj/item/pushbroom))
|
|
if(mybroom)
|
|
balloon_alert(user, "already has \a [mybroom]!")
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
if(!user.transferItemToLoc(tool, src))
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
balloon_alert(user, "placed [tool]")
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
if(istype(tool, /obj/item/storage/bag/trash))
|
|
if(mybag)
|
|
balloon_alert(user, "already has \a [mybag]!")
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
var/obj/item/storage/bag/trash/insert = tool
|
|
if(!insert.insertable)
|
|
balloon_alert(user, "cannot be inserted!")
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
if(!user.transferItemToLoc(tool, src))
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
balloon_alert(user, "attached [tool]")
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
if(istype(tool, /obj/item/reagent_containers/spray/cleaner))
|
|
if(myspray)
|
|
balloon_alert(user, "already has \a [myspray]!")
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
if(!user.transferItemToLoc(tool, src))
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
balloon_alert(user, "placed [tool]")
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
if(istype(tool, /obj/item/lightreplacer))
|
|
if(myreplacer)
|
|
balloon_alert(user, "already has \a [myreplacer]!")
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
if(!user.transferItemToLoc(tool, src))
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
balloon_alert(user, "placed [tool]")
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
if(istype(tool, /obj/item/clothing/suit/caution))
|
|
if(held_signs.len >= max_signs)
|
|
balloon_alert(user, "sign rack is full!")
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
if(!user.transferItemToLoc(tool, src))
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
balloon_alert(user, "placed [tool]")
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
return ..()
|
|
|
|
/obj/structure/mop_bucket/janitorialcart/crowbar_act(mob/living/user, obj/item/tool)
|
|
if(!CART_HAS_MINIMUM_REAGENT_VOLUME)
|
|
balloon_alert(user, "mop bucket is empty!")
|
|
return ITEM_INTERACT_SUCCESS
|
|
user.balloon_alert_to_viewers("starts dumping [src]...", "started dumping [src]...")
|
|
user.visible_message(span_notice("[user] begins to dumping the contents of [src]'s mop bucket."), span_notice("You begin to dump the contents of [src]'s mop bucket..."))
|
|
if(tool.use_tool(src, user, 5 SECONDS, volume = 50))
|
|
balloon_alert(user, "dumped [src]")
|
|
to_chat(user, span_notice("You dumped the contents of [src]'s mop bucket onto the floor."))
|
|
reagents.expose(loc)
|
|
reagents.clear_reagents()
|
|
update_appearance(UPDATE_OVERLAYS)
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
/obj/structure/mop_bucket/janitorialcart/item_interaction_secondary(mob/living/user, obj/item/tool, list/modifiers)
|
|
. = ..()
|
|
if(ITEM_INTERACT_ANY_BLOCKER & .)
|
|
return .
|
|
|
|
if(!mybag?.atom_storage.attempt_insert(tool, user))
|
|
return .
|
|
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
/obj/structure/mop_bucket/janitorialcart/attack_hand(mob/user, list/modifiers)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
|
|
var/list/items = list()
|
|
if(mybag)
|
|
items += list("Trash bag" = image(icon = mybag.icon, icon_state = mybag.icon_state))
|
|
if(mymop)
|
|
items += list("Mop" = image(icon = mymop.icon, icon_state = mymop.icon_state))
|
|
if(mybroom)
|
|
items += list("Broom" = image(icon = mybroom.icon, icon_state = mybroom.icon_state))
|
|
if(myspray)
|
|
items += list("Spray bottle" = image(icon = myspray.icon, icon_state = myspray.icon_state))
|
|
if(myreplacer)
|
|
items += list("Light replacer" = image(icon = myreplacer.icon, icon_state = myreplacer.icon_state))
|
|
if(held_signs.len)
|
|
var/obj/item/clothing/suit/caution/sign = held_signs[1]
|
|
items += list("Sign" = image(icon = sign.icon, icon_state = sign.icon_state))
|
|
|
|
if(!length(items))
|
|
return
|
|
|
|
var/pick = items[1]
|
|
if(length(items) > 1)
|
|
items = sort_list(items)
|
|
pick = show_radial_menu(user, src, items, custom_check = CALLBACK(src, PROC_REF(check_menu), user), radius = 38, require_near = TRUE)
|
|
|
|
if(!pick)
|
|
return
|
|
switch(pick)
|
|
if("Trash bag")
|
|
if(!mybag)
|
|
return
|
|
balloon_alert(user, "detached [mybag]")
|
|
user.put_in_hands(mybag)
|
|
if("Mop")
|
|
if(!mymop)
|
|
return
|
|
balloon_alert(user, "removed [mymop]")
|
|
user.put_in_hands(mymop)
|
|
if("Broom")
|
|
if(!mybroom)
|
|
return
|
|
balloon_alert(user, "removed [mybroom]")
|
|
user.put_in_hands(mybroom)
|
|
if("Spray bottle")
|
|
if(!myspray)
|
|
return
|
|
balloon_alert(user, "removed [myspray]")
|
|
user.put_in_hands(myspray)
|
|
if("Light replacer")
|
|
if(!myreplacer)
|
|
return
|
|
balloon_alert(user, "removed [myreplacer]")
|
|
user.put_in_hands(myreplacer)
|
|
if("Sign")
|
|
if(!held_signs.len)
|
|
return
|
|
var/obj/item/clothing/suit/caution/removed_sign = held_signs[1]
|
|
if(length(held_signs) > 1)
|
|
balloon_alert(user, "removed \a [removed_sign]")
|
|
else
|
|
balloon_alert(user, "removed [removed_sign]")
|
|
user.put_in_hands(removed_sign)
|
|
else
|
|
return
|
|
|
|
/obj/structure/mop_bucket/janitorialcart/attack_hand_secondary(mob/user, list/modifiers)
|
|
if(!mymop)
|
|
return SECONDARY_ATTACK_CONTINUE_CHAIN
|
|
balloon_alert(user, "removed [mymop]")
|
|
user.put_in_hands(mymop)
|
|
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
|
|
|
|
/**
|
|
* check_menu: Checks if we are allowed to interact with a radial menu
|
|
*
|
|
* Arguments:
|
|
* * user The mob interacting with a menu
|
|
*/
|
|
/obj/structure/mop_bucket/janitorialcart/proc/check_menu(mob/living/user)
|
|
return istype(user) && !user.incapacitated
|
|
|
|
/obj/structure/mop_bucket/janitorialcart/update_overlays()
|
|
. = ..()
|
|
if(mybag)
|
|
. += istype(mybag, /obj/item/storage/bag/trash/bluespace) ? "cart_bluespace_garbage" : "cart_garbage"
|
|
if(mymop)
|
|
. += "cart_mop"
|
|
if(mybroom)
|
|
. += "cart_broom"
|
|
if(myspray)
|
|
. += "cart_spray"
|
|
if(myreplacer)
|
|
. += "cart_replacer"
|
|
if(held_signs.len)
|
|
. += "cart_sign[min(held_signs.len, 4)]"
|
|
|
|
#undef CART_HAS_MINIMUM_REAGENT_VOLUME
|