diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index b8e6acf87a3..a6378c7ea8b 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -1228,6 +1228,8 @@ #define COMSIG_ITEM_ATTACK "item_attack" ///from base of obj/item/attack_self(): (/mob) #define COMSIG_ITEM_ATTACK_SELF "item_attack_self" +//from base of obj/item/attack_self_secondary(): (/mob) +#define COMSIG_ITEM_ATTACK_SELF_SECONDARY "item_attack_self_secondary" ///from base of obj/item/attack_obj(): (/obj, /mob) #define COMSIG_ITEM_ATTACK_OBJ "item_attack_obj" ///from base of obj/item/pre_attack(): (atom/target, mob/user, params) diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index 561c51dda3a..1883d13723a 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -127,9 +127,14 @@ var/obj/item/W = get_active_held_item() if(W == A) - W.attack_self(src, modifiers) - update_inv_hands() - return + if(LAZYACCESS(modifiers, RIGHT_CLICK)) + W.attack_self_secondary(src, modifiers) + update_inv_hands() + return + else + W.attack_self(src, modifiers) + update_inv_hands() + return //These are always reachable. //User itself, current loc, and user inventory diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index e1b7b581156..06b9ff794c5 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -68,6 +68,11 @@ return TRUE interact(user) +/// Called when the item is in the active hand, and right-clicked. Intended for alternate or opposite functions, such as lowering reagent transfer amount. At the moment, there is no verb or hotkey. +/obj/item/proc/attack_self_secondary(mob/user, modifiers) + if(SEND_SIGNAL(src, COMSIG_ITEM_ATTACK_SELF_SECONDARY, user) & COMPONENT_CANCEL_ATTACK_CHAIN) + return TRUE + /** * Called on the item before it hits something * diff --git a/code/game/objects/items/tanks/watertank.dm b/code/game/objects/items/tanks/watertank.dm index eb57eeb81ce..c65ecd47e16 100644 --- a/code/game/objects/items/tanks/watertank.dm +++ b/code/game/objects/items/tanks/watertank.dm @@ -114,7 +114,8 @@ righthand_file = 'icons/mob/inhands/equipment/mister_righthand.dmi' w_class = WEIGHT_CLASS_BULKY amount_per_transfer_from_this = 50 - possible_transfer_amounts = list(25,50,100) + possible_transfer_amounts = list(50) + can_toggle_range = FALSE volume = 500 item_flags = NOBLUDGEON | ABSTRACT // don't put in storage slot_flags = NONE @@ -128,9 +129,6 @@ return INITIALIZE_HINT_QDEL reagents = tank.reagents //This mister is really just a proxy for the tank's reagents -/obj/item/reagent_containers/spray/mister/attack_self() - return - /obj/item/reagent_containers/spray/mister/doMove(atom/destination) if(destination && (destination != tank.loc || !ismob(destination))) if (loc != tank) @@ -164,15 +162,13 @@ lefthand_file = 'icons/mob/inhands/equipment/mister_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/mister_righthand.dmi' amount_per_transfer_from_this = 5 - possible_transfer_amounts = list() + possible_transfer_amounts = list(5,10) current_range = 5 - spray_range = 5 /obj/item/watertank/janitor/make_noz() return new /obj/item/reagent_containers/spray/mister/janitor(src) -/obj/item/reagent_containers/spray/mister/janitor/attack_self(mob/user) - amount_per_transfer_from_this = (amount_per_transfer_from_this == 10 ? 5 : 10) +/obj/item/reagent_containers/spray/mister/janitor/mode_change_message(mob/user) to_chat(user, "You [amount_per_transfer_from_this == 10 ? "remove" : "fix"] the nozzle. You'll now use [amount_per_transfer_from_this] units per spray.") //ATMOS FIRE FIGHTING BACKPACK diff --git a/code/modules/food_and_drinks/drinks/drinks.dm b/code/modules/food_and_drinks/drinks/drinks.dm index 273951763e5..70b93557dae 100644 --- a/code/modules/food_and_drinks/drinks/drinks.dm +++ b/code/modules/food_and_drinks/drinks/drinks.dm @@ -184,7 +184,7 @@ throwforce = 1 amount_per_transfer_from_this = 5 custom_materials = list(/datum/material/iron=100) - possible_transfer_amounts = list() + possible_transfer_amounts = list(5) volume = 5 flags_1 = CONDUCT_1 spillable = TRUE @@ -458,7 +458,7 @@ name = "paper cup" desc = "A paper water cup." icon_state = "water_cup_e" - possible_transfer_amounts = list() + possible_transfer_amounts = list(10) volume = 10 spillable = TRUE isGlass = FALSE @@ -719,6 +719,13 @@ /obj/item/reagent_containers/food/drinks/soda_cans/attack_self(mob/user) if(!is_drainable()) open_soda(user) + return + return ..() + +/obj/item/reagent_containers/food/drinks/soda_cans/attack_self_secondary(mob/user) + if(!is_drainable()) + open_soda(user) + return return ..() /obj/item/reagent_containers/food/drinks/soda_cans/cola diff --git a/code/modules/food_and_drinks/drinks/drinks/bottle.dm b/code/modules/food_and_drinks/drinks/drinks/bottle.dm index cd7f93c777c..43f3a510bcc 100644 --- a/code/modules/food_and_drinks/drinks/drinks/bottle.dm +++ b/code/modules/food_and_drinks/drinks/drinks/bottle.dm @@ -525,7 +525,7 @@ list_reagents = list() var/list/accelerants = list( /datum/reagent/consumable/ethanol, /datum/reagent/fuel, /datum/reagent/clf3, /datum/reagent/phlogiston, /datum/reagent/napalm, /datum/reagent/hellwater, /datum/reagent/toxin/plasma, /datum/reagent/toxin/spore_burning) - var/active = 0 + var/active = FALSE /obj/item/reagent_containers/food/drinks/bottle/molotov/CheckParts(list/parts_list) ..() @@ -579,7 +579,9 @@ return to_chat(user, "You snuff out the flame on [src].") cut_overlay(custom_fire_overlay ? custom_fire_overlay : GLOB.fire_overlay) - active = 0 + active = FALSE + return + return ..() /obj/item/reagent_containers/food/drinks/bottle/pruno name = "pruno mix" diff --git a/code/modules/food_and_drinks/drinks/drinks/drinkingglass.dm b/code/modules/food_and_drinks/drinks/drinks/drinkingglass.dm index b43fec2efa3..bfa477742e3 100644 --- a/code/modules/food_and_drinks/drinks/drinks/drinkingglass.dm +++ b/code/modules/food_and_drinks/drinks/drinks/drinkingglass.dm @@ -67,7 +67,7 @@ base_icon_state = "shotglass" gulp_size = 15 amount_per_transfer_from_this = 15 - possible_transfer_amounts = list() + possible_transfer_amounts = list(15) volume = 15 custom_materials = list(/datum/material/glass=100) custom_price = PAYCHECK_ASSISTANT * 0.4 diff --git a/code/modules/food_and_drinks/food/condiment.dm b/code/modules/food_and_drinks/food/condiment.dm index db2fb7c2d0d..31ac76a15e2 100644 --- a/code/modules/food_and_drinks/food/condiment.dm +++ b/code/modules/food_and_drinks/food/condiment.dm @@ -262,7 +262,7 @@ icon_state = "condi_empty" volume = 10 amount_per_transfer_from_this = 10 - possible_transfer_amounts = list() + possible_transfer_amounts = list(10) /** * List of possible styles (list(, , )) for condiment packs. * Since all of them differs only in color should probably be replaced with usual reagentfillings instead diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm index d269c59b11a..3973aec29dd 100644 --- a/code/modules/reagents/reagent_containers.dm +++ b/code/modules/reagents/reagent_containers.dm @@ -6,6 +6,8 @@ w_class = WEIGHT_CLASS_TINY var/amount_per_transfer_from_this = 5 var/list/possible_transfer_amounts = list(5,10,15,20,25,30) + /// Where we are in the possible transfer amount list. + var/amount_list_position = 1 var/volume = 30 var/reagent_flags var/list/list_reagents = null @@ -27,6 +29,13 @@ add_initial_reagents() +/obj/item/reagent_containers/examine() + . = ..() + if(possible_transfer_amounts.len > 1) + . += "Left-click or right-click in-hand to increase or decrease its transfer amount." + else if(possible_transfer_amounts.len) + . += "Left-click or right-click in-hand to view its transfer amount." + /obj/item/reagent_containers/create_reagents(max_vol, flags) . = ..() RegisterSignal(reagents, list(COMSIG_REAGENTS_NEW_REAGENT, COMSIG_REAGENTS_ADD_REAGENT, COMSIG_REAGENTS_DEL_REAGENT, COMSIG_REAGENTS_REM_REAGENT), .proc/on_reagent_change) @@ -47,17 +56,28 @@ reagents.add_reagent_list(list_reagents) /obj/item/reagent_containers/attack_self(mob/user) - if(possible_transfer_amounts.len) - var/i=0 - for(var/A in possible_transfer_amounts) - i++ - if(A == amount_per_transfer_from_this) - if(i" if(open) . += "The battery case is open." + if(cell && cell.charge > 0) + . += "Ctrl+Click to toggle the power." /obj/item/reagent_containers/glass/maunamug/process(delta_time) ..() @@ -48,8 +50,7 @@ STOP_PROCESSING(SSobj, src) . = ..() - -/obj/item/reagent_containers/glass/maunamug/attack_self(mob/user) +/obj/item/reagent_containers/glass/maunamug/CtrlClick(mob/living/user) if(on) change_power_status(FALSE) else diff --git a/code/modules/reagents/reagent_containers/medigel.dm b/code/modules/reagents/reagent_containers/medigel.dm index 766e2614d89..67923cce59f 100644 --- a/code/modules/reagents/reagent_containers/medigel.dm +++ b/code/modules/reagents/reagent_containers/medigel.dm @@ -16,13 +16,13 @@ throw_speed = 3 throw_range = 7 amount_per_transfer_from_this = 10 + possible_transfer_amounts = list(5,10) volume = 60 var/can_fill_from_container = TRUE var/apply_type = PATCH var/apply_method = "spray" //the thick gel is sprayed and then dries into patch like film. var/self_delay = 30 var/squirt_mode = 0 - var/squirt_amount = 5 custom_price = PAYCHECK_MEDIUM * 2 unique_reskin = list( "Blue" = "medigel_blue", @@ -35,10 +35,13 @@ /obj/item/reagent_containers/medigel/attack_self(mob/user) squirt_mode = !squirt_mode - if(squirt_mode) - amount_per_transfer_from_this = squirt_amount - else - amount_per_transfer_from_this = initial(amount_per_transfer_from_this) + return ..() + +/obj/item/reagent_containers/medigel/attack_self_secondary(mob/user) + squirt_mode = !squirt_mode + return ..() + +/obj/item/reagent_containers/medigel/mode_change_message(mob/user) to_chat(user, "You will now apply the medigel's contents in [squirt_mode ? "short bursts":"extended sprays"]. You'll now use [amount_per_transfer_from_this] units per use.") /obj/item/reagent_containers/medigel/attack(mob/M, mob/user, def_zone) diff --git a/code/modules/reagents/reagent_containers/pill.dm b/code/modules/reagents/reagent_containers/pill.dm index 4be8d7d1816..385d6afaf0d 100644 --- a/code/modules/reagents/reagent_containers/pill.dm +++ b/code/modules/reagents/reagent_containers/pill.dm @@ -23,11 +23,6 @@ if(reagents.total_volume && rename_with_volume) name += " ([reagents.total_volume]u)" - -/obj/item/reagent_containers/pill/attack_self(mob/user) - return - - /obj/item/reagent_containers/pill/attack(mob/M, mob/user, def_zone) if(!canconsume(M, user)) return FALSE diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index 16cc8170977..576f241d460 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -14,15 +14,16 @@ w_class = WEIGHT_CLASS_SMALL throw_speed = 3 throw_range = 7 - var/stream_mode = 0 //whether we use the more focused mode + var/stream_mode = FALSE //whether we use the more focused mode var/current_range = 3 //the range of tiles the sprayer will reach. var/spray_range = 3 //the range of tiles the sprayer will reach when in spray mode. var/stream_range = 1 //the range of tiles the sprayer will reach when in stream mode. - var/stream_amount = 10 //the amount of reagents transfered when in stream mode. var/can_fill_from_container = TRUE + /// Are we able to toggle between stream and spray modes, which change the distance and amount sprayed? + var/can_toggle_range = TRUE amount_per_transfer_from_this = 5 volume = 250 - possible_transfer_amounts = list(5,10,15,20,25,30,50,100) + possible_transfer_amounts = list(5,10) /obj/item/reagent_containers/spray/afterattack(atom/target, mob/user, proximity_flag, click_parameters) . = ..() @@ -132,14 +133,22 @@ qdel(reagent_puff) /obj/item/reagent_containers/spray/attack_self(mob/user) + . = ..() + toggle_stream_mode(user) + +/obj/item/reagent_containers/spray/attack_self_secondary(mob/user) + . = ..() + toggle_stream_mode(user) + +/obj/item/reagent_containers/spray/proc/toggle_stream_mode(mob/user) + if(stream_range == spray_range || !stream_range || !spray_range || possible_transfer_amounts.len > 2 || !can_toggle_range) + return stream_mode = !stream_mode if(stream_mode) - amount_per_transfer_from_this = stream_amount current_range = stream_range else - amount_per_transfer_from_this = initial(amount_per_transfer_from_this) current_range = spray_range - to_chat(user, "You switch the nozzle setting to [stream_mode ? "\"stream\"":"\"spray\""]. You'll now use [amount_per_transfer_from_this] units per use.") + to_chat(user, "You switch the nozzle setting to [stream_mode ? "\"stream\"":"\"spray\""].") /obj/item/reagent_containers/spray/attackby(obj/item/I, mob/user, params) var/hotness = I.get_temperature() @@ -205,7 +214,7 @@ volume = 100 list_reagents = list(/datum/reagent/space_cleaner = 100) amount_per_transfer_from_this = 2 - stream_amount = 5 + possible_transfer_amounts = list(2,5) /obj/item/reagent_containers/spray/cleaner/suicide_act(mob/user) user.visible_message("[user] is putting the nozzle of \the [src] in [user.p_their()] mouth. It looks like [user.p_theyre()] trying to commit suicide!") @@ -264,12 +273,12 @@ icon_state = "sunflower" inhand_icon_state = "sunflower" amount_per_transfer_from_this = 1 + possible_transfer_amounts = list(1) + can_toggle_range = FALSE + current_range = 1 volume = 10 list_reagents = list(/datum/reagent/water = 10) -/obj/item/reagent_containers/spray/waterflower/attack_self(mob/user) //Don't allow changing how much the flower sprays - return - ///Subtype used for the lavaland clown ruin. /obj/item/reagent_containers/spray/waterflower/superlube name = "clown flower"