diff --git a/_maps/_basemap.dm b/_maps/_basemap.dm index 9499d3e8cb593..bf3b820460161 100644 --- a/_maps/_basemap.dm +++ b/_maps/_basemap.dm @@ -1,4 +1,4 @@ -//#define LOWMEMORYMODE //uncomment this to load centcom and runtime station and thats it. +#define LOWMEMORYMODE //uncomment this to load centcom and runtime station and thats it. #include "map_files\generic\CentCom.dmm" diff --git a/beestation.dme b/beestation.dme index 9d2230a22b21c..e031cc97451f9 100644 --- a/beestation.dme +++ b/beestation.dme @@ -63,6 +63,7 @@ #include "code\__DEFINES\contracts.dm" #include "code\__DEFINES\cooldowns.dm" #include "code\__DEFINES\cult.dm" +#include "code\__DEFINES\damage.dm" #include "code\__DEFINES\departments.dm" #include "code\__DEFINES\devices.dm" #include "code\__DEFINES\directional.dm" @@ -83,7 +84,6 @@ #include "code\__DEFINES\fov.dm" #include "code\__DEFINES\ghost.dm" #include "code\__DEFINES\gravity.dm" -#include "code\__DEFINES\helpers.dm" #include "code\__DEFINES\html_assistant.dm" #include "code\__DEFINES\hud.dm" #include "code\__DEFINES\icon_smoothing.dm" @@ -261,6 +261,7 @@ #include "code\__HELPERS\qdel.dm" #include "code\__HELPERS\radiation.dm" #include "code\__HELPERS\radio.dm" +#include "code\__HELPERS\random_helper.dm" #include "code\__HELPERS\randoms.dm" #include "code\__HELPERS\records.dm" #include "code\__HELPERS\roundend.dm" @@ -2567,6 +2568,26 @@ #include "code\modules\guardian\abilities\minor\snares.dm" #include "code\modules\guardian\abilities\minor\teleport.dm" #include "code\modules\guardian\abilities\special\time.dm" +#include "code\modules\health\damage\damage_sources\chemical.dm" +#include "code\modules\health\damage\damage_sources\damage_source.dm" +#include "code\modules\health\damage\damage_sources\living_damage_extensions.dm" +#include "code\modules\health\damage\damage_sources\object_damage_extensions.dm" +#include "code\modules\health\damage\damage_sources\sharp.dm" +#include "code\modules\health\damage\damage_types\brute.dm" +#include "code\modules\health\damage\damage_types\burn.dm" +#include "code\modules\health\damage\damage_types\clone.dm" +#include "code\modules\health\damage\damage_types\damage_source.dm" +#include "code\modules\health\damage\damage_types\stamina.dm" +#include "code\modules\health\damage\damage_types\suffocation.dm" +#include "code\modules\health\damage\damage_types\toxin.dm" +#include "code\modules\health\damage\systemic_damage\apply_bleeding.dm" +#include "code\modules\health\damage\systemic_damage\apply_damage.dm" +#include "code\modules\health\damage\systemic_damage\apply_dismemberment.dm" +#include "code\modules\health\damage\systemic_damage\armour_penetration.dm" +#include "code\modules\health\damage\systemic_damage\calculate_armour.dm" +#include "code\modules\health\damage\systemic_damage\display_attack_message.dm" +#include "code\modules\health\damage\systemic_damage\locate_target.dm" +#include "code\modules\health\damage\systemic_damage\on_damage.dm" #include "code\modules\holiday\easter.dm" #include "code\modules\holiday\holidays.dm" #include "code\modules\holodeck\area_copy.dm" diff --git a/code/__DEFINES/_helpers.dm b/code/__DEFINES/_helpers.dm index 22ca001ae4e61..35c2993d0f406 100644 --- a/code/__DEFINES/_helpers.dm +++ b/code/__DEFINES/_helpers.dm @@ -7,3 +7,6 @@ //Returns an integer given a hex input, supports negative values "-ff" //skips preceding invalid characters #define hex2num(X) text2num(X, 16) + +/// subtypesof(), typesof() without the parent path +#define subtypesof(typepath) ( typesof(typepath) - typepath ) diff --git a/code/__DEFINES/combat.dm b/code/__DEFINES/combat.dm index bf1870897cbc5..730ab55375bff 100644 --- a/code/__DEFINES/combat.dm +++ b/code/__DEFINES/combat.dm @@ -4,17 +4,17 @@ //Damage defines //TODO: merge these down to reduce on defines /// Physical fracturing and warping of the material. -#define BRUTE "brute" +#define BRUTE /datum/damage/brute /// Scorching and charring of the material. -#define BURN "burn" +#define BURN /datum/damage/burn /// Poisoning. Mostly caused by reagents. -#define TOX "toxin" +#define TOX /datum/damage/toxin /// Suffocation. -#define OXY "oxygen" +#define OXY /datum/damage/suffocation /// Cellular degredation. Rare and difficult to treat. -#define CLONE "clone" -/// Exhaustion and nonlethal damage. -#define STAMINA "stamina" +#define CLONE /datum/damage/clone +/// Stamina damage type +#define STAMINA_DAMTYPE /datum/damage/stamina /// Brain damage. Should probably be decomissioned and replaced with proper organ damage. #define BRAIN "brain" @@ -42,6 +42,8 @@ #define MELEE "melee" /// Involves magic. #define MAGIC "magic" +/// Exhaustion and nonlethal damage. +#define STAMINA "stamina" /* /// Involved in checking the likelihood of applying a wound to a mob. diff --git a/code/__DEFINES/damage.dm b/code/__DEFINES/damage.dm new file mode 100644 index 0000000000000..ec991511d616b --- /dev/null +++ b/code/__DEFINES/damage.dm @@ -0,0 +1,22 @@ + +GLOBAL_LIST_EMPTY(damage_type_singletons) + +#define GET_DAMAGE(damage_type) (length(GLOB.damage_type_singletons) ? GLOB.damage_type_singletons[damage_type] : (create_damage_singletons())[damage_type]) + +/proc/create_damage_singletons() + GLOB.damage_type_singletons = list() + for (var/type in subtypesof(/datum/damage)) + GLOB.damage_type_singletons[type] = new type + return GLOB.damage_type_singletons + +GLOBAL_LIST_EMPTY(damage_source_singletons) + +#define GET_DAMAGE_SOURCE(source_type) (length(GLOB.damage_source_singletons) ? GLOB.damage_source_singletons[source_type] : (create_source_singletons())[source_type]) + +/proc/create_source_singletons() + GLOB.damage_source_singletons = list() + for (var/type in subtypesof(/datum/damage_source)) + GLOB.damage_source_singletons[type] = new type + return GLOB.damage_source_singletons + +#define FIND_DAMAGE_SOURCE locate() in GLOB.damage_source_singletons diff --git a/code/__DEFINES/dcs/signals/signals_atom.dm b/code/__DEFINES/dcs/signals/signals_atom.dm index db0ed971008a2..11affcd20ff07 100644 --- a/code/__DEFINES/dcs/signals/signals_atom.dm +++ b/code/__DEFINES/dcs/signals/signals_atom.dm @@ -5,10 +5,6 @@ // /atom signals ///from base of atom/proc/Initialize(mapload): sent any time a new atom is created #define COMSIG_ATOM_CREATED "atom_created" -///! from base of atom/attackby(): (/obj/item, /mob/living, params) -#define COMSIG_PARENT_ATTACKBY "atom_attackby" - ///! Return this in response if you don't want afterattack to be called - #define COMPONENT_NO_AFTERATTACK 1 ///! from base of atom/attack_hulk(): (/mob/living/carbon/human) #define COMSIG_ATOM_HULK_ATTACK "hulk_attack" /// from base of atom/examine(): (/mob, list/examine_text) diff --git a/code/__DEFINES/dcs/signals/signals_mob/signals_human.dm b/code/__DEFINES/dcs/signals/signals_mob/signals_human.dm index 4d951dcbfe563..520c2b995f6f9 100644 --- a/code/__DEFINES/dcs/signals/signals_mob/signals_human.dm +++ b/code/__DEFINES/dcs/signals/signals_mob/signals_human.dm @@ -3,8 +3,8 @@ // All signals send the source datum of the signal as the first argument // /mob/living/carbon/human signals -#define COMSIG_HUMAN_MELEE_UNARMED_ATTACK "human_melee_unarmed_attack" //! from mob/living/carbon/human/UnarmedAttack(): (atom/target) -#define COMSIG_HUMAN_MELEE_UNARMED_ATTACKBY "human_melee_unarmed_attackby" //! from mob/living/carbon/human/UnarmedAttack(): (mob/living/carbon/human/attacker) +#define COMSIG_HUMAN_MELEE_UNARMED_ATTACK "human_melee_unarmed_attack" //! from mob/living/carbon/human/primary_interact(): (atom/target) +#define COMSIG_HUMAN_MELEE_UNARMED_ATTACKBY "human_melee_unarmed_attackby" //! from mob/living/carbon/human/primary_interact(): (mob/living/carbon/human/attacker) #define COMSIG_HUMAN_DISARM_HIT "human_disarm_hit" //! Hit by successful disarm attack (mob/living/carbon/human/attacker,zone_targeted) #define COMSIG_HUMAN_ATTACKED "carbon_attacked" //hit by something that checks shields. diff --git a/code/__DEFINES/dcs/signals/signals_mob/signals_mob.dm b/code/__DEFINES/dcs/signals/signals_mob/signals_mob.dm index a98a439dabcd9..2ac1f938fd60c 100644 --- a/code/__DEFINES/dcs/signals/signals_mob/signals_mob.dm +++ b/code/__DEFINES/dcs/signals/signals_mob/signals_mob.dm @@ -36,7 +36,7 @@ #define COMSIG_MOB_DROPPED_ITEM "mob_dropped_item" //! from base of /item/dropped(): (/mob/user, /obj/item, loc) #define COMSIG_MOB_APPLY_DAMGE "mob_apply_damage" //! from base of /mob/living/proc/apply_damage(): (damage, damagetype, def_zone) #define COMSIG_MOB_ITEM_AFTERATTACK "mob_item_afterattack" //! from base of obj/item/afterattack(): (atom/target, mob/user, proximity_flag, click_parameters) -#define COMSIG_MOB_ATTACK_RANGED "mob_attack_ranged" //! from base of mob/RangedAttack(): (atom/A, params) +#define COMSIG_MOB_ATTACK_RANGED "mob_attack_ranged" //! from base of mob/primary_ranged_attack(): (atom/A, params) #define COMSIG_MOB_THROW "mob_throw" //! from base of /mob/throw_item(): (atom/target) #define COMSIG_MOB_UPDATE_SIGHT "mob_update_sight" //! from base of /mob/update_sight(): () #define COMSIG_MOB_EXAMINATE "mob_examinate" //from base of /mob/verb/examinate(): (atom/target) diff --git a/code/__DEFINES/dcs/signals/signals_obj/signals_item/signals_item.dm b/code/__DEFINES/dcs/signals/signals_obj/signals_item/signals_item.dm index 48e403bdea008..a2c2fd70fd523 100644 --- a/code/__DEFINES/dcs/signals/signals_obj/signals_item/signals_item.dm +++ b/code/__DEFINES/dcs/signals/signals_obj/signals_item/signals_item.dm @@ -6,15 +6,15 @@ #define COMSIG_ITEM_ATTACK "item_attack" //! from base of obj/item/attack(): (/mob/living/target, /mob/living/user) #define COMSIG_ITEM_ATTACK_SELF "item_attack_self" //! from base of obj/item/attack_self(): (/mob) #define COMPONENT_NO_INTERACT 1 -#define COMSIG_ITEM_ATTACK_OBJ "item_attack_obj" //! from base of obj/item/attack_obj(): (/obj, /mob) - #define COMPONENT_NO_ATTACK_OBJ 1 +#define COMSIG_ITEM_INTERACT_WITH "item_interact_with" //! from base of interact_with(atom/target, mob/user, params) + #define COMPONENT_INTERACTION_SUCCESS (1 << 0) #define COMSIG_ITEM_PRE_ATTACK "item_pre_attack" //! from base of obj/item/pre_attack(): (atom/target, mob/user, params) #define COMPONENT_NO_ATTACK 1 #define COMSIG_ITEM_AFTERATTACK "item_afterattack" //! from base of obj/item/afterattack(): (atom/target, mob/user, params) #define COMSIG_ITEM_EQUIPPED "item_equip" //! from base of obj/item/equipped(): (/mob/equipper, slot) #define COMSIG_ITEM_DROPPED "item_drop" //! from base of obj/item/dropped(): (mob/user) #define COMSIG_ITEM_PICKUP "item_pickup" //! from base of obj/item/pickup(): (/mob/taker) -#define COMSIG_ITEM_ATTACK_ZONE "item_attack_zone" //! from base of mob/living/carbon/attacked_by(): (mob/living/carbon/target, mob/living/user, hit_zone) +#define COMSIG_ITEM_ATTACK_ZONE "item_attack_zone" //! from base of mob/living/carbon/on_attacked(): (mob/living/carbon/target, mob/living/user, hit_zone) #define COMSIG_ITEM_IMBUE_SOUL "item_imbue_soul" //! return a truthy value to prevent ensouling, checked in /obj/effect/proc_holder/spell/targeted/lichdom/cast(): (mob/user) #define COMSIG_ITEM_MARK_RETRIEVAL "item_mark_retrieval" //! called before marking an object for retrieval, checked in /obj/effect/proc_holder/spell/targeted/summonitem/cast() : (mob/user) #define COMPONENT_BLOCK_MARK_RETRIEVAL 1 diff --git a/code/__DEFINES/helpers.dm b/code/__DEFINES/helpers.dm deleted file mode 100644 index ff8441a0a8805..0000000000000 --- a/code/__DEFINES/helpers.dm +++ /dev/null @@ -1,2 +0,0 @@ -/// subtypesof(), typesof() without the parent path -#define subtypesof(typepath) ( typesof(typepath) - typepath ) diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index 63efa7e1f4533..36973930f098a 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -511,3 +511,22 @@ /// Messages when (something) lays an egg #define EGG_LAYING_MESSAGES list("lays an egg.","squats down and croons.","begins making a huge racket.","begins clucking raucously.") + +/// Update the health of a specific target +#define UPDATE_HEALTH(target) \ +if (target.health_dirty == HEALTH_DIRTY_NOT_DIRTY) {\ + target.health_dirty = HEALTH_DIRTY_QUEUED;\ + spawn(0) {\ + if (target.health_dirty == HEALTH_DIRTY_NOT_DIRTY) { return ; }\ + target.updatehealth();\ + }\ +} + +#define RESOLVE_HEALTH(target) if (target.health_dirty == HEALTH_DIRTY_QUEUED) {\ + target.updatehealth();\ +} + +/// Health does not need updating +#define HEALTH_DIRTY_NOT_DIRTY 0 +/// Health needs updating and has not been queued +#define HEALTH_DIRTY_QUEUED 1 diff --git a/code/__HELPERS/random_helper.dm b/code/__HELPERS/random_helper.dm new file mode 100644 index 0000000000000..20b3b25ced43d --- /dev/null +++ b/code/__HELPERS/random_helper.dm @@ -0,0 +1,8 @@ + +// Rig probability +GLOBAL_VAR_INIT(rigged_prob, null) + +/proc/safe_prob(probability) + if (!isnull(GLOB.rigged_prob)) + return GLOB.rigged_prob + return prob(probability) diff --git a/code/_onclick/ai.dm b/code/_onclick/ai.dm index fd0da7cf49cf6..5d4e8daaba6f0 100644 --- a/code/_onclick/ai.dm +++ b/code/_onclick/ai.dm @@ -88,14 +88,14 @@ A.attack_ai(src) /* - AI has no need for the UnarmedAttack() and RangedAttack() procs, + AI has no need for the primary_interact() and primary_ranged_attack() procs, because the AI code is not generic; attack_ai() is used instead. The below is only really for safety, or you can alter the way it functions and re-insert it above. */ -/mob/living/silicon/ai/UnarmedAttack(atom/A) +/mob/living/silicon/ai/primary_interact(atom/A) A.attack_ai(src) -/mob/living/silicon/ai/RangedAttack(atom/A) +/mob/living/silicon/ai/primary_ranged_attack(atom/A) A.attack_ai(src) /atom/proc/attack_ai(mob/user) diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index e8aac70c8206d..d4dc5b0608d8e 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -59,10 +59,10 @@ check whether you're adjacent to the target, then pass off the click to whoever is receiving it. The most common are: - * mob/UnarmedAttack(atom,adjacent) - used here only when adjacent, with no item in hand; in the case of humans, checks gloves + * mob/primary_interact(atom,adjacent) - used here only when adjacent, with no item in hand; in the case of humans, checks gloves * atom/attackby(item,user) - used only when adjacent * item/afterattack(atom,user,adjacent,params) - used both ranged and adjacent - * mob/RangedAttack(atom,params) - used only ranged, only used for tk and laser eyes but could be changed + * mob/primary_ranged_attack(atom,params) - used only ranged, only used for tk and laser eyes but could be changed */ /mob/proc/ClickOn( atom/A, params ) if(world.time <= next_click) @@ -133,11 +133,11 @@ //User itself, current loc, and user inventory if(A in DirectAccess()) if(W) - W.melee_attack_chain(src, A, params) + W.use_on(src, A, params) else if(ismob(A)) changeNext_move(CLICK_CD_MELEE) - UnarmedAttack(A) + primary_interact(A) return //Can't reach anything else in lockers or other weirdness @@ -147,16 +147,16 @@ //Standard reach turf to turf or reaching inside storage if(CanReach(A,W)) if(W) - W.melee_attack_chain(src, A, params) + W.use_on(src, A, params) else if(ismob(A)) changeNext_move(CLICK_CD_MELEE) - UnarmedAttack(A,1) + primary_interact(A,1) else if(W) W.afterattack(A,src,0,params) else - RangedAttack(A,params) + primary_ranged_attack(A,params) //Is the atom obscured by a PREVENT_CLICK_UNDER_1 object above it /atom/proc/IsObscured() @@ -259,7 +259,7 @@ proximity_flag is not currently passed to attack_hand, and is instead used in human click code to allow glove touches only at melee range. */ -/mob/proc/UnarmedAttack(atom/A, proximity_flag) +/mob/proc/primary_interact(atom/A, proximity_flag) if(ismob(A)) changeNext_move(CLICK_CD_MELEE) return @@ -272,8 +272,9 @@ for things like ranged glove touches, spitting alien acid/neurotoxin, animals lunging, etc. */ -/mob/proc/RangedAttack(atom/A, params) +/mob/proc/primary_ranged_attack(atom/A, params) SEND_SIGNAL(src, COMSIG_MOB_ATTACK_RANGED, A, params) + /* Restrained ClickOn diff --git a/code/_onclick/cyborg.dm b/code/_onclick/cyborg.dm index fe6acb9992e0b..4781709dc9c47 100644 --- a/code/_onclick/cyborg.dm +++ b/code/_onclick/cyborg.dm @@ -70,7 +70,7 @@ // cyborgs are prohibited from using storage items so we can I think safely remove (A.loc in contents) if(A == loc || (A in loc) || (A in contents)) - W.melee_attack_chain(src, A, params) + W.use_on(src, A, params) return if(!isturf(loc)) @@ -79,7 +79,7 @@ // cyborgs are prohibited from using storage items so we can I think safely remove (A.loc && isturf(A.loc.loc)) if(isturf(A) || isturf(A.loc)) if(A.Adjacent(src)) // see adjacent.dm - W.melee_attack_chain(src, A, params) + W.use_on(src, A, params) return else W.afterattack(A, src, 0, params) @@ -167,9 +167,9 @@ clicks, you can do so here, but you will have to change attack_robot() above to the proper function */ -/mob/living/silicon/robot/UnarmedAttack(atom/A) +/mob/living/silicon/robot/primary_interact(atom/A) A.attack_robot(src) -/mob/living/silicon/robot/RangedAttack(atom/A) +/mob/living/silicon/robot/primary_ranged_attack(atom/A) A.attack_robot(src) /atom/proc/attack_robot(mob/user) diff --git a/code/_onclick/hud/pai.dm b/code/_onclick/hud/pai.dm index f236d1e2e1c51..6cf9bbc59bb19 100644 --- a/code/_onclick/hud/pai.dm +++ b/code/_onclick/hud/pai.dm @@ -88,7 +88,7 @@ var/mob/living/silicon/pai/pAI = usr var/mob/living/carbon/holder = get(pAI.card.loc, /mob/living/carbon) if(holder) - pAI.hostscan.attack(holder, pAI) + pAI.hostscan.attack_mob_target(holder, pAI) else to_chat(usr, "You are not being carried by anyone!") return 0 diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index a9fddf5ee1688..a15e83467f4ad 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -1,18 +1,81 @@ -/obj/item/proc/melee_attack_chain(mob/user, atom/target, params) - if(!tool_attack_chain(user, target) && pre_attack(target, user, params)) - // Return 1 in attackby() to prevent afterattack() effects (when safely moving items for example) - var/resolved = target.attackby(src, user, params) - if(!resolved && target && !QDELETED(src)) - afterattack(target, user, 1, params) - -//Checks if the item can work as a tool, calling the appropriate tool behavior on the target -/obj/item/proc/tool_attack_chain(mob/user, atom/target) +/** + * Attempt to use an item on a specific target. + */ +/obj/item/proc/use_on(mob/user, atom/target, params) + SHOULD_NOT_OVERRIDE(TRUE) + // Harm intent always disables safe interactions and goes straight to attacking + if (user.a_intent != INTENT_HARM && tool_action(user, target)) + return + if (QDELETED(src)) + return + // Perform pre attack actions + if(!pre_attack(target, user, params)) + return + // Return 1 in attackby() to prevent afterattack() effects (when safely moving items for example) + var/resolved = attack(user, target, params) || target.attackby(src, user, params) + if(!resolved && target && !QDELETED(src)) + afterattack(target, user, 1, params) + +/** + * Deals an attack to the target, by default using this + * item's damage source profile. + * + * You may override this if you want to completely replace an object's + * attack function with another one that does something else. For example, + * play a sound instead of deal damage. + * + * If you want something to happen as a result of an attack use afterattack or + * pre_attack instead. Overriding this proc is strictly for replacing the + * damage dealing property of an item with some other property. + * + * If introducing swing combat, then that should be introduced at either the + * damage_source level or deal_attack level. + */ +/obj/item/proc/attack(mob/living/user, atom/target, params) + user.changeNext_move(CLICK_CD_MELEE) + user.do_attack_animation(target) + // By default deal our generic attack + deal_attack(user, target, user.zone_selected) + +/** + * Called to perform actions specific to certain tools. + * By default will pass on the tool behaviour to be used by the target instead of + * performing an action here, but you can add specific tool behaviours in here if you want. + */ +/obj/item/proc/tool_action(mob/user, atom/target) + SHOULD_NOT_OVERRIDE(TRUE) + if (interact_with(src, target) || QDELETED(src)) + return TRUE + if (target.item_interact(src, user) || QDELETED(src)) + return TRUE if(!tool_behaviour) return FALSE - return target.tool_act(user, src, tool_behaviour) +/** + * The majority of attackby was converted to this. + * Called when someone attempts to use an item on this device. + * Returns true if the interaction happened meaning that the user will not proceed to hit + * the object. + * You should **always** return true if the item has any interaction at all, even if that interaction + * did not go through. + * If the user is on harm intent, this will never be called in the first place. If you want a response + * on harm intent, then it needs to respond to being attacked rather than trying to use an item + * peacefully on it. + */ +/atom/proc/item_interact(obj/item/item, mob/user, params) + return FALSE + +/** + * Check if this item can interact with another item. + * Returns false if no interact occurred, returns true if an interact + * happened in which case attack will not continue. + */ +/obj/item/proc/interact_with(atom/target, mob/user, params) + if ((SEND_SIGNAL(src, COMSIG_ITEM_INTERACT_WITH, target, user, params)) & COMPONENT_INTERACTION_SUCCESS) + return TRUE + return FALSE // Called when the item is in the active hand, and clicked; alternately, there is an 'activate held object' verb or you can hit pagedown. /obj/item/proc/attack_self(mob/user) @@ -25,18 +88,7 @@ return FALSE return TRUE //return FALSE to avoid calling attackby after this proc does stuff -// No comment -/atom/proc/attackby(obj/item/W, mob/user, params) - if(SEND_SIGNAL(src, COMSIG_PARENT_ATTACKBY, W, user, params) & COMPONENT_NO_AFTERATTACK) - return TRUE - return FALSE - -/obj/attackby(obj/item/I, mob/living/user, params) - return ..() || ((obj_flags & CAN_BE_HIT) && I.attack_obj(src, user)) - -/mob/living/attackby(obj/item/I, mob/living/user, params) - if(..()) - return TRUE +/mob/living/item_interact(obj/item/I, mob/user, params) user.changeNext_move(CLICK_CD_MELEE) if(user.a_intent == INTENT_HARM && stat == DEAD && (butcher_results || guaranteed_butcher_results)) //can we butcher it? var/datum/component/butchering/butchering = I.GetComponent(/datum/component/butchering) @@ -45,15 +97,15 @@ playsound(loc, butchering.butcher_sound, 50, TRUE, -1) if(do_after(user, butchering.speed, src) && Adjacent(I)) butchering.Butcher(user, src) - return 1 + return TRUE else if(I.is_sharp() && !butchering) //give sharp objects butchering functionality, for consistency I.AddComponent(/datum/component/butchering, 80 * I.toolspeed) - attackby(I, user, params) //call the attackby again to refresh and do the butchering check again - return - return I.attack(src, user) + item_interact(I, user, params) //call the attackby again to refresh and do the butchering check again + return TRUE + return ..() -/obj/item/proc/attack(mob/living/M, mob/living/user) +/obj/item/proc/attack_mob_target(mob/living/M, mob/living/user) if(SEND_SIGNAL(src, COMSIG_ITEM_ATTACK, M, user) & COMPONENT_ITEM_NO_ATTACK) return SEND_SIGNAL(user, COMSIG_MOB_ITEM_ATTACK, M, user) @@ -91,7 +143,7 @@ user.time_of_last_poke = time else user.record_accidental_poking() - M.attacked_by(src, user) + M.on_attacked(src, user) M.time_of_last_attack_recieved = time user.time_of_last_attack_dealt = time user.check_for_accidental_attack() @@ -99,44 +151,21 @@ log_combat(user, M, "[nonharmfulhit ? "poked" : "attacked"]", src.name, "(INTENT: [uppertext(user.a_intent)]) (DAMTYPE: [uppertext(damtype)])") add_fingerprint(user) - -//the equivalent of the standard version of attack() but for object targets. -/obj/item/proc/attack_obj(obj/O, mob/living/user) - if(SEND_SIGNAL(src, COMSIG_ITEM_ATTACK_OBJ, O, user) & COMPONENT_NO_ATTACK_OBJ) - return - if(item_flags & NOBLUDGEON) - return - user.changeNext_move(CLICK_CD_MELEE) - user.do_attack_animation(O) - O.attacked_by(src, user) - -/atom/movable/proc/attacked_by() +/atom/proc/on_attacked(obj/item/I, mob/living/user) return -/obj/attacked_by(obj/item/I, mob/living/user) +/obj/on_attacked(obj/item/I, mob/living/user) if(I.force) user.visible_message("[user] hits [src] with [I]!", \ "You hit [src] with [I]!", null, COMBAT_MESSAGE_RANGE) //only witnesses close by and the victim see a hit message. log_combat(user, src, "attacked", I) - take_damage(I.force, I.damtype, MELEE, 1) -/mob/living/attacked_by(obj/item/I, mob/living/user) - send_item_attack_message(I, user) - if(I.force) - var/armour_block = run_armor_check(null, MELEE, armour_penetration = I.armour_penetration) - apply_damage(I.force, I.damtype, blocked = armour_block) - if(I.damtype == BRUTE) - if(prob(33)) - I.add_mob_blood(src) - var/turf/location = get_turf(src) - add_splatter_floor(location) - if(get_dist(user, src) <= 1) //people with TK won't get smeared with blood - user.add_mob_blood(src) - return TRUE //successful attack - -/mob/living/simple_animal/attacked_by(obj/item/I, mob/living/user, nonharmfulhit = FALSE) - if(I.force < force_threshold || I.damtype == STAMINA || nonharmfulhit) +/mob/living/on_attacked(obj/item/I, mob/living/user) + return I.deal_attack(user, src, ran_zone(user.zone_selected)) + +/mob/living/simple_animal/on_attacked(obj/item/I, mob/living/user, nonharmfulhit = FALSE) + if(I.force < force_threshold || I.damtype == STAMINA_DAMTYPE || nonharmfulhit) playsound(loc, 'sound/weapons/tap.ogg', I.get_clamped_volume(), 1, -1) else return ..() diff --git a/code/_onclick/other_mobs.dm b/code/_onclick/other_mobs.dm index 94fa29b272016..a2e2e0774b60a 100644 --- a/code/_onclick/other_mobs.dm +++ b/code/_onclick/other_mobs.dm @@ -4,7 +4,7 @@ Otherwise pretty standard. */ -/mob/living/carbon/human/UnarmedAttack(atom/A, proximity) +/mob/living/carbon/human/primary_interact(atom/A, proximity) if(!has_active_hand()) //can't attack without a hand. to_chat(src, "You look at your arm and sigh.") @@ -86,14 +86,14 @@ /mob/living/carbon/RestrainedClickOn(atom/A) return 0 -/mob/living/carbon/RangedAttack(atom/A, mouseparams) +/mob/living/carbon/primary_ranged_attack(atom/A, mouseparams) . = ..() if(!dna) return for(var/datum/mutation/HM as() in dna.mutations) HM.on_ranged_attack(A, mouseparams) -/mob/living/carbon/human/RangedAttack(atom/A, mouseparams) +/mob/living/carbon/human/primary_ranged_attack(atom/A, mouseparams) . = ..() if(gloves) var/obj/item/clothing/gloves/G = gloves @@ -107,7 +107,7 @@ /* Animals & All Unspecified */ -/mob/living/UnarmedAttack(atom/A) +/mob/living/primary_interact(atom/A) A.attack_animal(src) /atom/proc/attack_animal(mob/user) @@ -120,7 +120,7 @@ /* Monkeys */ -/mob/living/carbon/monkey/UnarmedAttack(atom/A, proximity) +/mob/living/carbon/monkey/primary_interact(atom/A, proximity) var/override = 0 for(var/datum/mutation/HM as() in dna.mutations) override += HM.on_attack_hand(A, proximity) @@ -151,16 +151,16 @@ var/mob/living/carbon/ML = A if(istype(ML)) var/dam_zone = pick(BODY_ZONE_CHEST, BODY_ZONE_PRECISE_L_HAND, BODY_ZONE_PRECISE_R_HAND, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG) - var/obj/item/bodypart/affecting = null - if(ishuman(ML)) - var/mob/living/carbon/human/H = ML - affecting = H.get_bodypart(ran_zone(dam_zone)) - var/armor = ML.run_armor_check(affecting, MELEE) if(prob(75)) - ML.apply_damage(rand(1,3), BRUTE, affecting, armor) + var/datum/damage_source/sharp/light/bite_source = FIND_DAMAGE_SOURCE ML.visible_message("[name] bites [ML]!", \ "[name] bites you!", null, COMBAT_MESSAGE_RANGE) - if(armor >= 2) + // Returns false if blocked + var/target_zone = ran_zone(dam_zone) + if(!bite_source.deal_attack(src, null, ML, /datum/damage/brute, rand(1, 3), target_zone)) + return + // Check bio armour + if (prob(ML.run_armor_check(target_zone, BIO, silent = TRUE))) return for(var/thing in diseases) var/datum/disease/D = thing @@ -173,7 +173,7 @@ Aliens Defaults to same as monkey in most places */ -/mob/living/carbon/alien/UnarmedAttack(atom/A) +/mob/living/carbon/alien/primary_interact(atom/A) A.attack_alien(src) /atom/proc/attack_alien(mob/living/carbon/alien/user) @@ -184,20 +184,48 @@ return // Babby aliens -/mob/living/carbon/alien/larva/UnarmedAttack(atom/A) - A.attack_larva(src) -/atom/proc/attack_larva(mob/user) - return +/mob/living/carbon/alien/larva/primary_interact(atom/A) + if (A.larva_attack_intercept(src)) + return + var/damage_dealt = deal_generic_attack(A) + if (damage_dealt <= 0) + return + amount_grown = min(amount_grown + damage_dealt, max_grown) +/atom/proc/larva_attack_intercept(mob/user) + return FALSE + +/mob/living/carbon/alien/larva/deal_generic_attack(atom/target) + switch(a_intent) + if(INTENT_HELP) + target.visible_message("[name] rubs its head against [target].", \ + "[name] rubs its head against you.") + return FALSE + + else + if(safe_prob(90)) + log_combat(src, target, "attacked") + var/datum/damage_source/source = GET_DAMAGE_SOURCE(/datum/damage_source/sharp/light) + source.deal_attack(src, null, target, /datum/damage/brute, rand(3, 10), ran_zone(zone_selected)) + playsound(loc, 'sound/weapons/bite.ogg', 50, 1, -1) + return TRUE + else + do_attack_animation(target) + target.visible_message("[name]'s bite misses [target]!", \ + "[name]'s bite misses you!", null, COMBAT_MESSAGE_RANGE) + return FALSE /* Slimes Nothing happening here */ -/mob/living/simple_animal/slime/UnarmedAttack(atom/A) - A.attack_slime(src) +/mob/living/simple_animal/slime/primary_interact(atom/A) + deal_generic_attack(A) -/atom/proc/attack_slime(mob/user) +/** + * + */ +/atom/proc/after_attacked_by_slime(mob/user) return /mob/living/simple_animal/slime/RestrainedClickOn(atom/A) @@ -207,7 +235,7 @@ /* Drones */ -/mob/living/simple_animal/drone/UnarmedAttack(atom/A) +/mob/living/simple_animal/drone/primary_interact(atom/A) A.attack_drone(src) /atom/proc/attack_drone(mob/living/simple_animal/drone/user) @@ -221,14 +249,14 @@ True Devil */ -/mob/living/carbon/true_devil/UnarmedAttack(atom/A, proximity) +/mob/living/carbon/true_devil/primary_interact(atom/A, proximity) A.attack_hand(src) /* Brain */ -/mob/living/brain/UnarmedAttack(atom/A)//Stops runtimes due to attack_animal being the default +/mob/living/brain/primary_interact(atom/A)//Stops runtimes due to attack_animal being the default return @@ -236,7 +264,7 @@ pAI */ -/mob/living/silicon/pai/UnarmedAttack(atom/attack_target, proximity_flag, list/modifiers) +/mob/living/silicon/pai/primary_interact(atom/attack_target, proximity_flag, list/modifiers) attack_target.attack_pai(src, modifiers) /atom/proc/attack_pai(mob/user, list/modifiers) @@ -246,7 +274,7 @@ Simple animals */ -/mob/living/simple_animal/UnarmedAttack(atom/A, proximity) +/mob/living/simple_animal/primary_interact(atom/A, proximity) if(!dextrous || a_intent == INTENT_HARM) return ..() if(!ismob(A)) @@ -258,7 +286,7 @@ Hostile animals */ -/mob/living/simple_animal/hostile/UnarmedAttack(atom/A) +/mob/living/simple_animal/hostile/primary_interact(atom/A) GiveTarget(A) if(dextrous && !ismob(A)) ..() diff --git a/code/_onclick/telekinesis.dm b/code/_onclick/telekinesis.dm index bf8868555867d..ad582697bc920 100644 --- a/code/_onclick/telekinesis.dm +++ b/code/_onclick/telekinesis.dm @@ -16,7 +16,7 @@ if(user.stat || !tkMaxRangeCheck(user, src)) return new /obj/effect/temp_visual/telekinesis(get_turf(src)) - user.UnarmedAttack(src,0) // attack_hand, attack_paw, etc + user.primary_interact(src,0) // attack_hand, attack_paw, etc add_hiddenprint(user) return @@ -142,7 +142,7 @@ if(!isturf(target) && isitem(focus) && target.Adjacent(focus)) apply_focus_overlay() var/obj/item/I = focus - I.melee_attack_chain(tk_user, target, params) //isn't copying the attack chain fun. we should do it more often. + I.use_on(tk_user, target, params) //isn't copying the attack chain fun. we should do it more often. if(check_if_focusable(focus)) focus.do_attack_animation(target, null, focus) else @@ -159,7 +159,7 @@ return return TRUE -/obj/item/tk_grab/attack(mob/living/M, mob/living/user, def_zone) +/obj/item/tk_grab/attack_mob_target(mob/living/M, mob/living/user, def_zone) return /obj/item/tk_grab/proc/focus_object(obj/target) diff --git a/code/datums/ai/dog/dog_behaviors.dm b/code/datums/ai/dog/dog_behaviors.dm index 60c60214dff75..bf87d0ef94fd3 100644 --- a/code/datums/ai/dog/dog_behaviors.dm +++ b/code/datums/ai/dog/dog_behaviors.dm @@ -203,6 +203,6 @@ var/old_melee_damage = living_pawn.melee_damage living_pawn.melee_damage = max(7, old_melee_damage) - living_pawn.UnarmedAttack(living_target, FALSE) + living_pawn.primary_interact(living_target, FALSE) living_pawn.melee_damage = old_melee_damage diff --git a/code/datums/ai/generic_actions.dm b/code/datums/ai/generic_actions.dm index a32adc2063eb8..a8715e8741573 100644 --- a/code/datums/ai/generic_actions.dm +++ b/code/datums/ai/generic_actions.dm @@ -55,7 +55,8 @@ continue bodypart_to_break.receive_damage(brute = 15) else - batman.adjustBruteLoss(150) + var/datum/damage_source/crush/crush_source = FIND_DAMAGE_SOURCE + crush_source.apply_direct(batman, BRUTE, 150) finish_action(controller, TRUE, target_key) @@ -100,9 +101,9 @@ pawn.a_intent = INTENT_HELP if(held_item) - held_item.melee_attack_chain(pawn, target) + held_item.use_on(pawn, target) else - pawn.UnarmedAttack(target, TRUE) + pawn.primary_interact(target, TRUE) finish_action(controller, TRUE) @@ -165,7 +166,7 @@ pawn.put_in_hands(target) - target.melee_attack_chain(pawn, pawn) + target.use_on(pawn, pawn) if(QDELETED(target) || prob(10)) // Even if we don't finish it all we can randomly decide to be done finish_action(controller, TRUE) diff --git a/code/datums/ai/monkey/monkey_behaviors.dm b/code/datums/ai/monkey/monkey_behaviors.dm index 01303801b7292..cb9c2b275f4b0 100644 --- a/code/datums/ai/monkey/monkey_behaviors.dm +++ b/code/datums/ai/monkey/monkey_behaviors.dm @@ -190,14 +190,14 @@ // attack with weapon if we have one if(living_pawn.CanReach(target, weapon)) if(weapon) - weapon.melee_attack_chain(living_pawn, target) + weapon.use_on(living_pawn, target) else if(disarm) living_pawn.a_intent = INTENT_DISARM - living_pawn.UnarmedAttack(target) + living_pawn.primary_interact(target) living_pawn.a_intent = INTENT_HARM else - living_pawn.UnarmedAttack(target) + living_pawn.primary_interact(target) controller.blackboard[BB_MONKEY_GUN_WORKED] = TRUE // We reset their memory of the gun being 'broken' if they accomplish some other attack else if(weapon) var/atom/real_target = target diff --git a/code/datums/ai/monkey/monkey_controller.dm b/code/datums/ai/monkey/monkey_controller.dm index 15a7da9020686..43bb9f82f85ec 100644 --- a/code/datums/ai/monkey/monkey_controller.dm +++ b/code/datums/ai/monkey/monkey_controller.dm @@ -175,7 +175,7 @@ have ways of interacting with a specific mob and control it. /datum/ai_controller/monkey/proc/on_attackby(datum/source, obj/item/I, mob/user) SIGNAL_HANDLER - if(I.force && I.damtype != STAMINA) + if(I.force && I.damtype != STAMINA_DAMTYPE) retaliate(user) /datum/ai_controller/monkey/proc/on_attack_hand(datum/source, mob/living/user) diff --git a/code/datums/ai/tamed/tamed_behaviour.dm b/code/datums/ai/tamed/tamed_behaviour.dm index a61feb146cd67..67411f97680cd 100644 --- a/code/datums/ai/tamed/tamed_behaviour.dm +++ b/code/datums/ai/tamed/tamed_behaviour.dm @@ -48,9 +48,9 @@ // Attack else if(COOLDOWN_FINISHED(src, attack_cooldown)) if(get_dist(pawn, controller.blackboard[BB_ATTACK_TARGET]) > 1) - pawn.RangedAttack(target) + pawn.primary_ranged_attack(target) else - pawn.UnarmedAttack(target) + pawn.primary_interact(target) COOLDOWN_START(src, attack_cooldown, 1.3 SECONDS) ..() diff --git a/code/datums/components/butchering.dm b/code/datums/components/butchering.dm index 60c9a33695970..cab2ddaf130b7 100644 --- a/code/datums/components/butchering.dm +++ b/code/datums/components/butchering.dm @@ -64,7 +64,7 @@ H.visible_message("[user] slits [H]'s throat!", \ "[user] slits your throat...") - H.apply_damage(item_force, BRUTE, BODY_ZONE_HEAD) + source.damage_direct(user, H, BODY_ZONE_HEAD) H.bleed_rate = CLAMP(H.bleed_rate + 20, 0, 30) H.apply_status_effect(/datum/status_effect/neck_slice) diff --git a/code/datums/components/caltrop.dm b/code/datums/components/caltrop.dm index ade35521ebe6f..acf5f04f7e784 100644 --- a/code/datums/components/caltrop.dm +++ b/code/datums/components/caltrop.dm @@ -62,7 +62,8 @@ if(HAS_TRAIT(H, TRAIT_LIGHT_STEP)) damage *= 0.5 - H.apply_damage(damage, BRUTE, picked_def_zone) + var/datum/damage_source/sharp/light/damage_source = FIND_DAMAGE_SOURCE + damage_source.deal_attack(null, parent, H, damage, /datum/damage/brute, picked_def_zone) if(COOLDOWN_FINISHED(src, caltrop_cooldown)) COOLDOWN_START(src, caltrop_cooldown, 1 SECONDS) //cooldown to avoid message spam. diff --git a/code/datums/components/chasm.dm b/code/datums/components/chasm.dm index bf0ab993a21e8..a670f4afb36d6 100644 --- a/code/datums/components/chasm.dm +++ b/code/datums/components/chasm.dm @@ -107,7 +107,8 @@ if(isliving(AM)) var/mob/living/L = AM L.Paralyze(100) - L.adjustBruteLoss(30) + var/datum/damage_source/impact/source = FIND_DAMAGE_SOURCE + source.apply_direct(L, BRUTE, 30) falling_atoms -= falling_ref else diff --git a/code/datums/components/cult_ritual_item.dm b/code/datums/components/cult_ritual_item.dm index 418f2b3edbbf1..6db8cf7bb386d 100644 --- a/code/datums/components/cult_ritual_item.dm +++ b/code/datums/components/cult_ritual_item.dm @@ -46,7 +46,7 @@ /datum/component/cult_ritual_item/RegisterWithParent() RegisterSignal(parent, COMSIG_ITEM_ATTACK_SELF, PROC_REF(try_scribe_rune)) RegisterSignal(parent, COMSIG_ITEM_ATTACK, PROC_REF(try_purge_holywater)) - RegisterSignal(parent, COMSIG_ITEM_ATTACK_OBJ, PROC_REF(try_hit_object)) + RegisterSignal(parent, COMSIG_ITEM_INTERACT_WITH, PROC_REF(try_hit_object)) RegisterSignal(parent, COMSIG_ITEM_ATTACK_EFFECT, PROC_REF(try_clear_rune)) if(examine_message) @@ -56,7 +56,7 @@ UnregisterSignal(parent, list( COMSIG_ITEM_ATTACK_SELF, COMSIG_ITEM_ATTACK, - COMSIG_ITEM_ATTACK_OBJ, + COMSIG_ITEM_INTERACT_WITH, COMSIG_ITEM_ATTACK_EFFECT, )) if(examine_message) @@ -115,10 +115,10 @@ INVOKE_ASYNC(src, PROC_REF(do_purge_holywater), user) /* - * Signal proc for [COMSIG_ITEM_ATTACK_OBJ]. + * Signal proc for [COMSIG_ITEM_INTERACT_WITH]. * Allows the ritual items to unanchor cult buildings or destroy rune girders. */ -/datum/component/cult_ritual_item/proc/try_hit_object(datum/source, obj/structure/target, mob/cultist) +/datum/component/cult_ritual_item/proc/try_hit_object(datum/source, mob/cultist, obj/structure/target) SIGNAL_HANDLER if(!isliving(cultist) || !IS_CULTIST(cultist)) @@ -126,11 +126,11 @@ if(istype(target, /obj/structure/girder/cult)) INVOKE_ASYNC(src, PROC_REF(do_destroy_girder), target, cultist) - return COMPONENT_NO_AFTERATTACK + return COMPONENT_INTERACTION_SUCCESS if(istype(target, /obj/structure/destructible/cult)) INVOKE_ASYNC(src, PROC_REF(do_unanchor_structure), target, cultist) - return COMPONENT_NO_AFTERATTACK + return COMPONENT_INTERACTION_SUCCESS /* * Signal proc for [COMSIG_ITEM_ATTACK_EFFECT]. @@ -303,7 +303,7 @@ log_game("[key_name(cultist)] has begun inscribing the Narsie summon rune at [AREACOORD(cultist)]") if(cultist.blood_volume) - cultist.apply_damage(initial(rune_to_scribe.scribe_damage), BRUTE, pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM)) // *cuts arm* *bone explodes* ever have one of those days? + cultist.apply_damage(tool.damage_source, tool.damtype, initial(rune_to_scribe.scribe_damage), pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM)) // *cuts arm* *bone explodes* ever have one of those days? var/scribe_mod = initial(rune_to_scribe.scribe_delay) if(!initial(rune_to_scribe.no_scribe_boost) && (our_turf.type in turfs_that_boost_us)) diff --git a/code/datums/components/explodable.dm b/code/datums/components/explodable.dm index 6b72a7a852ec0..f69546741861d 100644 --- a/code/datums/components/explodable.dm +++ b/code/datums/components/explodable.dm @@ -17,7 +17,7 @@ RegisterSignal(parent, COMSIG_MOVABLE_IMPACT, PROC_REF(explodable_impact)) RegisterSignal(parent, COMSIG_MOVABLE_BUMP, PROC_REF(explodable_bump)) if(isitem(parent)) - RegisterSignal(parent, list(COMSIG_ITEM_ATTACK, COMSIG_ITEM_ATTACK_OBJ, COMSIG_ITEM_HIT_REACT), PROC_REF(explodable_attack)) + RegisterSignal(parent, list(COMSIG_ITEM_ATTACK, COMSIG_ITEM_INTERACT_WITH, COMSIG_ITEM_HIT_REACT), PROC_REF(explodable_attack)) RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, PROC_REF(on_equip)) RegisterSignal(parent, COMSIG_ITEM_DROPPED, PROC_REF(on_drop)) diff --git a/code/datums/components/jousting.dm b/code/datums/components/jousting.dm index b5ecc67a5ec7a..ab071eec8b77f 100644 --- a/code/datums/components/jousting.dm +++ b/code/datums/components/jousting.dm @@ -55,7 +55,7 @@ var/msg if(damage) msg += "[user] [sharp? "impales" : "slams into"] [target] [sharp? "on" : "with"] their [parent]" - target.apply_damage(damage, BRUTE, user.zone_selected, 0) + I.deal_attack(user, target, user.zone_selected, override_damage = damage) if(prob(knockdown_chance)) msg += " and knocks [target] [target_buckled? "off of [target.buckled]" : "down"]" if(target_buckled) diff --git a/code/datums/components/larryknife.dm b/code/datums/components/larryknife.dm index 0738f722e2bce..0dcabeb377e53 100644 --- a/code/datums/components/larryknife.dm +++ b/code/datums/components/larryknife.dm @@ -23,7 +23,7 @@ leg = BODY_ZONE_R_LEG else leg = BODY_ZONE_L_LEG - C.apply_damage(knife_damage, BRUTE, leg) + C.apply_damage(/datum/damage_source/sharp/light, /datum/damage/brute, knife_damage, leg) P.visible_message("[C.name] is stabbed by [P.name].") playsound(get_turf(P), 'sound/weapons/slice.ogg', 50, 1) TIMER_COOLDOWN_START(src, COOLDOWN_LARRYKNIFE, 2 SECONDS) diff --git a/code/datums/components/radioactive.dm b/code/datums/components/radioactive.dm index 89efd7bc9e5e5..29479f69b9f50 100644 --- a/code/datums/components/radioactive.dm +++ b/code/datums/components/radioactive.dm @@ -20,7 +20,7 @@ RegisterSignal(parent, COMSIG_PARENT_EXAMINE, PROC_REF(rad_examine)) if(istype(parent, /obj/item)) RegisterSignal(parent, COMSIG_ITEM_ATTACK, PROC_REF(rad_attack)) - RegisterSignal(parent, COMSIG_ITEM_ATTACK_OBJ, PROC_REF(rad_attack)) + RegisterSignal(parent, COMSIG_ITEM_INTERACT_WITH, PROC_REF(rad_attack)) else return COMPONENT_INCOMPATIBLE if(strength * (RAD_CONTAMINATION_STR_COEFFICIENT * RAD_CONTAMINATION_BUDGET_SIZE) > RAD_COMPONENT_MINIMUM) diff --git a/code/datums/components/shell.dm b/code/datums/components/shell.dm index 8073da2742fd3..29723710d702a 100644 --- a/code/datums/components/shell.dm +++ b/code/datums/components/shell.dm @@ -133,7 +133,7 @@ if(istype(item, /obj/item/inducer)) var/obj/item/inducer/inducer = item - INVOKE_ASYNC(inducer, TYPE_PROC_REF(/obj/item, attack_obj), attached_circuit, attacker, list()) + INVOKE_ASYNC(inducer, TYPE_PROC_REF(/obj/item, interact_with), attached_circuit, attacker, list()) return COMPONENT_NO_AFTERATTACK if(attached_circuit) diff --git a/code/datums/components/spikes.dm b/code/datums/components/spikes.dm index cb8bd946f5662..8146e6e208d6f 100644 --- a/code/datums/components/spikes.dm +++ b/code/datums/components/spikes.dm @@ -26,8 +26,7 @@ var/netdamage = spikedamage * damage_mod if(istype(C) && cooldown <= world.time) var/atom/movable/P = parent - var/def_check = C.getarmor(type = MELEE) - C.apply_damage(netdamage, BRUTE, blocked = def_check) + C.apply_damage(/datum/damage_source/sharp/light, /datum/damage/brute, netdamage) P.visible_message("[C.name] is pricked on [P.name]'s spikes.") playsound(get_turf(P), 'sound/weapons/slice.ogg', 50, 1) cooldown = (world.time + 8) //spike cooldown is equal to default unarmed attack speed diff --git a/code/datums/components/squeak.dm b/code/datums/components/squeak.dm index 20ea8fabf2bea..a89d2f66fb98c 100644 --- a/code/datums/components/squeak.dm +++ b/code/datums/components/squeak.dm @@ -29,7 +29,7 @@ RegisterSignal(parent, COMSIG_ATOM_EMINENCE_ACT, PROC_REF(play_squeak_crossed)) RegisterSignal(parent, COMSIG_MOVABLE_DISPOSING, PROC_REF(disposing_react)) if(isitem(parent)) - RegisterSignal(parent, list(COMSIG_ITEM_ATTACK, COMSIG_ITEM_ATTACK_OBJ, COMSIG_ITEM_HIT_REACT), PROC_REF(play_squeak)) + RegisterSignal(parent, list(COMSIG_ITEM_ATTACK, COMSIG_ITEM_INTERACT_WITH, COMSIG_ITEM_HIT_REACT), PROC_REF(play_squeak)) RegisterSignal(parent, COMSIG_ITEM_ATTACK_SELF, PROC_REF(use_squeak)) RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, PROC_REF(on_equip)) RegisterSignal(parent, COMSIG_ITEM_DROPPED, PROC_REF(on_drop)) diff --git a/code/datums/diseases/advance/symptoms/beesymptom.dm b/code/datums/diseases/advance/symptoms/beesymptom.dm index 0714a5ef8bade..f56de816da74a 100644 --- a/code/datums/diseases/advance/symptoms/beesymptom.dm +++ b/code/datums/diseases/advance/symptoms/beesymptom.dm @@ -49,7 +49,6 @@ else to_chat(M, "Your stomach stings painfully.") M.adjustToxLoss(5) - M.updatehealth() if(4, 5) if(honey) ADD_TRAIT(M, TRAIT_BEEFRIEND, DISEASE_TRAIT) @@ -62,7 +61,6 @@ else to_chat(M, "Your stomach stings painfully.") M.adjustToxLoss(5) - M.updatehealth() if(prob(10)) M.visible_message("[M] buzzes.", \ "Your stomach buzzes violently!") diff --git a/code/datums/diseases/advance/symptoms/confusion.dm b/code/datums/diseases/advance/symptoms/confusion.dm index 0e508966b175e..5ace2b7333465 100644 --- a/code/datums/diseases/advance/symptoms/confusion.dm +++ b/code/datums/diseases/advance/symptoms/confusion.dm @@ -63,6 +63,5 @@ Bonus M.confused = min(100 * power, M.confused + 8) if(brain_damage) M.adjustOrganLoss(ORGAN_SLOT_BRAIN,3 * power, 80) - M.updatehealth() return diff --git a/code/datums/diseases/advance/symptoms/heal.dm b/code/datums/diseases/advance/symptoms/heal.dm index 2cb4206afa5a5..be0390772fc53 100644 --- a/code/datums/diseases/advance/symptoms/heal.dm +++ b/code/datums/diseases/advance/symptoms/heal.dm @@ -312,7 +312,7 @@ im not even gonna bother with these for the following symptoms. typed em out, co if(4, 5) M.emp_act(EMP_HEAVY) if(cellheal) - M.adjustCloneLoss(-30) + M.adjustCloneLossAbstract(-30) M.reagents.add_reagent(/datum/reagent/medicine/mutadone = 1) if(bigemp) empulse(M.loc, 0, 1) @@ -558,7 +558,8 @@ im not even gonna bother with these for the following symptoms. typed em out, co if(bruteheal) M.heal_overall_damage(2 * power, required_status = BODYTYPE_ORGANIC) if(prob(33) && tetsuo) - M.adjustCloneLoss(1) + var/datum/damage_source/body/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(M, CLONE, 1) else if(prob(5)) to_chat(M, "[pick("You feel bloated.", "The station seems small.", "You are the strongest.")]") diff --git a/code/datums/diseases/advance/symptoms/kitty.dm b/code/datums/diseases/advance/symptoms/kitty.dm index 096936524568a..a2885fb9fd26f 100644 --- a/code/datums/diseases/advance/symptoms/kitty.dm +++ b/code/datums/diseases/advance/symptoms/kitty.dm @@ -53,7 +53,7 @@ tail.Remove(M) tail.forceMove(get_turf(M)) M.add_splatter_floor(get_turf(M)) - M.apply_damage(5, BRUTE) + M.apply_damage(/datum/damage_source/forceful_laceration, /datum/damage/brute, 5, BODY_ZONE_PRECISE_GROIN) M.emote("laugh") playsound(M, 'sound/misc/desecration-01.ogg', 50, 1) else if(!ears || !tail) @@ -90,7 +90,7 @@ to_chat(H, "You pet [cat]!") cat.visible_message("[H] grabs [cat] roughly!", "[H] roughly grabs you by the neck!") H.emote("laugh") - cat.apply_damage(5, BRUTE) + cat.apply_damage(/datum/damage_source/impact, /datum/damage/brute, 5) dnacounter += 2 //real cats are purer, scarcer, and all around better else if(H.throw_at(cat, 7, 2)) if(get_dist(cat, H) > 1) @@ -110,7 +110,7 @@ targettail.forceMove(get_turf(target)) target.emote("scream") target.add_splatter_floor(get_turf(target)) - target.apply_damage(5, BRUTE) + target.apply_damage(/datum/damage_source/forceful_laceration, /datum/damage/brute, 5, BODY_ZONE_PRECISE_GROIN) H.put_in_hands(targettail) dnacounter += 1 playsound(target, 'sound/misc/desecration-01.ogg', 50, 1) @@ -129,14 +129,14 @@ targetears.forceMove(get_turf(target)) target.emote("scream") target.add_splatter_floor(get_turf(target)) - target.apply_damage(5, BRUTE) + target.apply_damage(/datum/damage_source/forceful_laceration, /datum/damage/brute, 5, BODY_ZONE_HEAD) H.put_in_hands(targetears) playsound(target, 'sound/misc/desecration-01.ogg', 50, 1) else H.visible_message("[H] yanks on [target]'s ears!", "You scratch behind [target]'s ears!") to_chat(target, "[H] yanks on your ears!") H.emote("laugh") - target.apply_damage(rand(1, 10), BRUTE) + target.apply_damage(/datum/damage_source/forceful_laceration, /datum/damage/brute, rand(1, 10)) /datum/symptom/toxoplasmosis/End(datum/disease/advance/A) . = ..() diff --git a/code/datums/diseases/advance/symptoms/macrophage.dm b/code/datums/diseases/advance/symptoms/macrophage.dm index 1e7ec1dab55ee..b515b93819f8a 100644 --- a/code/datums/diseases/advance/symptoms/macrophage.dm +++ b/code/datums/diseases/advance/symptoms/macrophage.dm @@ -57,12 +57,12 @@ if(gigagerms) phage = new /mob/living/simple_animal/hostile/macrophage/aggro(M.loc) phage.melee_damage = max(5, A.resistance) - M.apply_damage(rand(10, 20)) + M.apply_damage(/datum/damage_source/internal_rupture, /datum/damage/brute, rand(10, 20)) playsound(M, 'sound/effects/splat.ogg', 50, 1) M.emote("scream") else phage = new(M.loc) - M.apply_damage(rand(1, 7)) + M.apply_damage(/datum/damage_source/internal_rupture, /datum/damage/brute, rand(1, 7)) phage.health += A.resistance phage.maxHealth += A.resistance phage.infections += A diff --git a/code/datums/diseases/advance/symptoms/necropolis.dm b/code/datums/diseases/advance/symptoms/necropolis.dm index 09877bb28fd06..564306ad3b336 100644 --- a/code/datums/diseases/advance/symptoms/necropolis.dm +++ b/code/datums/diseases/advance/symptoms/necropolis.dm @@ -130,7 +130,8 @@ return visible_message("[src] grabs hold of [L]!") L.Stun(40) - L.adjustBruteLoss(rand(1,10)) + var/datum/damage_source/impact/source = FIND_DAMAGE_SOURCE + source.apply_direct(L, BRUTE, rand(1,10)) latched = TRUE if(!latched) retract() diff --git a/code/datums/diseases/advance/symptoms/radiation.dm b/code/datums/diseases/advance/symptoms/radiation.dm index 39e85fd856a73..d524ed1889d50 100644 --- a/code/datums/diseases/advance/symptoms/radiation.dm +++ b/code/datums/diseases/advance/symptoms/radiation.dm @@ -54,7 +54,7 @@ severity = 0 //this is, at base level, somewhat negative. low levels of radiation will become brute damage and a danger to a host, where otherwise they'd have no effect symptom_delay_min = 1 symptom_delay_max = 1 - var/toxheal = FALSE + var/toxheal = FALSE var/cellheal = FALSE suffixes = list(" Aptosis") threshold_desc = "Stage Speed 6: The disease also kills off contaminated cells, converting Toxin damage to Brute damage, at an efficient rate.
\ @@ -94,7 +94,7 @@ to_chat(M, "A tear opens in your flesh!") M.add_splatter_floor() if(M.getCloneLoss() && cellheal) - M.adjustCloneLoss(-1) + M.adjustCloneLossAbstract(-1) M.take_overall_damage(burn = 2) //this uses burn, so as not to make it so you can heal brute to heal all the damage types this deals, and it isn't a no-brainer to use with Pituitary if(prob(5)) to_chat(M, "A nasty rash appears on your skin!") diff --git a/code/datums/diseases/advance/symptoms/skin.dm b/code/datums/diseases/advance/symptoms/skin.dm index a06507f76eca0..e872742c7c26b 100644 --- a/code/datums/diseases/advance/symptoms/skin.dm +++ b/code/datums/diseases/advance/symptoms/skin.dm @@ -401,14 +401,12 @@ Thresholds done = TRUE if(H.pulling && iscarbon(H.pulling)) //grabbing is handled with the disease instead of the component, so the component doesn't have to be processed var/mob/living/carbon/C = H.pulling - var/def_check = C.getarmor(type = MELEE) - C.apply_damage(1*power, BRUTE, blocked = def_check) + C.apply_damage(/datum/damage_source/sharp/light, /datum/damage/brute, 1 * power, ran_zone()) C.visible_message("[C.name] is pricked on [H.name]'s spikes.") playsound(get_turf(C), 'sound/weapons/slice.ogg', 50, 1) for(var/mob/living/carbon/C in ohearers(1, H)) if(C.pulling && C.pulling == H) - var/def_check = C.getarmor(type = MELEE) - C.apply_damage(3*power, BRUTE, blocked = def_check) + C.apply_damage(/datum/damage_source/sharp/light, /datum/damage/brute, 3 * power, ran_zone()) C.visible_message("[C.name] is pricked on [H.name]'s spikes.") playsound(get_turf(C), 'sound/weapons/slice.ogg', 50, 1) @@ -454,14 +452,22 @@ Thresholds switch(A.stage) if(2, 3) var/buboes = (rand(1, 3) * power) - M.adjustBruteLoss(buboes / 2) - M.adjustToxLoss(buboes) + // Bursts through the skin and ruptures it + var/datum/damage_source/internal_rupture/source = FIND_DAMAGE_SOURCE + source.apply_direct(M, BRUTE, buboes / 2) + // Releases poisonous chemicals on the way out + var/datum/damage_source/chemical/chemical_source = FIND_DAMAGE_SOURCE + chemical_source.apply_direct(M, TOX, buboes) pustules = min(pustules + buboes, 10) to_chat(M, "painful sores open on your skin!") if(4, 5) var/buboes = (rand(3, 6) * power) - M.adjustBruteLoss(buboes / 2) - M.adjustToxLoss(buboes) + // Bursts through the skin and ruptures it + var/datum/damage_source/internal_rupture/source = FIND_DAMAGE_SOURCE + source.apply_direct(M, BRUTE, buboes / 2) + // Releases poisonous chemicals on the way out + var/datum/damage_source/chemical/chemical_source = FIND_DAMAGE_SOURCE + chemical_source.apply_direct(M, TOX, buboes) pustules = min(pustules + buboes, 20) to_chat(M, "painful sores open on your skin!") if((prob(pustules * 5) || pustules >= 20) && shoot) @@ -523,7 +529,7 @@ Thresholds speed = 5 damage_type = TOX icon_state = "energy2" - armor_flag = BIO + damage_source = /datum/damage_source/biohazard var/list/diseases /obj/projectile/pimple/on_hit(atom/target, blocked) diff --git a/code/datums/diseases/beesease.dm b/code/datums/diseases/beesease.dm index b26618640fefe..b033d0a64bc96 100644 --- a/code/datums/diseases/beesease.dm +++ b/code/datums/diseases/beesease.dm @@ -25,7 +25,6 @@ to_chat(affected_mob, "Your stomach stings painfully.") if(prob(20)) affected_mob.adjustToxLoss(2) - affected_mob.updatehealth() if(4) if(prob(10)) affected_mob.visible_message("[affected_mob] buzzes.", \ diff --git a/code/datums/diseases/brainrot.dm b/code/datums/diseases/brainrot.dm index edfc1486469e7..d6344928bd89e 100644 --- a/code/datums/diseases/brainrot.dm +++ b/code/datums/diseases/brainrot.dm @@ -25,7 +25,6 @@ to_chat(affected_mob, "You don't feel like yourself.") if(prob(5)) affected_mob.adjustOrganLoss(ORGAN_SLOT_BRAIN, 1, 170) - affected_mob.updatehealth() if(3) if(prob(2)) affected_mob.emote("stare") @@ -33,7 +32,6 @@ affected_mob.emote("drool") if(prob(10)) affected_mob.adjustOrganLoss(ORGAN_SLOT_BRAIN, 2, 170) - affected_mob.updatehealth() if(prob(2)) to_chat(affected_mob, "Your try to remember something important...but can't.") @@ -44,7 +42,6 @@ affected_mob.emote("drool") if(prob(15)) affected_mob.adjustOrganLoss(ORGAN_SLOT_BRAIN, 3, 170) - affected_mob.updatehealth() if(prob(2)) to_chat(affected_mob, "Strange buzzing fills your head, removing all thoughts.") if(prob(3)) diff --git a/code/datums/diseases/decloning.dm b/code/datums/diseases/decloning.dm index 90ff0cda7fff5..da0f798884846 100644 --- a/code/datums/diseases/decloning.dm +++ b/code/datums/diseases/decloning.dm @@ -30,7 +30,9 @@ if(prob(2)) affected_mob.emote("drool") if(prob(3)) - affected_mob.adjustCloneLoss(1) + var/datum/damage_source/body/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(affected_mob, CLONE, 1) + if(prob(2)) to_chat(affected_mob, "Your skin feels strange.") @@ -41,7 +43,8 @@ affected_mob.emote("drool") if(prob(5)) affected_mob.adjustOrganLoss(ORGAN_SLOT_BRAIN, 1, 170) - affected_mob.adjustCloneLoss(2) + var/datum/damage_source/body/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(affected_mob, CLONE, 2) if(prob(15)) affected_mob.stuttering += 3 if(5) @@ -52,7 +55,8 @@ if(prob(5)) to_chat(affected_mob, "Your skin starts degrading!") if(prob(10)) - affected_mob.adjustCloneLoss(5) + var/datum/damage_source/body/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(affected_mob, CLONE, 5) affected_mob.adjustOrganLoss(ORGAN_SLOT_BRAIN, 2, 170) if(affected_mob.cloneloss >= 100) affected_mob.visible_message("[affected_mob] skin turns to dust!", "Your skin turns to dust!") diff --git a/code/datums/diseases/dna_spread.dm b/code/datums/diseases/dna_spread.dm index 647a0c2f3d82a..badd4701ad618 100644 --- a/code/datums/diseases/dna_spread.dm +++ b/code/datums/diseases/dna_spread.dm @@ -43,7 +43,6 @@ to_chat(affected_mob, "Your stomach hurts.") if(prob(20)) affected_mob.adjustToxLoss(2) - affected_mob.updatehealth() if(4) if(!transformed && !carrier) //Save original dna for when the disease is cured. diff --git a/code/datums/diseases/flu.dm b/code/datums/diseases/flu.dm index 3cb6e91e7f6dd..afb74af08dd70 100644 --- a/code/datums/diseases/flu.dm +++ b/code/datums/diseases/flu.dm @@ -31,7 +31,6 @@ to_chat(affected_mob, "Your stomach hurts.") if(prob(20)) affected_mob.adjustToxLoss(1) - affected_mob.updatehealth() if(3) if(!(affected_mob.mobility_flags & MOBILITY_STAND) && prob(15)) @@ -50,5 +49,4 @@ to_chat(affected_mob, "Your stomach hurts.") if(prob(20)) affected_mob.adjustToxLoss(1) - affected_mob.updatehealth() return diff --git a/code/datums/diseases/rhumba_beat.dm b/code/datums/diseases/rhumba_beat.dm index 3d73ec600343c..25b1725581702 100644 --- a/code/datums/diseases/rhumba_beat.dm +++ b/code/datums/diseases/rhumba_beat.dm @@ -19,7 +19,6 @@ if(2) if(prob(45)) affected_mob.adjustFireLoss(5) - affected_mob.updatehealth() if(prob(1)) to_chat(affected_mob, "You feel strange...") if(3) diff --git a/code/datums/elements/bed_tucking.dm b/code/datums/elements/bed_tucking.dm index c094e5a5b108e..ccc786a420b07 100644 --- a/code/datums/elements/bed_tucking.dm +++ b/code/datums/elements/bed_tucking.dm @@ -17,11 +17,11 @@ x_offset = x y_offset = y rotation_degree = rotation - RegisterSignal(target, COMSIG_ITEM_ATTACK_OBJ, PROC_REF(tuck_into_bed)) + RegisterSignal(target, COMSIG_ITEM_INTERACT_WITH, PROC_REF(tuck_into_bed)) /datum/element/bed_tuckable/Detach(obj/target) . = ..() - UnregisterSignal(target, list(COMSIG_ITEM_ATTACK_OBJ, COMSIG_ITEM_PICKUP)) + UnregisterSignal(target, list(COMSIG_ITEM_INTERACT_WITH, COMSIG_ITEM_PICKUP)) /** * Tuck our object into bed. diff --git a/code/datums/holocall.dm b/code/datums/holocall.dm index 678e6db772472..bc0269f50ceed 100644 --- a/code/datums/holocall.dm +++ b/code/datums/holocall.dm @@ -232,7 +232,7 @@ QDEL_NULL(record) return ..() -/obj/item/disk/holodisk/attackby(obj/item/W, mob/user, params) +/obj/item/disk/holodisk/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/disk/holodisk)) var/obj/item/disk/holodisk/holodiskOriginal = W if (holodiskOriginal.record) @@ -246,7 +246,8 @@ name = holodiskOriginal.name else to_chat(user, "[holodiskOriginal] has no record on it!") - ..() + return TRUE + return ..() /obj/item/disk/holodisk/proc/build_record() record = new diff --git a/code/datums/martial/_martial.dm b/code/datums/martial/_martial.dm index aa50a31dd718b..4e998404be7c2 100644 --- a/code/datums/martial/_martial.dm +++ b/code/datums/martial/_martial.dm @@ -61,14 +61,11 @@ log_combat(A, D, "attempted to [atk_verb]") return 0 - var/obj/item/bodypart/affecting = D.get_bodypart(ran_zone(A.zone_selected)) - var/armor_block = D.run_armor_check(affecting, MELEE) - playsound(D.loc, A.dna.species.attack_sound, 25, 1, -1) D.visible_message("[A] [atk_verb]ed [D]!", \ "[A] [atk_verb]ed you!", null, COMBAT_MESSAGE_RANGE) - D.apply_damage(damage, A.dna.species.attack_type, affecting, armor_block) + D.apply_damage(A.dna.species.damage_source_type, A.dna.species.damage_type, damage, ran_zone(A.zone_selected)) log_combat(A, D, "punched") diff --git a/code/datums/martial/boxing.dm b/code/datums/martial/boxing.dm index f64c3388de463..86879a5ff6d76 100644 --- a/code/datums/martial/boxing.dm +++ b/code/datums/martial/boxing.dm @@ -24,23 +24,20 @@ log_combat(A, D, "attempted to hit", atk_verb) return 0 - - var/obj/item/bodypart/affecting = D.get_bodypart(ran_zone(A.zone_selected)) - var/armor_block = D.run_armor_check(affecting, MELEE) - playsound(D.loc, A.dna.species.attack_sound, 25, 1, -1) D.visible_message("[A] [atk_verb]ed [D]!", \ "[A] [atk_verb]ed you!", null, COMBAT_MESSAGE_RANGE) - D.apply_damage(damage, STAMINA, affecting, armor_block) + var/target_zone = ran_zone(A.zone_selected) + D.apply_damage(A.dna.species.damage_source_type, /datum/damage/stamina, damage, target_zone) log_combat(A, D, "punched (boxing) ") if(D.getStaminaLoss() > 50 && istype(D.mind?.martial_art, /datum/martial_art/boxing)) var/knockout_prob = D.getStaminaLoss() + rand(-15,15) if((D.stat != DEAD) && prob(knockout_prob)) D.visible_message("[A] knocks [D] out with a haymaker!", \ "[A] knocks you out with a haymaker!") - D.apply_effect(200,EFFECT_KNOCKDOWN,armor_block) + D.apply_effect(200,EFFECT_KNOCKDOWN, D.run_armor_check(target_zone, silent = TRUE)) D.SetSleeping(100) D.force_say(A) log_combat(A, D, "knocked out (boxing) ") diff --git a/code/datums/martial/cqc.dm b/code/datums/martial/cqc.dm index 2af2d0f976f7a..e40a2160f3a2e 100644 --- a/code/datums/martial/cqc.dm +++ b/code/datums/martial/cqc.dm @@ -50,20 +50,18 @@ return FALSE /datum/martial_art/cqc/proc/Slam(mob/living/carbon/human/A, mob/living/carbon/human/D) - var/def_check = D.getarmor(BODY_ZONE_CHEST, MELEE) if(!can_use(A)) return FALSE if(D.mobility_flags & MOBILITY_STAND) D.visible_message("[A] slams [D] into the ground!", \ "[A] slams you into the ground!") playsound(get_turf(A), 'sound/weapons/slam.ogg', 50, 1, -1) - D.apply_damage(10, BRUTE, blocked = def_check) + D.apply_damage(/datum/damage_source/impact, /datum/damage/brute, 10) D.Paralyze(120) log_combat(A, D, "slammed (CQC)") return TRUE /datum/martial_art/cqc/proc/Kick(mob/living/carbon/human/A, mob/living/carbon/human/D) - var/def_check = D.getarmor(BODY_ZONE_CHEST, MELEE) if(!can_use(A)) return FALSE if(!D.stat || !D.IsParalyzed()) @@ -72,7 +70,7 @@ playsound(get_turf(A), 'sound/weapons/cqchit1.ogg', 50, 1, -1) var/atom/throw_target = get_edge_target_turf(D, A.dir) D.throw_at(throw_target, 1, 14, A) - D.apply_damage(10, A.dna.species.attack_type, blocked = def_check) + D.apply_damage(A.dna.species.damage_source_type, A.dna.species.damage_type, 10, BODY_ZONE_HEAD) log_combat(A, D, "kicked (CQC)") if(D.IsParalyzed() && !D.stat) log_combat(A, D, "knocked out (Head kick)(CQC)") @@ -109,7 +107,6 @@ return TRUE /datum/martial_art/cqc/proc/Consecutive(mob/living/carbon/human/A, mob/living/carbon/human/D) - var/def_check = D.getarmor(BODY_ZONE_CHEST, MELEE) if(!can_use(A)) return FALSE if(!D.stat) @@ -121,7 +118,7 @@ if(I && D.temporarilyRemoveItemFromInventory(I)) A.put_in_hands(I) D.adjustStaminaLoss(50) - D.apply_damage(25, A.dna.species.attack_type, blocked = def_check) + D.apply_damage(A.dna.species.damage_source_type, A.dna.species.damage_type, 25, BODY_ZONE_CHEST) return TRUE /datum/martial_art/cqc/grab_act(mob/living/carbon/human/A, mob/living/carbon/human/D) @@ -145,7 +142,6 @@ return TRUE /datum/martial_art/cqc/harm_act(mob/living/carbon/human/A, mob/living/carbon/human/D) - var/def_check = D.getarmor(BODY_ZONE_CHEST, MELEE) if(!can_use(A)) return FALSE add_to_streak("H",D) @@ -158,7 +154,7 @@ if(!(D.mobility_flags & MOBILITY_STAND)) bonus_damage += 5 picked_hit_type = "stomps on" - D.apply_damage(bonus_damage, BRUTE, blocked = def_check) + D.apply_damage(A.dna.species.damage_source_type, D.dna.species.damage_type, bonus_damage, BODY_ZONE_CHEST) if(picked_hit_type == "kicks" || picked_hit_type == "stomps on") playsound(get_turf(D), 'sound/weapons/cqchit2.ogg', 50, 1, -1) else @@ -170,13 +166,12 @@ D.visible_message("[A] leg sweeps [D]!", \ "[A] leg sweeps you!") playsound(get_turf(A), 'sound/effects/hit_kick.ogg', 50, 1, -1) - D.apply_damage(10, BRUTE, blocked = def_check) + D.apply_damage(/datum/damage_source/punch, /datum/damage/brute, 10, BODY_ZONE_CHEST) D.Paralyze(60) log_combat(A, D, "sweeped (CQC)") return TRUE /datum/martial_art/cqc/disarm_act(mob/living/carbon/human/A, mob/living/carbon/human/D) - var/def_check = D.getarmor(BODY_ZONE_CHEST, MELEE) if(!can_use(A)) return FALSE add_to_streak("D",D) @@ -192,7 +187,7 @@ if(I && D.temporarilyRemoveItemFromInventory(I)) A.put_in_hands(I) D.Jitter(2) - D.apply_damage(5, A.dna.species.attack_type, blocked = def_check) + D.apply_damage(A.dna.species.damage_source_type, A.dna.species.damage_type, 5, BODY_ZONE_HEAD) else D.visible_message("[A] fails to disarm [D]!", \ "[A] fails to disarm you!", null, COMBAT_MESSAGE_RANGE) diff --git a/code/datums/martial/karate.dm b/code/datums/martial/karate.dm index e8439c6df763b..515866d4456ec 100644 --- a/code/datums/martial/karate.dm +++ b/code/datums/martial/karate.dm @@ -30,7 +30,6 @@ //Floor Stomp - brute and stamina damage if target isn't standing /datum/martial_art/karate/proc/floorKick(mob/living/carbon/human/A, mob/living/carbon/human/D) - var/def_check = D.getarmor(BODY_ZONE_HEAD, MELEE) if(!can_use(A)) return FALSE if(!(D.mobility_flags & MOBILITY_STAND)) @@ -39,14 +38,13 @@ "[A] stomped you in the head!", null, COMBAT_MESSAGE_RANGE) playsound(get_turf(D), 'sound/weapons/punch1.ogg', 75, 1, -1) A.do_attack_animation(D, ATTACK_EFFECT_KICK) - D.apply_damage(20, A.dna.species.attack_type, BODY_ZONE_HEAD, def_check) - D.apply_damage(10, STAMINA, BODY_ZONE_HEAD, def_check) + D.apply_damage(A.dna.species.damage_source_type, A.dna.species.damage_type, 20, BODY_ZONE_HEAD) + D.apply_damage(A.dna.species.damage_source_type, /datum/damage/stamina, 20, BODY_ZONE_HEAD) return 1 return basic_hit(A,D) //Calf Kick - paralyse one leg with stamina damage /datum/martial_art/karate/proc/calfKick(mob/living/carbon/human/A, mob/living/carbon/human/D) - var/def_check = D.getarmor(BODY_ZONE_L_LEG, MELEE) if(!can_use(A)) return FALSE if(!D.stat) @@ -55,13 +53,12 @@ "[A] roundhouse kicked you in the calf!", null, COMBAT_MESSAGE_RANGE) playsound(get_turf(D), 'sound/weapons/punch1.ogg', 75, 1, -1) A.do_attack_animation(D, ATTACK_EFFECT_KICK) - D.apply_damage(50, STAMINA, pick(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG), def_check) + D.apply_damage(A.dna.species.damage_source_type, /datum/damage/stamina, 50, pick(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)) return 1 return basic_hit(A,D) //Jumping Knee - brief knockdown and decent stamina damage /datum/martial_art/karate/proc/jumpingKnee(mob/living/carbon/human/A, mob/living/carbon/human/D) - var/def_check = D.getarmor(BODY_ZONE_HEAD, MELEE) if(!can_use(A)) return FALSE if(!D.stat) @@ -71,7 +68,7 @@ playsound(get_turf(D), 'sound/weapons/punch1.ogg', 75, 1, -1) D.emote("gasp") A.do_attack_animation(D, ATTACK_EFFECT_KICK) - D.apply_damage(30, STAMINA, BODY_ZONE_CHEST, def_check) + D.apply_damage(A.dna.species.damage_source_type, /datum/damage/stamina, 30, BODY_ZONE_CHEST) D.Knockdown(10) return 1 return basic_hit(A,D) diff --git a/code/datums/martial/krav_maga.dm b/code/datums/martial/krav_maga.dm index e8139f43eb2d1..f7d148696f050 100644 --- a/code/datums/martial/krav_maga.dm +++ b/code/datums/martial/krav_maga.dm @@ -89,13 +89,11 @@ /datum/martial_art/krav_maga/proc/leg_sweep(var/mob/living/carbon/human/A, var/mob/living/carbon/human/D) if(D.stat || D.IsParalyzed()) return 0 - var/obj/item/bodypart/affecting = D.get_bodypart(BODY_ZONE_CHEST) - var/armor_block = D.run_armor_check(affecting, MELEE) D.visible_message("[A] leg sweeps [D]!", \ "Your legs are sweeped by [A]!", "You hear a sickening sound of flesh hitting flesh!", null, A) to_chat(A, "You leg sweep [D]!") playsound(get_turf(A), 'sound/effects/hit_kick.ogg', 50, TRUE, -1) - D.apply_damage(rand(20,30), STAMINA, affecting, armor_block) + D.apply_damage(/datum/damage_source/punch, /datum/damage/stamina, rand(20, 30), BODY_ZONE_CHEST) D.Knockdown(60) log_combat(A, D, "leg sweeped") return 1 @@ -114,7 +112,7 @@ D.visible_message("[A] karate chops [D]'s neck!", \ "[A] karate chops your neck, rendering you unable to speak!", null, COMBAT_MESSAGE_RANGE) playsound(get_turf(A), 'sound/effects/hit_punch.ogg', 50, 1, -1) - D.apply_damage(5, A.dna.species.attack_type) + D.apply_damage(A.dna.species.damage_source_type, A.dna.species.damage_type, 5, BODY_ZONE_HEAD) if(D.silent <= 10) D.silent = CLAMP(D.silent + 10, 0, 10) log_combat(A, D, "neck chopped") @@ -130,14 +128,12 @@ if(check_streak(A,D)) return 1 log_combat(A, D, "punched") - var/obj/item/bodypart/affecting = D.get_bodypart(ran_zone(A.zone_selected)) - var/armor_block = D.run_armor_check(affecting, MELEE) var/picked_hit_type = pick("punched", "kicked") var/bonus_damage = 0 if(!(D.mobility_flags & MOBILITY_STAND)) bonus_damage += 5 picked_hit_type = "stomped" - D.apply_damage(rand(5,10) + bonus_damage, A.dna.species.attack_type, affecting, armor_block) + D.apply_damage(A.dna.species.damage_source_type, A.dna.species.damage_type, rand(5, 10) + bonus_damage, ran_zone(A.zone_selected)) if(picked_hit_type == "kicked" || picked_hit_type == "stomped") A.do_attack_animation(D, ATTACK_EFFECT_KICK) playsound(get_turf(D), 'sound/effects/hit_kick.ogg', 50, 1, -1) @@ -152,15 +148,13 @@ /datum/martial_art/krav_maga/disarm_act(var/mob/living/carbon/human/A, var/mob/living/carbon/human/D) if(check_streak(A,D)) return 1 - var/obj/item/bodypart/affecting = D.get_bodypart(ran_zone(A.zone_selected)) - var/armor_block = D.run_armor_check(affecting, MELEE) if((D.mobility_flags & MOBILITY_STAND)) D.visible_message("[A] reprimands [D]!", \ "You're slapped by [A]!", "You hear a sickening sound of flesh hitting flesh!", COMBAT_MESSAGE_RANGE, A) to_chat(A, "You jab [D]!") A.do_attack_animation(D, ATTACK_EFFECT_PUNCH) playsound(D, 'sound/effects/hit_punch.ogg', 50, TRUE, -1) - D.apply_damage(rand(5,10), STAMINA, affecting, armor_block) + D.apply_damage(A.dna.species.damage_source_type, /datum/damage/stamina, rand(5, 10), ran_zone(A.zone_selected)) log_combat(A, D, "punched nonlethally") if(!(D.mobility_flags & MOBILITY_STAND)) D.visible_message("[A] reprimands [D]!", \ @@ -168,7 +162,7 @@ to_chat(A, "You stomp [D]!") A.do_attack_animation(D, ATTACK_EFFECT_KICK) playsound(D, 'sound/effects/hit_punch.ogg', 50, TRUE, -1) - D.apply_damage(rand(10,15), STAMINA, affecting, armor_block) + D.apply_damage(A.dna.species.damage_source_type, /datum/damage/stamina, rand(10, 15), ran_zone(A.zone_selected)) log_combat(A, D, "stomped nonlethally") if(prob(D.getStaminaLoss())) D.visible_message("[D] sputters and recoils in pain!", "You recoil in pain as you are jabbed in a nerve!") diff --git a/code/datums/martial/mushpunch.dm b/code/datums/martial/mushpunch.dm index 4cd51ec8c7192..c15a34af7b2c7 100644 --- a/code/datums/martial/mushpunch.dm +++ b/code/datums/martial/mushpunch.dm @@ -12,7 +12,7 @@ atk_verb = pick("punches", "smashes", "ruptures", "cracks") D.visible_message("[A] [atk_verb] [D] with inhuman strength, sending [D.p_them()] flying backwards!", \ "[A] [atk_verb] you with inhuman strength, sending you flying backwards!") - D.apply_damage(rand(15,30), A.dna.species.attack_type) + D.apply_damage(A.dna.species.damage_source_type, A.dna.species.damage_type, rand(15, 30), ran_zone(A.zone_selected)) playsound(D, 'sound/effects/meteorimpact.ogg', 25, 1, -1) var/throwtarget = get_edge_target_turf(A, get_dir(A, get_step_away(D, A))) D.throw_at(throwtarget, 4, 2, A)//So stuff gets tossed around at the same time. diff --git a/code/datums/martial/psychotic_brawl.dm b/code/datums/martial/psychotic_brawl.dm index c760b13342400..840392fb88cb3 100644 --- a/code/datums/martial/psychotic_brawl.dm +++ b/code/datums/martial/psychotic_brawl.dm @@ -48,8 +48,8 @@ D.visible_message("[A] [atk_verb] [D]!", \ "[A] [atk_verb] you!") playsound(get_turf(D), 'sound/weapons/punch1.ogg', 40, 1, -1) - D.apply_damage(rand(5,10), A.dna.species.attack_type, BODY_ZONE_HEAD) - A.apply_damage(rand(5,10), A.dna.species.attack_type, BODY_ZONE_HEAD) + D.apply_damage(/datum/damage_source/impact, /datum/damage/brute, rand(5,10), BODY_ZONE_HEAD) + A.apply_damage(/datum/damage_source/impact, /datum/damage/brute, rand(5,10), BODY_ZONE_HEAD) if(!istype(D.head,/obj/item/clothing/head/helmet/) && !istype(D.head,/obj/item/clothing/head/hardhat)) D.adjustOrganLoss(ORGAN_SLOT_BRAIN, 5) A.Stun(rand(10,45)) @@ -59,7 +59,7 @@ atk_verb = pick("punches", "kicks", "hits", "slams into") D.visible_message("[A] [atk_verb] [D] with inhuman strength, sending [D.p_them()] flying backwards!", \ "[A] [atk_verb] you with inhuman strength, sending you flying backwards!") - D.apply_damage(rand(15,30), A.dna.species.attack_type) + D.apply_damage(A.dna.species.damage_source_type, A.dna.species.damage_type, rand(15, 30), ran_zone(A.zone_selected)) playsound(get_turf(D), 'sound/effects/meteorimpact.ogg', 25, 1, -1) var/throwtarget = get_edge_target_turf(A, get_dir(A, get_step_away(D, A))) D.throw_at(throwtarget, 4, 2, A)//So stuff gets tossed around at the same time. diff --git a/code/datums/martial/sleeping_carp.dm b/code/datums/martial/sleeping_carp.dm index bd2713d3920c0..3f4c65b6519b3 100644 --- a/code/datums/martial/sleeping_carp.dm +++ b/code/datums/martial/sleeping_carp.dm @@ -46,7 +46,7 @@ playsound(get_turf(A), 'sound/weapons/thudswoosh.ogg', 50, 1, -1) D.emote("scream") D.dropItemToGround(D.get_active_held_item()) - D.apply_damage(5, BRUTE, pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM)) + D.apply_damage(A.dna.species.damage_source_type, A.dna.species.damage_type, 5, pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM)) D.Stun(60) return 1 @@ -83,13 +83,12 @@ return basic_hit(A,D) /datum/martial_art/the_sleeping_carp/proc/headKick(mob/living/carbon/human/A, mob/living/carbon/human/D) - var/def_check = D.getarmor(BODY_ZONE_HEAD, MELEE) if(!D.stat && !D.IsParalyzed()) log_combat(A, D, "head kicked (Sleeping Carp)") A.do_attack_animation(D, ATTACK_EFFECT_KICK) D.visible_message("[A] kicks [D] in the head!", \ "[A] kicks you in the jaw!") - D.apply_damage(20, A.dna.species.attack_type, BODY_ZONE_HEAD, blocked = def_check) + D.apply_damage(A.dna.species.damage_source_type, A.dna.species.damage_type, 20, BODY_ZONE_HEAD) D.drop_all_held_items() playsound(get_turf(D), 'sound/weapons/punch1.ogg', 50, 1, -1) D.Stun(80) @@ -97,7 +96,6 @@ return basic_hit(A,D) /datum/martial_art/the_sleeping_carp/proc/elbowDrop(mob/living/carbon/human/A, mob/living/carbon/human/D) - var/def_check = D.getarmor(BODY_ZONE_CHEST, MELEE) if(!(D.mobility_flags & MOBILITY_STAND)) log_combat(A, D, "elbow dropped (Sleeping Carp)") A.do_attack_animation(D, ATTACK_EFFECT_PUNCH) @@ -105,7 +103,7 @@ "[A] piledrives you with their elbow!") if(D.stat) D.death() //FINISH HIM! - D.apply_damage(50, A.dna.species.attack_type, BODY_ZONE_CHEST, blocked = def_check) + D.apply_damage(A.dna.species.damage_source_type, A.dna.species.damage_type, 50, BODY_ZONE_CHEST) playsound(get_turf(D), 'sound/weapons/punch1.ogg', 75, 1, -1) return 1 return basic_hit(A,D) @@ -129,7 +127,6 @@ return 1 /datum/martial_art/the_sleeping_carp/harm_act(mob/living/carbon/human/A, mob/living/carbon/human/D) - var/def_check = D.getarmor(BODY_ZONE_CHEST, MELEE) add_to_streak("H",D) if(check_streak(A,D)) return 1 @@ -137,7 +134,7 @@ var/atk_verb = pick("punches", "kicks", "chops", "hits", "slams") D.visible_message("[A] [atk_verb] [D]!", \ "[A] [atk_verb] you!") - D.apply_damage(15, BRUTE, blocked = def_check) + D.apply_damage(A.dna.species.damage_source_type, A.dna.species.damage_type, 15, ran_zone(A.zone_selected)) playsound(get_turf(D), 'sound/weapons/punch1.ogg', 25, 1, -1) log_combat(A, D, "[atk_verb] (Sleeping Carp)") return 1 @@ -187,16 +184,12 @@ icon_state = "bostaff0" ..() -/obj/item/staff/bostaff/attack(mob/target, mob/living/user) +/obj/item/staff/bostaff/attack_mob_target(mob/target, mob/living/user) add_fingerprint(user) if((HAS_TRAIT(user, TRAIT_CLUMSY)) && prob(50)) to_chat(user, "You club yourself over the head with [src].") user.Paralyze(60) - if(ishuman(user)) - var/mob/living/carbon/human/H = user - H.apply_damage(2*force, BRUTE, BODY_ZONE_HEAD) - else - user.take_bodypart_damage(2*force) + deal_attack(user, user, BODY_ZONE_HEAD, override_damage = 2 * force) return if(iscyborg(target)) return ..() diff --git a/code/datums/martial/tribal_claw.dm b/code/datums/martial/tribal_claw.dm index d59e853ed14c8..d91c73c62eb3f 100644 --- a/code/datums/martial/tribal_claw.dm +++ b/code/datums/martial/tribal_claw.dm @@ -40,11 +40,10 @@ //Face Scratch, deals 10 brute to head(reduced by armor), blurs the target's vision and gives them the confused effect for a short time. /datum/martial_art/tribal_claw/proc/faceScratch(mob/living/carbon/human/A, mob/living/carbon/human/D) - var/def_check = D.getarmor(BODY_ZONE_HEAD, MELEE) log_combat(A, D, "face scratched (Tribal Claw)") D.visible_message("[A] scratches [D]'s face with their claws!", \ "[A] scratches your face with their claws!") - D.apply_damage(10, BRUTE, BODY_ZONE_HEAD, def_check) + D.apply_damage(A.dna.species.damage_source_type, A.dna.species.damage_type, 10, BODY_ZONE_HEAD) D.confused += 5 D.blur_eyes(5) A.do_attack_animation(D, ATTACK_EFFECT_CLAW) @@ -55,12 +54,11 @@ Jugular Cut, can only be done if the target is in crit, being held in a tier 3 g Deals 15 brute to head(reduced by armor) and causes a rapid bleeding effect similar to throat slicing someone with a sharp item. */ /datum/martial_art/tribal_claw/proc/jugularCut(mob/living/carbon/human/A, mob/living/carbon/human/D) - var/def_check = D.getarmor(BODY_ZONE_HEAD, MELEE) if((D.health <= D.crit_threshold || (A.pulling == D && A.grab_state >= GRAB_NECK) || D.IsSleeping())) log_combat(A, D, "jugular cut (Tribal Claw)") D.visible_message("[A] cuts [D]'s jugular vein with their claws!", \ "[A] cuts your jugular vein!") - D.apply_damage(15, BRUTE, BODY_ZONE_HEAD, def_check) + D.apply_damage(A.dna.species.damage_source_type, A.dna.species.damage_type, 15, BODY_ZONE_HEAD) D.bleed_rate = CLAMP(D.bleed_rate + 20, 0, 30) D.apply_status_effect(/datum/status_effect/neck_slice) A.do_attack_animation(D, ATTACK_EFFECT_CLAW) diff --git a/code/datums/martial/wrestling.dm b/code/datums/martial/wrestling.dm index cb55f73b19eba..d5c76253f7bc3 100644 --- a/code/datums/martial/wrestling.dm +++ b/code/datums/martial/wrestling.dm @@ -297,11 +297,13 @@ switch(rand(1,3)) if (2) - D.adjustBruteLoss(rand(20,30)) + var/datum/damage_source/impact/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(D, BRUTE, rand(20,30), null) if (3) D.ex_act(EXPLODE_LIGHT) else - D.adjustBruteLoss(rand(10,20)) + var/datum/damage_source/impact/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(D, BRUTE, rand(10,20), null) else D.ex_act(EXPLODE_LIGHT) @@ -334,7 +336,8 @@ D.visible_message("[A] headbutts [D]!", \ "[A] headbutts you!", null, COMBAT_MESSAGE_RANGE) - D.adjustBruteLoss(rand(10,20)) + var/datum/damage_source/damage_source = GET_DAMAGE_SOURCE(A.dna.species.damage_type) + damage_source.apply_direct(D, BRUTE, rand(10,20), null) playsound(A.loc, "swing_hit", 50, 1) D.Unconscious(20) log_combat(A, D, "headbutted") @@ -349,7 +352,8 @@ D.visible_message("[A] roundhouse-kicks [D]!", \ "[A] roundhouse-kicks you!", null, COMBAT_MESSAGE_RANGE) playsound(A.loc, "swing_hit", 50, 1) - D.adjustBruteLoss(rand(10,20)) + var/datum/damage_source/blunt/light/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(D, BRUTE, rand(10,20), null) var/turf/T = get_edge_target_turf(A, get_dir(A, get_step_away(D, A))) if (T && isturf(T)) @@ -391,7 +395,8 @@ if (falling == 1) A.visible_message("...and dives head-first into the ground, ouch!", \ "...and dive head-first into the ground, ouch!") - A.adjustBruteLoss(rand(10,20)) + var/datum/damage_source/impact/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(A, BRUTE, rand(10,20), null) A.Paralyze(60) to_chat(A, "[D] is too far away!") return 0 @@ -418,9 +423,11 @@ if (prob(33) || D.stat) D.ex_act(EXPLODE_LIGHT) else - D.adjustBruteLoss(rand(20,30)) + var/datum/damage_source/impact/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(D, BRUTE, rand(20,30), null) else - D.adjustBruteLoss(rand(20,30)) + var/datum/damage_source/impact/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(D, BRUTE, rand(20,30), null) D.Paralyze(40) diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm index db2a786170f95..f2b218b5cec8d 100644 --- a/code/datums/status_effects/buffs.dm +++ b/code/datums/status_effects/buffs.dm @@ -16,7 +16,7 @@ return ..() /datum/status_effect/shadow_mend/tick() - owner.adjustBruteLoss(-15) + owner.adjustBruteLossAbstract(-15) owner.adjustFireLoss(-15) /datum/status_effect/shadow_mend/on_remove() @@ -38,7 +38,7 @@ /datum/status_effect/void_price/tick() SEND_SOUND(owner, sound('sound/magic/summon_karp.ogg', volume = 25)) - owner.adjustBruteLoss(3) + owner.apply_damage(/datum/damage_source/magic, BRUTE, 3) /datum/status_effect/cyborg_power_regen id = "power_regen" @@ -103,11 +103,11 @@ qdel(src) return var/grace_heal = bloodlust * 0.05 - owner.adjustBruteLoss(-grace_heal) + owner.adjustBruteLossAbstract(-grace_heal) owner.adjustFireLoss(-grace_heal) owner.adjustToxLoss(-grace_heal, TRUE, TRUE) owner.adjustOxyLoss(-(grace_heal * 2)) - owner.adjustCloneLoss(-grace_heal) + owner.adjustCloneLossAbstract(-grace_heal) /datum/status_effect/his_grace/on_remove() owner.log_message("lost His Grace's stun immunity", LOG_ATTACK) @@ -217,7 +217,7 @@ var/new_bruteloss = owner.getBruteLoss() if(new_bruteloss < last_bruteloss) var/heal_amount = (new_bruteloss - last_bruteloss) * 10 - owner.adjustBruteLoss(heal_amount, updating_health = FALSE) + owner.adjustBruteLossAbstract(heal_amount) new_bruteloss = owner.getBruteLoss() needs_health_update = TRUE last_bruteloss = new_bruteloss @@ -225,7 +225,7 @@ var/new_fireloss = owner.getFireLoss() if(new_fireloss < last_fireloss) var/heal_amount = (new_fireloss - last_fireloss) * 10 - owner.adjustFireLoss(heal_amount, updating_health = FALSE) + owner.adjustFireLoss(heal_amount) new_fireloss = owner.getFireLoss() needs_health_update = TRUE last_fireloss = new_fireloss @@ -233,7 +233,7 @@ var/new_toxloss = owner.getToxLoss() if(new_toxloss < last_toxloss) var/heal_amount = (new_toxloss - last_toxloss) * 10 - owner.adjustToxLoss(heal_amount, updating_health = FALSE) + owner.adjustToxLoss(heal_amount) new_toxloss = owner.getToxLoss() needs_health_update = TRUE last_toxloss = new_toxloss @@ -241,7 +241,7 @@ var/new_oxyloss = owner.getOxyLoss() if(new_oxyloss < last_oxyloss) var/heal_amount = (new_oxyloss - last_oxyloss) * 10 - owner.adjustOxyLoss(heal_amount, updating_health = FALSE) + owner.adjustOxyLoss(heal_amount) new_oxyloss = owner.getOxyLoss() needs_health_update = TRUE last_oxyloss = new_oxyloss @@ -249,7 +249,7 @@ var/new_cloneloss = owner.getCloneLoss() if(new_cloneloss < last_cloneloss) var/heal_amount = (new_cloneloss - last_cloneloss) * 10 - owner.adjustCloneLoss(heal_amount, updating_health = FALSE) + owner.adjustCloneLossAbstract(heal_amount) new_cloneloss = owner.getCloneLoss() needs_health_update = TRUE last_cloneloss = new_cloneloss @@ -257,13 +257,12 @@ var/new_staminaloss = owner.getStaminaLoss() if(new_staminaloss < last_staminaloss) var/heal_amount = (new_staminaloss - last_staminaloss) * 10 - owner.adjustStaminaLoss(heal_amount, updating_health = FALSE) + owner.adjustStaminaLoss(heal_amount) new_staminaloss = owner.getStaminaLoss() needs_health_update = TRUE last_staminaloss = new_staminaloss if(needs_health_update) - owner.updatehealth() owner.playsound_local(get_turf(owner), 'sound/effects/singlebeat.ogg', 40, 1) last_health = owner.health @@ -313,7 +312,7 @@ var/obj/item/slashy slashy = owner.get_active_held_item() for(var/mob/living/M in ohearers(1,owner)) - slashy.attack(M, owner) + slashy.attack_mob_target(M, owner) /datum/status_effect/sword_spin/on_remove() owner.visible_message("[owner]'s inhuman strength dissipates and the sword's runes grow cold!") @@ -339,13 +338,13 @@ else if(ticks_passed == 2) to_chat(owner, "We begin to repair our tissue damage...") //Heals 2 brute per second, for a total of 60 - owner.adjustBruteLoss(-2, FALSE, TRUE) + owner.adjustBruteLossAbstract(-2, FALSE, TRUE) //Heals 1 fireloss per second, for a total of 30 owner.adjustFireLoss(-1, FALSE, TRUE) //Heals 5 oxyloss per second for a total of 150 owner.adjustOxyLoss(-5, FALSE, TRUE) //Heals 0.5 cloneloss per second for a total of 15 - owner.adjustCloneLoss(-0.5, TRUE, TRUE) + owner.adjustCloneLossAbstract(-0.5, TRUE, TRUE) /atom/movable/screen/alert/status_effect/fleshmend name = "Fleshmend" @@ -510,27 +509,27 @@ //Because a servant of medicines stops at nothing to help others, lets keep them on their toes and give them an additional boost. if(itemUser.health < itemUser.maxHealth) new /obj/effect/temp_visual/heal(get_turf(itemUser), "#375637") - itemUser.adjustBruteLoss(-1.5) + itemUser.adjustBruteLossAbstract(-1.5) itemUser.adjustFireLoss(-1.5) itemUser.adjustToxLoss(-1.5, forced = TRUE) //Because Slime People are people too itemUser.adjustOxyLoss(-1.5) itemUser.adjustStaminaLoss(-1.5) itemUser.adjustOrganLoss(ORGAN_SLOT_BRAIN, -1.5) - itemUser.adjustCloneLoss(-0.5) //Becasue apparently clone damage is the bastion of all health + itemUser.adjustCloneLossAbstract(-0.5) //Becasue apparently clone damage is the bastion of all health //Heal all those around you, unbiased for(var/mob/living/L in hearers(7, owner)) if(L.health < L.maxHealth) new /obj/effect/temp_visual/heal(get_turf(L), "#375637") if(iscarbon(L)) - L.adjustBruteLoss(-3.5) + L.adjustBruteLossAbstract(-3.5) L.adjustFireLoss(-3.5) L.adjustToxLoss(-3.5, FALSE, TRUE) //Because Slime People are people too L.adjustOxyLoss(-3.5) L.adjustStaminaLoss(-3.5) L.adjustOrganLoss(ORGAN_SLOT_BRAIN, -3.5) - L.adjustCloneLoss(-1) //Becasue apparently clone damage is the bastion of all health + L.adjustCloneLossAbstract(-1) //Becasue apparently clone damage is the bastion of all health else if(issilicon(L)) - L.adjustBruteLoss(-3.5) + L.adjustBruteLossAbstract(-3.5) L.adjustFireLoss(-3.5) else if(isanimal(L)) var/mob/living/simple_animal/SM = L @@ -558,7 +557,7 @@ ADD_TRAIT(owner, TRAIT_NECROPOLIS_INFECTED, "legion_core_trait") if(owner.z == 5) power = 2 - owner.adjustBruteLoss(-50 * power) + owner.adjustBruteLossAbstract(-50 * power) owner.adjustFireLoss(-50 * power) owner.cure_nearsighted() owner.ExtinguishMob() diff --git a/code/datums/status_effects/debuffs.dm b/code/datums/status_effects/debuffs.dm index 9b81588ba19e6..680170adfce47 100644 --- a/code/datums/status_effects/debuffs.dm +++ b/code/datums/status_effects/debuffs.dm @@ -109,7 +109,7 @@ else if((locate(/obj/structure/table) in owner.loc)) healing -= 0.1 - owner.adjustBruteLoss(healing) + owner.adjustBruteLossAbstract(healing) owner.adjustFireLoss(healing) owner.adjustToxLoss(healing * 0.5, TRUE, TRUE) owner.adjustStaminaLoss(healing) @@ -324,7 +324,8 @@ for(var/obj/item/his_grace/HG in owner.held_items) qdel(src) return - owner.adjustBruteLoss(0.1) + var/datum/damage_source/magic/abstract/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(owner, BRUTE, 0.1, null) owner.adjustFireLoss(0.1) owner.adjustToxLoss(0.2, TRUE, TRUE) @@ -443,7 +444,8 @@ for(var/d in GLOB.alldirs) new /obj/effect/temp_visual/dir_setting/bloodsplatter(T, d) playsound(T, "desecration", 200, 1, -1) - owner.adjustBruteLoss(bleed_damage) + var/datum/damage_source/body/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(owner, BRUTE, bleed_damage, null) else new /obj/effect/temp_visual/bleed(get_turf(owner)) diff --git a/code/datums/status_effects/neutral.dm b/code/datums/status_effects/neutral.dm index 4af92f8a3cd79..417be88aa0f45 100644 --- a/code/datums/status_effects/neutral.dm +++ b/code/datums/status_effects/neutral.dm @@ -117,11 +117,11 @@ spell.charge_counter = spell.charge_max spell.recharging = FALSE spell.update_icon() - rewarded.adjustBruteLoss(-25) + rewarded.adjustBruteLossAbstract(-25) rewarded.adjustFireLoss(-25) rewarded.adjustToxLoss(-25, FALSE, TRUE) rewarded.adjustOxyLoss(-25) - rewarded.adjustCloneLoss(-25) + rewarded.adjustCloneLossAbstract(-25) /datum/status_effect/bugged //Lets another mob hear everything you can id = "bugged" diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 66b1cb2e5eab8..ab17c21e4d505 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -309,7 +309,7 @@ var/a_incidence_s = abs(incidence_s) if(a_incidence_s > 90 && a_incidence_s < 270) return FALSE - if((P.armor_flag in list(BULLET, BOMB)) && P.ricochet_incidence_leeway) + if((ispath(P.damage_source, /datum/damage_source/bullet) || ispath(P.damage_source, /datum/damage_source/explosion)) && P.ricochet_incidence_leeway) if((a_incidence_s < 90 && a_incidence_s < 90 - P.ricochet_incidence_leeway) || (a_incidence_s > 270 && a_incidence_s -270 > P.ricochet_incidence_leeway)) return FALSE var/new_angle_s = SIMPLIFY_DEGREES(face_angle + incidence_s) diff --git a/code/game/gamemodes/clown_ops/clown_weapons.dm b/code/game/gamemodes/clown_ops/clown_weapons.dm index f0c7dabdc45b8..05ca2619439b6 100644 --- a/code/game/gamemodes/clown_ops/clown_weapons.dm +++ b/code/game/gamemodes/clown_ops/clown_weapons.dm @@ -92,7 +92,7 @@ else qdel(GetComponent(/datum/component/slippery)) -/obj/item/melee/transforming/energy/sword/bananium/attack(mob/living/M, mob/living/user) +/obj/item/melee/transforming/energy/sword/bananium/attack_mob_target(mob/living/M, mob/living/user) ..() if(active) var/datum/component/slippery/slipper = GetComponent(/datum/component/slippery) @@ -104,7 +104,7 @@ var/datum/component/slippery/slipper = GetComponent(/datum/component/slippery) slipper.Slip(src, hit_atom) -/obj/item/melee/transforming/energy/sword/bananium/attackby(obj/item/I, mob/living/user, params) +/obj/item/melee/transforming/energy/sword/bananium/item_interact(obj/item/I, mob/living/user, params) if((world.time > next_trombone_allowed) && istype(I, /obj/item/melee/transforming/energy/sword/bananium)) next_trombone_allowed = world.time + 50 to_chat(user, "You slap the two swords together. Sadly, they do not seem to fit.") diff --git a/code/game/gamemodes/gangs/dominator.dm b/code/game/gamemodes/gangs/dominator.dm index 631b7a16f09ea..3d4f01755c6a7 100644 --- a/code/game/gamemodes/gangs/dominator.dm +++ b/code/game/gamemodes/gangs/dominator.dm @@ -142,7 +142,7 @@ new /obj/item/stack/sheet/plasteel(src.loc) qdel(src) -/obj/machinery/dominator/attacked_by(obj/item/I, mob/living/user) +/obj/machinery/dominator/on_attacked(obj/item/I, mob/living/user) add_fingerprint(user) ..() diff --git a/code/game/gamemodes/gangs/gang_pen.dm b/code/game/gamemodes/gangs/gang_pen.dm index 26e310d888ca1..dfe164825d53f 100644 --- a/code/game/gamemodes/gangs/gang_pen.dm +++ b/code/game/gamemodes/gangs/gang_pen.dm @@ -9,7 +9,7 @@ ..() last_used = world.time -/obj/item/pen/gang/attack(mob/living/M, mob/user, stealth = TRUE) +/obj/item/pen/gang/attack_mob_target(mob/living/M, mob/user, stealth = TRUE) if(!istype(M)) return if(!ishuman(M) || !ishuman(user) || M.stat == DEAD) diff --git a/code/game/gamemodes/meteor/meteors.dm b/code/game/gamemodes/meteor/meteors.dm index 7361fabba0780..e525dee04bcfd 100644 --- a/code/game/gamemodes/meteor/meteors.dm +++ b/code/game/gamemodes/meteor/meteors.dm @@ -228,12 +228,12 @@ GLOBAL_LIST_INIT(meteorsC, list(/obj/effect/meteor/dust)) //for space dust event if(!(flags_1 & ADMIN_SPAWNED_1) && isliving(user)) user.client.give_award(/datum/award/achievement/misc/meteor_examine, user) -/obj/effect/meteor/attackby(obj/item/I, mob/user, params) - if(I.tool_behaviour == TOOL_MINING) +/obj/effect/meteor/tool_act(mob/living/user, obj/item/I, tool_type) + if (tool_type == TOOL_MINING) make_debris() qdel(src) - else - . = ..() + return TRUE + return ..() /obj/effect/meteor/proc/make_debris() for(var/throws = dropamt, throws > 0, throws--) diff --git a/code/game/machinery/PDApainter.dm b/code/game/machinery/PDApainter.dm index 39251bad41906..c39cb31a5f1bf 100644 --- a/code/game/machinery/PDApainter.dm +++ b/code/game/machinery/PDApainter.dm @@ -127,33 +127,35 @@ storedid = null update_icon() -/obj/machinery/pdapainter/attackby(obj/item/O, mob/user, params) +/obj/machinery/pdapainter/item_interact(obj/item/O, mob/user, params) if(default_unfasten_wrench(user, O)) power_change() - return + return TRUE else if(istype(O, /obj/item/modular_computer/tablet/pda)) if(storedpda) to_chat(user, "There is already a PDA inside!") - return + return TRUE else if(!user.transferItemToLoc(O, src)) - return + return TRUE storedpda = O O.add_fingerprint(user) update_icon() + return TRUE else if(istype(O, /obj/item/card/id)) var/obj/item/card/id/new_id = O if(!new_id.electric) - return + return TRUE if(storedid) to_chat(user, "There is already an ID card inside!") - return + return TRUE else if(!user.transferItemToLoc(O, src)) - return + return TRUE storedid = O O.add_fingerprint(user) update_icon() + return TRUE else if(O.tool_behaviour == TOOL_WELDER && user.a_intent != INTENT_HARM) if(machine_stat & BROKEN) diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index c6255c463d490..a1774b019260c 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -503,7 +503,7 @@ Class Procs: set_occupant(null) update_icon() -/obj/machinery/run_obj_armor(damage_amount, damage_type, damage_flag = NONE, attack_dir) +/obj/machinery/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir, armour_penetration = 0) if(damage_flag == MELEE && damage_amount < damage_deflection) return 0 return ..() @@ -575,7 +575,7 @@ Class Procs: return TRUE // Power cell in hand replacement -/obj/machinery/attackby(obj/item/C, mob/user) +/obj/machinery/item_interact(obj/item/C, mob/user) if(istype(C, /obj/item/stock_parts/cell) && panel_open) for(var/obj/item/P in component_parts) if(istype(P,/obj/item/stock_parts/cell)) @@ -586,8 +586,8 @@ Class Procs: RefreshParts() playsound(src, 'sound/surgery/taperecorder_close.ogg', 50, FALSE) to_chat(user, "You replace [P.name] with [C.name].") - return - ..() + return TRUE + return ..() /obj/machinery/proc/exchange_parts(mob/user, obj/item/storage/part_replacer/W) if(!istype(W)) diff --git a/code/game/machinery/airlock_cycle_control.dm b/code/game/machinery/airlock_cycle_control.dm index d0fd454fe76ec..b5bb1ca0a03f2 100644 --- a/code/game/machinery/airlock_cycle_control.dm +++ b/code/game/machinery/airlock_cycle_control.dm @@ -441,7 +441,7 @@ vent.update_icon() update_icon(TRUE) -/obj/machinery/advanced_airlock_controller/attackby(obj/item/W, mob/user, params) +/obj/machinery/advanced_airlock_controller/item_interact(obj/item/W, mob/user, params) switch(buildstage) if(2) if(W.tool_behaviour == TOOL_WIRECUTTER && panel_open && wires.is_all_cut()) @@ -450,19 +450,19 @@ new /obj/item/stack/cable_coil(loc, 5) buildstage = 1 update_icon() - return + return TRUE else if(W.tool_behaviour == TOOL_SCREWDRIVER) // Opening that up. W.play_tool_sound(src) panel_open = !panel_open to_chat(user, "The wires have been [panel_open ? "exposed" : "unexposed"].") update_icon() - return + return TRUE else if(istype(W, /obj/item/card/id) || istype(W, /obj/item/modular_computer/tablet/pda))// trying to unlock the interface with an ID card togglelock(user) - return + return TRUE else if(panel_open && is_wire_tool(W)) wires.interact(user) - return + return TRUE if(1) if(W.tool_behaviour == TOOL_CROWBAR) user.visible_message("[user.name] removes the electronics from [src.name].",\ @@ -475,13 +475,13 @@ playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1) buildstage = 0 update_icon() - return + return TRUE if(istype(W, /obj/item/stack/cable_coil)) var/obj/item/stack/cable_coil/cable = W if(cable.get_amount() < 5) to_chat(user, "You need five lengths of cable to wire the airlock controller!") - return + return TRUE user.visible_message("[user.name] wires the airlock controller.", \ "You start wiring the airlock controller...") if (do_after(user, 20, target = src)) @@ -496,7 +496,7 @@ shorted = 0 buildstage = 2 update_icon() - return + return TRUE if(0) if(istype(W, /obj/item/electronics/advanced_airlock_controller)) if(user.temporarilyRemoveItemFromInventory(W)) @@ -504,7 +504,7 @@ buildstage = 1 update_icon() qdel(W) - return + return TRUE if(istype(W, /obj/item/electroadaptive_pseudocircuit)) var/obj/item/electroadaptive_pseudocircuit/P = W @@ -514,14 +514,14 @@ "You adapt an airlock controller circuit and slot it into the assembly.") buildstage = 1 update_icon() - return + return TRUE if(W.tool_behaviour == TOOL_WRENCH) to_chat(user, "You detach \the [src] from the wall.") W.play_tool_sound(src) new /obj/item/wallframe/advanced_airlock_controller( user.loc ) qdel(src) - return + return TRUE return ..() diff --git a/code/game/machinery/announcement_system.dm b/code/game/machinery/announcement_system.dm index 1d9e75f885541..73e8f2ece722b 100644 --- a/code/game/machinery/announcement_system.dm +++ b/code/game/machinery/announcement_system.dm @@ -58,18 +58,20 @@ GLOBAL_LIST_EMPTY(announcement_systems) ..() update_icon() -/obj/machinery/announcement_system/attackby(obj/item/P, mob/user, params) +/obj/machinery/announcement_system/item_interact(obj/item/P, mob/user, params) if(P.tool_behaviour == TOOL_SCREWDRIVER) P.play_tool_sound(src) panel_open = !panel_open to_chat(user, "You [panel_open ? "open" : "close"] the maintenance hatch of [src].") update_icon() + return TRUE else if(default_deconstruction_crowbar(P)) - return + return TRUE else if(P.tool_behaviour == TOOL_MULTITOOL && panel_open && (machine_stat & BROKEN)) to_chat(user, "You reset [src]'s firmware.") set_machine_stat(machine_stat & ~BROKEN) update_icon() + return TRUE else return ..() diff --git a/code/game/machinery/aug_manipulator.dm b/code/game/machinery/aug_manipulator.dm index 05198de578825..03030c954c188 100644 --- a/code/game/machinery/aug_manipulator.dm +++ b/code/game/machinery/aug_manipulator.dm @@ -52,31 +52,32 @@ storedpart = null update_icon() -/obj/machinery/aug_manipulator/attackby(obj/item/O, mob/user, params) +/obj/machinery/aug_manipulator/item_interact(obj/item/O, mob/user, params) if(default_unfasten_wrench(user, O)) power_change() - return + return TRUE else if(istype(O, /obj/item/bodypart)) var/obj/item/bodypart/B = O if(IS_ORGANIC_LIMB(B)) to_chat(user, "The machine only accepts cybernetics!") - return + return TRUE if(storedpart) to_chat(user, "There is already something inside!") - return + return TRUE else O = user.get_active_held_item() if(!user.transferItemToLoc(O, src)) - return + return TRUE storedpart = O O.add_fingerprint(user) update_icon() + return TRUE else if(O.tool_behaviour == TOOL_WELDER && user.a_intent != INTENT_HARM) if(obj_integrity < max_integrity) if(!O.tool_start_check(user, amount=0)) - return + return TRUE user.visible_message("[user] begins repairing [src].", \ "You begin repairing [src]...", \ @@ -84,13 +85,15 @@ if(O.use_tool(src, user, 40, volume=50)) if(!(machine_stat & BROKEN)) - return + return TRUE to_chat(user, "You repair [src].") set_machine_stat(machine_stat & ~BROKEN) obj_integrity = max(obj_integrity, max_integrity) update_icon() + return TRUE else to_chat(user, "[src] does not need repairs.") + return TRUE else return ..() diff --git a/code/game/machinery/bank_machine.dm b/code/game/machinery/bank_machine.dm index 1b4c728fb9f9c..cb529e0539a53 100644 --- a/code/game/machinery/bank_machine.dm +++ b/code/game/machinery/bank_machine.dm @@ -21,7 +21,7 @@ QDEL_NULL(radio) . = ..() -/obj/machinery/computer/bank_machine/attackby(obj/item/I, mob/user) +/obj/machinery/computer/bank_machine/item_interact(obj/item/I, mob/user) var/value = 0 if(istype(I, /obj/item/stack/spacecash)) var/obj/item/stack/spacecash/C = I @@ -35,7 +35,7 @@ D.adjust_money(value) to_chat(user, "You deposit [I]. The Cargo Budget is now $[D.account_balance].") qdel(I) - return + return TRUE return ..() /obj/machinery/computer/bank_machine/process(delta_time) diff --git a/code/game/machinery/buttons.dm b/code/game/machinery/buttons.dm index 750e247ff2760..ec1d6f7e480af 100644 --- a/code/game/machinery/buttons.dm +++ b/code/game/machinery/buttons.dm @@ -58,7 +58,7 @@ else icon_state = skin -/obj/machinery/button/attackby(obj/item/W, mob/user, params) +/obj/machinery/button/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_SCREWDRIVER) if(panel_open || allowed(user)) default_deconstruction_screwdriver(user, "button-open", "[skin]",W) @@ -66,7 +66,7 @@ else to_chat(user, "Maintenance Access Denied.") flick("[skin]-denied", src) - return + return TRUE if(panel_open) if(!device && istype(W, /obj/item/assembly)) @@ -97,12 +97,8 @@ qdel(src) update_icon() - return - - if(user.a_intent != INTENT_HARM && !(W.item_flags & NOBLUDGEON)) - return attack_hand(user) - else - return ..() + return TRUE + return ..() /obj/machinery/button/on_emag(mob/user) ..() diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 6fd3f051fc198..acd1cf5cfb0c3 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -252,7 +252,7 @@ return TRUE -/obj/machinery/camera/attackby(obj/item/attacking_item, mob/living/user, params) +/obj/machinery/camera/item_interact(obj/item/attacking_item, mob/living/user, params) // UPGRADES if(panel_open) var/obj/structure/camera_assembly/assembly = assembly_ref?.resolve() @@ -266,18 +266,18 @@ to_chat(user, "You attach [attacking_item] into [assembly]'s inner circuits.") else to_chat(user, "[src] already has that upgrade!") - return + return TRUE else if(istype(attacking_item, /obj/item/assembly/prox_sensor)) if(!isMotion()) if(!user.temporarilyRemoveItemFromInventory(attacking_item)) - return + return TRUE upgradeMotion() to_chat(user, "You attach [attacking_item] into [assembly]'s inner circuits.") qdel(attacking_item) else to_chat(user, "[src] already has that upgrade!") - return + return TRUE // OTHER if(istype(attacking_item, /obj/item/modular_computer/tablet) && isliving(user)) @@ -296,7 +296,7 @@ if(isAI(O)) var/mob/living/silicon/ai/AI = O if(AI.control_disabled || (AI.stat == DEAD)) - return + return TRUE AI.last_tablet_note_seen = "[itemname][info]" @@ -309,7 +309,7 @@ if (O.client?.eye == src) to_chat(O, "[user] holds \a [itemname] up to one of the cameras ...") O << browse("[itemname][info]", "window=[itemname]") - return + return TRUE if(istype(attacking_item, /obj/item/paper)) // Grab the paper, sanitise the name as we're about to just throw it into chat wrapped in HTML tags. @@ -351,12 +351,12 @@ if (potential_viewer.client?.eye == src) log_paper("[key_name(user)] held [last_shown_paper] up to [src], and [key_name(potential_viewer)] may read it.") to_chat(potential_viewer, " holds \a [item_name] up to your camera...") - return + return TRUE else if(istype(attacking_item, /obj/item/camera_bug)) if(!can_use()) to_chat(user, "Camera non-functional.") - return + return TRUE if(bug) to_chat(user, "Camera bug removed.") bug.bugged_cameras -= src.c_tag @@ -365,11 +365,11 @@ to_chat(user, "Camera bugged.") bug = attacking_item bug.bugged_cameras[src.c_tag] = WEAKREF(src) - return + return TRUE return ..() -/obj/machinery/camera/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir) +/obj/machinery/camera/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir, armour_penetration = 0) if(damage_flag == MELEE && damage_amount < 12 && !(machine_stat & BROKEN)) return 0 . = ..() diff --git a/code/game/machinery/camera/camera_assembly.dm b/code/game/machinery/camera/camera_assembly.dm index 516e678c4f48f..b7a0b31773d64 100644 --- a/code/game/machinery/camera/camera_assembly.dm +++ b/code/game/machinery/camera/camera_assembly.dm @@ -96,7 +96,7 @@ proxy_module = null -/obj/structure/camera_assembly/attackby(obj/item/W, mob/living/user, params) +/obj/structure/camera_assembly/item_interact(obj/item/W, mob/living/user, params) switch(state) if(STATE_WRENCHED) if(W.tool_behaviour == TOOL_WELDER) @@ -104,7 +104,7 @@ to_chat(user, "You weld [src] securely into place.") setAnchored(TRUE) state = STATE_WELDED - return + return TRUE if(STATE_WELDED) if(istype(W, /obj/item/stack/cable_coil)) @@ -114,8 +114,8 @@ state = STATE_WIRED else to_chat(user, "You need two lengths of cable to wire a camera!") - return - return + return TRUE + return TRUE else if(W.tool_behaviour == TOOL_WELDER) @@ -123,31 +123,31 @@ to_chat(user, "You unweld [src] from its place.") state = STATE_WRENCHED setAnchored(TRUE) - return + return TRUE if(STATE_WIRED) // Upgrades! if(istype(W, /obj/item/stack/sheet/mineral/plasma)) //emp upgrade if(emp_module) to_chat(user, "[src] already contains a [emp_module]!") - return + return TRUE if(!W.use_tool(src, user, 0, amount=1)) //only use one sheet, otherwise the whole stack will be consumed. - return + return TRUE emp_module = new(src) if(malf_xray_firmware_active) malf_xray_firmware_active = FALSE //flavor reason: MALF AI Upgrade Camera Network ability's firmware is incompatible with the new part //real reason: make it a normal upgrade so the finished camera's icons and examine texts are restored. to_chat(user, "You attach [W] into [src]'s inner circuits.") - return + return TRUE else if(istype(W, /obj/item/assembly/prox_sensor)) //motion sensing upgrade if(proxy_module) to_chat(user, "[src] already contains a [proxy_module]!") - return + return TRUE if(!user.transferItemToLoc(W, src)) - return + return TRUE to_chat(user, "You attach [W] into [src]'s inner circuits.") proxy_module = W - return + return TRUE return ..() diff --git a/code/game/machinery/camera/presets.dm b/code/game/machinery/camera/presets.dm index e61f2bf717c4d..b4ae91f3102d8 100644 --- a/code/game/machinery/camera/presets.dm +++ b/code/game/machinery/camera/presets.dm @@ -81,7 +81,7 @@ assembly.malf_emp_firmware_active = TRUE //don't add parts to drop, update icon, ect. reconstructing it will also retain the upgrade. assembly.malf_emp_firmware_present = TRUE //so the upgrade is retained after incompatible parts are removed. - else if(!assembly.emp_module) //only happens via upgrading in camera/attackby() + else if(!assembly.emp_module) //only happens via upgrading in camera/item_interact() assembly.emp_module = new(assembly) if(assembly.malf_emp_firmware_active) assembly.malf_emp_firmware_active = FALSE //make it appear like it's just normally upgraded so the icons and examine texts are restored. diff --git a/code/game/machinery/cell_charger.dm b/code/game/machinery/cell_charger.dm index 7b21dff633dfa..d04c3f7380b89 100644 --- a/code/game/machinery/cell_charger.dm +++ b/code/game/machinery/cell_charger.dm @@ -30,39 +30,38 @@ if(in_range(user, src) || isobserver(user)) . += "The status display reads: Charging power: [charge_rate]W." -/obj/machinery/cell_charger/attackby(obj/item/W, mob/user, params) +/obj/machinery/cell_charger/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/stock_parts/cell) && !panel_open) if(machine_stat & BROKEN) to_chat(user, "[src] is broken!") - return + return TRUE if(!anchored) to_chat(user, "[src] isn't attached to the ground!") - return + return TRUE if(charging) to_chat(user, "There is already a cell in the charger!") - return - else - var/area/a = loc.loc // Gets our locations location, like a dream within a dream - if(!isarea(a)) - return - if(a.power_equip == 0) // There's no APC in this area, don't try to cheat power! - to_chat(user, "[src] blinks red as you try to insert the cell!") - return - if(!user.transferItemToLoc(W,src)) - return - - charging = W - user.visible_message("[user] inserts a cell into [src].", "You insert a cell into [src].") - chargelevel = -1 - update_icon() - else - if(!charging && default_deconstruction_screwdriver(user, icon_state, icon_state, W)) - return - if(default_deconstruction_crowbar(W)) - return - if(!charging && default_unfasten_wrench(user, W)) - return - return ..() + return TRUE + var/area/a = loc.loc // Gets our locations location, like a dream within a dream + if(!isarea(a)) + return TRUE + if(a.power_equip == 0) // There's no APC in this area, don't try to cheat power! + to_chat(user, "[src] blinks red as you try to insert the cell!") + return TRUE + if(!user.transferItemToLoc(W,src)) + return TRUE + + charging = W + user.visible_message("[user] inserts a cell into [src].", "You insert a cell into [src].") + chargelevel = -1 + update_icon() + return TRUE + if(!charging && default_deconstruction_screwdriver(user, icon_state, icon_state, W)) + return TRUE + if(default_deconstruction_crowbar(W)) + return TRUE + if(!charging && default_unfasten_wrench(user, W)) + return TRUE + return ..() /obj/machinery/cell_charger/deconstruct() if(charging) diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index 0bd4a9607a5d6..247120c56bf8a 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -355,7 +355,7 @@ mob_occupant.Unconscious(80) var/dmg_mult = CONFIG_GET(number/damage_multiplier) //Slowly get that clone healed and finished. - mob_occupant.adjustCloneLoss(-((speed_coeff / 2) * dmg_mult), TRUE, TRUE) + mob_occupant.adjustCloneLossAbstract(-((speed_coeff / 2) * dmg_mult), TRUE, TRUE) if(reagents.has_reagent(/datum/reagent/medicine/synthflesh, fleshamnt)) reagents.remove_reagent(/datum/reagent/medicine/synthflesh, fleshamnt) else if(reagents.has_reagent(/datum/reagent/blood, fleshamnt*3)) @@ -424,22 +424,22 @@ DEFINE_BUFFER_HANDLER(/obj/machinery/clonepod) return COMPONENT_BUFFER_RECIEVED //Let's unlock this early I guess. Might be too early, needs tweaking. -/obj/machinery/clonepod/attackby(obj/item/W, mob/user, params) +/obj/machinery/clonepod/item_interact(obj/item/W, mob/user, params) if(!(occupant || mess)) if(default_deconstruction_screwdriver(user, "[icon_state]_maintenance", "[initial(icon_state)]",W)) - return + return TRUE if(default_deconstruction_crowbar(W)) - return + return TRUE var/mob/living/mob_occupant = occupant if(W.GetID()) if(!check_access(W)) to_chat(user, "Access Denied.") - return + return TRUE if(!(mob_occupant || mess)) to_chat(user, "Error: Pod has no occupant.") - return + return TRUE else add_fingerprint(user) connected_message("Emergency Ejection") @@ -448,8 +448,8 @@ DEFINE_BUFFER_HANDLER(/obj/machinery/clonepod) go_out() log_cloning("[key_name(user)] manually ejected [key_name(mob_occupant)] from [src] at [AREACOORD(src)].") log_combat(user, mob_occupant, "ejected", W, "from [src]") - else - return ..() + return TRUE + return ..() /obj/machinery/clonepod/should_emag(mob/user) return !!occupant @@ -496,7 +496,8 @@ DEFINE_BUFFER_HANDLER(/obj/machinery/clonepod) if(HAS_TRAIT(mob_occupant, TRAIT_NOCLONELOSS)) var/cl_loss = mob_occupant.getCloneLoss() - mob_occupant.adjustBruteLoss(cl_loss, FALSE) + var/datum/damage_source/body/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(mob_occupant, BRUTE, cl_loss, null, FALSE) mob_occupant.setCloneLoss(0, FALSE, TRUE) current_insurance = null diff --git a/code/game/machinery/computer/Operating.dm b/code/game/machinery/computer/Operating.dm index cb7b56c2f5907..8225183ccf280 100644 --- a/code/game/machinery/computer/Operating.dm +++ b/code/game/machinery/computer/Operating.dm @@ -30,7 +30,7 @@ sbed.op_computer = null . = ..() -/obj/machinery/computer/operating/attackby(obj/item/O, mob/user, params) +/obj/machinery/computer/operating/item_interact(obj/item/O, mob/user, params) if(istype(O, /obj/item/disk/surgery)) user.visible_message("[user] begins to load \the [O] in \the [src]...", "You begin to load a surgery protocol from \the [O]...", diff --git a/code/game/machinery/computer/aifixer.dm b/code/game/machinery/computer/aifixer.dm index 6ae9cc445868e..17bbdd6a9c7c4 100644 --- a/code/game/machinery/computer/aifixer.dm +++ b/code/game/machinery/computer/aifixer.dm @@ -74,8 +74,7 @@ occupier.adjustOxyLoss(-5, 0) occupier.adjustFireLoss(-5, 0) occupier.adjustToxLoss(-5, 0) - occupier.adjustBruteLoss(-5, 0) - occupier.updatehealth() + occupier.adjustBruteLossAbstract(-5) if(occupier.health >= 0 && occupier.stat == DEAD) occupier.revive(full_heal = FALSE, admin_revive = FALSE) if(!occupier.radio_enabled) diff --git a/code/game/machinery/computer/arcade.dm b/code/game/machinery/computer/arcade.dm index 804d7c4022abc..2505e3b9505fe 100644 --- a/code/game/machinery/computer/arcade.dm +++ b/code/game/machinery/computer/arcade.dm @@ -111,12 +111,13 @@ GLOBAL_LIST_INIT(arcade_prize_pool, list( var/atom/movable/the_prize = new redeemselect(drop_location()) visible_message("[src] dispenses [the_prize]!", "You hear a chime and a clunk.") -/obj/machinery/computer/arcade/attackby(obj/item/W, mob/user) +/obj/machinery/computer/arcade/item_interact(obj/item/W, mob/user) if(istype(W, /obj/item/coin/arcade_token) || istype(W, /obj/item/coin/bananium)) to_chat(user, "You insert the [W] into the [src].") redeem(user) qdel(W) - return + return TRUE + return ..() /obj/machinery/computer/arcade/emp_act(severity) . = ..() diff --git a/code/game/machinery/computer/buildandrepair.dm b/code/game/machinery/computer/buildandrepair.dm index af5eb0246e729..d180f0419be40 100644 --- a/code/game/machinery/computer/buildandrepair.dm +++ b/code/game/machinery/computer/buildandrepair.dm @@ -3,7 +3,7 @@ icon_state = "0" state = 0 -/obj/structure/frame/computer/attackby(obj/item/P, mob/user, params) +/obj/structure/frame/computer/item_interact(obj/item/P, mob/user, params) add_fingerprint(user) switch(state) if(0) @@ -13,17 +13,17 @@ to_chat(user, "You wrench the frame into place.") setAnchored(TRUE) state = 1 - return + return TRUE if(P.tool_behaviour == TOOL_WELDER) if(!P.tool_start_check(user, amount=0)) - return + return TRUE to_chat(user, "You start deconstructing the frame...") if(P.use_tool(src, user, 20, volume=50)) to_chat(user, "You deconstruct the frame.") new /obj/item/stack/sheet/iron(drop_location(), 5, TRUE, user) qdel(src) - return + return TRUE if(1) if(P.tool_behaviour == TOOL_WRENCH) to_chat(user, "You start to unfasten the frame...") @@ -31,26 +31,26 @@ to_chat(user, "You unfasten the frame.") setAnchored(FALSE) state = 0 - return + return TRUE if(istype(P, /obj/item/circuitboard/computer) && !circuit) if(!user.transferItemToLoc(P, src)) - return + return TRUE playsound(src, 'sound/items/deconstruct.ogg', 50, 1) to_chat(user, "You place [P] inside the frame.") icon_state = "1" circuit = P circuit.add_fingerprint(user) - return + return TRUE else if(istype(P, /obj/item/circuitboard) && !circuit) to_chat(user, "This frame does not accept circuit boards of this type!") - return + return TRUE if(P.tool_behaviour == TOOL_SCREWDRIVER && circuit) P.play_tool_sound(src) to_chat(user, "You screw [circuit] into place.") state = 2 icon_state = "2" - return + return TRUE if(P.tool_behaviour == TOOL_CROWBAR && circuit) P.play_tool_sound(src) to_chat(user, "You remove [circuit].") @@ -59,25 +59,25 @@ circuit.forceMove(drop_location()) circuit.add_fingerprint(user) circuit = null - return + return TRUE if(2) if(P.tool_behaviour == TOOL_SCREWDRIVER && circuit) P.play_tool_sound(src) to_chat(user, "You unfasten the circuit board.") state = 1 icon_state = "1" - return + return TRUE if(istype(P, /obj/item/stack/cable_coil)) if(!P.tool_start_check(user, amount=5)) - return + return TRUE to_chat(user, "You start adding cables to the frame...") if(P.use_tool(src, user, 20, volume=50, amount=5)) if(state != 2) - return + return TRUE to_chat(user, "You add cables to the frame.") state = 3 icon_state = "3" - return + return TRUE if(3) if(P.tool_behaviour == TOOL_WIRECUTTER) P.play_tool_sound(src) @@ -85,19 +85,19 @@ state = 2 icon_state = "2" new /obj/item/stack/cable_coil(drop_location(), 5, TRUE, user) - return + return TRUE if(istype(P, /obj/item/stack/sheet/glass)) if(!P.tool_start_check(user, amount=2)) - return + return TRUE playsound(src, 'sound/items/deconstruct.ogg', 50, 1) to_chat(user, "You start to put in the glass panel...") if(P.use_tool(src, user, 20, amount=2)) if(state != 3) - return + return TRUE to_chat(user, "You put in the glass panel.") state = 4 src.icon_state = "4" - return + return TRUE if(4) if(P.tool_behaviour == TOOL_CROWBAR) P.play_tool_sound(src) @@ -105,7 +105,7 @@ state = 3 icon_state = "3" new /obj/item/stack/sheet/glass(drop_location(), 2, TRUE, user) - return + return TRUE if(P.tool_behaviour == TOOL_SCREWDRIVER) P.play_tool_sound(src) to_chat(user, "You connect the monitor.") @@ -113,9 +113,8 @@ B.setDir(dir) transfer_fingerprints_to(B) qdel(src) - return - if(user.a_intent == INTENT_HARM) - return ..() + return TRUE + return ..() /obj/structure/frame/computer/deconstruct(disassembled = TRUE) diff --git a/code/game/machinery/computer/card.dm b/code/game/machinery/computer/card.dm index 47ef94de0934b..5c17274ceb19c 100644 --- a/code/game/machinery/computer/card.dm +++ b/code/game/machinery/computer/card.dm @@ -84,7 +84,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0) if(inserted_scan_id || inserted_modify_id) . += "Alt-click to eject the ID card." -/obj/machinery/computer/card/attackby(obj/I, mob/user, params) +/obj/machinery/computer/card/item_interact(obj/I, mob/user, params) if(isidcard(I)) if(check_access(I) && !inserted_scan_id) if(id_insert(user, I, inserted_scan_id)) @@ -93,6 +93,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0) else if(id_insert(user, I, inserted_modify_id)) inserted_modify_id = I updateUsrDialog() + return TRUE else return ..() diff --git a/code/game/machinery/computer/cloning.dm b/code/game/machinery/computer/cloning.dm index 156086840cc59..cb0c8b48ee796 100644 --- a/code/game/machinery/computer/cloning.dm +++ b/code/game/machinery/computer/cloning.dm @@ -156,14 +156,15 @@ pod.connected = null LAZYREMOVE(pods, pod) -/obj/machinery/computer/cloning/attackby(obj/item/W, mob/user, params) +/obj/machinery/computer/cloning/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/disk/data)) //INSERT SOME DISKETTES if (!diskette) if (!user.transferItemToLoc(W,src)) - return + return TRUE diskette = W to_chat(user, "You insert [W].") playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0) + return TRUE else return ..() diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index ede58d6987c77..80e1e88376090 100755 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -61,9 +61,10 @@ return TRUE return authenticated -/obj/machinery/computer/communications/attackby(obj/I, mob/user, params) +/obj/machinery/computer/communications/item_interact(obj/I, mob/user, params) if(istype(I, /obj/item/card/id)) attack_hand(user) + return TRUE else return ..() diff --git a/code/game/machinery/computer/dna_console.dm b/code/game/machinery/computer/dna_console.dm index 6bee8ce4c83f5..41d408235adfc 100644 --- a/code/game/machinery/computer/dna_console.dm +++ b/code/game/machinery/computer/dna_console.dm @@ -128,15 +128,15 @@ rad_pulse() return -/obj/machinery/computer/scan_consolenew/attackby(obj/item/I, mob/user, params) +/obj/machinery/computer/scan_consolenew/item_interact(obj/item/I, mob/user, params) if (istype(I, /obj/item/disk/data)) //INSERT SOME DISKETTES if (!src.diskette) if (!user.transferItemToLoc(I,src)) - return + return TRUE src.diskette = I to_chat(user, "You insert [I].") src.updateUsrDialog() - return + return TRUE if (istype(I, /obj/item/chromosome)) if(LAZYLEN(stored_chromosomes) < max_chromosomes) I.forceMove(src) @@ -144,7 +144,7 @@ to_chat(user, "You insert [I].") else to_chat(user, "You cannot store any more chromosomes.") - return + return TRUE if(istype(I, /obj/item/dnainjector/activator)) var/obj/item/dnainjector/activator/A = I if(A.used) @@ -157,7 +157,7 @@ stored_chromosomes += CM to_chat(user,"[capitalize(CM.name)] added to storage.") qdel(I) - return + return TRUE else return ..() diff --git a/code/game/machinery/computer/law.dm b/code/game/machinery/computer/law.dm index 6b79544de1164..cb46c13bd65b0 100644 --- a/code/game/machinery/computer/law.dm +++ b/code/game/machinery/computer/law.dm @@ -15,36 +15,37 @@ -/obj/machinery/computer/upload/attackby(obj/item/O, mob/user, params) +/obj/machinery/computer/upload/item_interact(obj/item/O, mob/user, params) if(istype(O, /obj/item/aiModule)) var/obj/item/aiModule/M = O if(machine_stat & (NOPOWER|BROKEN|MAINT)) - return + return TRUE if(!current) to_chat(user, "You haven't selected anything to transmit laws to!") - return + return TRUE var/input = stripped_input(user, "Please enter the Upload code.", "Uplode Code Check") if(!GLOB.upload_code) GLOB.upload_code = random_code(4) if(input != GLOB.upload_code) to_chat(user, "Upload failed! The code inputted was incorrect!") - return + return TRUE if(!can_upload_to(current)) to_chat(user, "Upload failed! Check to make sure [current.name] is functioning properly.") current = null - return + return TRUE var/turf/currentloc = get_turf(current) var/turf/user_turf = get_turf(user) if(currentloc && user.get_virtual_z_level() != currentloc.get_virtual_z_level() && (!is_station_level(currentloc.z) || !is_station_level(user_turf.z))) to_chat(user, "Upload failed! Unable to establish a connection to [current.name]. You're too far away!") current = null - return + return TRUE M.install(current.laws, user) if(alert("Do you wish to scramble the upload code?", "Scramble Code", "Yes", "No") != "Yes") - return + return TRUE message_admins("[ADMIN_LOOKUPFLW(usr)] has scrambled the upload code [GLOB.upload_code]!") GLOB.upload_code = random_code(4) to_chat(user, "You scramble the upload code") + return TRUE else return ..() diff --git a/code/game/machinery/computer/prisoner/_prisoner.dm b/code/game/machinery/computer/prisoner/_prisoner.dm index d3e7fd6f3edf8..d227ce27deab5 100644 --- a/code/game/machinery/computer/prisoner/_prisoner.dm +++ b/code/game/machinery/computer/prisoner/_prisoner.dm @@ -51,8 +51,9 @@ playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, FALSE) updateUsrDialog() -/obj/machinery/computer/prisoner/attackby(obj/item/I, mob/user) +/obj/machinery/computer/prisoner/item_interact(obj/item/I, mob/user) if(istype(I, /obj/item/card/id/prisoner)) id_insert(user, I) + return TRUE else return ..() diff --git a/code/game/machinery/computer/prisoner/management.dm b/code/game/machinery/computer/prisoner/management.dm index 69e99b71a0c1c..fd1a507f81dca 100644 --- a/code/game/machinery/computer/prisoner/management.dm +++ b/code/game/machinery/computer/prisoner/management.dm @@ -68,12 +68,13 @@ popup.open() return -/obj/machinery/computer/prisoner/management/attackby(obj/item/I, mob/user, params) +/obj/machinery/computer/prisoner/management/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/card/id)) if(screen) id_insert(user) else to_chat(user, "Unauthorized access.") + return TRUE else return ..() diff --git a/code/game/machinery/constructable_frame.dm b/code/game/machinery/constructable_frame.dm index fe67fb7878ebf..8390d0c32a0f9 100644 --- a/code/game/machinery/constructable_frame.dm +++ b/code/game/machinery/constructable_frame.dm @@ -71,18 +71,18 @@ amt += req_components[path] return amt -/obj/structure/frame/machine/attackby(obj/item/P, mob/user, params) +/obj/structure/frame/machine/item_interact(obj/item/P, mob/user, params) switch(state) if(1) if(istype(P, /obj/item/circuitboard/machine)) to_chat(user, "The frame needs wiring first!") - return + return TRUE else if(istype(P, /obj/item/circuitboard)) to_chat(user, "This frame does not accept circuit boards of this type!") - return + return TRUE if(istype(P, /obj/item/stack/cable_coil)) if(!P.tool_start_check(user, amount=5)) - return + return TRUE to_chat(user, "You start to add cables to the frame...") if(P.use_tool(src, user, 20, volume=50, amount=5)) @@ -90,7 +90,7 @@ state = 2 icon_state = "box_1" - return + return TRUE if(P.tool_behaviour == TOOL_SCREWDRIVER && !anchored) user.visible_message("[user] disassembles the frame.", \ "You start to disassemble the frame...", "You hear banging and clanking.") @@ -99,14 +99,14 @@ to_chat(user, "You disassemble the frame.") new /obj/item/stack/sheet/iron(drop_location(), 5, TRUE, user) qdel(src) - return + return TRUE if(P.tool_behaviour == TOOL_WRENCH) to_chat(user, "You start [anchored ? "un" : ""]securing [src]...") if(P.use_tool(src, user, 40, volume=75)) if(state == 1) to_chat(user, "You [anchored ? "un" : ""]secure [src].") setAnchored(!anchored) - return + return TRUE if(2) if(P.tool_behaviour == TOOL_WRENCH) @@ -114,15 +114,15 @@ if(P.use_tool(src, user, 40, volume=75)) to_chat(user, "You [anchored ? "un" : ""]secure [src].") setAnchored(!anchored) - return + return TRUE if(istype(P, /obj/item/circuitboard/machine)) var/obj/item/circuitboard/machine/B = P if(!anchored && B.needs_anchored) to_chat(user, "The frame needs to be secured first!") - return + return TRUE if(!user.transferItemToLoc(B, src)) - return + return TRUE playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1) to_chat(user, "You add the circuit board to the frame.") circuit = B @@ -131,11 +131,11 @@ components = list() req_components = B.req_components.Copy() update_namelist() - return + return TRUE else if(istype(P, /obj/item/circuitboard)) to_chat(user, "This frame does not accept circuit boards of this type!") - return + return TRUE if(P.tool_behaviour == TOOL_WIRECUTTER) P.play_tool_sound(src) @@ -143,7 +143,7 @@ state = 1 icon_state = "box_0" new /obj/item/stack/cable_coil(drop_location(), 5) - return + return TRUE if(3) if(P.tool_behaviour == TOOL_CROWBAR) @@ -162,14 +162,14 @@ req_components = null components = null icon_state = "box_1" - return + return TRUE if(P.tool_behaviour == TOOL_WRENCH && !circuit.needs_anchored) to_chat(user, "You start [anchored ? "un" : ""]securing [src]...") if(P.use_tool(src, user, 40, volume=75)) to_chat(user, "You [anchored ? "un" : ""]secure [src].") setAnchored(!anchored) - return + return TRUE if(P.tool_behaviour == TOOL_SCREWDRIVER) var/component_check = 1 @@ -194,7 +194,7 @@ circuit.moveToNullspace() new_machine.RefreshParts() qdel(src) - return + return TRUE if(istype(P, /obj/item/storage/part_replacer) && P.contents.len && get_req_components_amt()) var/obj/item/storage/part_replacer/replacer = P @@ -235,7 +235,7 @@ to_chat(user, "You add [part] to [src].") if(added_components.len) replacer.play_rped_sound() - return + return TRUE if(isitem(P) && get_req_components_amt()) for(var/I in req_components) @@ -255,17 +255,16 @@ req_components[I] -= used_amt to_chat(user, "You add [P] to [src].") - return + return TRUE if(!user.transferItemToLoc(P, src)) break to_chat(user, "You add [P] to [src].") components += P req_components[I]-- - return 1 + return TRUE to_chat(user, "You cannot add that to the machine!") - return 0 - if(user.a_intent == INTENT_HARM) - return ..() + return TRUE + return ..() /obj/structure/frame/machine/deconstruct(disassembled = TRUE) if(!(flags_1 & NODECONSTRUCT_1)) diff --git a/code/game/machinery/dance_machine.dm b/code/game/machinery/dance_machine.dm index 7ac02da9ddf47..ed6ca47072a9c 100644 --- a/code/game/machinery/dance_machine.dm +++ b/code/game/machinery/dance_machine.dm @@ -67,9 +67,9 @@ dance_over() return ..() -/obj/machinery/jukebox/attackby(obj/item/O, mob/user, params) - if(!active && !(flags_1 & NODECONSTRUCT_1)) - if(O.tool_behaviour == TOOL_WRENCH) +/obj/machinery/jukebox/item_interact(obj/item/O, mob/user, params) + if(O.tool_behaviour == TOOL_WRENCH) + if(!active && !(flags_1 & NODECONSTRUCT_1)) if(!anchored && !isinspace()) to_chat(user,"You secure [src] to the floor.") setAnchored(TRUE) @@ -77,7 +77,13 @@ to_chat(user,"You unsecure and disconnect [src].") setAnchored(FALSE) playsound(src, 'sound/items/deconstruct.ogg', 50, 1) - return + return TRUE + else + if (!(flags_1 & NODECONSTRUCT_1)) + to_chat(user, "You must turn off [src] first!") + else + return FALSE + return TRUE return ..() /obj/machinery/jukebox/update_icon() diff --git a/code/game/machinery/defibrillator_mount.dm b/code/game/machinery/defibrillator_mount.dm index 2c2c3579ba33e..2566214a0ed9f 100644 --- a/code/game/machinery/defibrillator_mount.dm +++ b/code/game/machinery/defibrillator_mount.dm @@ -79,37 +79,37 @@ return user.put_in_hands(defib.paddles) -/obj/machinery/defibrillator_mount/attackby(obj/item/I, mob/living/user, params) +/obj/machinery/defibrillator_mount/item_interact(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/defibrillator)) if(defib) to_chat(user, "There's already a defibrillator in [src]!") - return + return TRUE if(HAS_TRAIT(I, TRAIT_NODROP) || !user.transferItemToLoc(I, src)) to_chat(user, "[I] is stuck to your hand!") - return + return TRUE user.visible_message("[user] hooks up [I] to [src]!", \ "You press [I] into the mount, and it clicks into place.") playsound(src, 'sound/machines/click.ogg', 50, TRUE) defib = I begin_processing() update_icon() - return + return TRUE else if(defib && I == defib.paddles) defib.paddles.snap_back() - return + return TRUE var/obj/item/card/id = I.GetID() if(id) if(check_access(id) || GLOB.security_level >= SEC_LEVEL_RED) //anyone can toggle the clamps in red alert! if(!defib) to_chat(user, "You can't engage the clamps on a defibrillator that isn't there.") - return + return TRUE clamps_locked = !clamps_locked to_chat(user, "Clamps [clamps_locked ? "" : "dis"]engaged.") update_icon() else to_chat(user, "Insufficient access.") - return - ..() + return TRUE + return ..() /obj/machinery/defibrillator_mount/multitool_act(mob/living/user, obj/item/multitool) if(!defib) diff --git a/code/game/machinery/dish_drive.dm b/code/game/machinery/dish_drive.dm index ce038fc91f99a..f0ea721dd3696 100644 --- a/code/game/machinery/dish_drive.dm +++ b/code/game/machinery/dish_drive.dm @@ -46,21 +46,21 @@ playsound(src, 'sound/items/pshoom.ogg', 50, TRUE) flick("synthesizer_beam", src) -/obj/machinery/dish_drive/attackby(obj/item/I, mob/living/user, params) +/obj/machinery/dish_drive/item_interact(obj/item/I, mob/living/user, params) if(is_type_in_list(I, collectable_items) && user.a_intent != INTENT_HARM) if(!user.transferItemToLoc(I, src)) - return + return TRUE to_chat(user, "You put [I] in [src], and it's beamed into energy!") playsound(src, 'sound/items/pshoom.ogg', 50, TRUE) flick("synthesizer_beam", src) - return + return TRUE else if(default_deconstruction_screwdriver(user, "[initial(icon_state)]-o", initial(icon_state), I)) - return + return TRUE else if(default_unfasten_wrench(user, I)) - return + return TRUE else if(default_deconstruction_crowbar(I, FALSE)) - return - ..() + return TRUE + return ..() /obj/machinery/dish_drive/RefreshParts() idle_power_usage = initial(idle_power_usage) diff --git a/code/game/machinery/dna_scanner.dm b/code/game/machinery/dna_scanner.dm index 36e1e85d0fffc..0d854a657d072 100644 --- a/code/game/machinery/dna_scanner.dm +++ b/code/game/machinery/dna_scanner.dm @@ -127,21 +127,21 @@ return open_machine() -/obj/machinery/dna_scannernew/attackby(obj/item/I, mob/user, params) +/obj/machinery/dna_scannernew/item_interact(obj/item/I, mob/user, params) if(default_deconstruction_screwdriver(user, icon_state, icon_state, I))//sent icon_state is irrelevant... update_icon()//..since we're updating the icon here, since the scanner can be unpowered when opened/closed - return + return TRUE if(default_pry_open(I)) - return + return TRUE if(default_deconstruction_crowbar(I)) - return + return TRUE if(panel_open && is_wire_tool(I)) wires.interact(user) - return + return TRUE return ..() diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 78f1e89468a66..cb290ea8fe85a 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -848,7 +848,7 @@ H.visible_message("[user] headbutts the airlock.", \ "You headbutt the airlock!") H.Paralyze(100) - H.apply_damage(10, BRUTE, BODY_ZONE_HEAD) + H.apply_damage(/datum/damage_source/impact, /datum/damage/brute, 10, BODY_ZONE_HEAD) else visible_message("[user] headbutts the airlock. Good thing [user.p_theyre()] wearing a helmet.") @@ -898,11 +898,11 @@ else updateDialog() -/obj/machinery/door/airlock/attackby(obj/item/C, mob/user, params) +/obj/machinery/door/airlock/item_interact(obj/item/C, mob/user, params) if(!issilicon(user) && !IsAdminGhost(user)) if(isElectrified() && C?.siemens_coefficient) if(shock(user, 75)) - return + return TRUE add_fingerprint(user) if(panel_open) @@ -912,56 +912,56 @@ var/obj/item/stack/sheet/iron/S = C if(S.get_amount() < 2) to_chat(user, "You need at least 2 iron sheets to reinforce [src].") - return + return TRUE to_chat(user, "You start reinforcing [src].") if(do_after(user, 20, src)) if(!panel_open || !S.use(2)) - return + return TRUE user.visible_message("[user] reinforces \the [src] with iron.", "You reinforce \the [src] with iron.") security_level = AIRLOCK_SECURITY_IRON update_icon() - return + return TRUE else if(istype(C, /obj/item/stack/sheet/plasteel)) var/obj/item/stack/sheet/plasteel/S = C if(S.get_amount() < 2) to_chat(user, "You need at least 2 plasteel sheets to reinforce [src].") - return + return TRUE to_chat(user, "You start reinforcing [src].") if(do_after(user, 20, src)) if(!panel_open || !S.use(2)) - return + return TRUE user.visible_message("[user] reinforces \the [src] with plasteel.", "You reinforce \the [src] with plasteel.") security_level = AIRLOCK_SECURITY_PLASTEEL modify_max_integrity(normal_integrity * AIRLOCK_INTEGRITY_MULTIPLIER) damage_deflection = AIRLOCK_DAMAGE_DEFLECTION_R update_icon() - return + return TRUE if(AIRLOCK_SECURITY_IRON) if(C.tool_behaviour == TOOL_WELDER) if(!C.tool_start_check(user, amount=2)) - return + return TRUE to_chat(user, "You begin cutting the panel's shielding...") if(C.use_tool(src, user, 40, volume=50, amount = 2)) if(!panel_open) - return + return TRUE user.visible_message("[user] cuts through \the [src]'s shielding.", "You cut through \the [src]'s shielding.", "You hear welding.") security_level = AIRLOCK_SECURITY_NONE spawn_atom_to_turf(/obj/item/stack/sheet/iron, user.loc, 2) update_icon() - return + return TRUE if(AIRLOCK_SECURITY_PLASTEEL_I_S) if(C.tool_behaviour == TOOL_CROWBAR) var/obj/item/crowbar/W = C to_chat(user, "You start removing the inner layer of shielding...") if(W.use_tool(src, user, 40, volume=100)) if(!panel_open) - return + return TRUE if(security_level != AIRLOCK_SECURITY_PLASTEEL_I_S) - return + return TRUE user.visible_message("[user] remove \the [src]'s shielding.", "You remove \the [src]'s inner shielding.") security_level = AIRLOCK_SECURITY_NONE @@ -969,121 +969,127 @@ damage_deflection = AIRLOCK_DAMAGE_DEFLECTION_N spawn_atom_to_turf(/obj/item/stack/sheet/plasteel, user.loc, 1) update_icon() - return + return TRUE if(AIRLOCK_SECURITY_PLASTEEL_I) if(C.tool_behaviour == TOOL_WELDER) if(!C.tool_start_check(user, amount=2)) - return + return TRUE to_chat(user, "You begin cutting the inner layer of shielding...") if(C.use_tool(src, user, 40, volume=50, amount=2)) if(!panel_open) - return + return TRUE user.visible_message("[user] cuts through \the [src]'s shielding.", "You cut through \the [src]'s shielding.", "You hear welding.") security_level = AIRLOCK_SECURITY_PLASTEEL_I_S - return + return TRUE if(AIRLOCK_SECURITY_PLASTEEL_O_S) if(C.tool_behaviour == TOOL_CROWBAR) to_chat(user, "You start removing outer layer of shielding...") if(C.use_tool(src, user, 40, volume=100)) if(!panel_open) - return + return TRUE if(security_level != AIRLOCK_SECURITY_PLASTEEL_O_S) - return + return TRUE user.visible_message("[user] remove \the [src]'s shielding.", "You remove \the [src]'s shielding.") security_level = AIRLOCK_SECURITY_PLASTEEL_I spawn_atom_to_turf(/obj/item/stack/sheet/plasteel, user.loc, 1) - return + return TRUE if(AIRLOCK_SECURITY_PLASTEEL_O) if(C.tool_behaviour == TOOL_WELDER) if(!C.tool_start_check(user, amount=2)) - return + return TRUE to_chat(user, "You begin cutting the outer layer of shielding...") if(C.use_tool(src, user, 40, volume=50, amount=2)) if(!panel_open) - return + return TRUE user.visible_message("[user] cuts through \the [src]'s shielding.", "You cut through \the [src]'s shielding.", "You hear welding.") security_level = AIRLOCK_SECURITY_PLASTEEL_O_S - return + return TRUE if(AIRLOCK_SECURITY_PLASTEEL) if(C.tool_behaviour == TOOL_WIRECUTTER) if(hasPower() && shock(user, 60)) // Protective grille of wiring is electrified - return + return TRUE to_chat(user, "You start cutting through the outer grille.") if(C.use_tool(src, user, 10, volume=100)) if(!panel_open) - return + return TRUE user.visible_message("[user] cut through \the [src]'s outer grille.", "You cut through \the [src]'s outer grille.") security_level = AIRLOCK_SECURITY_PLASTEEL_O - return + return TRUE if(C.tool_behaviour == TOOL_SCREWDRIVER) if((panel_open && detonated) || protected_door) to_chat(user, "[src] has no maintenance panel!") - return + return TRUE panel_open = !panel_open to_chat(user, "You [panel_open ? "open":"close"] the maintenance panel of the airlock.") C.play_tool_sound(src) update_icon() + return TRUE else if((C.tool_behaviour == TOOL_WIRECUTTER) && note) user.visible_message("[user] cuts down [note] from [src].", "You remove [note] from [src].") C.play_tool_sound(src) note.forceMove(get_turf(user)) note = null update_icon() + return TRUE else if(is_wire_tool(C) && panel_open) attempt_wire_interaction(user) - return + return TRUE else if(istype(C, /obj/item/pai_cable)) var/obj/item/pai_cable/cable = C cable.plugin(src, user) + return TRUE else if(istype(C, /obj/item/airlock_painter)) change_paintjob(C, user) + return TRUE else if(istype(C, /obj/item/doorCharge)) if(!panel_open || security_level) to_chat(user, "The maintenance panel must be open to apply [C]!") - return + return TRUE if(obj_flags & EMAGGED) - return + return TRUE if(charge && !detonated) to_chat(user, "There's already a charge hooked up to this door!") - return + return TRUE if(detonated) to_chat(user, "The maintenance panel is destroyed!") - return + return TRUE to_chat(user, "You apply [C]. Next time someone opens the door, it will explode.") panel_open = FALSE update_icon() user.transferItemToLoc(C, src, TRUE) charge = C + return TRUE else if(istype(C, /obj/item/paper) || istype(C, /obj/item/photo)) if(note) to_chat(user, "There's already something pinned to this airlock! Use wirecutters to remove it.") - return + return TRUE if(!user.transferItemToLoc(C, src)) to_chat(user, "For some reason, you can't attach [C]!") - return + return TRUE user.visible_message("[user] pins [C] to [src].", "You pin [C] to [src].") note = C update_icon() + return TRUE else if(HAS_TRAIT(C, TRAIT_DOOR_PRYER) && user.a_intent != INTENT_HARM) if(isElectrified() && C?.siemens_coefficient) shock(user,100) if(locked) to_chat(user, "The bolts are down, it won't budge!") - return + return TRUE if(welded) if(C.tool_behaviour == TOOL_CROWBAR) if(try_to_crowbar(C, user)) - return + return TRUE to_chat(user, "It's welded, it won't budge!") - return + return TRUE var/time_to_open = 5 if(hasPower() && !prying_so_hard && density) @@ -1097,6 +1103,7 @@ prying_so_hard = FALSE if(!hasPower()) INVOKE_ASYNC(src, (density ? PROC_REF(open) : PROC_REF(close)), 2) + return TRUE else return ..() @@ -1188,7 +1195,7 @@ H.Unconscious(160) H.adjust_fire_stacks(20) H.IgniteMob() //Guaranteed knockout and ignition for nearby people - H.apply_damage(40, BRUTE, BODY_ZONE_CHEST) + H.apply_damage(/datum/damage_source/explosion, /datum/damage/burn, 40) return if(forced < 2) if(!ignore_emagged && (obj_flags & EMAGGED)) diff --git a/code/game/machinery/doors/airlock_types.dm b/code/game/machinery/doors/airlock_types.dm index 9ed596fbd0178..ae28d8fe8ee51 100644 --- a/code/game/machinery/doors/airlock_types.dm +++ b/code/game/machinery/doors/airlock_types.dm @@ -245,12 +245,11 @@ /obj/machinery/door/airlock/plasma/BlockThermalConductivity() //we don't stop the heat~ return 0 -/obj/machinery/door/airlock/plasma/attackby(obj/item/C, mob/user, params) +/obj/machinery/door/airlock/plasma/item_interact(obj/item/C, mob/user, params) if(C.is_hot() > 300)//If the temperature of the object is over 300, then ignite if(plasma_ignition(6, user)) PlasmaBurn() - else - return ..() + return ..() /obj/machinery/door/airlock/plasma/glass opacity = FALSE diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index b19e2dd041731..fbba71a4060a9 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -231,16 +231,16 @@ T.ImmediateCalculateAdjacentTurfs() // alright lets put it back return max_moles - min_moles > 20 -/obj/machinery/door/attackby(obj/item/I, mob/user, params) - if(user.a_intent != INTENT_HARM && (I.tool_behaviour == TOOL_CROWBAR || istype(I, /obj/item/fireaxe))) +/obj/machinery/door/item_interact(obj/item/I, mob/user, params) + if(I.tool_behaviour == TOOL_CROWBAR || istype(I, /obj/item/fireaxe)) try_to_crowbar(I, user) - return 1 + return TRUE else if(I.tool_behaviour == TOOL_WELDER) try_to_weld(I, user) - return 1 - else if(!(I.item_flags & NOBLUDGEON) && user.a_intent != INTENT_HARM) + return TRUE + else if(!(I.item_flags & NOBLUDGEON)) try_to_activate_door(I, user) - return 1 + return TRUE return ..() /obj/machinery/door/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir) @@ -366,21 +366,23 @@ for(var/mob/living/L in get_turf(src)) L.visible_message("[src] closes on [L], crushing [L.p_them()]!", "[src] closes on you and crushes you!") if(isalien(L)) //For xenos - L.adjustBruteLoss(DOOR_CRUSH_DAMAGE * 1.5) //Xenos go into crit after aproximately the same amount of crushes as humans. + var/datum/damage_source/crush/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(L, BRUTE, DOOR_CRUSH_DAMAGE * 1.5, null) //Xenos go into crit after aproximately the same amount of crushes as humans. L.emote("roar") else if(ishuman(L)) //For humans - var/armour = L.run_armor_check(BODY_ZONE_CHEST, MELEE) - var/multiplier = CLAMP(1 - (armour * 0.01), 0, 1) - L.adjustBruteLoss(multiplier * DOOR_CRUSH_DAMAGE) + var/datum/damage_source/crush/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(L, BRUTE, DOOR_CRUSH_DAMAGE, null) L.emote("scream") if(!L.IsParalyzed()) L.Paralyze(60) else if(ismonkey(L)) //For monkeys - L.adjustBruteLoss(DOOR_CRUSH_DAMAGE) + var/datum/damage_source/crush/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(L, BRUTE, DOOR_CRUSH_DAMAGE, null) if(!L.IsParalyzed()) L.Paralyze(60) else //for simple_animals & borgs - L.adjustBruteLoss(DOOR_CRUSH_DAMAGE) + var/datum/damage_source/crush/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(L, BRUTE, DOOR_CRUSH_DAMAGE, null) var/turf/location = get_turf(src) //add_blood doesn't work for borgs/xenos, but add_blood_floor does. L.add_splatter_floor(location) diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index 2a42f32d5ebd3..21bf0e24e1b45 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -108,44 +108,45 @@ "You bang on \the [src].") playsound(loc, 'sound/effects/glassknock.ogg', 10, FALSE, frequency = 32000) -/obj/machinery/door/firedoor/attackby(obj/item/C, mob/user, params) +/obj/machinery/door/firedoor/item_interact(obj/item/C, mob/user, params) add_fingerprint(user) if(operating) - return + return ..() if(istype(C, /obj/item/modular_computer/tablet/pda)) var/attack_verb = pick("smushes","rubs","smashes","presses","taps") visible_message("[user] [attack_verb] \the [C] against [src]\s card reader.", "You [attack_verb] \the [C] against [src]\s card reader. It doesn't do anything.", "You hear plastic click against metal.") - return + return TRUE if(welded) if(C.tool_behaviour == TOOL_WRENCH) if(boltslocked) to_chat(user, "There are screws locking the bolts in place!") - return + return TRUE C.play_tool_sound(src) user.visible_message("[user] starts undoing [src]'s bolts...", \ "You start unfastening [src]'s floor bolts...") if(!C.use_tool(src, user, 50)) - return + return TRUE playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, 1) user.visible_message("[user] unfastens [src]'s bolts.", \ "You undo [src]'s floor bolts.") deconstruct(TRUE) - return + return TRUE if(C.tool_behaviour == TOOL_SCREWDRIVER) user.visible_message("[user] [boltslocked ? "unlocks" : "locks"] [src]'s bolts.", \ "You [boltslocked ? "unlock" : "lock"] [src]'s floor bolts.") C.play_tool_sound(src) boltslocked = !boltslocked - return + return TRUE if(C.tool_behaviour == TOOL_MULTITOOL) if(!access_log) to_chat(user, "\the [C] beeps, 'Access Log Empty.'") - return + return TRUE to_chat(user, "\the [C] beeps, 'Dumping access log...'") for(var/entry in access_log) to_chat(user, "[entry]") + return TRUE return ..() @@ -546,7 +547,7 @@ ..() icon_state = "frame[constructionStep]" -/obj/structure/firelock_frame/attackby(obj/item/C, mob/user) +/obj/structure/firelock_frame/item_interact(obj/item/C, mob/user) switch(constructionStep) if(CONSTRUCTION_PANEL_OPEN) if(C.tool_behaviour == TOOL_CROWBAR) @@ -554,28 +555,28 @@ user.visible_message("[user] starts prying something out from [src]...", \ "You begin prying out the wire cover...") if(!C.use_tool(src, user, 50)) - return + return TRUE if(constructionStep != CONSTRUCTION_PANEL_OPEN) - return + return TRUE playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, 1) user.visible_message("[user] pries out a metal plate from [src], exposing the wires.", \ "You remove the cover plate from [src], exposing the wires.") constructionStep = CONSTRUCTION_WIRES_EXPOSED update_icon() - return + return TRUE if(C.tool_behaviour == TOOL_WRENCH) var/obj/machinery/door/firedoor/A = locate(/obj/machinery/door/firedoor) in get_turf(src) if(A && A.dir == src.dir) to_chat(user, "There's already a firelock there.") - return + return TRUE C.play_tool_sound(src) user.visible_message("[user] starts bolting down [src]...", \ "You begin bolting [src]...") if(!C.use_tool(src, user, 30)) - return + return TRUE var/obj/machinery/door/firedoor/D = locate(/obj/machinery/door/firedoor) in get_turf(src) if(D && D.dir == src.dir) - return + return TRUE user.visible_message("[user] finishes the firelock.", \ "You finish the firelock.") playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, 1) @@ -583,28 +584,28 @@ F.dir = src.dir F.update_icon() qdel(src) - return + return TRUE if(istype(C, /obj/item/stack/sheet/plasteel)) var/obj/item/stack/sheet/plasteel/P = C if(reinforced) to_chat(user, "[src] is already reinforced.") - return + return TRUE if(P.get_amount() < 2) to_chat(user, "You need more plasteel to reinforce [src].") - return + return TRUE user.visible_message("[user] begins reinforcing [src]...", \ "You begin reinforcing [src]...") playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, 1) if(do_after(user, 60, target = src)) if(constructionStep != CONSTRUCTION_PANEL_OPEN || reinforced || P.get_amount() < 2 || !P) - return + return TRUE user.visible_message("[user] reinforces [src].", \ "You reinforce [src].") playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, 1) P.use(2) reinforced = TRUE firelock_type = /obj/machinery/door/firedoor/heavy - return + return TRUE if(CONSTRUCTION_WIRES_EXPOSED) if(C.tool_behaviour == TOOL_WIRECUTTER) @@ -612,61 +613,61 @@ user.visible_message("[user] starts cutting the wires from [src]...", \ "You begin removing [src]'s wires...") if(!C.use_tool(src, user, 60)) - return + return TRUE if(constructionStep != CONSTRUCTION_WIRES_EXPOSED) - return + return TRUE user.visible_message("[user] removes the wires from [src].", \ "You remove the wiring from [src], exposing the circuit board.") new/obj/item/stack/cable_coil(get_turf(src), 5) constructionStep = CONSTRUCTION_GUTTED update_icon() - return + return TRUE if(C.tool_behaviour == TOOL_CROWBAR) C.play_tool_sound(src) user.visible_message("[user] starts prying a metal plate into [src]...", \ "You begin prying the cover plate back onto [src]...") if(!C.use_tool(src, user, 80)) - return + return TRUE if(constructionStep != CONSTRUCTION_WIRES_EXPOSED) - return + return TRUE playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, 1) user.visible_message("[user] pries the metal plate into [src].", \ "You pry [src]'s cover plate into place, hiding the wires.") constructionStep = CONSTRUCTION_PANEL_OPEN update_icon() - return + return TRUE if(CONSTRUCTION_GUTTED) if(C.tool_behaviour == TOOL_CROWBAR) user.visible_message("[user] begins removing the circuit board from [src]...", \ "You begin prying out the circuit board from [src]...") if(!C.use_tool(src, user, 50, volume=50)) - return + return TRUE if(constructionStep != CONSTRUCTION_GUTTED) - return + return TRUE user.visible_message("[user] removes [src]'s circuit board.", \ "You remove the circuit board from [src].") new /obj/item/electronics/firelock(drop_location()) constructionStep = CONSTRUCTION_NOCIRCUIT update_icon() - return + return TRUE if(istype(C, /obj/item/stack/cable_coil)) var/obj/item/stack/cable_coil/B = C if(B.get_amount() < 5) to_chat(user, "You need more wires to add wiring to [src].") - return + return TRUE user.visible_message("[user] begins wiring [src]...", \ "You begin adding wires to [src]...") playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, 1) if(do_after(user, 60, target = src)) if(constructionStep != CONSTRUCTION_GUTTED || B.get_amount() < 5 || !B) - return + return TRUE user.visible_message("[user] adds wires to [src].", \ "You wire [src].") playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, 1) B.use(5) constructionStep = CONSTRUCTION_WIRES_EXPOSED update_icon() - return + return TRUE if(CONSTRUCTION_NOCIRCUIT) if(C.tool_behaviour == TOOL_WELDER) if(!C.tool_start_check(user, amount=1)) @@ -676,7 +677,7 @@ if(C.use_tool(src, user, 40, volume=50, amount=1)) if(constructionStep != CONSTRUCTION_NOCIRCUIT) - return + return TRUE var/turf/T = get_turf(src) switch(firelock_type) if(/obj/machinery/door/firedoor/heavy) @@ -693,31 +694,31 @@ "You cut [src] into iron.") new /obj/item/stack/sheet/iron(T, 3) qdel(src) - return + return TRUE if(istype(C, /obj/item/electronics/firelock)) user.visible_message("[user] starts adding [C] to [src]...", \ "You begin adding a circuit board to [src]...") playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, 1) if(!do_after(user, 40, target = src)) - return + return TRUE if(constructionStep != CONSTRUCTION_NOCIRCUIT) - return + return TRUE qdel(C) user.visible_message("[user] adds a circuit to [src].", \ "You insert and secure [C].") playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, 1) constructionStep = CONSTRUCTION_GUTTED update_icon() - return + return TRUE if(istype(C, /obj/item/electroadaptive_pseudocircuit)) var/obj/item/electroadaptive_pseudocircuit/P = C if(!P.adapt_circuit(user, 30)) - return + return TRUE user.visible_message("[user] fabricates a circuit and places it into [src].", \ "You adapt a firelock circuit and slot it into the assembly.") constructionStep = CONSTRUCTION_GUTTED update_icon() - return + return TRUE return ..() /obj/structure/firelock_frame/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd) diff --git a/code/game/machinery/doors/poddoor.dm b/code/game/machinery/doors/poddoor.dm index 052ea58a3dfed..36de8013072cc 100644 --- a/code/game/machinery/doors/poddoor.dm +++ b/code/game/machinery/doors/poddoor.dm @@ -21,13 +21,11 @@ var/pod_close_sound = 'sound/machines/blastdoor.ogg' icon_state = "blast_closed" -/obj/machinery/door/poddoor/attackby(obj/item/W, mob/user, params) - . = ..() - +/obj/machinery/door/poddoor/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_SCREWDRIVER) if(density) to_chat(user, "You need to open [src] before opening its maintenance panel.") - return + return TRUE else if(default_deconstruction_screwdriver(user, icon_state, icon_state, W)) to_chat(user, "You [panel_open ? "open" : "close"] the maintenance hatch of [src].") return TRUE @@ -38,6 +36,7 @@ if(change_id) id = clamp(round(change_id, 1), 1, 100) to_chat(user, "You change the ID to [id].") + return TRUE if(W.tool_behaviour == TOOL_CROWBAR &&deconstruction == BLASTDOOR_FINISHED) to_chat(user, "You start to remove the airlock electronics.") @@ -45,6 +44,7 @@ new /obj/item/electronics/airlock(loc) id = null deconstruction = BLASTDOOR_NEEDS_ELECTRONICS + return TRUE else if(W.tool_behaviour == TOOL_WIRECUTTER && deconstruction == BLASTDOOR_NEEDS_ELECTRONICS) to_chat(user, "You start to remove the internal cables.") @@ -54,16 +54,19 @@ var/amount = recipe.reqs[/obj/item/stack/cable_coil] new /obj/item/stack/cable_coil(loc, amount) deconstruction = BLASTDOOR_NEEDS_WIRES + return TRUE else if(W.tool_behaviour == TOOL_WELDER && deconstruction == BLASTDOOR_NEEDS_WIRES) if(!W.tool_start_check(user, amount=0)) - return + return TRUE to_chat(user, "You start tearing apart the [src].") playsound(src.loc, 'sound/items/welder.ogg', 50, 1) if(do_after(user, 15 SECONDS, target = src)) new /obj/item/stack/sheet/plasteel(loc, 15) qdel(src) + return TRUE + return ..() /obj/machinery/door/poddoor/examine(mob/user) . = ..() diff --git a/code/game/machinery/doors/unpowered.dm b/code/game/machinery/doors/unpowered.dm index deff33a2e8c54..92aa6f4bdb20a 100644 --- a/code/game/machinery/doors/unpowered.dm +++ b/code/game/machinery/doors/unpowered.dm @@ -6,12 +6,8 @@ ..() return - -/obj/machinery/door/unpowered/attackby(obj/item/I, mob/user, params) - if(locked) - return - else - return ..() +/obj/machinery/door/unpowered/item_interact(obj/item/I, mob/user, params) + return FALSE /obj/machinery/door/unpowered/shuttle icon = 'icons/turf/shuttle.dmi' diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index 7321d5a7aa380..6f718c15e7cce 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -242,21 +242,17 @@ desc += "
Its access panel is smoking slightly." open(2) -/obj/machinery/door/window/attackby(obj/item/I, mob/living/user, params) - - if(operating) - return - +/obj/machinery/door/window/item_interact(obj/item/I, mob/living/user, params) add_fingerprint(user) if(!(flags_1&NODECONSTRUCT_1)) if(I.tool_behaviour == TOOL_SCREWDRIVER) if(density || operating) to_chat(user, "You need to open the door to access the maintenance panel!") - return + return TRUE I.play_tool_sound(src) panel_open = !panel_open to_chat(user, "You [panel_open ? "open":"close"] the maintenance panel of the [name].") - return + return TRUE if(I.tool_behaviour == TOOL_CROWBAR) if(panel_open && !density && !operating) @@ -285,7 +281,7 @@ if(obj_flags & EMAGGED) to_chat(user, "You discard the damaged electronics.") qdel(src) - return + return TRUE to_chat(user, "You remove the airlock electronics.") @@ -303,7 +299,7 @@ ae.forceMove(drop_location()) qdel(src) - return + return TRUE return ..() /obj/machinery/door/window/interact(mob/user) //for sillycones @@ -440,10 +436,10 @@ /obj/machinery/door/window/clockwork/ratvar_act() return FALSE -/obj/machinery/door/window/clockwork/attackby(obj/item/I, mob/living/user, params) +/obj/machinery/door/window/clockwork/item_interact(obj/item/I, mob/living/user, params) if(operating) - return + return FALSE add_fingerprint(user) if(!(flags_1&NODECONSTRUCT_1)) @@ -451,7 +447,7 @@ I.play_tool_sound(src) panel_open = !panel_open to_chat(user, "You [panel_open ? "open":"close"] the maintenance panel of the [name].") - return + return TRUE if(I.tool_behaviour == TOOL_CROWBAR) if(panel_open && !density && !operating) @@ -460,7 +456,7 @@ if(I.use_tool(src, user, 40, volume=50)) if(panel_open && !density && !operating && loc) qdel(src) - return + return TRUE return ..() /obj/machinery/door/window/northleft diff --git a/code/game/machinery/doppler_array.dm b/code/game/machinery/doppler_array.dm index c381e979d648a..8f5d365fb6fd0 100644 --- a/code/game/machinery/doppler_array.dm +++ b/code/game/machinery/doppler_array.dm @@ -116,7 +116,7 @@ update_icon() -/obj/machinery/doppler_array/attackby(obj/item/I, mob/user, params) +/obj/machinery/doppler_array/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_WRENCH) if(!anchored && !isinspace()) anchored = TRUE @@ -127,7 +127,7 @@ power_change() to_chat(user, "You unfasten [src].") I.play_tool_sound(src) - return + return TRUE return ..() /obj/machinery/doppler_array/proc/rot_message(mob/user) diff --git a/code/game/machinery/droneDispenser.dm b/code/game/machinery/droneDispenser.dm index 0e83ea3b0944f..7163ea83650b0 100644 --- a/code/game/machinery/droneDispenser.dm +++ b/code/game/machinery/droneDispenser.dm @@ -204,27 +204,28 @@ else icon_state = icon_on -/obj/machinery/droneDispenser/attackby(obj/item/I, mob/living/user) +/obj/machinery/droneDispenser/item_interact(obj/item/I, mob/living/user) if(I.tool_behaviour == TOOL_CROWBAR) var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) materials.retrieve_all() I.play_tool_sound(src) to_chat(user, "You retrieve the materials from [src].") + return TRUE else if(I.tool_behaviour == TOOL_WELDER) if(!(machine_stat & BROKEN)) to_chat(user, "[src] doesn't need repairs.") - return + return TRUE if(!I.tool_start_check(user, amount=1)) - return + return TRUE user.visible_message( "[user] begins patching up [src] with [I].", "You begin restoring the damage to [src]...") if(!I.use_tool(src, user, 40, volume=50, amount=1)) - return + return TRUE user.visible_message( "[user] fixes [src]!", @@ -233,6 +234,7 @@ set_machine_stat(machine_stat & ~BROKEN) obj_integrity = max_integrity update_icon() + return TRUE else return ..() diff --git a/code/game/machinery/embedded_controller/access_controller.dm b/code/game/machinery/embedded_controller/access_controller.dm index d9461dd6c715c..475b91fe5a59d 100644 --- a/code/game/machinery/embedded_controller/access_controller.dm +++ b/code/game/machinery/embedded_controller/access_controller.dm @@ -12,9 +12,6 @@ resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF var/idSelf -/obj/machinery/doorButtons/attackby(obj/O, mob/user) - return attack_hand(user) - /obj/machinery/doorButtons/proc/findObjsByTag() return diff --git a/code/game/machinery/fabricators/autolathe.dm b/code/game/machinery/fabricators/autolathe.dm index ec50cb67f8dac..d82509bd6d87e 100644 --- a/code/game/machinery/fabricators/autolathe.dm +++ b/code/game/machinery/fabricators/autolathe.dm @@ -81,7 +81,7 @@ security_interface_locked = TRUE . = TRUE -/obj/machinery/modular_fabricator/autolathe/attackby(obj/item/O, mob/user, params) +/obj/machinery/modular_fabricator/autolathe/item_interact(obj/item/O, mob/user, params) if((ACCESS_SECURITY in O.GetAccess()) && !(obj_flags & EMAGGED)) security_interface_locked = !security_interface_locked @@ -102,11 +102,8 @@ wires.interact(user) return TRUE - if(user.a_intent == INTENT_HARM) //so we can hit the machine - return ..() - if(machine_stat) - return TRUE + return ..() if(istype(O, /obj/item/disk/design_disk)) user.visible_message("[user] loads \the [O] into \the [src]...", diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm index 9a2b8bf287a8d..78fad3238d0ed 100644 --- a/code/game/machinery/firealarm.dm +++ b/code/game/machinery/firealarm.dm @@ -173,7 +173,7 @@ /obj/machinery/firealarm/attack_robot(mob/user) return attack_hand(user) -/obj/machinery/firealarm/attackby(obj/item/W, mob/user, params) +/obj/machinery/firealarm/item_interact(obj/item/W, mob/user, params) add_fingerprint(user) if(W.tool_behaviour == TOOL_SCREWDRIVER && buildstage == 2) @@ -181,14 +181,14 @@ panel_open = !panel_open to_chat(user, "The wires have been [panel_open ? "exposed" : "unexposed"].") update_appearance() - return + return TRUE if(panel_open) if(W.tool_behaviour == TOOL_WELDER && user.a_intent == INTENT_HELP) if(obj_integrity < max_integrity) if(!W.tool_start_check(user, amount=0)) - return + return TRUE to_chat(user, "You begin repairing [src]...") if(W.use_tool(src, user, 40, volume=50)) @@ -196,7 +196,7 @@ to_chat(user, "You repair [src].") else to_chat(user, "[src] is already in good condition!") - return + return TRUE switch(buildstage) if(2) @@ -206,7 +206,7 @@ user.visible_message("[user] has reconnected [src]'s detecting unit!", "You reconnect [src]'s detecting unit.") else user.visible_message("[user] has disconnected [src]'s detecting unit!", "You disconnect [src]'s detecting unit.") - return + return TRUE else if(W.tool_behaviour == TOOL_WIRECUTTER) buildstage = 1 @@ -214,14 +214,14 @@ new /obj/item/stack/cable_coil(user.loc, 5) to_chat(user, "You cut the wires from \the [src].") update_appearance() - return + return TRUE else if(W.force) //hit and turn it on ..() var/area/A = get_area(src) if(!A.fire) alarm() - return + return TRUE if(1) if(istype(W, /obj/item/stack/cable_coil)) @@ -233,7 +233,7 @@ buildstage = 2 to_chat(user, "You wire \the [src].") update_appearance() - return + return TRUE else if(W.tool_behaviour == TOOL_CROWBAR) user.visible_message("[user.name] removes the electronics from [src.name].", \ @@ -248,24 +248,24 @@ new /obj/item/electronics/firealarm(user.loc) buildstage = 0 update_appearance() - return + return TRUE if(0) if(istype(W, /obj/item/electronics/firealarm)) to_chat(user, "You insert the circuit.") qdel(W) buildstage = 1 update_appearance() - return + return TRUE else if(istype(W, /obj/item/electroadaptive_pseudocircuit)) var/obj/item/electroadaptive_pseudocircuit/P = W if(!P.adapt_circuit(user, 15)) - return + return TRUE user.visible_message("[user] fabricates a circuit and places it into [src].", \ "You adapt a fire alarm circuit and slot it into the assembly.") buildstage = 1 update_appearance() - return + return TRUE else if(W.tool_behaviour == TOOL_WRENCH) user.visible_message("[user] removes the fire alarm assembly from the wall.", \ @@ -274,8 +274,7 @@ frame.forceMove(user.drop_location()) W.play_tool_sound(src) qdel(src) - return - + return TRUE return ..() /obj/machinery/firealarm/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd) diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm index b3da1ded3bbad..abf3b76ec0762 100644 --- a/code/game/machinery/flasher.dm +++ b/code/game/machinery/flasher.dm @@ -54,7 +54,7 @@ icon_state = "[base_state]1-p" //Don't want to render prison breaks impossible -/obj/machinery/flasher/attackby(obj/item/W, mob/user, params) +/obj/machinery/flasher/item_interact(obj/item/W, mob/user, params) add_fingerprint(user) if (W.tool_behaviour == TOOL_WIRECUTTER) if (bulb) @@ -64,6 +64,7 @@ bulb.forceMove(loc) bulb = null power_change() + return TRUE else if (istype(W, /obj/item/assembly/flash/handheld)) if (!bulb) @@ -74,6 +75,7 @@ power_change() else to_chat(user, "A flashbulb is already installed in [src]!") + return TRUE else if (W.tool_behaviour == TOOL_WRENCH) if(!bulb) @@ -83,8 +85,8 @@ deconstruct(TRUE) else to_chat(user, "Remove a flashbulb from [src] first!") - else - return ..() + return TRUE + return ..() //Let the AI trigger them directly. /obj/machinery/flasher/attack_ai() @@ -98,7 +100,7 @@ if(anchored) flash() -/obj/machinery/flasher/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir) +/obj/machinery/flasher/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir, armour_penetration = 0) if(damage_flag == MELEE && damage_amount < 10) //any melee attack below 10 dmg does nothing return 0 . = ..() @@ -174,7 +176,7 @@ if (M.m_intent != MOVE_INTENT_WALK && anchored) flash() -/obj/machinery/flasher/portable/attackby(obj/item/W, mob/user, params) +/obj/machinery/flasher/portable/item_interact(obj/item/W, mob/user, params) if (W.tool_behaviour == TOOL_WRENCH) W.play_tool_sound(src, 100) @@ -190,7 +192,7 @@ setAnchored(FALSE) power_change() proximity_monitor.SetRange(0) - + return TRUE else return ..() diff --git a/code/game/machinery/gulag_teleporter.dm b/code/game/machinery/gulag_teleporter.dm index ae72aeca1f6b9..ccfdc926dcbcd 100644 --- a/code/game/machinery/gulag_teleporter.dm +++ b/code/game/machinery/gulag_teleporter.dm @@ -54,13 +54,13 @@ The console is located at computer/gulag_teleporter.dm /obj/machinery/gulag_teleporter/updateUsrDialog() return -/obj/machinery/gulag_teleporter/attackby(obj/item/I, mob/user) +/obj/machinery/gulag_teleporter/item_interact(obj/item/I, mob/user) if(!occupant && default_deconstruction_screwdriver(user, "[icon_state]", "[icon_state]",I)) update_icon() - return + return TRUE if(default_deconstruction_crowbar(I)) - return + return TRUE if(default_pry_open(I)) return diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index aa77e40912a0b..c343cbe55a08c 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -150,29 +150,29 @@ Possible to do for anyone motivated enough: if(in_range(user, src) || isobserver(user)) . += "The status display reads: Current projection range: [holo_range] units." -/obj/machinery/holopad/attackby(obj/item/P, mob/user, params) +/obj/machinery/holopad/item_interact(obj/item/P, mob/user, params) if(default_deconstruction_screwdriver(user, "holopad_open", "holopad0", P)) - return + return TRUE if(default_pry_open(P)) - return + return TRUE if(default_unfasten_wrench(user, P)) - return + return TRUE if(default_deconstruction_crowbar(P)) - return + return TRUE if(istype(P,/obj/item/disk/holodisk)) if(disk) to_chat(user,"There's already a disk inside [src]") - return + return TRUE if (!user.transferItemToLoc(P,src)) - return + return TRUE to_chat(user,"You insert [P] into [src]") disk = P updateDialog() - return + return TRUE return ..() diff --git a/code/game/machinery/igniter.dm b/code/game/machinery/igniter.dm index adb348ffa92da..e4a89afc9014c 100644 --- a/code/game/machinery/igniter.dm +++ b/code/game/machinery/igniter.dm @@ -48,13 +48,13 @@ . = ..() icon_state = "igniter[on]" -/obj/machinery/igniter/attackby(obj/item/I, mob/living/user, params) +/obj/machinery/igniter/item_interact(obj/item/I, mob/living/user, params) if(default_deconstruction_screwdriver(user, "igniter_o", "igniter[on]", I)) on = FALSE - return + return TRUE if(default_deconstruction_crowbar(I)) - return + return TRUE return ..() @@ -102,7 +102,7 @@ icon_state = "[base_state]-p" // src.sd_SetLuminosity(0) -/obj/machinery/sparker/attackby(obj/item/W, mob/user, params) +/obj/machinery/sparker/item_interact(obj/item/W, mob/user, params) if (W.tool_behaviour == TOOL_SCREWDRIVER) add_fingerprint(user) src.disable = !src.disable @@ -115,6 +115,7 @@ icon_state = "[base_state]" else icon_state = "[base_state]-p" + return TRUE else return ..() diff --git a/code/game/machinery/iv_drip.dm b/code/game/machinery/iv_drip.dm index f040c0b14fddb..d1b42fcdf4496 100644 --- a/code/game/machinery/iv_drip.dm +++ b/code/game/machinery/iv_drip.dm @@ -103,19 +103,19 @@ to_chat(usr, "There's nothing attached to the IV drip!") -/obj/machinery/iv_drip/attackby(obj/item/W, mob/user, params) +/obj/machinery/iv_drip/item_interact(obj/item/W, mob/user, params) if(is_type_in_typecache(W, drip_containers)) if(beaker) to_chat(user, "There is already a reagent container loaded!") - return + return TRUE if(!user.transferItemToLoc(W, src)) - return + return TRUE beaker = W to_chat(user, "You attach [W] to [src].") user.log_message("attached a [W] to [src] at [AREACOORD(src)] containing ([beaker.reagents.log_list()])", LOG_ATTACK) add_fingerprint(user) update_icon() - return + return TRUE else return ..() @@ -130,7 +130,7 @@ if(!(get_dist(src, attached) <= 1 && isturf(attached.loc))) to_chat(attached, "The IV drip needle is ripped out of you!") - attached.apply_damage(3, BRUTE, pick(BODY_ZONE_R_ARM, BODY_ZONE_L_ARM)) + attached.apply_damage(/datum/damage_source/skin_prick, /datum/damage/brute, 3, pick(BODY_ZONE_R_ARM, BODY_ZONE_L_ARM)) attached = null update_icon() return PROCESS_KILL diff --git a/code/game/machinery/launch_pad.dm b/code/game/machinery/launch_pad.dm index 91bbd26be528f..48c4d51492832 100644 --- a/code/game/machinery/launch_pad.dm +++ b/code/game/machinery/launch_pad.dm @@ -62,14 +62,14 @@ DEFINE_BUFFER_HANDLER(/obj/machinery/launchpad) return COMPONENT_BUFFER_RECIEVED return NONE -/obj/machinery/launchpad/attackby(obj/item/I, mob/user, params) +/obj/machinery/launchpad/item_interact(obj/item/I, mob/user, params) if(stationary) if(default_deconstruction_screwdriver(user, "lpad-idle-o", "lpad-idle", I)) update_indicator() - return + return TRUE if(default_deconstruction_crowbar(I)) - return + return TRUE return ..() @@ -258,13 +258,14 @@ DEFINE_BUFFER_HANDLER(/obj/machinery/launchpad) closed = TRUE update_indicator() -/obj/machinery/launchpad/briefcase/attackby(obj/item/I, mob/user, params) +/obj/machinery/launchpad/briefcase/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/launchpad_remote)) var/obj/item/launchpad_remote/L = I if(L.pad == WEAKREF(src)) //do not attempt to link when already linked - return ..() + return TRUE L.pad = WEAKREF(src) to_chat(user, "You link [src] to [L].") + return TRUE else return ..() @@ -297,7 +298,7 @@ DEFINE_BUFFER_HANDLER(/obj/machinery/launchpad) user.transferItemToLoc(src, pad, TRUE) SEND_SIGNAL(src, COMSIG_TRY_STORAGE_HIDE_ALL) -/obj/item/storage/briefcase/launchpad/attackby(obj/item/I, mob/user, params) +/obj/item/storage/briefcase/launchpad/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/launchpad_remote)) var/obj/item/launchpad_remote/L = I if(L.pad == WEAKREF(src.pad)) //do not attempt to link when already linked diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm index d6db992c23af0..cb46bfb6a7c0d 100644 --- a/code/game/machinery/lightswitch.dm +++ b/code/game/machinery/lightswitch.dm @@ -77,20 +77,21 @@ area.power_change() -/obj/machinery/light_switch/attackby(obj/item/I, mob/user, params) +/obj/machinery/light_switch/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_SCREWDRIVER) screwdrivered = !screwdrivered user.visible_message("[user] [screwdrivered ? "un" : ""]secures [name].", \ "You [screwdrivered ? "un" : ""]secure [name].") I.play_tool_sound(src) update_appearance(updates = UPDATE_ICON|UPDATE_OVERLAYS) - return + return TRUE if(I.tool_behaviour == TOOL_CROWBAR && screwdrivered) I.play_tool_sound(src) user.visible_message("[user] pries [name] off the wall.","You pry [name] off the wall.") new /obj/item/wallframe/light_switch(loc) qdel(src) - return + return TRUE + return ..() /obj/machinery/light_switch/power_change() if(area == get_area(src)) diff --git a/code/game/machinery/limbgrower.dm b/code/game/machinery/limbgrower.dm index 518ccc43997bb..4c758da99e5dc 100644 --- a/code/game/machinery/limbgrower.dm +++ b/code/game/machinery/limbgrower.dm @@ -61,20 +61,18 @@ reagents.trans_to(G, G.reagents.maximum_volume) ..() -/obj/machinery/limbgrower/attackby(obj/item/O, mob/user, params) +/obj/machinery/limbgrower/item_interact(obj/item/O, mob/user, params) if (busy) to_chat(user, "The Limb Grower is busy. Please wait for completion of previous operation.") - return + return TRUE if(default_deconstruction_screwdriver(user, "limbgrower_panelopen", "limbgrower_idleoff", O)) updateUsrDialog() - return + return TRUE if(panel_open && default_deconstruction_crowbar(O)) - return - - if(user.a_intent == INTENT_HARM) //so we can hit the machine - return ..() + return TRUE + return ..() /obj/machinery/limbgrower/Topic(href, href_list) if(..()) diff --git a/code/game/machinery/mass_driver.dm b/code/game/machinery/mass_driver.dm index cc70606554268..62e643c3fd011 100644 --- a/code/game/machinery/mass_driver.dm +++ b/code/game/machinery/mass_driver.dm @@ -40,17 +40,17 @@ O.throw_at(target, drive_range * power, power) flick("mass_driver1", src) -/obj/machinery/mass_driver/attackby(obj/item/I, mob/living/user, params) +/obj/machinery/mass_driver/item_interact(obj/item/I, mob/living/user, params) if(is_wire_tool(I) && panel_open) wires.interact(user) - return + return TRUE if(default_deconstruction_screwdriver(user, "mass_driver_o", "mass_driver", I)) - return + return TRUE if(default_change_direction_wrench(user, I)) - return + return TRUE if(default_deconstruction_crowbar(I)) - return + return TRUE return ..() diff --git a/code/game/machinery/navbeacon.dm b/code/game/machinery/navbeacon.dm index c7fe6f3e21118..3283d1d8204f0 100644 --- a/code/game/machinery/navbeacon.dm +++ b/code/game/machinery/navbeacon.dm @@ -70,10 +70,10 @@ /obj/machinery/navbeacon/update_icon() icon_state = "navbeacon[open]" -/obj/machinery/navbeacon/attackby(obj/item/I, mob/user, params) +/obj/machinery/navbeacon/item_interact(obj/item/I, mob/user, params) var/turf/T = loc if(T.intact) - return // prevent intraction when T-scanner revealed + return TRUE // prevent intraction when T-scanner revealed if(I.tool_behaviour == TOOL_SCREWDRIVER) open = !open @@ -81,6 +81,7 @@ user.visible_message("[user] [open ? "opens" : "closes"] the beacon's cover.", "You [open ? "open" : "close"] the beacon's cover.") update_icon() + return TRUE else if (istype(I, /obj/item/card/id) || istype(I, /obj/item/modular_computer/tablet)) if(open) @@ -92,6 +93,7 @@ updateDialog() else to_chat(user, "You must open the cover first!") + return TRUE else return ..() diff --git a/code/game/machinery/newscaster/newscaster_machine.dm b/code/game/machinery/newscaster/newscaster_machine.dm index b779bd9ba2d65..1d2dcb2e7540c 100644 --- a/code/game/machinery/newscaster/newscaster_machine.dm +++ b/code/game/machinery/newscaster/newscaster_machine.dm @@ -513,7 +513,7 @@ return TRUE -/obj/machinery/newscaster/attackby(obj/item/I, mob/living/user, params) +/obj/machinery/newscaster/item_interact(obj/item/I, mob/living/user, params) if(I.tool_behaviour == TOOL_WRENCH) to_chat(user, "You start [anchored ? "un" : ""]securing [name]...") I.play_tool_sound(src) @@ -528,31 +528,33 @@ to_chat(user, "You [anchored ? "un" : ""]secure [name].") new /obj/item/wallframe/newscaster(loc) qdel(src) - else if(I.tool_behaviour == TOOL_WELDER && user.a_intent != INTENT_HARM) + return TRUE + else if(I.tool_behaviour == TOOL_WELDER) if(machine_stat & BROKEN) if(!I.tool_start_check(user, amount=0)) - return + return TRUE user.visible_message("[user] is repairing [src].", \ "You begin repairing [src]...", \ "You hear welding.") if(I.use_tool(src, user, 40, volume=50)) if(!(machine_stat & BROKEN)) - return + return TRUE to_chat(user, "You repair [src].") obj_integrity = max_integrity set_machine_stat(machine_stat & ~BROKEN) update_icon() else to_chat(user, "[src] does not need repairs.") + return TRUE else if(istype(I, /obj/item/paper)) if(!user.temporarilyRemoveItemFromInventory(I)) - return + return TRUE else paper_remaining ++ to_chat(user, "You insert the [I] into \the [src]! It now holds [paper_remaining] sheets of paper.") qdel(I) - return + return TRUE return ..() /obj/machinery/newscaster/play_attack_sound(damage, damage_type = BRUTE, damage_flag = 0) diff --git a/code/game/machinery/newscaster/newspaper.dm b/code/game/machinery/newscaster/newspaper.dm index 29da9452d0122..46b47504f51df 100644 --- a/code/game/machinery/newscaster/newspaper.dm +++ b/code/game/machinery/newscaster/newspaper.dm @@ -158,25 +158,26 @@ I am begging someone to remake this to be more like the paper UI, it's so bad. if(ismob(loc)) attack_self(loc) -/obj/item/newspaper/attackby(obj/item/W, mob/living/user, params) +/obj/item/newspaper/item_interact(obj/item/W, mob/living/user, params) if(burn_paper_product_attackby_check(W, user)) - return + return TRUE if(istype(W, /obj/item/pen)) if(!user.is_literate()) to_chat(user, "You scribble illegibly on [src]!") - return + return TRUE if(scribble_page == curr_page) to_chat(user, "There's already a scribble in this page... You wouldn't want to make things too cluttered, would you?") else var/s = stripped_input(user, "Write something", "Newspaper") if (!s) - return + return TRUE if(!user.canUseTopic(src, BE_CLOSE)) - return + return TRUE scribble_page = curr_page scribble = s attack_self(user) add_fingerprint(user) + return TRUE else return ..() diff --git a/code/game/machinery/pipe/pipe_dispenser.dm b/code/game/machinery/pipe/pipe_dispenser.dm index b56efbce182ca..4bbda5ec2e6ab 100644 --- a/code/game/machinery/pipe/pipe_dispenser.dm +++ b/code/game/machinery/pipe/pipe_dispenser.dm @@ -60,12 +60,12 @@ piping_layer = CLAMP(--piping_layer, PIPING_LAYER_MIN, PIPING_LAYER_MAX) return -/obj/machinery/pipedispenser/attackby(obj/item/W, mob/user, params) +/obj/machinery/pipedispenser/item_interact(obj/item/W, mob/user, params) add_fingerprint(user) if (istype(W, /obj/item/pipe) || istype(W, /obj/item/pipe_meter)) to_chat(usr, "You put [W] back into [src].") qdel(W) - return + return TRUE else return ..() diff --git a/code/game/machinery/porta_turret/portable_turret.dm b/code/game/machinery/porta_turret/portable_turret.dm index 2ac12f34bcc2b..f1d54659b39a5 100644 --- a/code/game/machinery/porta_turret/portable_turret.dm +++ b/code/game/machinery/porta_turret/portable_turret.dm @@ -262,7 +262,7 @@ check_should_process() -/obj/machinery/porta_turret/attackby(obj/item/I, mob/user, params) +/obj/machinery/porta_turret/item_interact(obj/item/I, mob/user, params) if(machine_stat & BROKEN) if(I.tool_behaviour == TOOL_CROWBAR) //If the turret is destroyed, you can remove it with a crowbar to @@ -280,10 +280,11 @@ else to_chat(user, "You remove the turret but did not manage to salvage anything.") qdel(src) + return TRUE else if((I.tool_behaviour == TOOL_WRENCH) && (!on)) if(raised) - return + return TRUE //This code handles moving the turret around. After all, it's a portable turret! if(!anchored && !isinspace()) @@ -300,6 +301,7 @@ power_change() invisibility = 0 qdel(cover) //deletes the cover, and the turret instance itself becomes its own cover. + return TRUE else if(I.GetID()) //Behavior lock/unlock mangement @@ -308,6 +310,7 @@ to_chat(user, "Controls are now [locked ? "locked" : "unlocked"].") else to_chat(user, "Access denied.") + return TRUE else return ..() @@ -887,14 +890,14 @@ DEFINE_BUFFER_HANDLER(/obj/machinery/porta_turret) . += "Ctrl-click [src] to [ enabled ? "disable" : "enable"] turrets.\n"+\ "Alt-click [src] to set turrets to [ lethal ? "stun" : "kill"]." -/obj/machinery/turretid/attackby(obj/item/I, mob/user, params) +/obj/machinery/turretid/item_interact(obj/item/I, mob/user, params) if(machine_stat & BROKEN) - return + return ..() if (issilicon(user)) return attack_hand(user) - if ( get_dist(src, user) == 0 ) // trying to unlock the interface + if (get_dist(src, user) == 0 && I.GetAccess()) // trying to unlock the interface if (allowed(usr)) if(obj_flags & EMAGGED) to_chat(user, "The turret control is unresponsive.") @@ -904,6 +907,8 @@ DEFINE_BUFFER_HANDLER(/obj/machinery/porta_turret) to_chat(user, "You [ locked ? "lock" : "unlock"] the panel.") else to_chat(user, "Access denied.") + return TRUE + return TRUE REGISTER_BUFFER_HANDLER(/obj/machinery/turretid) diff --git a/code/game/machinery/porta_turret/portable_turret_construct.dm b/code/game/machinery/porta_turret/portable_turret_construct.dm index 1c9580239f298..96d8aefd7cd36 100644 --- a/code/game/machinery/porta_turret/portable_turret_construct.dm +++ b/code/game/machinery/porta_turret/portable_turret_construct.dm @@ -19,7 +19,7 @@ var/finish_name = "turret" //the name applied to the product turret var/obj/item/gun/installed_gun = null -/obj/machinery/porta_turret_construct/attackby(obj/item/I, mob/user, params) +/obj/machinery/porta_turret_construct/item_interact(obj/item/I, mob/user, params) //this is a bit unwieldy but self-explanatory switch(build_step) if(PTURRET_UNSECURED) //first step @@ -28,14 +28,14 @@ to_chat(user, "You secure the external bolts.") setAnchored(TRUE) build_step = PTURRET_BOLTED - return + return TRUE else if(I.tool_behaviour == TOOL_CROWBAR && !anchored) I.play_tool_sound(src, 75) to_chat(user, "You dismantle the turret construction.") new /obj/item/stack/sheet/iron( loc, 5) qdel(src) - return + return TRUE if(PTURRET_BOLTED) if(istype(I, /obj/item/stack/sheet/iron)) @@ -46,14 +46,14 @@ icon_state = "turret_frame2" else to_chat(user, "You need two sheets of iron to continue construction!") - return + return TRUE else if(I.tool_behaviour == TOOL_WRENCH) I.play_tool_sound(src, 75) to_chat(user, "You unfasten the external bolts.") setAnchored(FALSE) build_step = PTURRET_UNSECURED - return + return TRUE if(PTURRET_START_INTERNAL_ARMOUR) @@ -61,11 +61,11 @@ I.play_tool_sound(src, 100) to_chat(user, "You bolt the metal armor into place.") build_step = PTURRET_INTERNAL_ARMOUR_ON - return + return TRUE else if(I.tool_behaviour == TOOL_WELDER) if(!I.tool_start_check(user, amount=5)) //uses up 5 fuel - return + return TRUE to_chat(user, "You start to remove the turret's interior metal armor...") @@ -73,18 +73,18 @@ build_step = PTURRET_BOLTED to_chat(user, "You remove the turret's interior metal armor.") new /obj/item/stack/sheet/iron(drop_location(), 2) - return + return TRUE if(PTURRET_INTERNAL_ARMOUR_ON) if(istype(I, /obj/item/gun/energy)) //the gun installation part var/obj/item/gun/energy/E = I if(!user.transferItemToLoc(E, src)) - return + return TRUE installed_gun = E to_chat(user, "You add [I] to the turret.") build_step = PTURRET_GUN_EQUIPPED - return + return TRUE else if(I.tool_behaviour == TOOL_WRENCH) I.play_tool_sound(src, 100) @@ -96,10 +96,10 @@ if(isprox(I)) build_step = PTURRET_SENSORS_ON if(!user.temporarilyRemoveItemFromInventory(I)) - return + return TRUE to_chat(user, "You add the proximity sensor to the turret.") qdel(I) - return + return TRUE if(PTURRET_SENSORS_ON) @@ -107,7 +107,7 @@ I.play_tool_sound(src, 100) build_step = PTURRET_CLOSED to_chat(user, "You close the internal access hatch.") - return + return TRUE if(PTURRET_CLOSED) @@ -118,18 +118,18 @@ build_step = PTURRET_START_EXTERNAL_ARMOUR else to_chat(user, "You need two sheets of iron to continue construction!") - return + return TRUE else if(I.tool_behaviour == TOOL_SCREWDRIVER) I.play_tool_sound(src, 100) build_step = PTURRET_SENSORS_ON to_chat(user, "You open the internal access hatch.") - return + return TRUE if(PTURRET_START_EXTERNAL_ARMOUR) if(I.tool_behaviour == TOOL_WELDER) if(!I.tool_start_check(user, amount=5)) - return + return TRUE to_chat(user, "You begin to weld the turret's armor down...") if(I.use_tool(src, user, 30, volume=50, amount=5)) @@ -154,17 +154,17 @@ to_chat(user, "You pry off the turret's exterior armor.") new /obj/item/stack/sheet/iron(loc, 2) build_step = PTURRET_CLOSED - return + return TRUE if(istype(I, /obj/item/pen)) //you can rename turrets like bots! var/t = stripped_input(user, "Enter new turret name", name, finish_name) if(!t) - return + return TRUE if(!Adjacent(user)) - return + return TRUE finish_name = t - return + return TRUE return ..() diff --git a/code/game/machinery/porta_turret/portable_turret_cover.dm b/code/game/machinery/porta_turret/portable_turret_cover.dm index 99db226937df2..094e7ae78316b 100644 --- a/code/game/machinery/porta_turret/portable_turret_cover.dm +++ b/code/game/machinery/porta_turret/portable_turret_cover.dm @@ -39,10 +39,10 @@ return parent_turret.attack_hand(user) -/obj/machinery/porta_turret_cover/attackby(obj/item/I, mob/user, params) +/obj/machinery/porta_turret_cover/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_WRENCH && !parent_turret.on) if(parent_turret.raised) - return + return TRUE if(!parent_turret.anchored) parent_turret.setAnchored(TRUE) @@ -55,6 +55,7 @@ parent_turret.invisibility = INVISIBILITY_MAXIMUM parent_turret.update_icon() qdel(src) + return TRUE else if(I.GetID()) if(parent_turret.allowed(user)) @@ -63,6 +64,7 @@ updateUsrDialog() else to_chat(user, "Access denied.") + return TRUE else return ..() @@ -74,8 +76,8 @@ DEFINE_BUFFER_HANDLER(/obj/machinery/porta_turret_cover) return COMPONENT_BUFFER_RECIEVED return NONE -/obj/machinery/porta_turret_cover/attacked_by(obj/item/I, mob/user) - parent_turret.attacked_by(I, user) +/obj/machinery/porta_turret_cover/on_attacked(obj/item/I, mob/user) + parent_turret.on_attacked(I, user) /obj/machinery/porta_turret_cover/attack_alien(mob/living/carbon/alien/humanoid/user) parent_turret.attack_alien(user) diff --git a/code/game/machinery/quantum_pad.dm b/code/game/machinery/quantum_pad.dm index 301dcd373b71a..1f3c6ddf9ffa1 100644 --- a/code/game/machinery/quantum_pad.dm +++ b/code/game/machinery/quantum_pad.dm @@ -56,15 +56,15 @@ teleport_cooldown = initial(teleport_cooldown) teleport_cooldown -= (E * 100) -/obj/machinery/quantumpad/attackby(obj/item/I, mob/user, params) +/obj/machinery/quantumpad/item_interact(obj/item/I, mob/user, params) if(default_deconstruction_screwdriver(user, "pad-idle-o", "qpad-idle", I)) - return + return TRUE else if(panel_open && I.tool_behaviour == TOOL_WIRECUTTER) wires.interact(user) return TRUE if(panel_open) - return + return TRUE if(istype(I, /obj/item/quantum_keycard)) var/obj/item/quantum_keycard/K = I @@ -76,9 +76,10 @@ if(do_after(user, 40, target = src)) to_chat(user, "You complete the link between [K] and [src].") K.qpad = src + return TRUE if(default_deconstruction_crowbar(I)) - return + return TRUE return ..() diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm index 3c0ea2cb89659..ee7cce3bcc452 100755 --- a/code/game/machinery/recharger.dm +++ b/code/game/machinery/recharger.dm @@ -54,51 +54,51 @@ use_power = IDLE_POWER_USE update_icon() -/obj/machinery/recharger/attackby(obj/item/G, mob/user, params) +/obj/machinery/recharger/item_interact(obj/item/G, mob/user, params) if(G.tool_behaviour == TOOL_WRENCH) if(charging) to_chat(user, "Remove the charging item first!") - return + return TRUE setAnchored(!anchored) power_change() to_chat(user, "You [anchored ? "attached" : "detached"] [src].") G.play_tool_sound(src) - return + return TRUE var/allowed = is_type_in_typecache(G, allowed_devices) if(allowed) if(anchored) if(charging || panel_open) - return 1 + return TRUE //Checks to make sure he's not in space doing it, and that the area got proper power. var/area/a = get_area(src) if(!isarea(a) || a.power_equip == 0) to_chat(user, "[src] blinks red as you try to insert [G].") - return 1 + return TRUE if (istype(G, /obj/item/gun/energy)) var/obj/item/gun/energy/E = G if(!E.can_charge) to_chat(user, "Your gun has no external power connector.") - return 1 + return TRUE if(!user.transferItemToLoc(G, src)) - return 1 + return TRUE setCharging(G) else to_chat(user, "[src] isn't connected to anything!") - return 1 + return TRUE if(anchored && !charging) if(default_deconstruction_screwdriver(user, "rechargeropen", "recharger0", G)) - return + return TRUE if(panel_open && G.tool_behaviour == TOOL_CROWBAR) default_deconstruction_crowbar(G) - return + return TRUE return ..() diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm index 63fd310824d59..74ae7e422610d 100644 --- a/code/game/machinery/rechargestation.dm +++ b/code/game/machinery/rechargestation.dm @@ -55,16 +55,16 @@ if (!(. & EMP_PROTECT_SELF)) open_machine() -/obj/machinery/recharge_station/attackby(obj/item/P, mob/user, params) +/obj/machinery/recharge_station/item_interact(obj/item/P, mob/user, params) if(state_open) if(default_deconstruction_screwdriver(user, "borgdecon2", "borgcharger0", P)) - return + return TRUE if(default_pry_open(P)) - return + return TRUE if(default_deconstruction_crowbar(P)) - return + return TRUE return ..() /obj/machinery/recharge_station/interact(mob/user) diff --git a/code/game/machinery/recycler.dm b/code/game/machinery/recycler.dm index ed37f71deb0e0..bafea7d210302 100644 --- a/code/game/machinery/recycler.dm +++ b/code/game/machinery/recycler.dm @@ -54,18 +54,18 @@ update_icon() -/obj/machinery/recycler/attackby(obj/item/I, mob/user, params) +/obj/machinery/recycler/item_interact(obj/item/I, mob/user, params) if(default_deconstruction_screwdriver(user, "grinder-oOpen", "grinder-o0", I)) - return + return TRUE if(default_pry_open(I)) - return + return TRUE if(default_unfasten_wrench(user, I)) - return + return TRUE if(default_deconstruction_crowbar(I)) - return + return TRUE return ..() /obj/machinery/recycler/on_emag(mob/user) @@ -192,7 +192,8 @@ // Instantly lie down, also go unconscious from the pain, before you die. L.Unconscious(100) - L.adjustBruteLoss(crush_damage) + var/datum/damage_source/crush/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(L, BRUTE, crush_damage, null) L.log_message("has been crushed by a recycler that was emagged by [(emagged_by || "nobody")]", LOG_ATTACK, color="red") if(L.stat == DEAD && (L.butcher_results || L.guaranteed_butcher_results)) var/datum/component/butchering/butchering = GetComponent(/datum/component/butchering) diff --git a/code/game/machinery/requests_console.dm b/code/game/machinery/requests_console.dm index 90e7a4d9e230a..42450e0efbe47 100644 --- a/code/game/machinery/requests_console.dm +++ b/code/game/machinery/requests_console.dm @@ -414,7 +414,7 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) Radio.set_frequency(radio_freq) Radio.talk_into(src, "[alert]: [message]", radio_freq) -/obj/machinery/requests_console/attackby(obj/item/O, mob/user, params) +/obj/machinery/requests_console/item_interact(obj/item/O, mob/user, params) if(O.tool_behaviour == TOOL_CROWBAR) if(open) to_chat(user, "You close the maintenance panel.") @@ -423,7 +423,7 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) to_chat(user, "You open the maintenance panel.") open = TRUE update_icon() - return + return TRUE if(O.tool_behaviour == TOOL_SCREWDRIVER) if(open) hackState = !hackState @@ -434,7 +434,7 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) update_icon() else to_chat(user, "You must open the maintenance panel first!") - return + return TRUE var/obj/item/card/id/ID = O.GetID() @@ -451,13 +451,13 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) announceAuth = FALSE to_chat(user, "You are not authorized to send announcements!") updateUsrDialog() - return + return TRUE if (istype(O, /obj/item/stamp)) if(screen == REQ_SCREEN_AUTHENTICATE) var/obj/item/stamp/T = O msgStamped = "Stamped with the [T.name]" updateUsrDialog() - return + return TRUE return ..() #undef REQ_EMERGENCY_SECURITY diff --git a/code/game/machinery/scan_gate.dm b/code/game/machinery/scan_gate.dm index a4ba6c4804d44..96157c71c6af2 100644 --- a/code/game/machinery/scan_gate.dm +++ b/code/game/machinery/scan_gate.dm @@ -70,7 +70,7 @@ if(duration) scanline_timer = addtimer(CALLBACK(src, PROC_REF(set_scanline), "passive"), duration, TIMER_STOPPABLE) -/obj/machinery/scanner_gate/attackby(obj/item/W, mob/user, params) +/obj/machinery/scanner_gate/item_interact(obj/item/W, mob/user, params) var/obj/item/card/id/card = W.GetID() if(card) if(locked) @@ -89,6 +89,7 @@ ui_update() else to_chat(user, "You try to lock [src] with [W], but nothing happens.") + return TRUE else return ..() diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index 31c48463f1326..cec4a9e87564a 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -147,7 +147,7 @@ to_chat(user, "The device must first be secured to the floor!") return -/obj/machinery/shieldgen/attackby(obj/item/W, mob/user, params) +/obj/machinery/shieldgen/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_SCREWDRIVER) W.play_tool_sound(src, 100) panel_open = !panel_open @@ -155,6 +155,7 @@ to_chat(user, "You open the panel and expose the wiring.") else to_chat(user, "You close the panel.") + return TRUE else if(istype(W, /obj/item/stack/cable_coil) && (machine_stat & BROKEN) && panel_open) var/obj/item/stack/cable_coil/coil = W if (coil.get_amount() < 1) @@ -169,6 +170,7 @@ set_machine_stat(machine_stat & ~BROKEN) to_chat(user, "You repair \the [src].") update_icon() + return TRUE else if(W.tool_behaviour == TOOL_WRENCH) if(locked) @@ -185,6 +187,7 @@ to_chat(user, "\The [src] shuts off!") shields_down() setAnchored(FALSE) + return TRUE else if(W.GetID()) if(allowed(user) && !(obj_flags & EMAGGED)) @@ -194,6 +197,7 @@ to_chat(user, "Error, access controller damaged!") else to_chat(user, "Access denied.") + return TRUE else return ..() @@ -351,9 +355,10 @@ return FAILED_UNFASTEN return ..() -/obj/machinery/shieldwallgen/attackby(obj/item/W, mob/user, params) +/obj/machinery/shieldwallgen/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_WRENCH) default_unfasten_wrench(user, W, 0) + return TRUE else if(W.GetID()) if(allowed(user) && !(obj_flags & EMAGGED)) @@ -363,6 +368,7 @@ to_chat(user, "Error, access controller damaged!") else to_chat(user, "Access denied.") + return TRUE else add_fingerprint(user) diff --git a/code/game/machinery/shuttle/custom_shuttle.dm b/code/game/machinery/shuttle/custom_shuttle.dm index 9bf721b80c83b..b3cb213cf275b 100644 --- a/code/game/machinery/shuttle/custom_shuttle.dm +++ b/code/game/machinery/shuttle/custom_shuttle.dm @@ -20,14 +20,14 @@ . = ..() GLOB.custom_shuttle_machines -= src -/obj/machinery/shuttle/attackby(obj/item/I, mob/living/user, params) +/obj/machinery/shuttle/item_interact(obj/item/I, mob/living/user, params) if(default_deconstruction_screwdriver(user, icon_state_open, icon_state_closed, I)) - return + return TRUE if(default_pry_open(I)) - return + return TRUE if(panel_open) if(default_change_direction_wrench(user, I)) - return + return TRUE if(default_deconstruction_crowbar(I)) - return + return TRUE return ..() diff --git a/code/game/machinery/shuttle/shuttle_engine.dm b/code/game/machinery/shuttle/shuttle_engine.dm index 262c26e1111c3..b0149dd9e7185 100644 --- a/code/game/machinery/shuttle/shuttle_engine.dm +++ b/code/game/machinery/shuttle/shuttle_engine.dm @@ -126,15 +126,15 @@ env.set_temperature(env.return_temperature() + deltaTemperature) air_update_turf() -/obj/machinery/shuttle/engine/attackby(obj/item/I, mob/living/user, params) +/obj/machinery/shuttle/engine/item_interact(obj/item/I, mob/living/user, params) check_setup() if(default_deconstruction_screwdriver(user, icon_state_open, icon_state_closed, I)) - return + return TRUE if(default_pry_open(I)) - return + return TRUE if(panel_open) if(default_change_direction_wrench(user, I)) - return + return TRUE if(default_deconstruction_crowbar(I)) - return + return TRUE return ..() diff --git a/code/game/machinery/shuttle/shuttle_heater.dm b/code/game/machinery/shuttle/shuttle_heater.dm index 1420165f4e4d7..80aee5fddaa0f 100644 --- a/code/game/machinery/shuttle/shuttle_heater.dm +++ b/code/game/machinery/shuttle/shuttle_heater.dm @@ -103,17 +103,17 @@ air_contents.remove(amount) return -/obj/machinery/atmospherics/components/unary/shuttle/heater/attackby(obj/item/I, mob/living/user, params) +/obj/machinery/atmospherics/components/unary/shuttle/heater/item_interact(obj/item/I, mob/living/user, params) update_adjacent_engines() if(default_deconstruction_screwdriver(user, icon_state_open, icon_state_closed, I)) - return + return TRUE if(default_pry_open(I)) - return + return TRUE if(panel_open) if(default_change_direction_wrench(user, I)) - return + return TRUE if(default_deconstruction_crowbar(I)) - return + return TRUE return ..() /obj/machinery/atmospherics/components/unary/shuttle/heater/proc/update_adjacent_engines() diff --git a/code/game/machinery/sleeper.dm b/code/game/machinery/sleeper.dm index 33d367711745e..947db195734ae 100644 --- a/code/game/machinery/sleeper.dm +++ b/code/game/machinery/sleeper.dm @@ -101,20 +101,19 @@ . = ..() icon_state = "[initial(icon_state)][state_open ? "-open" : ""]" -/obj/machinery/sleeper/attackby(obj/item/I, mob/living/user, params) +/obj/machinery/sleeper/item_interact(obj/item/I, mob/living/user, params) if ((istype(I, /obj/item/reagent_containers/glass) \ - || istype(I, /obj/item/reagent_containers/chem_bag)) \ - && user.a_intent != INTENT_HARM) + || istype(I, /obj/item/reagent_containers/chem_bag))) if (length(inserted_vials) >= max_vials) to_chat(user, "[src] cannot hold any more!") - return + return TRUE user.visible_message("[user] inserts \the [I] into \the [src]", "You insert \the [I] into \the [src]") user.temporarilyRemoveItemFromInventory(I) I.forceMove(null) inserted_vials += I ui_update() - return - . = ..() + return TRUE + return ..() /obj/machinery/sleeper/on_deconstruction() for(var/atom/movable/A as anything in inserted_vials) diff --git a/code/game/machinery/slotmachine.dm b/code/game/machinery/slotmachine.dm index e9df19e49dab5..f3958f3a1da48 100644 --- a/code/game/machinery/slotmachine.dm +++ b/code/game/machinery/slotmachine.dm @@ -82,7 +82,7 @@ ..() update_icon() -/obj/machinery/computer/slot_machine/attackby(obj/item/I, mob/living/user, params) +/obj/machinery/computer/slot_machine/item_interact(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/coin)) var/obj/item/coin/C = I if(paymode == COIN) @@ -102,6 +102,7 @@ qdel(C) else to_chat(user, "This machine is only accepting holochips!") + return TRUE else if(istype(I, /obj/item/holochip)) if(paymode == HOLOCHIP) var/obj/item/holochip/H = I @@ -112,6 +113,7 @@ qdel(H) else to_chat(user, "This machine is only accepting coins!") + return TRUE else if(I.tool_behaviour == TOOL_MULTITOOL) if(balance > 0) visible_message("[src] says, 'ERROR! Please empty the machine balance before altering paymode'") //Prevents converting coins into holocredits and vice versa @@ -122,6 +124,7 @@ else paymode = HOLOCHIP visible_message("[src] says, 'This machine now works with HOLOCHIPS!'") + return TRUE else return ..() diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm index 8a3e6229a0300..7395425ef05d3 100644 --- a/code/game/machinery/spaceheater.dm +++ b/code/game/machinery/spaceheater.dm @@ -158,7 +158,7 @@ default_unfasten_wrench(user, tool) return TOOL_ACT_TOOLTYPE_SUCCESS -/obj/machinery/space_heater/attackby(obj/item/I, mob/user, params) +/obj/machinery/space_heater/item_interact(obj/item/I, mob/user, params) add_fingerprint(user) if(default_deconstruction_screwdriver(user, icon_state, icon_state, I)) @@ -172,12 +172,12 @@ if(istype(I, /obj/item/stock_parts/cell)) if(!panel_open) balloon_alert(user, "Hatch must be open!") - return + return TRUE if(cell) balloon_alert(user, "Already a power cell inside!") - return + return TRUE if(!user.transferItemToLoc(I, src)) - return + return TRUE cell = I I.add_fingerprint(usr) user.visible_message("\The [user] inserts a power cell into \the [src].", "You insert the power cell into \the [src].") diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index 1dc7ca419c1cb..7151443899576 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -386,72 +386,73 @@ add_fingerprint(user) -/obj/machinery/suit_storage_unit/attackby(obj/item/I, mob/user, params) +/obj/machinery/suit_storage_unit/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_CROWBAR && user.a_intent == INTENT_HARM && !panel_open && machine_stat & NOPOWER) if(locked) to_chat(user, "[src]'s door won't budge!") - return + return TRUE if(!state_open) visible_message("[user] starts prying open the doors of [src]!", "You start prying open the doors of [src]!") I.play_tool_sound(src, 50) if(do_after(user, 20, target=src)) playsound(src, 'sound/effects/bin_open.ogg', 50, TRUE) open_machine(0) - return + return TRUE + return TRUE else I.play_tool_sound(src, 50) visible_message("[user] pulls out the contents of [src] outside!", "You pull [src]'s contents outside!") dump_contents() update_icon() - return + return TRUE if(state_open && is_operational) if(istype(I, /obj/item/clothing/suit)) if(suit) to_chat(user, "The unit already contains a suit!") - return + return TRUE if(!user.transferItemToLoc(I, src)) - return + return TRUE suit = I else if(istype(I, /obj/item/clothing/head)) if(helmet) to_chat(user, "The unit already contains a helmet!") - return + return TRUE if(!user.transferItemToLoc(I, src)) - return + return TRUE helmet = I else if(istype(I, /obj/item/clothing/mask)) if(mask) to_chat(user, "The unit already contains a mask!") - return + return TRUE if(!user.transferItemToLoc(I, src)) - return + return TRUE mask = I else if(storage) to_chat(user, "The auxiliary storage compartment is full!") - return + return TRUE if(!user.transferItemToLoc(I, src)) - return + return TRUE storage = I visible_message("[user] inserts [I] into [src]", "You load [I] into [src].") update_icon() ui_update() - return + return TRUE if(panel_open && is_wire_tool(I)) wires.interact(user) - return + return TRUE if(!state_open) if(default_deconstruction_screwdriver(user, "panel", "close", I)) ui_update() // Wires might've changed availability of decontaminate button - return + return TRUE if(is_empty()) if(default_deconstruction_crowbar(I)) - return + return TRUE if(default_pry_open(I)) dump_contents() - return + return TRUE return ..() diff --git a/code/game/machinery/syndicatebeacon.dm b/code/game/machinery/syndicatebeacon.dm index 7475dfece0258..e71ef071ef2cd 100644 --- a/code/game/machinery/syndicatebeacon.dm +++ b/code/game/machinery/syndicatebeacon.dm @@ -55,28 +55,29 @@ else to_chat(user, "You need to screw \the [src] to the floor first!") -/obj/machinery/power/singularity_beacon/attackby(obj/item/W, mob/user, params) +/obj/machinery/power/singularity_beacon/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_WRENCH) if(active) to_chat(user, "You need to deactivate \the [src] first!") - return + return TRUE if(anchored) setAnchored(FALSE) to_chat(user, "You unbolt \the [src] from the floor and detach it from the cable.") disconnect_from_network() - return + return TRUE else if(!connect_to_network()) to_chat(user, "\The [src] must be placed over an exposed, powered cable node!") - return + return TRUE setAnchored(TRUE) to_chat(user, "You bolt \the [src] to the floor and attach it to the cable.") - return + return TRUE else if(W.tool_behaviour == TOOL_SCREWDRIVER) user.visible_message( \ "[user] messes with \the [src] for a bit.", \ "You can't fit the screwdriver into \the [src]'s bolts! Try using a wrench.") + return TRUE else return ..() diff --git a/code/game/machinery/syndicatebomb.dm b/code/game/machinery/syndicatebomb.dm index 9823acd3d2360..88ede23a55fb1 100644 --- a/code/game/machinery/syndicatebomb.dm +++ b/code/game/machinery/syndicatebomb.dm @@ -121,7 +121,7 @@ else . = timer_set -/obj/machinery/syndicatebomb/attackby(obj/item/I, mob/user, params) +/obj/machinery/syndicatebomb/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_WRENCH && can_unanchor) if(!anchored) if(!isturf(loc) || isspaceturf(loc)) @@ -132,6 +132,7 @@ setAnchored(TRUE) if(active) to_chat(user, "The bolts lock in place.") + return TRUE else if(!active) to_chat(user, "You wrench the bomb from the floor.") @@ -139,14 +140,17 @@ setAnchored(FALSE) else to_chat(user, "The bolts are locked down!") + return TRUE else if(I.tool_behaviour == TOOL_SCREWDRIVER) open_panel = !open_panel update_icon() to_chat(user, "You [open_panel ? "open" : "close"] the wire panel.") + return TRUE else if(is_wire_tool(I) && open_panel) wires.interact(user) + return TRUE else if(I.tool_behaviour == TOOL_CROWBAR) if(open_panel && wires.is_all_cut()) @@ -163,6 +167,7 @@ to_chat(user, "The wires connecting the shell to the explosives are holding it down!") else to_chat(user, "The cover is screwed on, it won't pry off!") + return TRUE else if(istype(I, /obj/item/bombcore) || istype(I, /obj/item/transfer_valve)) if(!payload) if(!user.transferItemToLoc(I, src)) @@ -174,30 +179,34 @@ to_chat(user, "You place [payload] into [src].") else to_chat(user, "[payload] is already loaded into [src]! You'll have to remove it first.") + return TRUE else if(I.tool_behaviour == TOOL_WELDER) if(payload || !wires.is_all_cut() || !open_panel) - return + return TRUE if(!I.tool_start_check(user, amount=5)) //uses up 5 fuel - return + return TRUE to_chat(user, "You start to cut [src] apart...") if(I.use_tool(src, user, 20, volume=50, amount=5)) //uses up 5 fuel to_chat(user, "You cut [src] apart.") new /obj/item/stack/sheet/plasteel( loc, 5) qdel(src) + return TRUE else if(istype(I, /obj/item/stack/sheet/plasteel)) var/obj/item/stack/sheet/stack_sheets = I if(stack_sheets.amount < PLASTEEL_REPAIR_AMOUNT) to_chat(user, "You need at least [PLASTEEL_REPAIR_AMOUNT] sheets of plasteel to repair [src].") - return + return TRUE if(do_after(user, delay = 2.5 SECONDS, target = src) && stack_sheets.use(PLASTEEL_REPAIR_AMOUNT)) obj_integrity = min(obj_integrity + 100, max_integrity) + return TRUE else var/old_integ = obj_integrity . = ..() if((old_integ > obj_integrity) && active && (payload in src)) to_chat(user, "That seems like a really bad idea...") + return TRUE /obj/machinery/syndicatebomb/interact(mob/user) wires.interact(user) @@ -467,23 +476,23 @@ qdel(loc) qdel(src) -/obj/item/bombcore/chemical/attackby(obj/item/I, mob/user, params) +/obj/item/bombcore/chemical/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_CROWBAR && beakers.len > 0) I.play_tool_sound(src) for (var/obj/item/B in beakers) B.forceMove(drop_location()) beakers -= B - return + return TRUE else if(istype(I, /obj/item/reagent_containers/glass/beaker) || istype(I, /obj/item/reagent_containers/glass/bottle)) if(beakers.len < max_beakers) if(!user.transferItemToLoc(I, src)) - return + return TRUE beakers += I to_chat(user, "You load [src] with [I].") else to_chat(user, "[I] won't fit! \The [src] can only hold up to [max_beakers] containers.") - return - ..() + return TRUE + return ..() /obj/item/bombcore/chemical/CheckParts(list/parts_list) ..() diff --git a/code/game/machinery/telecomms/computers/logbrowser.dm b/code/game/machinery/telecomms/computers/logbrowser.dm index 59485079462df..7d74689bd8ad2 100644 --- a/code/game/machinery/telecomms/computers/logbrowser.dm +++ b/code/game/machinery/telecomms/computers/logbrowser.dm @@ -210,6 +210,6 @@ updateUsrDialog() return -/obj/machinery/computer/telecomms/server/attackby() +/obj/machinery/computer/telecomms/server/item_interact() . = ..() updateUsrDialog() diff --git a/code/game/machinery/telecomms/computers/message.dm b/code/game/machinery/telecomms/computers/message.dm index 889b46adbfcc5..b336dfba9213d 100644 --- a/code/game/machinery/telecomms/computers/message.dm +++ b/code/game/machinery/telecomms/computers/message.dm @@ -13,10 +13,11 @@ /// If the console is currently being hacked by a silicon var/hacking = FALSE -/obj/machinery/computer/message_monitor/attackby(obj/item/O, mob/living/user, params) +/obj/machinery/computer/message_monitor/item_interact(obj/item/O, mob/living/user, params) if(O.tool_behaviour == TOOL_SCREWDRIVER && (obj_flags & EMAGGED)) //Stops people from just unscrewing the monitor and putting it back to get the console working again. to_chat(user, "It is too hot to mess with!") + return TRUE else return ..() diff --git a/code/game/machinery/telecomms/computers/telemonitor.dm b/code/game/machinery/telecomms/computers/telemonitor.dm index 048bd813e8bcb..fdb2daaa76286 100644 --- a/code/game/machinery/telecomms/computers/telemonitor.dm +++ b/code/game/machinery/telecomms/computers/telemonitor.dm @@ -121,6 +121,6 @@ updateUsrDialog() return -/obj/machinery/computer/telecomms/monitor/attackby() +/obj/machinery/computer/telecomms/monitor/item_interact() . = ..() updateUsrDialog() diff --git a/code/game/machinery/telecomms/machine_interactions.dm b/code/game/machinery/telecomms/machine_interactions.dm index cd0f1fd32a5a5..b3f38a1ac3bce 100644 --- a/code/game/machinery/telecomms/machine_interactions.dm +++ b/code/game/machinery/telecomms/machine_interactions.dm @@ -10,7 +10,7 @@ var/tempfreq = FREQ_COMMON emp_disable_time = 5 MINUTES -/obj/machinery/telecomms/attackby(obj/item/P, mob/user, params) +/obj/machinery/telecomms/item_interact(obj/item/P, mob/user, params) var/icon_closed = initial(icon_state) var/icon_open = "[initial(icon_state)]_o" @@ -19,13 +19,14 @@ icon_open = "[initial(icon_state)]_o_off" if(default_deconstruction_screwdriver(user, icon_open, icon_closed, P)) - return + return TRUE // Using a multitool lets you access the receiver's interface else if(P.tool_behaviour == TOOL_MULTITOOL) attack_hand(user) + return TRUE else if(default_deconstruction_crowbar(P)) - return + return TRUE else return ..() diff --git a/code/game/machinery/telecomms/machines/allinone.dm b/code/game/machinery/telecomms/machines/allinone.dm index 150227c820820..f4901776bf2a7 100644 --- a/code/game/machinery/telecomms/machines/allinone.dm +++ b/code/game/machinery/telecomms/machines/allinone.dm @@ -39,9 +39,10 @@ sleep(signal.data["slow"]) // simulate the network lag if necessary signal.broadcast() -/obj/machinery/telecomms/allinone/attackby(obj/item/P, mob/user, params) +/obj/machinery/telecomms/allinone/item_interact(obj/item/P, mob/user, params) if(P.tool_behaviour == TOOL_MULTITOOL) return attack_hand(user) + return ..() /obj/machinery/telecomms/allinone/exploration name = "exploration mainframe" diff --git a/code/game/machinery/telecomms/machines/message_server.dm b/code/game/machinery/telecomms/machines/message_server.dm index 5f7003e346d4d..780d65653c946 100644 --- a/code/game/machinery/telecomms/machines/message_server.dm +++ b/code/game/machinery/telecomms/machines/message_server.dm @@ -32,17 +32,18 @@ else to_chat(user, "It seems that the blackbox is missing...") -/obj/machinery/blackbox_recorder/attackby(obj/item/I, mob/living/user, params) - . = ..() +/obj/machinery/blackbox_recorder/item_interact(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/blackbox)) if(HAS_TRAIT(I, TRAIT_NODROP) || !user.transferItemToLoc(I, src)) to_chat(user, "[I] is stuck to your hand!") - return + return TRUE user.visible_message("[user] clicks [I] into [src]!", \ "You press the device into [src], and it clicks into place. The tapes begin spinning again.") playsound(src, 'sound/machines/click.ogg', 50, TRUE) stored = I update_icon() + return TRUE + return ..() /obj/machinery/blackbox_recorder/Destroy() if(stored) diff --git a/code/game/machinery/telecomms/machines/relay.dm b/code/game/machinery/telecomms/machines/relay.dm index ddee3b3ad8b39..1238c4fdd1bbb 100644 --- a/code/game/machinery/telecomms/machines/relay.dm +++ b/code/game/machinery/telecomms/machines/relay.dm @@ -80,7 +80,7 @@ icon_state = "relay" broadcasting = FALSE //It only receives -/obj/machinery/telecomms/relay/preset/reebe/attackby(obj/item/P, mob/user, params) +/obj/machinery/telecomms/relay/preset/reebe/item_interact(obj/item/P, mob/user, params) if(istype(P, /obj/item/encryptionkey) || P.tool_behaviour == TOOL_SCREWDRIVER) if(GLOB.clockcult_eminence) var/mob/living/simple_animal/eminence/eminence = GLOB.clockcult_eminence @@ -88,6 +88,7 @@ for(var/i in E.channels) E.channels[i] = 1 eminence.internal_radio.attackby(E, user, params) + return TRUE . = ..() //Generic preset relay diff --git a/code/game/machinery/teleporter.dm b/code/game/machinery/teleporter.dm index 8ad946230f73c..eabdf4002db7b 100644 --- a/code/game/machinery/teleporter.dm +++ b/code/game/machinery/teleporter.dm @@ -54,14 +54,14 @@ if(is_ready()) teleport(AM) -/obj/machinery/teleport/hub/attackby(obj/item/W, mob/user, params) +/obj/machinery/teleport/hub/item_interact(obj/item/W, mob/user, params) if(default_deconstruction_screwdriver(user, "tele-o", "tele0", W)) if(power_station?.engaged) power_station.engaged = 0 //hub with panel open is off, so the station must be informed. update_icon() - return + return TRUE if(default_deconstruction_crowbar(W)) - return + return TRUE return ..() /obj/machinery/teleport/hub/proc/teleport(atom/movable/M as mob|obj, turf/T) @@ -170,19 +170,19 @@ teleporter_console = null return ..() -/obj/machinery/teleport/station/attackby(obj/item/W, mob/user, params) +/obj/machinery/teleport/station/item_interact(obj/item/W, mob/user, params) if(default_deconstruction_screwdriver(user, "controller-o", "controller", W)) update_icon() - return + return TRUE else if(default_deconstruction_crowbar(W)) - return + return TRUE else if(W.tool_behaviour == TOOL_WIRECUTTER) if(panel_open) link_console_and_hub() to_chat(user, "You reconnect the station to nearby machinery.") - return + return TRUE else return ..() diff --git a/code/game/machinery/transformer.dm b/code/game/machinery/transformer.dm index cf84dda76e736..f37e3a7717ba9 100644 --- a/code/game/machinery/transformer.dm +++ b/code/game/machinery/transformer.dm @@ -89,7 +89,8 @@ playsound(src.loc, 'sound/items/welder.ogg', 50, 1) H.emote("scream") // It is painful - H.adjustBruteLoss(max(0, 80 - H.getBruteLoss())) // Hurt the human, don't try to kill them though. + var/datum/damage_source/sharp/incision/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(H, BRUTE, max(0, 80 - H.getBruteLoss(), null)) // Hurt the human, don't try to kill them though. // Sleep for a couple of ticks to allow the human to see the pain sleep(5) diff --git a/code/game/machinery/washing_machine.dm b/code/game/machinery/washing_machine.dm index c85426593c0cf..15705a0cd8c47 100644 --- a/code/game/machinery/washing_machine.dm +++ b/code/game/machinery/washing_machine.dm @@ -276,13 +276,13 @@ GLOBAL_LIST_INIT(dye_registry, list( if(panel_open) add_overlay("wm_panel") -/obj/machinery/washing_machine/attackby(obj/item/W, mob/user, params) +/obj/machinery/washing_machine/item_interact(obj/item/W, mob/user, params) if(panel_open && !busy && default_unfasten_wrench(user, W)) - return + return TRUE if(default_deconstruction_screwdriver(user, null, null, W)) update_icon() - return + return TRUE else if(user.a_intent != INTENT_HARM) @@ -305,6 +305,7 @@ GLOBAL_LIST_INIT(dye_registry, list( if(W.dye_color) color_source = W update_icon() + return TRUE else return ..() diff --git a/code/game/mecha/combat/durand.dm b/code/game/mecha/combat/durand.dm index aabac69c0b42d..66ebc5c4cca17 100644 --- a/code/game/mecha/combat/durand.dm +++ b/code/game/mecha/combat/durand.dm @@ -110,12 +110,14 @@ Expects a turf. Returns true if the attack should be blocked, false if not.*/ else . = ..() -/obj/mecha/combat/durand/attackby(obj/item/W as obj, mob/user as mob, params) +/// BACONTODO: Convertme! +/obj/mecha/combat/durand/item_interact(obj/item/W as obj, mob/user as mob, params) if(defense_check(user.loc)) log_message("Attack absorbed by defense field. Attacker - [user], with [W]", LOG_MECHA, color="orange") shield.attackby(W, user, params) + return TRUE else - . = ..() + return ..() /obj/mecha/combat/durand/hitby(atom/movable/AM, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum) if(defense_check(AM.loc)) diff --git a/code/game/mecha/equipment/tools/mining_tools.dm b/code/game/mecha/equipment/tools/mining_tools.dm index ccbc3991466fb..672930d5d8bb4 100644 --- a/code/game/mecha/equipment/tools/mining_tools.dm +++ b/code/game/mecha/equipment/tools/mining_tools.dm @@ -125,7 +125,7 @@ else //drill makes a hole var/obj/item/bodypart/target_part = target.get_bodypart(ran_zone(BODY_ZONE_CHEST)) - target.apply_damage(10, BRUTE, BODY_ZONE_CHEST, target.run_armor_check(target_part, MELEE)) + target.apply_damage(/datum/damage_source/drill, /datum/damage/brute, 10, BODY_ZONE_CHEST) //blood splatters and sparks if(issilicon(target) || isbot(target) || isswarmer(target) || !IS_ORGANIC_LIMB(target_part)) diff --git a/code/game/mecha/equipment/tools/other_tools.dm b/code/game/mecha/equipment/tools/other_tools.dm index 5343bdd20c9cf..ca0173803f4f7 100644 --- a/code/game/mecha/equipment/tools/other_tools.dm +++ b/code/game/mecha/equipment/tools/other_tools.dm @@ -411,16 +411,16 @@ fuel.amount += units P.use(units) occupant_message("[units] unit\s of [fuel] successfully loaded.") - return units + return TRUE else occupant_message("Unit is full.") - return 0 - else - occupant_message("[fuel] traces in target minimal! [P] cannot be used as fuel.") - return + return TRUE + return FALSE -/obj/item/mecha_parts/mecha_equipment/generator/attackby(weapon,mob/user, params) - load_fuel(weapon) +/obj/item/mecha_parts/mecha_equipment/generator/item_interact(weapon,mob/user, params) + if (load_fuel(weapon)) + return TRUE + return ..() /obj/item/mecha_parts/mecha_equipment/generator/process() if(!chassis) diff --git a/code/game/mecha/equipment/tools/work_tools.dm b/code/game/mecha/equipment/tools/work_tools.dm index 4579886323274..179c25fc03371 100644 --- a/code/game/mecha/equipment/tools/work_tools.dm +++ b/code/game/mecha/equipment/tools/work_tools.dm @@ -71,7 +71,6 @@ if(!M) return M.adjustOxyLoss(round(dam_force/2)) - M.updatehealth() target.visible_message("[chassis] squeezes [target]!", \ "[chassis] squeezes you!",\ "You hear something crack.") @@ -132,7 +131,6 @@ if(!M) return M.adjustOxyLoss(round(dam_force/2)) - M.updatehealth() target.visible_message("[chassis] destroys [target] in an unholy fury!", \ "[chassis] destroys you in an unholy fury!") log_combat(chassis.occupant, M, "attacked", "[name]", "(INTENT: [uppertext(chassis.occupant.a_intent)]) (DAMTYPE: [uppertext(damtype)])") diff --git a/code/game/mecha/mech_bay.dm b/code/game/mecha/mech_bay.dm index 2c644a494fe29..c459d21f70513 100644 --- a/code/game/mecha/mech_bay.dm +++ b/code/game/mecha/mech_bay.dm @@ -74,16 +74,16 @@ recharge_console.ui_update() -/obj/machinery/mech_bay_recharge_port/attackby(obj/item/I, mob/user, params) +/obj/machinery/mech_bay_recharge_port/item_interact(obj/item/I, mob/user, params) if(default_deconstruction_screwdriver(user, "recharge_port-o", "recharge_port", I)) - return + return TRUE if(default_change_direction_wrench(user, I)) recharging_turf = get_step(loc, dir) - return + return TRUE if(default_deconstruction_crowbar(I)) - return + return TRUE return ..() /obj/machinery/computer/mech_bay_power_console diff --git a/code/game/mecha/mecha_defense.dm b/code/game/mecha/mecha_defense.dm index 944970bcf6e9a..03f06913a3b93 100644 --- a/code/game/mecha/mecha_defense.dm +++ b/code/game/mecha/mecha_defense.dm @@ -21,7 +21,7 @@ occupant_message("Taking damage!") log_message("Took [damage_amount] points of damage. Damage type: [damage_type].", LOG_MECHA) -/obj/mecha/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir) +/obj/mecha/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir, armour_penetration = 0) . = ..() if(!damage_amount) return 0 @@ -115,7 +115,7 @@ if (!enclosed && occupant && !silicon_pilot && !Proj.force_hit && (Proj.def_zone == BODY_ZONE_HEAD || Proj.def_zone == BODY_ZONE_CHEST)) //allows bullets to hit the pilot of open-canopy mechs occupant.bullet_act(Proj) //If the sides are open, the occupant can be hit return BULLET_ACT_HIT - log_message("Hit by projectile. Type: [Proj.name]([Proj.armor_flag]).", LOG_MECHA, color="red") + log_message("Hit by projectile. Type: [Proj.name]([Proj.damage_source]).", LOG_MECHA, color="red") . = ..() /obj/mecha/ex_act(severity, target) @@ -176,35 +176,35 @@ log_message("Exposed to dangerous temperature.", LOG_MECHA, color="red") take_damage(5, BURN, 0, 1) -/obj/mecha/attackby(obj/item/W as obj, mob/user as mob, params) +/obj/mecha/item_interact(obj/item/W as obj, mob/user as mob, params) if(istype(W, /obj/item/mmi)) var/obj/item/mmi/M = W var/mob/living/brain/BM = M.brainmob if(is_banned_from(BM.ckey, JOB_NAME_CYBORG) || BM.client.get_exp_living(TRUE) <= MINUTES_REQUIRED_BASIC) to_chat(user, "This [M.name] is not compatible, try a different one!") - return + return TRUE if(mmi_move_inside(W,user)) to_chat(user, "[src]-[W] interface initialized successfully.") else to_chat(user, "[src]-[W] interface initialization failed.") - return + return TRUE if(W.GetID()) if(add_req_access || maint_access) if(internals_access_allowed(user)) output_maintenance_dialog(W.GetID(), user) - return + return TRUE to_chat(user, "Invalid ID: Access denied.") - return + return TRUE to_chat(user, "Maintenance protocols disabled by operator.") - return + return TRUE if(istype(W, /obj/item/stock_parts/cell)) if(construction_state == MECHA_OPEN_HATCH) if(!cell) if(!user.transferItemToLoc(W, src, silent = FALSE)) - return + return TRUE var/obj/item/stock_parts/cell/C = W to_chat(user, "You install the power cell.") playsound(src, 'sound/items/screwdriver2.ogg', 50, FALSE) @@ -212,13 +212,13 @@ log_message("Power cell installed", LOG_MECHA) else to_chat(user, "There's already a power cell installed.") - return + return TRUE if(istype(W, /obj/item/stock_parts/scanning_module)) if(construction_state == MECHA_OPEN_HATCH) if(!scanmod) if(!user.transferItemToLoc(W, src)) - return + return TRUE to_chat(user, "You install the scanning module.") playsound(src, 'sound/items/screwdriver2.ogg', 50, FALSE) scanmod = W @@ -226,13 +226,13 @@ update_part_values() else to_chat(user, "There's already a scanning module installed.") - return + return TRUE if(istype(W, /obj/item/stock_parts/capacitor)) if(construction_state == MECHA_OPEN_HATCH) if(!capacitor) if(!user.transferItemToLoc(W, src)) - return + return TRUE to_chat(user, "You install the capacitor.") playsound(src, 'sound/items/screwdriver2.ogg', 50, FALSE) capacitor = W @@ -240,7 +240,7 @@ update_part_values() else to_chat(user, "There's already a capacitor installed.") - return + return TRUE if(istype(W, /obj/item/stack/cable_coil)) if(construction_state == MECHA_OPEN_HATCH && (internal_damage & MECHA_INT_SHORT_CIRCUIT)) @@ -250,12 +250,12 @@ to_chat(user, "You replace the fused wires.") else to_chat(user, "You need two lengths of cable to fix this mech!") - return + return TRUE if(istype(W, /obj/item/mecha_parts)) var/obj/item/mecha_parts/P = W P.try_attach_part(user, src) - return + return TRUE log_message("Attacked by [W]. Attacker - [user]", LOG_MECHA) return ..() diff --git a/code/game/mecha/mecha_wreckage.dm b/code/game/mecha/mecha_wreckage.dm index 12455e6546abe..bd2e0fa8b4893 100644 --- a/code/game/mecha/mecha_wreckage.dm +++ b/code/game/mecha/mecha_wreckage.dm @@ -22,7 +22,7 @@ return AI = AI_pilot - AI.apply_damage(150, BURN) //Give the AI a bit of damage from the "shock" of being suddenly shut down + AI.apply_damage(/datum/damage_source/electrical_damage, /datum/damage/burn, 150) //Give the AI a bit of damage from the "shock" of being suddenly shut down AI.death() //The damage is not enough to kill the AI, but to be 'corrupted files' in need of repair. AI.forceMove(src) //Put the dead AI inside the wreckage for recovery add_overlay(mutable_appearance('icons/obj/projectiles.dmi', "green_laser")) //Overlay for the recovery beacon @@ -34,14 +34,14 @@ if(AI) . += "The AI recovery beacon is active." -/obj/structure/mecha_wreckage/attackby(obj/item/I, mob/user, params) +/obj/structure/mecha_wreckage/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_WELDER) if(salvage_num <= 0 || !length(welder_salvage)) to_chat(user, "You don't see anything that can be cut with [I]!") - return + return TRUE if(!I.use_tool(src, user, 0, volume=50)) - return + return TRUE var/type = prob(70) ? pick(welder_salvage) : null if(type) @@ -52,12 +52,12 @@ salvage_num-- else to_chat(user, "You fail to salvage anything valuable from [src]!") - return + return TRUE else if(I.tool_behaviour == TOOL_WIRECUTTER) if(salvage_num <= 0) to_chat(user, "You don't see anything that can be cut with [I]!") - return + return TRUE else if(wirecutters_salvage && wirecutters_salvage.len) var/type = prob(70) ? pick(wirecutters_salvage) : null if(type) @@ -66,6 +66,7 @@ salvage_num-- else to_chat(user, "You fail to salvage anything valuable from [src]!") + return TRUE else if(I.tool_behaviour == TOOL_CROWBAR) if(crowbar_salvage?.len) @@ -74,10 +75,11 @@ S.forceMove(user.drop_location()) crowbar_salvage -= S user.visible_message("[user] pries [S] from [src].", "You pry [S] from [src].") - return + return TRUE else to_chat(user, "You don't see anything that can be pried with [I]!") - + return TRUE + return ..() /obj/structure/mecha_wreckage/transfer_ai(interaction, mob/user, mob/living/silicon/ai/ai_mob, obj/item/aicard/card) if(!..()) diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm index e513a320c37bd..bce40a8503f17 100644 --- a/code/game/objects/buckling.dm +++ b/code/game/objects/buckling.dm @@ -21,14 +21,14 @@ if(user_unbuckle_mob(buckled_mobs[1],user)) return 1 -/atom/movable/attackby(obj/item/W, mob/user, params) - if(!can_buckle || !istype(W, /obj/item/riding_offhand) || !user.Adjacent(src)) +/atom/movable/item_interact(obj/item/item, mob/user, params) + if(!can_buckle || !istype(item, /obj/item/riding_offhand) || !user.Adjacent(src)) return ..() - var/obj/item/riding_offhand/riding_item = W + var/obj/item/riding_offhand/riding_item = item var/mob/living/carried_mob = riding_item.rider if(carried_mob == user) //Piggyback user. - return + return TRUE user.unbuckle_mob(carried_mob) carried_mob.forceMove(get_turf(src)) return mouse_buckle_handling(carried_mob, user) diff --git a/code/game/objects/effects/anomalies.dm b/code/game/objects/effects/anomalies.dm index 0553ed180b983..9040bbe56c001 100644 --- a/code/game/objects/effects/anomalies.dm +++ b/code/game/objects/effects/anomalies.dm @@ -100,9 +100,11 @@ qdel(src) -/obj/effect/anomaly/attackby(obj/item/I, mob/user, params) +/obj/effect/anomaly/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_ANALYZER) to_chat(user, "Analyzing... [src]'s unstable field is fluctuating along frequency [format_frequency(aSignal.frequency)], code [aSignal.code].") + return TRUE + return ..() /////////////////////// /atom/movable/warp_effect diff --git a/code/game/objects/effects/contraband.dm b/code/game/objects/effects/contraband.dm index a283f551f1eca..c67315bc04b8d 100644 --- a/code/game/objects/effects/contraband.dm +++ b/code/game/objects/effects/contraband.dm @@ -87,7 +87,7 @@ ruined = initial(selected.ruined) -/obj/structure/sign/poster/attackby(obj/item/I, mob/user, params) +/obj/structure/sign/poster/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_WIRECUTTER) I.play_tool_sound(src, 100) if(ruined) @@ -96,6 +96,8 @@ else to_chat(user, "You carefully remove the poster from the wall.") roll_and_drop(user.loc) + return TRUE + return ..() /obj/structure/sign/poster/attack_hand(mob/user) . = ..() @@ -119,7 +121,7 @@ forceMove(P) return P -//separated to reduce code duplication. Moved here for ease of reference and to unclutter r_wall/attackby() +//separated to reduce code duplication. Moved here for ease of reference and to unclutter r_wall/item_interact() /turf/closed/wall/proc/place_poster(obj/item/poster/P, mob/user) if(!P.poster_structure) to_chat(user, "[P] has no poster... inside it? Inform a coder!") diff --git a/code/game/objects/effects/decals/cleanable.dm b/code/game/objects/effects/decals/cleanable.dm index 51aa54ed40cd8..acf089c64a0c1 100644 --- a/code/game/objects/effects/decals/cleanable.dm +++ b/code/game/objects/effects/decals/cleanable.dm @@ -34,28 +34,30 @@ if(mergeable_decal) return TRUE -/obj/effect/decal/cleanable/attackby(obj/item/W, mob/user, params) +/obj/effect/decal/cleanable/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/reagent_containers/glass) || istype(W, /obj/item/reagent_containers/food/drinks)) if(src.reagents && W.reagents) . = 1 //so the containers don't splash their content on the src while scooping. if(!src.reagents.total_volume) to_chat(user, "[src] isn't thick enough to scoop up!") - return + return TRUE if(W.reagents.total_volume >= W.reagents.maximum_volume) to_chat(user, "[W] is full!") - return + return TRUE to_chat(user, "You scoop up [src] into [W]!") reagents.trans_to(W, reagents.total_volume, transfered_by = user) if(!reagents.total_volume) //scooped up all of it qdel(src) - return + return TRUE + return TRUE if(W.is_hot()) //todo: make heating a reagent holder proc if(istype(W, /obj/item/clothing/mask/cigarette)) - return + return TRUE else var/hotness = W.is_hot() reagents.expose_temperature(hotness) to_chat(user, "You heat [name] with [W]!") + return TRUE else return ..() diff --git a/code/game/objects/effects/decals/cleanable/robots.dm b/code/game/objects/effects/decals/cleanable/robots.dm index e483c45933e1e..322cdb649df9c 100644 --- a/code/game/objects/effects/decals/cleanable/robots.dm +++ b/code/game/objects/effects/decals/cleanable/robots.dm @@ -80,13 +80,13 @@ . = ..() reagents.add_reagent(/datum/reagent/oil, 30) -/obj/effect/decal/cleanable/oil/attackby(obj/item/I, mob/living/user) +/obj/effect/decal/cleanable/oil/item_interact(obj/item/I, mob/living/user) var/attacked_by_hot_thing = I.is_hot() if(attacked_by_hot_thing) visible_message("[user] tries to ignite [src] with [I]!", "You try to ignite [src] with [I].") log_combat(user, src, (attacked_by_hot_thing < 480) ? "tried to ignite" : "ignited", I) fire_act(attacked_by_hot_thing) - return + return TRUE return ..() /obj/effect/decal/cleanable/oil/fire_act(exposed_temperature, exposed_volume) diff --git a/code/game/objects/effects/effects.dm b/code/game/objects/effects/effects.dm index 07d3b6ada8697..50f88abcc2107 100644 --- a/code/game/objects/effects/effects.dm +++ b/code/game/objects/effects/effects.dm @@ -9,14 +9,9 @@ vis_flags = VIS_INHERIT_PLANE var/forensic_protected = FALSE -/obj/effect/attackby(obj/item/weapon, mob/user, params) +/obj/effect/item_interact(obj/item/weapon, mob/user, params) if(SEND_SIGNAL(weapon, COMSIG_ITEM_ATTACK_EFFECT, src, user, params) & COMPONENT_NO_AFTERATTACK) return TRUE - - // I'm not sure why these are snowflaked to early return but they are - if(istype(weapon, /obj/item/mop) || istype(weapon, /obj/item/soap)) - return - return ..() /obj/effect/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir) diff --git a/code/game/objects/effects/mainttraps.dm b/code/game/objects/effects/mainttraps.dm index 56c111cf972e9..4afcf53057ab8 100644 --- a/code/game/objects/effects/mainttraps.dm +++ b/code/game/objects/effects/mainttraps.dm @@ -288,14 +288,17 @@ rune_in_use = FALSE can_be_scribed = FALSE -/obj/effect/rune/cluwne/attackby(obj/I, mob/user, params) +/obj/effect/rune/cluwne/item_interact(obj/I, mob/user, params) if(istype(I, /obj/item/melee/cultblade/dagger) && iscultist(user)) SEND_SOUND(user,'sound/items/sheath.ogg') if(do_after(user, 15, target = src)) to_chat(user, "It's not within your power to erase the [lowertext(cultist_name)].") + return TRUE else if(istype(I, /obj/item/nullrod)) user.say("BEGONE FOUL MAGIKS!!", forced = "nullrod") to_chat(user, "You try to disrupt the magic of [src] with the [I], and nothing happens to the crude crayon markings. You feel foolish.") + return TRUE + return ..() /obj/effect/rune/cluwne/attack_hand(mob/living/user)//this is where we check if someone is able to use the rune var/cluwne = FALSE diff --git a/code/game/objects/effects/mines.dm b/code/game/objects/effects/mines.dm index b102b9468a399..dca19ed04e85d 100644 --- a/code/game/objects/effects/mines.dm +++ b/code/game/objects/effects/mines.dm @@ -106,13 +106,15 @@ ) AddElement(/datum/element/connect_loc, loc_connections) -/obj/effect/mine/attackby(obj/I, mob/user, params) +/obj/effect/mine/item_interact(obj/I, mob/user, params) if(istype(I, /obj/item/multitool)) to_chat(user, "You begin to disarm the [src]...") if(do_after(user, disarm_time, target = src)) to_chat(user, "You disarm the [src].") new disarm_product(src.loc) qdel(src) + return TRUE + return ..() /obj/effect/mine/proc/mineEffect(mob/victim) to_chat(victim, "*click*") @@ -216,7 +218,8 @@ /obj/effect/mine/stun/mineEffect(mob/living/victim) if(isliving(victim)) victim.adjustStaminaLoss(stun_time) - victim.adjustBruteLoss(damage) + var/datum/damage_source/explosion/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(victim, BRUTE, damage, null) /obj/effect/mine/shrapnel name = "shrapnel mine" @@ -270,11 +273,12 @@ /obj/effect/mine/sound/mineEffect(mob/victim) playsound(loc, sound, volume, 1) -/obj/effect/mine/sound/attackby(obj/item/soundsynth/J, mob/user, params) +/obj/effect/mine/sound/item_interact(obj/item/soundsynth/J, mob/user, params) if(istype(J, /obj/item/soundsynth)) to_chat(user, "You change the sound settings of the [src].") sound = J.selected_sound - + return TRUE + return ..() /obj/effect/mine/sound/bwoink name = "bwoink mine" diff --git a/code/game/objects/effects/portals.dm b/code/game/objects/effects/portals.dm index 472cb998b7797..fa671a5a84a2e 100644 --- a/code/game/objects/effects/portals.dm +++ b/code/game/objects/effects/portals.dm @@ -59,10 +59,11 @@ return FALSE return ..() -/obj/effect/portal/attackby(obj/item/W, mob/user, params) +/obj/effect/portal/item_interact(obj/item/W, mob/user, params) if(user && Adjacent(user)) teleport(user) return TRUE + return ..() /obj/effect/portal/Bumped(atom/movable/bumper) teleport(bumper) diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm index b3dbe045cd0c5..2bbfda9a7c76f 100644 --- a/code/game/objects/effects/spiders.dm +++ b/code/game/objects/effects/spiders.dm @@ -13,14 +13,14 @@ if(damage_type == BURN)//the stickiness of the web mutes all attack sounds except fire damage type playsound(loc, 'sound/items/welder.ogg', 100, 1) -/obj/structure/spider/attackby(obj/item/I, mob/living/user, params) +/obj/structure/spider/on_attacked(obj/item/I, mob/living/user) + ..() if(I.damtype != BURN) if(prob(35)) user.transferItemToLoc(I, drop_location()) to_chat(user, "The [I] gets stuck in \the [src]!") - return ..() -/obj/structure/spider/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir) +/obj/structure/spider/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir, armour_penetration = 0) if(damage_flag == MELEE) switch(damage_type) if(BURN) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 015f566fd6d91..3ce23197ab89a 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -632,7 +632,7 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) blockhand = BODY_ZONE_L_ARM if(isprojectile(hitby)) var/obj/projectile/P = hitby - if(P.damage_type != STAMINA)// disablers dont do shit to shields + if(P.damage_type != STAMINA_DAMTYPE)// disablers dont do shit to shields attackforce = (P.damage) else if(isitem(hitby)) var/obj/item/I = hitby @@ -642,7 +642,7 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) if(!I.damtype == BRUTE) attackforce = (attackforce / 2)//as above, burning weapons, or weapons that deal other damage type probably dont get force from physical power attackforce = (attackforce * I.attack_weight) - if(I.damtype == STAMINA)//pure stamina damage wont affect blocks + if(I.damtype == STAMINA_DAMTYPE)//pure stamina damage wont affect blocks attackforce = 0 else if(attack_type == UNARMED_ATTACK && isliving(hitby)) var/mob/living/L = hitby @@ -661,7 +661,7 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) else L.attackby(src, owner) owner.visible_message("[L] injures themselves on [owner]'s [src]!") - owner.apply_damage(attackforce, STAMINA, blockhand, block_power) + owner.apply_damage(/datum/damage_source/fatigue, /datum/damage/stamina, attackforce * ((100 - block_power) / 100), blockhand) if((owner.getStaminaLoss() >= 35 && HAS_TRAIT(src, TRAIT_NODROP)) || (HAS_TRAIT(owner, TRAIT_NOLIMBDISABLE) && owner.getStaminaLoss() >= 30))//if you don't drop the item, you can't block for a few seconds owner.blockbreak() if(attackforce) @@ -762,7 +762,7 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) return if(usr.get_active_held_item() == null) // Let me know if this has any problems -Yota - usr.UnarmedAttack(src) + usr.primary_interact(src) //This proc is executed when someone clicks the on-screen UI button. //The default action is attack_self(). @@ -774,14 +774,6 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) return 0 /obj/item/proc/eyestab(mob/living/carbon/M, mob/living/carbon/user) - - var/is_human_victim - var/obj/item/bodypart/affecting = M.get_bodypart(BODY_ZONE_HEAD) - if(ishuman(M)) - if(!affecting) //no head! - return - is_human_victim = TRUE - if(M.is_eyes_covered()) // you can't stab someone in the eyes wearing a mask! to_chat(user, "You're going to need to remove [M.p_their()] eye protection first!") @@ -809,12 +801,6 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) "[user] has stabbed [user.p_them()]self in the eyes with [src]!", \ "You stab yourself in the eyes with [src]!" \ ) - if(is_human_victim) - var/mob/living/carbon/human/U = M - U.apply_damage(7, BRUTE, affecting) - - else - M.take_bodypart_damage(7) SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "eye_stab", /datum/mood_event/eye_stab) @@ -1282,10 +1268,10 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) victim.visible_message("[victim] looks like [victim.p_theyve()] just bit something they shouldn't have!", \ "OH GOD! Was that a crunch? That didn't feel good at all!!") - victim.apply_damage(max(15, force), BRUTE, BODY_ZONE_HEAD) + victim.apply_damage(/datum/damage_source/consumption, /datum/damage/brute, max(15, force), BODY_ZONE_HEAD) victim.losebreath += 2 if(tryEmbed(victim.get_bodypart(BODY_ZONE_CHEST), forced = TRUE)) //and if it embeds successfully in their chest, cause a lot of pain - victim.apply_damage(max(25, force*1.5), BRUTE, BODY_ZONE_CHEST) + victim.apply_damage(/datum/damage_source/consumption, /datum/damage/brute, max(25, force*1.5), BODY_ZONE_CHEST) victim.losebreath += 6 discover_after = FALSE if(QDELETED(src)) // in case trying to embed it caused its deletion (say, if it's DROPDEL) diff --git a/code/game/objects/items/RCD.dm b/code/game/objects/items/RCD.dm index 074992b8f980f..3467176c9e319 100644 --- a/code/game/objects/items/RCD.dm +++ b/code/game/objects/items/RCD.dm @@ -61,16 +61,16 @@ RLD silo_mats = null return ..() -/obj/item/construction/attackby(obj/item/W, mob/user, params) +/obj/item/construction/item_interact(obj/item/W, mob/user, params) if(iscyborg(user)) - return + return ..() var/loaded = 0 if(istype(W, /obj/item/rcd_ammo)) var/obj/item/rcd_ammo/R = W var/load = min(R.ammoamt, max_matter - matter) if(load <= 0) to_chat(user, "[src] can't hold any more matter-units!") - return + return TRUE R.ammoamt -= load if(R.ammoamt <= 0) qdel(R) @@ -102,6 +102,7 @@ RLD else return ..() update_icon() //ensures that ammo counters (if present) get updated + return TRUE /obj/item/construction/proc/loadwithsheets(obj/item/stack/sheet/S, value, mob/user) var/maxsheets = round((max_matter-matter)/value) //calculate the max number of sheets that will fit in RCD diff --git a/code/game/objects/items/RCL.dm b/code/game/objects/items/RCL.dm index 02bfbbe5ac92d..0419f87206692 100644 --- a/code/game/objects/items/RCL.dm +++ b/code/game/objects/items/RCL.dm @@ -44,31 +44,31 @@ active = FALSE -/obj/item/rcl/attackby(obj/item/W, mob/user) +/obj/item/rcl/item_interact(obj/item/W, mob/user) if(istype(W, /obj/item/stack/cable_coil)) var/obj/item/stack/cable_coil/C = W if(!loaded) if(!user.transferItemToLoc(W, src)) to_chat(user, "[src] is stuck to your hand!") - return + return TRUE else loaded = W //W.loc is src at this point. loaded.max_amount = max_amount //We store a lot. update_icon() - return + return TRUE if(loaded.amount < max_amount) var/transfer_amount = min(max_amount - loaded.amount, C.amount) C.use(transfer_amount) loaded.amount += transfer_amount else - return + return TRUE update_icon() to_chat(user, "You add the cables to [src]. It now contains [loaded.amount].") else if(W.tool_behaviour == TOOL_SCREWDRIVER) if(!loaded) - return + return TRUE if(ghetto && prob(10)) //Is it a ghetto RCL? If so, give it a 10% chance to fall apart to_chat(user, "You attempt to loosen the securing screws on the side, but it falls apart!") while(loaded.amount > 30) //There are only two kinds of situations: "nodiff" (60,90), or "diff" (31-59, 61-89) @@ -80,7 +80,7 @@ loaded.use(30) new /obj/item/stack/cable_coil(get_turf(user), 30) qdel(src) - return + return TRUE to_chat(user, "You loosen the securing screws on the side, allowing you to lower the guiding edge and retrieve the wires.") while(loaded.amount > 30) //There are only two kinds of situations: "nodiff" (60,90), or "diff" (31-59, 61-89) @@ -97,8 +97,9 @@ loaded = null update_icon() + return TRUE else - ..() + return ..() /obj/item/rcl/examine(mob/user) . = ..() diff --git a/code/game/objects/items/RPD.dm b/code/game/objects/items/RPD.dm index a2dccf179b13d..dc944c204b0bd 100644 --- a/code/game/objects/items/RPD.dm +++ b/code/game/objects/items/RPD.dm @@ -301,7 +301,7 @@ GLOBAL_LIST_INIT(fluid_duct_recipes, list( /obj/item/pipe_dispenser/attack_self(mob/user) ui_interact(user) -/obj/item/pipe_dispenser/attackby(obj/item/W, mob/user, params) +/obj/item/pipe_dispenser/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/rpd_upgrade)) install_upgrade(W, user) return TRUE @@ -431,23 +431,14 @@ GLOBAL_LIST_INIT(fluid_duct_recipes, list( spark_system.start() playsound(get_turf(src), 'sound/effects/pop.ogg', 50, FALSE) -/obj/item/pipe_dispenser/attack_obj(obj/O, mob/living/user) - // don't attempt to attack what we don't want to attack - if(is_type_in_typecache(O, atmos_constructs) || is_type_in_typecache(O, rpd_targets) || is_type_in_typecache(O, rpd_whitelist)) - return - - return ..() - -/obj/item/pipe_dispenser/afterattack(atom/A, mob/user, proximity) - if(!user.IsAdvancedToolUser() || istype(A, /turf/open/space/transit)) - return ..() - +/obj/item/pipe_dispenser/interact_with(atom/target, mob/user, params) // this shouldn't use early return because checking less condition is good - if(isturf(A) || is_type_in_typecache(A, atmos_constructs) || is_type_in_typecache(A, rpd_targets) || is_type_in_typecache(A, rpd_whitelist)) - if(proximity || ranged) - rpd_create(A, user) - return - + if(isturf(target) || is_type_in_typecache(target, atmos_constructs) || is_type_in_typecache(target, rpd_targets) || is_type_in_typecache(target, rpd_whitelist)) + if(!user.IsAdvancedToolUser() || istype(target, /turf/open/space/transit)) + return TRUE + if(get_dist(user, target) <= 1 || ranged) + rpd_create(target, user) + return TRUE return ..() /obj/item/pipe_dispenser/proc/rpd_create(atom/A, mob/user) diff --git a/code/game/objects/items/RSF.dm b/code/game/objects/items/RSF.dm index 92230dfac0ad6..b2519dedadde3 100644 --- a/code/game/objects/items/RSF.dm +++ b/code/game/objects/items/RSF.dm @@ -26,15 +26,16 @@ RSF /obj/item/rsf/cyborg matter = 30 -/obj/item/rsf/attackby(obj/item/W, mob/user, params) +/obj/item/rsf/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/rcd_ammo)) if((matter + 10) > 30) to_chat(user, "The RSF can't hold any more matter.") - return + return TRUE qdel(W) matter += 10 playsound(src.loc, 'sound/machines/click.ogg', 10, 1) to_chat(user, "The RSF now holds [matter]/30 fabrication-units.") + return TRUE else return ..() @@ -139,9 +140,6 @@ RSF . = ..() . += "It currently holds [matter]/10 cookie-units." -/obj/item/cookiesynth/attackby() - return - /obj/item/cookiesynth/on_emag(mob/user) ..() if(obj_flags & EMAGGED) diff --git a/code/game/objects/items/airlock_painter.dm b/code/game/objects/items/airlock_painter.dm index 5cfdfa871e43c..471304ca6c8ce 100644 --- a/code/game/objects/items/airlock_painter.dm +++ b/code/game/objects/items/airlock_painter.dm @@ -157,17 +157,18 @@ . += "Its ink levels look [ink_level]." -/obj/item/airlock_painter/attackby(obj/item/W, mob/user, params) +/obj/item/airlock_painter/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/toner)) if(ink) to_chat(user, "[src] already contains \a [ink].") - return + return TRUE if(!user.transferItemToLoc(W, src)) - return + return TRUE to_chat(user, "You install [W] into [src].") ink = W update_icon() playsound(src.loc, 'sound/machines/click.ogg', 50, 1) + return TRUE else return ..() diff --git a/code/game/objects/items/apc_frame.dm b/code/game/objects/items/apc_frame.dm index f5f6464cc2bf8..43dd5356cb71b 100644 --- a/code/game/objects/items/apc_frame.dm +++ b/code/game/objects/items/apc_frame.dm @@ -58,13 +58,14 @@ /obj/item/wallframe/proc/after_attach(var/obj/O) transfer_fingerprints_to(O) -/obj/item/wallframe/attackby(obj/item/W, mob/user, params) +/obj/item/wallframe/item_interact(obj/item/W, mob/user, params) ..() if(W.tool_behaviour == TOOL_SCREWDRIVER) // For camera-building borgs var/turf/T = get_step(get_turf(user), user.dir) if(iswallturf(T)) T.attackby(src, user, params) + return TRUE var/iron_amt = round(materials[/datum/material/iron]/MINERAL_MATERIAL_AMOUNT) //Replace this shit later var/glass_amt = round(materials[/datum/material/glass]/MINERAL_MATERIAL_AMOUNT) //Replace this shit later @@ -76,8 +77,8 @@ if(glass_amt) new /obj/item/stack/sheet/glass(get_turf(src), glass_amt) qdel(src) - - + return TRUE + return ..() // APC HULL /obj/item/wallframe/apc diff --git a/code/game/objects/items/bedsheets.dm b/code/game/objects/items/bedsheets.dm index ba6ba688e78d9..73253adfa22bf 100644 --- a/code/game/objects/items/bedsheets.dm +++ b/code/game/objects/items/bedsheets.dm @@ -26,7 +26,7 @@ . = ..() AddElement(/datum/element/bed_tuckable, 0, 0, 0) -/obj/item/bedsheet/attack(mob/living/M, mob/user) +/obj/item/bedsheet/attack_mob_target(mob/living/M, mob/user) if(!attempt_initiate_surgery(src, M, user)) ..() @@ -44,7 +44,7 @@ add_fingerprint(user) return -/obj/item/bedsheet/attackby(obj/item/I, mob/user, params) +/obj/item/bedsheet/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_WIRECUTTER || I.is_sharp()) var/turf/T = get_turf(src) var/obj/item/stack/sheet/cotton/cloth/C = new (T, 3) @@ -55,6 +55,7 @@ C.add_fingerprint(user) qdel(src) to_chat(user, "You tear [src] up.") + return TRUE else return ..() diff --git a/code/game/objects/items/candle.dm b/code/game/objects/items/candle.dm index 7b7e7d0ef13d5..f1906b87c4361 100644 --- a/code/game/objects/items/candle.dm +++ b/code/game/objects/items/candle.dm @@ -23,10 +23,11 @@ /obj/item/candle/update_icon() icon_state = "candle[(wax > 800) ? ((wax > 1500) ? 1 : 2) : 3][lit ? "_lit" : ""]" -/obj/item/candle/attackby(obj/item/W, mob/user, params) +/obj/item/candle/item_interact(obj/item/W, mob/user, params) var/msg = W.ignition_effect(src, user) if(msg) light(msg) + return TRUE else return ..() diff --git a/code/game/objects/items/cardboard_cutouts.dm b/code/game/objects/items/cardboard_cutouts.dm index 08c093bd55c4b..0056ecc44ee87 100644 --- a/code/game/objects/items/cardboard_cutouts.dm +++ b/code/game/objects/items/cardboard_cutouts.dm @@ -44,13 +44,13 @@ icon_state = initial(icon_state) //This resets a cutout to its blank state - this is intentional to allow for resetting pushed_over = FALSE -/obj/item/cardboard_cutout/attackby(obj/item/I, mob/living/user, params) +/obj/item/cardboard_cutout/item_interact(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/toy/crayon)) change_appearance(I, user) - return + return TRUE // Why yes, this does closely resemble mob and object attack code. if(I.item_flags & NOBLUDGEON) - return + return ..() if(!I.force) playsound(loc, 'sound/weapons/tap.ogg', get_clamped_volume(), 1, -1) else if(I.hitsound) @@ -64,6 +64,7 @@ "You hit [src] with [I]!") if(prob(I.force)) push_over() + return TRUE /obj/item/cardboard_cutout/bullet_act(obj/projectile/P, def_zone, piercing_hit = FALSE) if(istype(P, /obj/projectile/bullet/reusable)) diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm index ba58b6702cfec..d97af34b620c2 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -76,7 +76,7 @@ icon_state = "emag_bs" prox_check = FALSE -/obj/item/card/emag/attack() +/obj/item/card/emag/attack_mob_target() return /obj/item/card/emag/afterattack(atom/target, mob/user, proximity) @@ -175,10 +175,10 @@ else to_chat(usr, "Success: [target_value] points have been added. [registered_account.account_holder]'s account now holds [registered_account.report_currency(ACCOUNT_CURRENCY_MINING)].") -/obj/item/card/id/attackby(obj/item/W, mob/user, params) +/obj/item/card/id/item_interact(obj/item/W, mob/user, params) if(iscash(W)) insert_money(W, user) - return + return TRUE else if(istype(W, /obj/item/storage/bag/money)) var/obj/item/storage/bag/money/money_bag = W var/list/money_contained = money_bag.contents @@ -187,7 +187,7 @@ if (money_added) to_chat(user, "You stuff the contents into the card! They disappear in a puff of bluespace smoke, adding [money_added] worth of credits to the linked account.") - return + return TRUE else return ..() @@ -532,21 +532,21 @@ update_label("John Doe", "Clowny") return chameleon_action.emp_randomise() -/obj/item/card/id/syndicate/attackby(obj/item/W, mob/user, params) +/obj/item/card/id/syndicate/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_MULTITOOL) if(chameleon_action.hidden) chameleon_action.hidden = FALSE actions += chameleon_action chameleon_action.Grant(user) log_game("[key_name(user)] has removed the disguise lock on the agent ID ([name]) with [W]") - return + return TRUE else chameleon_action.hidden = TRUE actions -= chameleon_action chameleon_action.Remove(user) log_game("[key_name(user)] has locked the disguise of the agent ID ([name]) with [W]") - return - . = ..() + return TRUE + return ..() // broken chameleon agent card /obj/item/card/id/syndicate/broken @@ -782,13 +782,15 @@ update_label("John Doe", "Clowny") hud_state = JOB_HUD_PAPER electric = FALSE -/obj/item/card/id/paper/attackby(obj/item/W, mob/user, params) +/obj/item/card/id/paper/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/pen)) var/target_name = stripped_input(user, "What name would you like to write onto the card?", "Written name:", registered_name || "John Doe", MAX_MESSAGE_LEN) registered_name = target_name || registered_name // in case they hit cancel assignment = "Unknown" to_chat(user, "You scribble the name [target_name] onto the slip.") update_label() + return TRUE + return ..() /obj/item/card/id/paper/alt_click_can_use_id(mob/living/user) to_chat(user, "There's no money circuitry in here!") diff --git a/code/game/objects/items/chainsaw.dm b/code/game/objects/items/chainsaw.dm index a3ced95701ef9..3404ad2015540 100644 --- a/code/game/objects/items/chainsaw.dm +++ b/code/game/objects/items/chainsaw.dm @@ -141,6 +141,6 @@ var/knockdown = 1 light_range = 6 -/obj/item/chainsaw/energy/doom/attack(mob/living/target) +/obj/item/chainsaw/energy/doom/attack_mob_target(mob/living/target) ..() target.Knockdown(4) diff --git a/code/game/objects/items/cigs_lighters.dm b/code/game/objects/items/cigs_lighters.dm index d4c3944d1c2b5..e4f7660b8250c 100644 --- a/code/game/objects/items/cigs_lighters.dm +++ b/code/game/objects/items/cigs_lighters.dm @@ -44,7 +44,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM playsound(src, "sound/items/match_strike.ogg", 15, TRUE) lit = TRUE icon_state = "match_lit" - damtype = BURN + damtype = /datum/damage/burn force = 3 hitsound = 'sound/items/welder.ogg' item_state = "cigon" @@ -58,7 +58,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM if(lit) lit = FALSE burnt = TRUE - damtype = BRUTE + damtype = /datum/damage/brute force = initial(force) icon_state = "match_burnt" item_state = "cigoff" @@ -74,7 +74,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM ..() matchburnout() -/obj/item/match/attack(mob/living/carbon/M, mob/living/carbon/user) +/obj/item/match/attack_mob_target(mob/living/carbon/M, mob/living/carbon/user) if(!isliving(M)) return if(lit && M.IgniteMob()) @@ -160,7 +160,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM STOP_PROCESSING(SSobj, src) . = ..() -/obj/item/clothing/mask/cigarette/attackby(obj/item/W, mob/user, params) +/obj/item/clothing/mask/cigarette/item_interact(obj/item/W, mob/user, params) if(!lit && smoketime > 0) var/lighting_text = W.ignition_effect(src, user) if(lighting_text) @@ -202,7 +202,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM name = "lit [name]" attack_verb = list("burnt", "singed") hitsound = 'sound/items/welder.ogg' - damtype = BURN + damtype = /datum/damage/burn force = 4 var/turf/T = get_turf(src) if(reagents.get_reagent_amount(/datum/reagent/toxin/plasma)) // the plasma explodes when exposed to fire @@ -236,7 +236,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM name = copytext_char(name, 5) //5 == length_char("lit ") + 1 attack_verb = null hitsound = null - damtype = BRUTE + damtype = /datum/damage/brute force = 0 icon_state = icon_off item_state = icon_off @@ -296,7 +296,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM qdel(src) . = ..() -/obj/item/clothing/mask/cigarette/attack(mob/living/carbon/M, mob/living/carbon/user) +/obj/item/clothing/mask/cigarette/attack_mob_target(mob/living/carbon/M, mob/living/carbon/user) if(!istype(M)) return ..() if(M.on_fire && !lit) @@ -524,7 +524,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM handle_reagents() -/obj/item/clothing/mask/cigarette/pipe/attackby(obj/item/O, mob/user, params) +/obj/item/clothing/mask/cigarette/pipe/item_interact(obj/item/O, mob/user, params) if(istype(O, /obj/item/reagent_containers/food/snacks/grown)) var/obj/item/reagent_containers/food/snacks/grown/G = O if(!packeditem) @@ -540,6 +540,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM to_chat(user, "It has to be dried first!") else to_chat(user, "It is already packed!") + return TRUE else var/lighting_text = O.ignition_effect(src,user) if(lighting_text) @@ -547,8 +548,8 @@ CIGARETTE PACKETS ARE IN FANCY.DM light(lighting_text) else to_chat(user, "There is nothing to smoke!") - else - return ..() + return TRUE + return ..() /obj/item/clothing/mask/cigarette/pipe/attack_self(mob/user) var/turf/location = get_turf(user) @@ -645,7 +646,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM lit = new_lit if(lit) force = 5 - damtype = BURN + damtype = /datum/damage/burn hitsound = 'sound/items/welder.ogg' attack_verb = list("burnt", "singed") START_PROCESSING(SSobj, src) @@ -682,7 +683,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM user.visible_message("After a few attempts, [user] manages to light [src].", "After a few attempts, you manage to light [src].") else var/hitzone = user.held_index_to_dir(user.active_hand_index) == "r" ? BODY_ZONE_PRECISE_R_HAND : BODY_ZONE_PRECISE_L_HAND - user.apply_damage(5, BURN, hitzone) + user.apply_damage(/datum/damage_source/accidental_burn, /datum/damage/burn, 5, hitzone) user.visible_message("After a few attempts, [user] manages to light [src] - however, [user.p_they()] burn [user.p_their()] finger in the process.", "You burn yourself while lighting the lighter!") SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "burnt_thumb", /datum/mood_event/burnt_thumb) playsound(src.loc, 'sound/items/lighter_on.ogg', 100, 1) @@ -698,7 +699,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM else . = ..() -/obj/item/lighter/attack(mob/living/carbon/M, mob/living/carbon/user) +/obj/item/lighter/attack_mob_target(mob/living/carbon/M, mob/living/carbon/user) if(lit && M.IgniteMob()) message_admins("[ADMIN_LOOKUPFLW(user)] set [key_name_admin(M)] on fire with [src] at [AREACOORD(user)]") log_game("[key_name(user)] set [key_name(M)] on fire with [src] at [AREACOORD(user)]") @@ -855,7 +856,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM icon_state = "[param_color]_vape" item_state = "[param_color]_vape" -/obj/item/clothing/mask/vape/attackby(obj/item/O, mob/user, params) +/obj/item/clothing/mask/vape/item_interact(obj/item/O, mob/user, params) if(O.tool_behaviour == TOOL_SCREWDRIVER) if(!screw) screw = TRUE @@ -872,6 +873,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM to_chat(user, "You close the cap on [src].") DISABLE_BITFIELD(reagents.flags, OPENCONTAINER) cut_overlays() + return TRUE if(O.tool_behaviour == TOOL_MULTITOOL) if(screw && !(obj_flags & EMAGGED))//also kinky @@ -885,11 +887,12 @@ CIGARETTE PACKETS ARE IN FANCY.DM super = 0 to_chat(user, "You decrease the voltage of [src].") add_overlay("vapeopen_low") + return TRUE if(screw && (obj_flags & EMAGGED)) to_chat(user, "[src] can't be modified!") - else - ..() + return TRUE + ..() /obj/item/clothing/mask/vape/should_emag(mob/user) if(!..()) @@ -980,7 +983,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM vapetime -= vapedelay if(prob(5))//small chance for the vape to break and deal damage if it's emagged playsound(get_turf(src), 'sound/effects/pop_expl.ogg', 50, 0) - M.apply_damage(20, BURN, BODY_ZONE_HEAD) + M.apply_damage(/datum/damage_source/explosion, /datum/damage/burn, 20, BODY_ZONE_HEAD) M.Paralyze(300, 1, 0) var/datum/effect_system/spark_spread/sp = new /datum/effect_system/spark_spread sp.set_up(5, 1, src) diff --git a/code/game/objects/items/circuitboards/computer_circuitboards.dm b/code/game/objects/items/circuitboards/computer_circuitboards.dm index 262f5e409410f..807d431ef81fc 100644 --- a/code/game/objects/items/circuitboards/computer_circuitboards.dm +++ b/code/game/objects/items/circuitboards/computer_circuitboards.dm @@ -33,10 +33,11 @@ var/target_dept = 1 var/list/dept_list = list("General","Security","Medical","Science","Engineering") -/obj/item/circuitboard/computer/card/minor/attackby(obj/item/I, mob/user, params) +/obj/item/circuitboard/computer/card/minor/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_SCREWDRIVER) target_dept = (target_dept == dept_list.len) ? 1 : (target_dept + 1) to_chat(user, "You set the board to \"[dept_list[target_dept]]\".") + return TRUE else return ..() @@ -51,7 +52,7 @@ build_path = /obj/machinery/computer/communications var/insecure = FALSE // Forbids shuttles that are set as illegal. -/obj/item/circuitboard/computer/communications/attackby(obj/item/I, mob/user, params) +/obj/item/circuitboard/computer/communications/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_SCREWDRIVER) insecure = !insecure if(insecure) @@ -60,6 +61,7 @@ else desc = "Can be modified using a screwdriver." to_chat(user, "You re-enable the shuttle safety features of the board.") + return TRUE else return ..() @@ -236,7 +238,7 @@ icon_state = "generic" build_path = /obj/machinery/computer/libraryconsole -/obj/item/circuitboard/computer/libraryconsole/attackby(obj/item/I, mob/user, params) +/obj/item/circuitboard/computer/libraryconsole/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_SCREWDRIVER) if(build_path == /obj/machinery/computer/libraryconsole/bookmanagement) name = "Library Visitor Console (Computer Board)" @@ -246,6 +248,7 @@ name = "Book Inventory Management Console (Computer Board)" build_path = /obj/machinery/computer/libraryconsole/bookmanagement to_chat(user, "Access protocols successfully updated.") + return TRUE else return ..() @@ -371,7 +374,7 @@ name = "R&D console - production only (Computer Board)" build_path = /obj/machinery/computer/rdconsole/production -/obj/item/circuitboard/computer/rdconsole/attackby(obj/item/I, mob/user, params) +/obj/item/circuitboard/computer/rdconsole/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_SCREWDRIVER) if(build_path == /obj/machinery/computer/rdconsole/core) name = "R&D Console - Robotics (Computer Board)" @@ -381,6 +384,7 @@ name = "R&D Console (Computer Board)" build_path = /obj/machinery/computer/rdconsole/core to_chat(user, "Defaulting access protocols.") + return TRUE else return ..() @@ -496,14 +500,14 @@ /obj/item/circuitboard/computer/shuttle var/hacked = FALSE -/obj/item/circuitboard/computer/shuttle/attackby(obj/item/I, mob/user, params) +/obj/item/circuitboard/computer/shuttle/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_MULTITOOL) hacked = !hacked if(hacked) to_chat(user, "You disable the circuitboard's ID scanning protocols.") else to_chat(user, "You reset the circuitboard's ID scanning protocols.") - return + return TRUE . = ..() /obj/item/circuitboard/computer/shuttle/white_ship diff --git a/code/game/objects/items/circuitboards/machine_circuitboards.dm b/code/game/objects/items/circuitboards/machine_circuitboards.dm index 1b38f839ce94e..c7f4b3c675437 100644 --- a/code/game/objects/items/circuitboards/machine_circuitboards.dm +++ b/code/game/objects/items/circuitboards/machine_circuitboards.dm @@ -156,7 +156,7 @@ if(build_path) build_path = PATH_POWERCOIL -/obj/item/circuitboard/machine/tesla_coil/attackby(obj/item/I, mob/user, params) +/obj/item/circuitboard/machine/tesla_coil/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_SCREWDRIVER) var/obj/item/circuitboard/new_type var/new_setting @@ -171,6 +171,7 @@ build_path = initial(new_type.build_path) I.play_tool_sound(src) to_chat(user, "You change the circuitboard setting to \"[new_setting]\".") + return TRUE else return ..() @@ -485,12 +486,13 @@ build_path = new_type return ..() -/obj/item/circuitboard/machine/smartfridge/attackby(obj/item/I, mob/user, params) +/obj/item/circuitboard/machine/smartfridge/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_SCREWDRIVER) var/position = fridges_name_paths.Find(build_path, fridges_name_paths) position = (position == fridges_name_paths.len) ? 1 : (position + 1) build_path = fridges_name_paths[position] to_chat(user, "You set the board to [fridges_name_paths[build_path]].") + return TRUE else return ..() @@ -574,7 +576,7 @@ /obj/machinery/vending/modularpc = "Deluxe Silicate Selections", /obj/machinery/vending/custom = "Custom Vendor") -/obj/item/circuitboard/machine/vendor/attackby(obj/item/I, mob/user, params) +/obj/item/circuitboard/machine/vendor/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_SCREWDRIVER) var/static/list/display_vending_names_paths if(!display_vending_names_paths) @@ -583,6 +585,7 @@ display_vending_names_paths[vending_names_paths[path]] = path var/choice = input(user,"Choose a new brand","Select an Item") as null|anything in display_vending_names_paths set_type(display_vending_names_paths[choice]) + return TRUE else return ..() @@ -708,7 +711,7 @@ /obj/item/reagent_containers/glass/beaker = /obj/item/reagent_containers/glass/beaker/large) needs_anchored = FALSE -/obj/item/circuitboard/machine/chem_master/attackby(obj/item/I, mob/user, params) +/obj/item/circuitboard/machine/chem_master/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_SCREWDRIVER) var/new_name = "ChemMaster" var/new_path = /obj/machinery/chem_master @@ -720,6 +723,7 @@ build_path = new_path name = "[new_name] 3000 (Machine Board)" to_chat(user, "You change the circuit board setting to \"[new_name]\".") + return TRUE else return ..() @@ -1142,7 +1146,7 @@ /obj/item/stock_parts/manipulator = 1) needs_anchored = FALSE -/obj/item/circuitboard/machine/processor/attackby(obj/item/I, mob/user, params) +/obj/item/circuitboard/machine/processor/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_SCREWDRIVER) if(build_path == /obj/machinery/processor) name = "Slime Processor (Machine Board)" @@ -1152,6 +1156,7 @@ name = "Food Processor (Machine Board)" build_path = /obj/machinery/processor to_chat(user, "Defaulting name protocols.") + return TRUE else return ..() diff --git a/code/game/objects/items/clown_items.dm b/code/game/objects/items/clown_items.dm index 011cdec1c3020..aae8c1e5cea64 100644 --- a/code/game/objects/items/clown_items.dm +++ b/code/game/objects/items/clown_items.dm @@ -162,7 +162,7 @@ //LoadComponent so child types dont stack squeak components LoadComponent(/datum/component/squeak, sound_list, 50) -/obj/item/bikehorn/attack(mob/living/carbon/M, mob/living/carbon/user) +/obj/item/bikehorn/attack_mob_target(mob/living/carbon/M, mob/living/carbon/user) SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "honk", /datum/mood_event/honk) return ..() @@ -186,7 +186,7 @@ item_state = "gold_horn" var/flip_cooldown = 0 -/obj/item/bikehorn/golden/attack() +/obj/item/bikehorn/golden/attack_mob_target() if(flip_cooldown < world.time) flip_mobs() return ..() diff --git a/code/game/objects/items/cosmetics.dm b/code/game/objects/items/cosmetics.dm index 1b19b16310f5b..70bda32a73002 100644 --- a/code/game/objects/items/cosmetics.dm +++ b/code/game/objects/items/cosmetics.dm @@ -43,7 +43,7 @@ else icon_state = "lipstick" -/obj/item/lipstick/attack(mob/M, mob/user) +/obj/item/lipstick/attack_mob_target(mob/M, mob/user) if(!open) return @@ -77,7 +77,7 @@ to_chat(user, "Where are the lips on that?") //you can wipe off lipstick with paper! -/obj/item/paper/attack(mob/M, mob/user) +/obj/item/paper/attack_mob_target(mob/M, mob/user) if(user.zone_selected == BODY_ZONE_PRECISE_MOUTH) if(!ismob(M)) return @@ -124,7 +124,7 @@ playsound(loc, 'sound/items/welder2.ogg', 20, 1) -/obj/item/razor/attack(mob/M, mob/user) +/obj/item/razor/attack_mob_target(mob/M, mob/user) if(ishuman(M) && extended == 1 && user.a_intent != INTENT_HARM) var/mob/living/carbon/human/H = M var/location = user.zone_selected @@ -258,7 +258,7 @@ user.visible_message("[user] is slitting [user.p_their()] own throat with [src]! It looks like [user.p_theyre()] trying to commit suicide!") return (BRUTELOSS) -/obj/item/razor/attack(mob/M, mob/user) +/obj/item/razor/attack_mob_target(mob/M, mob/user) . = ..() if(ishuman(M) && extended == 1 && (user.a_intent == INTENT_HARM)) var/mob/living/carbon/human/H = M diff --git a/code/game/objects/items/courtroom.dm b/code/game/objects/items/courtroom.dm index 11c1a521db790..9154178dc6c35 100644 --- a/code/game/objects/items/courtroom.dm +++ b/code/game/objects/items/courtroom.dm @@ -28,10 +28,11 @@ w_class = WEIGHT_CLASS_TINY resistance_flags = FLAMMABLE -/obj/item/gavelblock/attackby(obj/item/I, mob/user, params) +/obj/item/gavelblock/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/gavelhammer)) playsound(loc, 'sound/items/gavel.ogg', 100, 1) user.visible_message("[user] strikes [src] with [I].") user.changeNext_move(CLICK_CD_MELEE) + return TRUE else return ..() diff --git a/code/game/objects/items/crab17.dm b/code/game/objects/items/crab17.dm index ac9ef7a82875c..a0beafcf97b0c 100644 --- a/code/game/objects/items/crab17.dm +++ b/code/game/objects/items/crab17.dm @@ -67,22 +67,23 @@ . = ..() . += "It's integrated integrity meter reads: HEALTH: [obj_integrity]." -/obj/structure/checkoutmachine/attackby(obj/item/W, mob/user, params) +/obj/structure/checkoutmachine/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/card/id)) var/obj/item/card/id/card = W if(!card.registered_account) to_chat(user, "This card does not have a registered account!") - return + return TRUE if(protected_accounts["[card.registered_account.account_id]"]) to_chat(user, "It appears that your funds are safe from draining!") - return + return TRUE if(do_after(user, 40, target = src)) if(protected_accounts["[card.registered_account.account_id]"]) - return + return TRUE to_chat(user, "You quickly cash out your funds to a more secure banking location. Funds are safu.") // This is a reference and not a typo protected_accounts["[card.registered_account.account_id]"] = TRUE card.registered_account.withdrawDelay = 0 next_health_to_teleport -= RUN_AWAY_DELAYED_HP // swipe your card, then it will likely less run away + return TRUE else return ..() diff --git a/code/game/objects/items/crayons.dm b/code/game/objects/items/crayons.dm index 45f1329e95136..f4e74e28f219f 100644 --- a/code/game/objects/items/crayons.dm +++ b/code/game/objects/items/crayons.dm @@ -414,7 +414,7 @@ reagents.trans_to(t, ., volume_multiplier, transfered_by = user) check_empty(user) -/obj/item/toy/crayon/attack(mob/M, mob/user) +/obj/item/toy/crayon/attack_mob_target(mob/M, mob/user) if(edible && (M == user)) to_chat(user, "You take a bite of the [src.name]. Delicious!") var/eaten = use_charges(user, 5, FALSE) @@ -545,19 +545,20 @@ for(var/obj/item/toy/crayon/crayon in contents) add_overlay(mutable_appearance('icons/obj/crayons.dmi', crayon.crayon_color)) -/obj/item/storage/crayons/attackby(obj/item/W, mob/user, params) +/obj/item/storage/crayons/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/toy/crayon)) var/obj/item/toy/crayon/C = W switch(C.crayon_color) if("mime") to_chat(usr, "This crayon is too sad to be contained in this box.") - return + return TRUE if("rainbow") to_chat(usr, "This crayon is too powerful to be contained in this box.") - return + return TRUE if(istype(W, /obj/item/toy/crayon/spraycan)) to_chat(user, "Spraycans are not crayons.") - return + return TRUE + return TRUE return ..() /obj/item/storage/crayons/attack_self(mob/user) diff --git a/code/game/objects/items/credit_holochip.dm b/code/game/objects/items/credit_holochip.dm index 55939bd4604eb..dc5aecfe23921 100644 --- a/code/game/objects/items/credit_holochip.dm +++ b/code/game/objects/items/credit_holochip.dm @@ -72,14 +72,15 @@ else return 0 -/obj/item/holochip/attackby(obj/item/I, mob/user, params) - ..() +/obj/item/holochip/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/holochip)) var/obj/item/holochip/H = I credits += H.credits to_chat(user, "You insert the credits into [src].") update_icon() qdel(H) + return TRUE + return ..() /obj/item/holochip/AltClick(mob/user) if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user))) diff --git a/code/game/objects/items/debug_items.dm b/code/game/objects/items/debug_items.dm index 697e9683232bc..f91f4f0d38517 100644 --- a/code/game/objects/items/debug_items.dm +++ b/code/game/objects/items/debug_items.dm @@ -42,7 +42,7 @@ return FALSE return TRUE -/obj/item/debug/omnitool/attack(mob/living/M, mob/living/user) +/obj/item/debug/omnitool/attack_mob_target(mob/living/M, mob/living/user) if(tool_behaviour == "drapes") attempt_initiate_surgery(src, M, user) ..() diff --git a/code/game/objects/items/defib.dm b/code/game/objects/items/defib.dm index 906943f790834..f5aa2bdbf0268 100644 --- a/code/game/objects/items/defib.dm +++ b/code/game/objects/items/defib.dm @@ -110,9 +110,10 @@ var/atom/movable/screen/inventory/hand/H = over_object M.putItemFromInventoryInHandIfPossible(src, H.held_index) -/obj/item/defibrillator/attackby(obj/item/W, mob/user, params) +/obj/item/defibrillator/item_interact(obj/item/W, mob/user, params) if(W == paddles) toggle_paddles() + return TRUE else if(istype(W, /obj/item/stock_parts/cell)) var/obj/item/stock_parts/cell/C = W if(cell) @@ -120,12 +121,13 @@ else if(C.maxcharge < paddles.revivecost) to_chat(user, "[src] requires a higher capacity cell.") - return + return TRUE if(!user.transferItemToLoc(W, src)) - return + return TRUE cell = W to_chat(user, "You install a cell in [src].") update_icon() + return TRUE else if(W.tool_behaviour == TOOL_SCREWDRIVER) if(cell) @@ -134,8 +136,8 @@ cell = null to_chat(user, "You remove the cell from [src].") update_icon() - else - return ..() + return TRUE + return ..() /obj/item/defibrillator/should_emag(mob/user) return TRUE @@ -276,11 +278,12 @@ cell = new /obj/item/stock_parts/cell/infinite(src) update_icon() -/obj/item/defibrillator/compact/combat/loaded/attackby(obj/item/W, mob/user, params) +/obj/item/defibrillator/compact/combat/loaded/item_interact(obj/item/W, mob/user, params) if(W == paddles) toggle_paddles() update_icon() - return + return TRUE + return ..() //paddles @@ -433,7 +436,7 @@ listeningTo = null defib.update_icon() -/obj/item/shockpaddles/attack(mob/M, mob/user) +/obj/item/shockpaddles/attack_mob_target(mob/M, mob/user) if(busy) return if(req_defib && !defib.powered) @@ -571,7 +574,7 @@ H.visible_message("[H] thrashes wildly, clutching at [H.p_their()] chest!", "You feel a horrible agony in your chest!") H.set_heartattack(TRUE) - H.apply_damage(50, BURN, BODY_ZONE_CHEST) + H.apply_damage(/datum/damage_source/shock, /datum/damage/burn, 50, BODY_ZONE_CHEST) log_combat(user, H, "overloaded the heart of", defib) H.Paralyze(100) H.Jitter(100) @@ -653,8 +656,7 @@ H.adjustOxyLoss((mobhealth - HALFWAYCRITDEATH) * (H.getOxyLoss() / overall_damage), 0) H.adjustToxLoss((mobhealth - HALFWAYCRITDEATH) * (H.getToxLoss() / overall_damage), 0) H.adjustFireLoss((mobhealth - HALFWAYCRITDEATH) * (total_burn / overall_damage), 0) - H.adjustBruteLoss((mobhealth - HALFWAYCRITDEATH) * (total_brute / overall_damage), 0) - H.updatehealth() // Previous "adjust" procs don't update health, so we do it manually. + H.apply_damage(/datum/damage_source/body, BRUTE, (mobhealth - HALFWAYCRITDEATH) * (total_brute / overall_damage), null, FALSE) user.visible_message("[req_defib ? "[defib]" : "[src]"] pings: Resuscitation successful.") playsound(src, 'sound/machines/defib_success.ogg', 50, 0) H.set_heartattack(FALSE) @@ -695,7 +697,7 @@ item_state = "defibpaddles0" req_defib = FALSE -/obj/item/shockpaddles/cyborg/attack(mob/M, mob/user) +/obj/item/shockpaddles/cyborg/attack_mob_target(mob/M, mob/user) if(iscyborg(user)) var/mob/living/silicon/robot/R = user if(R.emagged) diff --git a/code/game/objects/items/deployable/barricade.dm b/code/game/objects/items/deployable/barricade.dm index b9b3e215c19a5..0a2a0b030f37a 100644 --- a/code/game/objects/items/deployable/barricade.dm +++ b/code/game/objects/items/deployable/barricade.dm @@ -56,15 +56,16 @@ /obj/structure/barricade/proc/make_debris() return -/obj/structure/barricade/attackby(obj/item/I, mob/user, params) +/obj/structure/barricade/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_WELDER && user.a_intent != INTENT_HARM && bar_material == METAL) if(obj_integrity < max_integrity) if(!I.tool_start_check(user, amount=0)) - return + return TRUE to_chat(user, "You begin repairing [src]...") if(I.use_tool(src, user, 40, volume=40)) obj_integrity = CLAMP(obj_integrity + 20, 0, max_integrity) + return TRUE else if(I.GetID() && initial(locked_down)) if(allowed(user)) @@ -72,7 +73,7 @@ to_chat(user, "You [locked_down ? "lock" : "unlock"] the release mechanism.") else to_chat(user, "Access denied.") - return + return TRUE else return ..() @@ -131,12 +132,12 @@ pickup_delay = 15 SECONDS drop_amount = 5 -/obj/structure/barricade/wooden/attackby(obj/item/I, mob/user) +/obj/structure/barricade/wooden/item_interact(obj/item/I, mob/user) if(istype(I,/obj/item/stack/sheet/wood)) var/obj/item/stack/sheet/wood/W = I if(W.amount < 5) to_chat(user, "You need at least five wooden planks to make a wall!") - return + return TRUE else to_chat(user, "You start adding [I] to [src]...") if(do_after(user, 50, target=src)) @@ -145,7 +146,7 @@ T.PlaceOnTop(/turf/closed/wall/mineral/wood/nonmetal) transfer_fingerprints_to(T) qdel(src) - return + return TRUE return ..() /obj/structure/barricade/wooden/pick_up_barricade() diff --git a/code/game/objects/items/devices/aicard.dm b/code/game/objects/items/devices/aicard.dm index 81230397f78ea..eae4f89786a13 100644 --- a/code/game/objects/items/devices/aicard.dm +++ b/code/game/objects/items/devices/aicard.dm @@ -94,7 +94,6 @@ to_chat(AI, "Your core files are being wiped!") while(AI.stat != DEAD && flush) AI.adjustOxyLoss(1) - AI.updatehealth() sleep(5) flush = FALSE . = TRUE diff --git a/code/game/objects/items/devices/antivirus.dm b/code/game/objects/items/devices/antivirus.dm index 50f7c761053b0..8e12f7b1076c0 100644 --- a/code/game/objects/items/devices/antivirus.dm +++ b/code/game/objects/items/devices/antivirus.dm @@ -4,7 +4,7 @@ var/resistcap = 6 //one higher than what it can cure icon_state = "antivirus4" -/obj/item/disk/antivirus/attack(mob/M, mob/user, def_zone) +/obj/item/disk/antivirus/attack_mob_target(mob/M, mob/user, def_zone) if(ishuman(M)) var/mob/living/carbon/human/H = M var/cured = 0 diff --git a/code/game/objects/items/devices/beacon.dm b/code/game/objects/items/devices/beacon.dm index b4c6aef9214fa..273de02902ad6 100644 --- a/code/game/objects/items/devices/beacon.dm +++ b/code/game/objects/items/devices/beacon.dm @@ -33,15 +33,15 @@ to_chat(user, "You [enabled ? "enable" : "disable"] the beacon.") return -/obj/item/beacon/attackby(obj/item/W, mob/user) +/obj/item/beacon/item_interact(obj/item/W, mob/user) if(istype(W, /obj/item/pen)) // needed for things that use custom names like the locator var/new_name = stripped_input(user, "What would you like the name to be?") if(!user.canUseTopic(src, BE_CLOSE)) - return + return TRUE if(new_name) name = new_name renamed = TRUE - return + return TRUE else return ..() diff --git a/code/game/objects/items/devices/chameleonproj.dm b/code/game/objects/items/devices/chameleonproj.dm index 09e735f7210ec..938dabafedecb 100644 --- a/code/game/objects/items/devices/chameleonproj.dm +++ b/code/game/objects/items/devices/chameleonproj.dm @@ -137,7 +137,8 @@ master = C master.active_dummy = src -/obj/effect/dummy/chameleon/attackby() +/obj/effect/dummy/chameleon/on_attacked(obj/item/I, mob/living/user) + ..() master.disrupt() //ATTACK HAND IGNORING PARENT RETURN VALUE @@ -147,7 +148,7 @@ /obj/effect/dummy/chameleon/attack_animal() master.disrupt() -/obj/effect/dummy/chameleon/attack_slime() +/obj/effect/dummy/chameleon/after_attacked_by_slime() master.disrupt() /obj/effect/dummy/chameleon/attack_alien() diff --git a/code/game/objects/items/devices/compressionkit.dm b/code/game/objects/items/devices/compressionkit.dm index 7305865cd483b..83f6ae0a355b9 100644 --- a/code/game/objects/items/devices/compressionkit.dm +++ b/code/game/objects/items/devices/compressionkit.dm @@ -72,8 +72,7 @@ to_chat(user, "Anomalous error. Summon a coder.") -/obj/item/compressionkit/attackby(obj/item/I, mob/user, params) - ..() +/obj/item/compressionkit/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/stack/ore/bluespace_crystal)) var/obj/item/stack/ore/bluespace_crystal/B = I charges += 2 @@ -82,3 +81,5 @@ B.amount -= 1 else qdel(I) + return TRUE + return ..() diff --git a/code/game/objects/items/devices/flashlight.dm b/code/game/objects/items/devices/flashlight.dm index 463878c0e7dea..1ae0af0617260 100644 --- a/code/game/objects/items/devices/flashlight.dm +++ b/code/game/objects/items/devices/flashlight.dm @@ -56,7 +56,7 @@ user.visible_message("[user] is putting [src] close to [user.p_their()] eyes and turning it on! It looks like [user.p_theyre()] trying to commit suicide!") return (FIRELOSS) -/obj/item/flashlight/attack(mob/living/carbon/M, mob/living/carbon/human/user) +/obj/item/flashlight/attack_mob_target(mob/living/carbon/M, mob/living/carbon/human/user) add_fingerprint(user) if(istype(M) && on && (user.zone_selected in list(BODY_ZONE_PRECISE_EYES, BODY_ZONE_PRECISE_MOUTH))) @@ -323,7 +323,7 @@ if(.) user.visible_message("[user] lights \the [src].", "You light \the [src]!") force = on_damage - damtype = BURN + damtype = /datum/damage/burn if(!istype(src, /obj/item/flashlight/flare/torch)) add_emitter(/obj/emitter/sparks/flare, "spark", 10) add_emitter(/obj/emitter/flare_smoke, "smoke", 9) @@ -401,7 +401,7 @@ emp_cur_charges = min(emp_cur_charges+1, emp_max_charges) return TRUE -/obj/item/flashlight/emp/attack(mob/living/M, mob/living/user) +/obj/item/flashlight/emp/attack_mob_target(mob/living/M, mob/living/user) if(on && (user.zone_selected in list(BODY_ZONE_PRECISE_EYES, BODY_ZONE_PRECISE_MOUTH))) // call original attack when examining organs ..() return diff --git a/code/game/objects/items/devices/geiger_counter.dm b/code/game/objects/items/devices/geiger_counter.dm index ba318e4d61c6f..9d850f9a5dc42 100644 --- a/code/game/objects/items/devices/geiger_counter.dm +++ b/code/game/objects/items/devices/geiger_counter.dm @@ -158,19 +158,19 @@ else to_chat(user, "[icon2html(src, user)] Target is free of radioactive contamination.") -/obj/item/geiger_counter/attackby(obj/item/I, mob/user, params) +/obj/item/geiger_counter/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_SCREWDRIVER && (obj_flags & EMAGGED)) if(scanning) to_chat(user, "Turn off [src] before you perform this action!") - return 0 + return TRUE user.visible_message("[user] unscrews [src]'s maintenance panel and begins fiddling with its innards...", "You begin resetting [src]...") if(!I.use_tool(src, user, 40, volume=50)) - return 0 + return TRUE user.visible_message("[user] refastens [src]'s maintenance panel!", "You reset [src] to its factory settings!") obj_flags &= ~EMAGGED radiation_count = 0 update_icon() - return 1 + return TRUE else return ..() diff --git a/code/game/objects/items/devices/laserpointer.dm b/code/game/objects/items/devices/laserpointer.dm index 854c23e66aece..04bdd2593dd83 100644 --- a/code/game/objects/items/devices/laserpointer.dm +++ b/code/game/objects/items/devices/laserpointer.dm @@ -38,21 +38,23 @@ . = ..() diode = new /obj/item/stock_parts/micro_laser/ultra -/obj/item/laser_pointer/attackby(obj/item/W, mob/user, params) +/obj/item/laser_pointer/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/stock_parts/micro_laser)) if(!diode) if(!user.transferItemToLoc(W, src)) - return + return TRUE diode = W to_chat(user, "You install a [diode.name] in [src].") else to_chat(user, "[src] already has a diode installed.") + return TRUE else if(W.tool_behaviour == TOOL_SCREWDRIVER) if(diode) to_chat(user, "You remove the [diode.name] from \the [src].") diode.forceMove(drop_location()) diode = null + return TRUE else return ..() diff --git a/code/game/objects/items/devices/lightreplacer.dm b/code/game/objects/items/devices/lightreplacer.dm index c06342e3ebdae..c9c3183e195e7 100644 --- a/code/game/objects/items/devices/lightreplacer.dm +++ b/code/game/objects/items/devices/lightreplacer.dm @@ -73,46 +73,45 @@ . = ..() . += status_string() -/obj/item/lightreplacer/attackby(obj/item/W, mob/user, params) +/obj/item/lightreplacer/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/stack/sheet/glass)) var/obj/item/stack/sheet/glass/G = W if(uses >= max_uses) to_chat(user, "[src.name] is full.") - return else if(G.use(decrement)) AddUses(increment) to_chat(user, "You insert a piece of glass into \the [src.name]. You have [uses] light\s remaining.") - return else to_chat(user, "You need one sheet of glass to replace lights!") + return TRUE if(istype(W, /obj/item/shard)) if(uses >= max_uses) to_chat(user, "\The [src] is full.") - return + return TRUE if(!user.temporarilyRemoveItemFromInventory(W)) - return + return TRUE AddUses(round(increment*0.75)) to_chat(user, "You insert a shard of glass into \the [src]. You have [uses] light\s remaining.") qdel(W) - return + return TRUE if(istype(W, /obj/item/light)) var/obj/item/light/L = W if(L.status == 0) // LIGHT OKAY if(uses < max_uses) if(!user.temporarilyRemoveItemFromInventory(W)) - return + return TRUE AddUses(1) qdel(L) else if(!user.temporarilyRemoveItemFromInventory(W)) - return + return TRUE to_chat(user, "You insert [L] into \the [src].") AddShards(1, user) qdel(L) - return + return TRUE if(istype(W, /obj/item/storage)) var/obj/item/storage/S = W @@ -137,13 +136,15 @@ if(!found_lightbulbs) to_chat(user, "\The [S] contains no bulbs.") - return + return TRUE if(!replaced_something && src.uses == max_uses) to_chat(user, "\The [src] is full!") - return + return TRUE to_chat(user, "You fill \the [src] with lights from \the [S]. " + status_string() + "") + return TRUE + return ..() /obj/item/lightreplacer/should_emag(mob/user) return emaggable && ..() diff --git a/code/game/objects/items/devices/powersink.dm b/code/game/objects/items/devices/powersink.dm index d630c66c41207..67f2590965e11 100644 --- a/code/game/objects/items/devices/powersink.dm +++ b/code/game/objects/items/devices/powersink.dm @@ -61,7 +61,7 @@ update_appearance() set_light(0) -/obj/item/powersink/attackby(obj/item/I, mob/user, params) +/obj/item/powersink/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_WRENCH) if(mode == DISCONNECTED) var/turf/T = loc @@ -83,11 +83,13 @@ "[user] detaches \the [src] from the cable.", \ "You unbolt \the [src] from the floor and detach it from the cable.", "You hear some wires being disconnected from something.") + return TRUE else if(I.tool_behaviour == TOOL_SCREWDRIVER) user.visible_message( \ "[user] messes with \the [src] for a bit.", \ "You can't fit the screwdriver into \the [src]'s bolts! Try using a wrench.") + return TRUE else return ..() diff --git a/code/game/objects/items/devices/pressureplates.dm b/code/game/objects/items/devices/pressureplates.dm index f86eccacf00b4..8738613f8ded7 100644 --- a/code/game/objects/items/devices/pressureplates.dm +++ b/code/game/objects/items/devices/pressureplates.dm @@ -53,10 +53,11 @@ if(istype(sigdev)) sigdev.signal() -/obj/item/pressure_plate/attackby(obj/item/I, mob/living/L) +/obj/item/pressure_plate/item_interact(obj/item/I, mob/living/L) if(istype(I, /obj/item/assembly/signaler) && !istype(sigdev) && removable_signaller && L.transferItemToLoc(I, src)) sigdev = I to_chat(L, "You attach [I] to [src]!") + return TRUE return ..() /obj/item/pressure_plate/attack_self(mob/living/L) diff --git a/code/game/objects/items/devices/radio/electropack.dm b/code/game/objects/items/devices/radio/electropack.dm index e4e62ae722c8d..e9980f30b555a 100644 --- a/code/game/objects/items/devices/radio/electropack.dm +++ b/code/game/objects/items/devices/radio/electropack.dm @@ -37,14 +37,14 @@ return return ..() -/obj/item/electropack/attackby(obj/item/W, mob/user, params) +/obj/item/electropack/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/clothing/head/helmet)) var/obj/item/assembly/shock_kit/A = new /obj/item/assembly/shock_kit(user) A.icon = 'icons/obj/assemblies.dmi' if(!user.transferItemToLoc(W, A)) to_chat(user, "[W] is stuck to your hand, you cannot attach it to [src]!") - return + return TRUE W.master = A A.helmet_part = W @@ -54,6 +54,7 @@ user.put_in_hands(A) A.add_fingerprint(user) + return TRUE else return ..() diff --git a/code/game/objects/items/devices/radio/headset.dm b/code/game/objects/items/devices/radio/headset.dm index f6ad00f0ba3d0..a9f8466f903ea 100644 --- a/code/game/objects/items/devices/radio/headset.dm +++ b/code/game/objects/items/devices/radio/headset.dm @@ -295,7 +295,7 @@ GLOBAL_LIST_INIT(channel_tokens, list( /obj/item/radio/headset/silicon/can_receive(freq, level) return ..(freq, level, TRUE) -/obj/item/radio/headset/attackby(obj/item/W, mob/user, params) +/obj/item/radio/headset/item_interact(obj/item/W, mob/user, params) user.set_machine(src) if(W.tool_behaviour == TOOL_SCREWDRIVER) @@ -317,25 +317,27 @@ GLOBAL_LIST_INIT(channel_tokens, list( else to_chat(user, "This headset doesn't have any unique encryption keys! How useless...") + return TRUE else if(istype(W, /obj/item/encryptionkey)) if(keyslot && keyslot2) to_chat(user, "The headset can't hold another key!") - return + return TRUE if(!keyslot) if(!user.transferItemToLoc(W, src)) - return + return TRUE keyslot = W else if(!user.transferItemToLoc(W, src)) - return + return TRUE keyslot2 = W recalculateChannels() ui_update() + return TRUE else return ..() diff --git a/code/game/objects/items/devices/radio/intercom.dm b/code/game/objects/items/devices/radio/intercom.dm index 7fcf024b5b6f5..85837f0c5cfcb 100644 --- a/code/game/objects/items/devices/radio/intercom.dm +++ b/code/game/objects/items/devices/radio/intercom.dm @@ -29,7 +29,7 @@ else . += "It's unscrewed from the wall, and can be detached." -/obj/item/radio/intercom/attackby(obj/item/I, mob/living/user, params) +/obj/item/radio/intercom/item_interact(obj/item/I, mob/living/user, params) if(I.tool_behaviour == TOOL_SCREWDRIVER) if(unscrewed) user.visible_message("[user] starts tightening [src]'s screws...", "You start screwing in [src]...") @@ -41,11 +41,11 @@ if(I.use_tool(src, user, 40, volume=50)) user.visible_message("[user] loosens [src]'s screws!", "You unscrew [src], loosening it from the wall.") unscrewed = TRUE - return + return TRUE else if(I.tool_behaviour == TOOL_WRENCH) if(!unscrewed) to_chat(user, "You need to unscrew [src] from the wall first!") - return + return TRUE user.visible_message("[user] starts unsecuring [src]...", "You start unsecuring [src]...") I.play_tool_sound(src) if(I.use_tool(src, user, 80)) @@ -53,7 +53,7 @@ playsound(src, 'sound/items/deconstruct.ogg', 50, 1) new/obj/item/wallframe/intercom(get_turf(src)) qdel(src) - return + return TRUE return ..() /obj/item/radio/intercom/attack_ai(mob/user) diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index 73007e063f861..8e03d9349c073 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -368,7 +368,7 @@ if (in_range(src, user) && !headset) . += "Ctrl-Shift-click on the [name] to toggle speaker.
Alt-click on the [name] to toggle broadcasting.
" -/obj/item/radio/attackby(obj/item/W, mob/user, params) +/obj/item/radio/item_interact(obj/item/W, mob/user, params) add_fingerprint(user) if(W.tool_behaviour == TOOL_SCREWDRIVER) unscrewed = !unscrewed @@ -376,6 +376,7 @@ to_chat(user, "The radio can now be attached and modified!") else to_chat(user, "The radio can no longer be modified or attached!") + return TRUE else return ..() @@ -422,7 +423,7 @@ . = ..() set_frequency(FREQ_SYNDICATE) -/obj/item/radio/borg/attackby(obj/item/W, mob/user, params) +/obj/item/radio/borg/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_SCREWDRIVER) if(keyslot) @@ -443,20 +444,22 @@ else to_chat(user, "This radio doesn't have any encryption keys!") + return TRUE else if(istype(W, /obj/item/encryptionkey/)) if(keyslot) to_chat(user, "The radio can't hold another key!") - return + return TRUE if(!keyslot) if(!user.transferItemToLoc(W, src)) - return + return TRUE keyslot = W recalculateChannels() ui_update() - + return TRUE + return ..() /obj/item/radio/off // Station bounced radios, their only difference is spawning with the speakers off, this was made to help the lag. listening = 0 // And it's nice to have a subtype too for future features. diff --git a/code/game/objects/items/devices/reverse_bear_trap.dm b/code/game/objects/items/devices/reverse_bear_trap.dm index 2597bea3b625f..dab9640a335c8 100644 --- a/code/game/objects/items/devices/reverse_bear_trap.dm +++ b/code/game/objects/items/devices/reverse_bear_trap.dm @@ -82,7 +82,7 @@ return ..() -/obj/item/reverse_bear_trap/attack(mob/living/target, mob/living/user) +/obj/item/reverse_bear_trap/attack_mob_target(mob/living/target, mob/living/user) if(target.get_item_by_slot(ITEM_SLOT_HEAD)) to_chat(user, "Remove [target.p_their()] headgear first!") return @@ -111,7 +111,7 @@ jill.emote("scream") playsound(src, 'sound/effects/snap.ogg', 75, TRUE, frequency = 0.5) playsound(src, 'sound/effects/splat.ogg', 50, TRUE, frequency = 0.5) - jill.apply_damage(9999, BRUTE, BODY_ZONE_HEAD) + jill.apply_damage(/datum/damage_source/sharp/heavy, /datum/damage/brute, 9999, BODY_ZONE_HEAD) jill.death() //just in case, for some reason, they're still alive flash_color(jill, flash_color = "#FF0000", flash_time = 100) diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index 790bf8300d554..07d2dc65ab069 100644 --- a/code/game/objects/items/devices/scanners.dm +++ b/code/game/objects/items/devices/scanners.dm @@ -164,7 +164,7 @@ GENE SCANNER to_chat(user, "You switch the health analyzer to check physical health.") scanmode = 0 -/obj/item/healthanalyzer/attack(mob/living/M, mob/living/carbon/human/user) +/obj/item/healthanalyzer/attack_mob_target(mob/living/M, mob/living/carbon/human/user) flick("[icon_state]-scan", src) //makes it so that it plays the scan animation upon scanning, including clumsy scanning playsound(src, 'sound/effects/fastbeep.ogg', 10) @@ -542,14 +542,15 @@ GENE SCANNER user.visible_message("[user] begins to analyze [user.p_them()]self with [src]! The display shows that [user.p_theyre()] dead!") return BRUTELOSS -/obj/item/analyzer/attackby(obj/O, mob/living/user) +/obj/item/analyzer/item_interact(obj/O, mob/living/user) if(istype(O, /obj/item/bodypart/l_arm/robot) || istype(O, /obj/item/bodypart/r_arm/robot)) to_chat(user, "You add [O] to [src].") qdel(O) qdel(src) user.put_in_hands(new /obj/item/bot_assembly/atmosbot) + return TRUE else - ..() + return ..() /obj/item/analyzer/attack_self(mob/user) add_fingerprint(user) @@ -755,7 +756,7 @@ GENE SCANNER throw_range = 7 materials = list(/datum/material/iron=30, /datum/material/glass=20) -/obj/item/slime_scanner/attack(mob/living/M, mob/living/user) +/obj/item/slime_scanner/attack_mob_target(mob/living/M, mob/living/user) if(user.stat || user.is_blind()) return if(!isslime(M)) @@ -865,7 +866,7 @@ GENE SCANNER throw_range = 7 materials = list(/datum/material/iron=200) -/obj/item/nanite_scanner/attack(mob/living/M, mob/living/carbon/human/user) +/obj/item/nanite_scanner/attack_mob_target(mob/living/M, mob/living/carbon/human/user) user.visible_message("[user] analyzes [M]'s nanites.", \ "You analyze [M]'s nanites.") @@ -896,7 +897,7 @@ GENE SCANNER var/ready = TRUE var/cooldown = 200 -/obj/item/sequence_scanner/attack(mob/living/M, mob/living/user) +/obj/item/sequence_scanner/attack_mob_target(mob/living/M, mob/living/user) add_fingerprint(user) if(!HAS_TRAIT(M, TRAIT_RADIMMUNE) && !HAS_TRAIT(M, TRAIT_BADDNA)) //no scanning if its a husk or DNA-less Species user.visible_message("[user] analyzes [M]'s genetic sequence.", \ @@ -1008,21 +1009,23 @@ GENE SCANNER . = ..() scanner = new(src) -/obj/item/extrapolator/attackby(obj/item/W, mob/user, params) +/obj/item/extrapolator/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/stock_parts/scanning_module)) if(!scanner) if(!user.transferItemToLoc(W, src)) - return + return TRUE scanner = W to_chat(user, "You install a [scanner.name] in [src].") else to_chat(user, "[src] already has a scanner installed.") + return TRUE else if(W.tool_behaviour == TOOL_SCREWDRIVER) if(scanner) to_chat(user, "You remove the [scanner.name] from \the [src].") scanner.forceMove(drop_location()) scanner = null + return TRUE else return ..() @@ -1047,7 +1050,7 @@ GENE SCANNER . += "A class [scanner.rating] scanning module is installed. It is screwed in place." -/obj/item/extrapolator/attack(atom/AM, mob/living/user) +/obj/item/extrapolator/attack_mob_target(atom/AM, mob/living/user) return /obj/item/extrapolator/afterattack(atom/target, mob/user, proximity_flag, click_parameters) diff --git a/code/game/objects/items/devices/sound_synth.dm b/code/game/objects/items/devices/sound_synth.dm index 11d4109470486..8566a7807846f 100644 --- a/code/game/objects/items/devices/sound_synth.dm +++ b/code/game/objects/items/devices/sound_synth.dm @@ -98,7 +98,7 @@ return pick_sound() -/obj/item/soundsynth/attack(mob/living/target, mob/living/user, def_zone) +/obj/item/soundsynth/attack_mob_target(mob/living/target, mob/living/user, def_zone) if(target == user) pick_sound() return diff --git a/code/game/objects/items/devices/swapper.dm b/code/game/objects/items/devices/swapper.dm index ccb5fa00f3475..602ed6f6364ce 100644 --- a/code/game/objects/items/devices/swapper.dm +++ b/code/game/objects/items/devices/swapper.dm @@ -27,20 +27,21 @@ icon_state = "swapper" ..() -/obj/item/swapper/attackby(obj/item/I, mob/user, params) +/obj/item/swapper/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/swapper)) var/obj/item/swapper/other_swapper = I if(other_swapper.linked_swapper) to_chat(user, "[other_swapper] is already linked. Break the current link to establish a new one.") - return + return TRUE if(linked_swapper) to_chat(user, "[src] is already linked. Break the current link to establish a new one.") - return + return TRUE to_chat(user, "You establish a quantum link between the two devices.") linked_swapper = other_swapper other_swapper.linked_swapper = src update_icon() linked_swapper.update_icon() + return TRUE else return ..() diff --git a/code/game/objects/items/devices/taperecorder.dm b/code/game/objects/items/devices/taperecorder.dm index b2b614e4d0489..e408e6fd31d46 100644 --- a/code/game/objects/items/devices/taperecorder.dm +++ b/code/game/objects/items/devices/taperecorder.dm @@ -38,14 +38,15 @@ . += "The wire panel is [open_panel ? "opened" : "closed"]." -/obj/item/taperecorder/attackby(obj/item/I, mob/user, params) +/obj/item/taperecorder/item_interact(obj/item/I, mob/user, params) if(!mytape && istype(I, /obj/item/tape)) if(!user.transferItemToLoc(I,src)) - return + return TRUE mytape = I to_chat(user, "You insert [I] into [src].") update_icon() - + return TRUE + return ..() /obj/item/taperecorder/proc/eject(mob/user) if(mytape) @@ -307,12 +308,14 @@ ruined = 0 -/obj/item/tape/attackby(obj/item/I, mob/user, params) +/obj/item/tape/item_interact(obj/item/I, mob/user, params) if(ruined && I.tool_behaviour == TOOL_SCREWDRIVER || istype(I, /obj/item/pen)) to_chat(user, "You start winding the tape back in...") if(I.use_tool(src, user, 120)) to_chat(user, "You wound the tape back in.") fix() + return TRUE + return ..() //Random colour tapes /obj/item/tape/random diff --git a/code/game/objects/items/devices/traitordevices.dm b/code/game/objects/items/devices/traitordevices.dm index 6705e9c977078..f6ab858fbed77 100644 --- a/code/game/objects/items/devices/traitordevices.dm +++ b/code/game/objects/items/devices/traitordevices.dm @@ -78,7 +78,7 @@ effective or pretty fucking useless. var/intensity = 10 // how much damage the radiation does var/wavelength = 10 // time it takes for the radiation to kick in, in seconds -/obj/item/healthanalyzer/rad_laser/attack(mob/living/M, mob/living/user) +/obj/item/healthanalyzer/rad_laser/attack_mob_target(mob/living/M, mob/living/user) if(!stealth || !irradiate) ..() if(!irradiate) @@ -262,8 +262,7 @@ effective or pretty fucking useless. layer = MOB_LAYER attack_verb = null -/obj/item/shadowcloak/magician/attackby(obj/item/W, mob/user, params) - . = ..() +/obj/item/shadowcloak/magician/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/upgradewand)) var/obj/item/upgradewand/wand = W if(!wand.used && max_charge == initial(max_charge)) @@ -272,6 +271,8 @@ effective or pretty fucking useless. max_charge = 450 to_chat(user, "You upgrade the [src] with the [wand].
") playsound(user, 'sound/weapons/emitter2.ogg', 25, 1, -1) + return TRUE + return ..() /obj/item/jammer name = "signal jammer" diff --git a/code/game/objects/items/devices/transfer_valve.dm b/code/game/objects/items/devices/transfer_valve.dm index 8b6d1ad9d75a1..70ec648425011 100644 --- a/code/game/objects/items/devices/transfer_valve.dm +++ b/code/game/objects/items/devices/transfer_valve.dm @@ -23,20 +23,20 @@ /obj/item/transfer_valve/IsAssemblyHolder() return TRUE -/obj/item/transfer_valve/attackby(obj/item/item, mob/user, params) +/obj/item/transfer_valve/item_interact(obj/item/item, mob/user, params) if(istype(item, /obj/item/tank)) if(tank_one && tank_two) to_chat(user, "There are already two tanks attached, remove one first!") - return + return TRUE if(!tank_one) if(!user.transferItemToLoc(item, src)) - return + return TRUE tank_one = item to_chat(user, "You attach the tank to the transfer valve.") else if(!tank_two) if(!user.transferItemToLoc(item, src)) - return + return TRUE tank_two = item to_chat(user, "You attach the tank to the transfer valve.") @@ -45,17 +45,18 @@ update_icon() + return TRUE //TODO: Have this take an assemblyholder else if(isassembly(item)) var/obj/item/assembly/A = item if(A.secured) to_chat(user, "The device is secured.") - return + return TRUE if(attached_device) to_chat(user, "There is already a device attached to the valve, remove it first!") - return + return TRUE if(!user.transferItemToLoc(item, src)) - return + return TRUE attached_device = A to_chat(user, "You attach the [item] to the valve controls and secure it.") A.on_attach() @@ -63,7 +64,8 @@ A.toggle_secure() //this calls update_icon(), which calls update_icon() on the holder (i.e. the bomb). log_bomber(user, "attached a [item.name] to a ttv -", src, null, FALSE) attacher = user - return + return TRUE + return ..() //Attached device memes /obj/item/transfer_valve/Move() diff --git a/code/game/objects/items/dna_injector.dm b/code/game/objects/items/dna_injector.dm index b3a72c79d3116..95939b95cb574 100644 --- a/code/game/objects/items/dna_injector.dm +++ b/code/game/objects/items/dna_injector.dm @@ -48,7 +48,7 @@ return TRUE return FALSE -/obj/item/dnainjector/attack(mob/living/target, mob/living/user) +/obj/item/dnainjector/attack_mob_target(mob/living/target, mob/living/user) if(!user.IsAdvancedToolUser()) to_chat(user, "You don't have the dexterity to do this!") return diff --git a/code/game/objects/items/documents.dm b/code/game/objects/items/documents.dm index 9976848bdfc46..4c2142317240b 100644 --- a/code/game/objects/items/documents.dm +++ b/code/game/objects/items/documents.dm @@ -45,7 +45,7 @@ var/obj/item/documents/photocopy/C = copy copy_type = C.copy_type -/obj/item/documents/photocopy/attackby(obj/item/O, mob/user, params) +/obj/item/documents/photocopy/item_interact(obj/item/O, mob/user, params) if(istype(O, /obj/item/toy/crayon/red) || istype(O, /obj/item/toy/crayon/blue)) if (forgedseal) to_chat(user, "You have already forged a seal on [src]!") @@ -56,3 +56,5 @@ forgedseal = C.crayon_color to_chat(user, "You forge the official seal with a [C.crayon_color] crayon. No one will notice... right?") update_icon() + return TRUE + return ..() diff --git a/code/game/objects/items/dualsaber.dm b/code/game/objects/items/dualsaber.dm index 3db34e3ca9dc5..257c56e755ccb 100644 --- a/code/game/objects/items/dualsaber.dm +++ b/code/game/objects/items/dualsaber.dm @@ -116,7 +116,7 @@ user.visible_message("[user] begins beating [user.p_them()]self to death with \the [src]'s handle! It probably would've been cooler if [user.p_they()] turned it on first!") return BRUTELOSS -/obj/item/dualsaber/attack(mob/target, mob/living/carbon/user) +/obj/item/dualsaber/attack_mob_target(mob/target, mob/living/carbon/user) var/wielded = ISWIELDED(src) if(user.has_dna()) if(user.dna.check_mutation(HULK)) @@ -190,7 +190,7 @@ /obj/item/dualsaber/purple possible_colors = list("purple") -/obj/item/dualsaber/attackby(obj/item/W, mob/user, params) +/obj/item/dualsaber/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_MULTITOOL) if(!hacked) hacked = TRUE @@ -200,5 +200,6 @@ update_icon() else to_chat(user, "It's starting to look like a triple rainbow - no, nevermind.") + return TRUE else return ..() diff --git a/code/game/objects/items/extinguisher.dm b/code/game/objects/items/extinguisher.dm index 09a96094b010d..050edb7e328ae 100644 --- a/code/game/objects/items/extinguisher.dm +++ b/code/game/objects/items/extinguisher.dm @@ -78,16 +78,16 @@ to_chat(user, "The safety is [safety ? "on" : "off"].") return -/obj/item/extinguisher/attack(mob/M, mob/user) +/obj/item/extinguisher/attack_mob_target(mob/M, mob/user) if(user.a_intent == INTENT_HELP && !safety) //If we're on help intent and going to spray people, don't bash them. return FALSE else return ..() -/obj/item/extinguisher/attack_obj(obj/O, mob/living/user) - if(AttemptRefill(O, user)) +/obj/item/extinguisher/interact_with(atom/target, mob/user, params) + if(AttemptRefill(target, user)) refilling = TRUE - return FALSE + return TRUE else return ..() @@ -228,11 +228,12 @@ user.visible_message("[user] empties out \the [src] onto the floor using the release valve.", "You quietly empty out \the [src] using its release valve.") //firebot assembly -/obj/item/extinguisher/attackby(obj/O, mob/user, params) +/obj/item/extinguisher/item_interact(obj/O, mob/user, params) if(istype(O, /obj/item/bodypart/l_arm/robot) || istype(O, /obj/item/bodypart/r_arm/robot)) to_chat(user, "You add [O] to [src].") qdel(O) qdel(src) user.put_in_hands(new /obj/item/bot_assembly/firebot) + return TRUE else - ..() + return ..() diff --git a/code/game/objects/items/flamethrower.dm b/code/game/objects/items/flamethrower.dm index e48e1674f9d45..f3126b8d43f78 100644 --- a/code/game/objects/items/flamethrower.dm +++ b/code/game/objects/items/flamethrower.dm @@ -85,7 +85,7 @@ log_combat(user, target, "flamethrowered", src) flame_turf(turflist) -/obj/item/flamethrower/attackby(obj/item/W, mob/user, params) +/obj/item/flamethrower/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_WRENCH && !status)//Taking this apart var/turf/T = get_turf(src) if(weldtool) @@ -99,25 +99,25 @@ ptank = null new /obj/item/stack/rods(T) qdel(src) - return + return TRUE else if(W.tool_behaviour == TOOL_SCREWDRIVER && igniter && !lit) status = !status to_chat(user, "[igniter] is now [status ? "secured" : "unsecured"]!") update_icon() - return + return TRUE else if(isigniter(W)) var/obj/item/assembly/igniter/I = W if(I.secured) - return + return TRUE if(igniter) - return + return TRUE if(!user.transferItemToLoc(W, src)) - return + return TRUE igniter = I update_icon() - return + return TRUE else if(istype(W, /obj/item/tank/internals/plasma)) if(ptank) @@ -125,12 +125,12 @@ ptank.forceMove(get_turf(src)) ptank = W to_chat(user, "You swap the plasma tank in [src]!") - return + return TRUE if(!user.transferItemToLoc(W, src)) - return + return TRUE ptank = W update_icon() - return + return TRUE else return ..() @@ -243,7 +243,7 @@ /obj/item/flamethrower/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) var/obj/projectile/P = hitby - if(damage && attack_type == PROJECTILE_ATTACK && P.damage_type != STAMINA && prob(15)) + if(damage && attack_type == PROJECTILE_ATTACK && P.damage_type != STAMINA_DAMTYPE && prob(15)) owner.visible_message("\The [attack_text] hits the fuel tank on [owner]'s [name], rupturing it! What a shot!") var/turf/target_turf = get_turf(owner) log_game("A projectile ([hitby]) detonated a flamethrower tank held by [key_name(owner)] at [COORD(target_turf)]") diff --git a/code/game/objects/items/food/cake.dm b/code/game/objects/items/food/cake.dm index da2c21da3cea8..bed653700956b 100644 --- a/code/game/objects/items/food/cake.dm +++ b/code/game/objects/items/food/cake.dm @@ -256,10 +256,10 @@ /obj/item/food/cake/birthday/energy/proc/energy_bite(mob/living/user) to_chat(user, "As you eat the cake, you accidentally hurt yourself on the embedded energy sword!") - user.apply_damage(30, BURN, BODY_ZONE_HEAD) // ITs an ENERGY sword, so it burns, duh + user.apply_damage(/datum/damage_source/consumption, /datum/damage/burn, 30, BODY_ZONE_HEAD) // ITs an ENERGY sword, so it burns, duh playsound(user, 'sound/weapons/blade1.ogg', 5, TRUE) -/obj/item/food/cake/birthday/energy/attack(mob/living/target_mob, mob/living/user) +/obj/item/food/cake/birthday/energy/attack_mob_target(mob/living/target_mob, mob/living/user) . = ..() if(HAS_TRAIT(user, TRAIT_PACIFISM) && target_mob != user) //Prevents pacifists from attacking others directly return @@ -282,10 +282,10 @@ /obj/item/food/cakeslice/birthday/energy/proc/energy_bite(mob/living/user) to_chat(user, "As you eat the cake slice, you accidentally hurt yourself on the embedded energy dagger!") - user.apply_damage(18, BURN, BODY_ZONE_HEAD) + user.apply_damage(/datum/damage_source/consumption, /datum/damage/burn, 18, BODY_ZONE_HEAD) playsound(user, 'sound/weapons/blade1.ogg', 5, TRUE) -/obj/item/food/cakeslice/birthday/energy/attack(mob/living/target_mob, mob/living/user) +/obj/item/food/cakeslice/birthday/energy/attack_mob_target(mob/living/target_mob, mob/living/user) . = ..() if(HAS_TRAIT(user, TRAIT_PACIFISM) && target_mob != user) //Prevents pacifists from attacking others directly return diff --git a/code/game/objects/items/granters.dm b/code/game/objects/items/granters.dm index b9e0a8ab618fd..1fd15acee86c0 100644 --- a/code/game/objects/items/granters.dm +++ b/code/game/objects/items/granters.dm @@ -355,8 +355,9 @@ to_chat(user, "[src] explodes!") playsound(src,'sound/effects/explosion1.ogg',40,1) user.flash_act(1, 1) - user.adjustBruteLoss(6) - user.adjustFireLoss(6) + var/datum/damage_source/explosion/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(user, BRUTE, 6, null) + damage_source.apply_direct(user, BURN, 6, null) qdel(src) /obj/item/book/granter/martial/carp diff --git a/code/game/objects/items/grenades/_grenade.dm b/code/game/objects/items/grenades/_grenade.dm index b4cef71600967..2272412ec9f9c 100644 --- a/code/game/objects/items/grenades/_grenade.dm +++ b/code/game/objects/items/grenades/_grenade.dm @@ -137,7 +137,7 @@ var/mob/M = loc M.dropItemToGround(src) -/obj/item/grenade/attackby(obj/item/W, mob/user, params) +/obj/item/grenade/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_SCREWDRIVER) switch(det_time) if(1) @@ -150,6 +150,7 @@ det_time = 1 to_chat(user, "You set the [name] for instant detonation.") add_fingerprint(user) + return TRUE else return ..() @@ -158,7 +159,7 @@ /obj/item/grenade/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) var/obj/projectile/P = hitby - if(damage && attack_type == PROJECTILE_ATTACK && P.damage_type != STAMINA && prob(15)) + if(damage && attack_type == PROJECTILE_ATTACK && P.damage_type != STAMINA_DAMTYPE && prob(15)) owner.visible_message("[attack_text] hits [owner]'s [src], setting it off! What a shot!") var/turf/T = get_turf(src) log_game("A projectile ([hitby]) detonated a grenade held by [key_name(owner)] at [COORD(T)]") diff --git a/code/game/objects/items/grenades/chem_grenade.dm b/code/game/objects/items/grenades/chem_grenade.dm index 4d6f0f2b9b64a..6e297845aa238 100644 --- a/code/game/objects/items/grenades/chem_grenade.dm +++ b/code/game/objects/items/grenades/chem_grenade.dm @@ -57,16 +57,17 @@ if(stage == GRENADE_WIRED) wires.interact(user) -/obj/item/grenade/chem_grenade/attackby(obj/item/I, mob/user, params) +/obj/item/grenade/chem_grenade/item_interact(obj/item/I, mob/user, params) if(istype(I,/obj/item/assembly) && stage == GRENADE_WIRED) wires.interact(user) + return TRUE if(I.tool_behaviour == TOOL_SCREWDRIVER) if(dud_flags & GRENADE_USED) to_chat(user, "You started to reset the trigger.") if (do_after(user, 2 SECONDS, src)) to_chat(user, "You reset the trigger.") dud_flags &= ~GRENADE_USED - return + return TRUE if(stage == GRENADE_WIRED) if(beakers.len) stage_change(GRENADE_READY) @@ -82,25 +83,26 @@ to_chat(user, "You modify the time delay. It's set for [DisplayTimeText(det_time)].") else to_chat(user, "You need to add a wire!") - return + return TRUE else if(stage == GRENADE_WIRED && is_type_in_list(I, allowed_containers)) . = TRUE //no afterattack if(is_type_in_list(I, banned_containers)) to_chat(user, "[src] is too small to fit [I]!") // this one hits home huh anon? - return + return TRUE if(beakers.len == 2) to_chat(user, "[src] can not hold more containers!") - return + return TRUE else if(I.reagents.total_volume) if(!user.transferItemToLoc(I, src)) - return + return TRUE to_chat(user, "You add [I] to the [initial(name)] assembly.") beakers += I var/reagent_list = pretty_string_from_reagent_list(I.reagents) user.log_message("inserted [I] ([reagent_list]) into [src]",LOG_GAME) else to_chat(user, "[I] is empty!") + return TRUE else if(stage == GRENADE_EMPTY && istype(I, /obj/item/stack/cable_coil)) var/obj/item/stack/cable_coil/C = I @@ -110,11 +112,12 @@ to_chat(user, "You rig the [initial(name)] assembly.") else to_chat(user, "You need one length of coil to wire the assembly!") - return + return TRUE else if(stage == GRENADE_READY && I.tool_behaviour == TOOL_WIRECUTTER && !active) stage_change(GRENADE_WIRED) to_chat(user, "You unlock the [initial(name)] assembly.") + return TRUE else if(stage == GRENADE_WIRED && I.tool_behaviour == TOOL_WRENCH) if(beakers.len) @@ -127,10 +130,11 @@ beakers = list() to_chat(user, "You open the [initial(name)] assembly and remove the payload.") wires.detach_assembly(wires.get_wire(1)) - return + return TRUE new /obj/item/stack/cable_coil(get_turf(src),1) stage_change(GRENADE_EMPTY) to_chat(user, "You remove the activation mechanism from the [initial(name)] assembly.") + return TRUE else return ..() @@ -254,12 +258,13 @@ //I tried to just put it in the allowed_containers list but //if you do that it must have reagents. If you're going to //make a special case you might as well do it explicitly. -Sayu -/obj/item/grenade/chem_grenade/large/attackby(obj/item/I, mob/user, params) +/obj/item/grenade/chem_grenade/large/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/slime_extract) && stage == GRENADE_WIRED) if(!user.transferItemToLoc(I, src)) - return + return TRUE to_chat(user, "You add [I] to the [initial(name)] assembly.") beakers += I + return TRUE else return ..() @@ -285,7 +290,7 @@ icon_state = "timeg" var/unit_spread = 10 // Amount of units per repeat. Can be altered with a multitool. -/obj/item/grenade/chem_grenade/adv_release/attackby(obj/item/I, mob/user, params) +/obj/item/grenade/chem_grenade/adv_release/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_MULTITOOL) switch(unit_spread) if(0 to 24) @@ -295,8 +300,8 @@ else unit_spread = 5 to_chat(user, " You set the time release to [unit_spread] units per detonation.") - return - ..() + return TRUE + return ..() /obj/item/grenade/chem_grenade/adv_release/prime(mob/living/lanced_by) if(stage != GRENADE_READY || dud_flags) diff --git a/code/game/objects/items/grenades/flashbang.dm b/code/game/objects/items/grenades/flashbang.dm index 278e82934ec01..d1a2469a208ac 100644 --- a/code/game/objects/items/grenades/flashbang.dm +++ b/code/game/objects/items/grenades/flashbang.dm @@ -119,7 +119,7 @@ M.Paralyze(20) M.Knockdown(200) M.soundbang_act(1, 200, 10, 15) - if(M.apply_damages(10, 10)) + if(M.apply_damage(/datum/damage_source/explosion, /datum/damage/burn, 20, ran_zone())) to_chat(M, "The blast from \the [src] bruises and burns you!") // only checking if they're on top of the tile, cause being one tile over will be its own punishment diff --git a/code/game/objects/items/grenades/plastic.dm b/code/game/objects/items/grenades/plastic.dm index a2a0374933e11..31457f8834695 100644 --- a/code/game/objects/items/grenades/plastic.dm +++ b/code/game/objects/items/grenades/plastic.dm @@ -39,26 +39,26 @@ target = null ..() -/obj/item/grenade/plastic/attackby(obj/item/I, mob/user, params) +/obj/item/grenade/plastic/item_interact(obj/item/I, mob/user, params) if(!nadeassembly && istype(I, /obj/item/assembly_holder)) var/obj/item/assembly_holder/A = I if(!user.transferItemToLoc(I, src)) - return ..() + return TRUE nadeassembly = A A.master = src assemblyattacher = user.ckey to_chat(user, "You add [A] to the [name].") playsound(src, 'sound/weapons/tap.ogg', 20, 1) update_icon() - return + return TRUE if(nadeassembly && I.tool_behaviour == TOOL_WIRECUTTER) I.play_tool_sound(src, 20) nadeassembly.forceMove(get_turf(src)) nadeassembly.master = null nadeassembly = null update_icon() - return - ..() + return TRUE + return ..() /obj/item/grenade/plastic/prime(mob/living/lanced_by) . = ..() @@ -211,12 +211,14 @@ prime() user.gib(1, 1) -/obj/item/grenade/plastic/c4/attackby(obj/item/I, mob/user, params) +/obj/item/grenade/plastic/c4/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_SCREWDRIVER) open_panel = !open_panel to_chat(user, "You [open_panel ? "open" : "close"] the wire panel.") + return TRUE else if(is_wire_tool(I)) wires.interact(user) + return TRUE else return ..() @@ -242,7 +244,7 @@ explosion(location,0,0,3) qdel(src) -/obj/item/grenade/plastic/c4/attack(mob/M, mob/user, def_zone) +/obj/item/grenade/plastic/c4/attack_mob_target(mob/M, mob/user, def_zone) return // X4 is an upgraded directional variant of c4 which is relatively safe to be standing next to. And much less safe to be standing on the other side of. diff --git a/code/game/objects/items/handcuffs.dm b/code/game/objects/items/handcuffs.dm index cf5478cfbd15b..7cffbbb610fb0 100644 --- a/code/game/objects/items/handcuffs.dm +++ b/code/game/objects/items/handcuffs.dm @@ -41,7 +41,7 @@ var/cuffsound = 'sound/weapons/handcuffs.ogg' var/trashtype = null //for disposable cuffs -/obj/item/restraints/handcuffs/attack(mob/living/carbon/C, mob/living/user) +/obj/item/restraints/handcuffs/attack_mob_target(mob/living/carbon/C, mob/living/user) if(!istype(C)) return @@ -147,7 +147,7 @@ desc = "Fake handcuffs meant for gag purposes." breakouttime = 10 //Deciseconds = 1s -/obj/item/restraints/handcuffs/cable/attackby(obj/item/I, mob/user, params) +/obj/item/restraints/handcuffs/cable/item_interact(obj/item/I, mob/user, params) ..() if(istype(I, /obj/item/stack/rods)) var/obj/item/stack/rods/R = I @@ -159,22 +159,23 @@ qdel(src) else to_chat(user, "You need one rod to make a wired rod!") - return + return TRUE else if(istype(I, /obj/item/stack/sheet/iron)) var/obj/item/stack/sheet/iron/M = I if(M.get_amount() < 6) to_chat(user, "You need at least six iron sheets to make good enough weights!") - return + return TRUE to_chat(user, "You begin to apply [I] to [src]...") if(do_after(user, 35, target = src)) if(M.get_amount() < 6 || !M) - return + return TRUE var/obj/item/restraints/legcuffs/bola/S = new /obj/item/restraints/legcuffs/bola M.use(6) user.put_in_hands(S) to_chat(user, "You make some weights out of [I] and tie them to [src].") remove_item_from_storage(user) qdel(src) + return TRUE else return ..() @@ -194,7 +195,7 @@ icon_state = "cuff_used" item_state = "cuff" -/obj/item/restraints/handcuffs/cable/zipties/used/attack() +/obj/item/restraints/handcuffs/cable/zipties/used/attack_mob_target() return //Legcuffs @@ -284,7 +285,7 @@ close_trap() L.visible_message("[L] triggers \the [src].", \ "You trigger \the [src]!") - L.apply_damage(trap_damage, BRUTE, def_zone) + L.apply_damage(/datum/damage_source/sharp/heavy, /datum/damage/brute, trap_damage, def_zone) /obj/item/restraints/legcuffs/beartrap/energy name = "energy snare" diff --git a/code/game/objects/items/his_grace.dm b/code/game/objects/items/his_grace.dm index e302a94a462a0..2377d5067e535 100644 --- a/code/game/objects/items/his_grace.dm +++ b/code/game/objects/items/his_grace.dm @@ -44,7 +44,7 @@ if(!awakened) INVOKE_ASYNC(src, PROC_REF(awaken), user) -/obj/item/his_grace/attack(mob/living/M, mob/user) +/obj/item/his_grace/attack_mob_target(mob/living/M, mob/user) if(awakened && M.stat) consume(M) else @@ -95,7 +95,8 @@ master.remove_status_effect(STATUS_EFFECT_HISGRACE) REMOVE_TRAIT(src, TRAIT_NODROP, HIS_GRACE_TRAIT) master.Paralyze(60) - master.adjustBruteLoss(master.maxHealth) + var/datum/damage_source/damage_source = GET_DAMAGE_SOURCE(damtype) + damage_source.apply_direct(master, BRUTE, master.maxHealth, null) playsound(master, 'sound/effects/splat.ogg', 100, 0) else master.apply_status_effect(STATUS_EFFECT_HISGRACE) @@ -119,7 +120,8 @@ do_attack_animation(L, null, src) playsound(L, 'sound/weapons/smash.ogg', 50, 1) playsound(L, 'sound/misc/desecration-01.ogg', 50, 1) - L.adjustBruteLoss(force) + var/datum/damage_source/damage_source = GET_DAMAGE_SOURCE(damtype) + damage_source.apply_direct(L, BRUTE, force, null) adjust_bloodthirst(-5) //Don't stop attacking they're right there! else consume(L) @@ -181,7 +183,8 @@ return var/victims = 0 meal.visible_message("[src] swings open and devours [meal]!", "[src] consumes you!") - meal.adjustBruteLoss(200) + var/datum/damage_source/damage_source = GET_DAMAGE_SOURCE(damtype) + damage_source.apply_direct(meal, BRUTE, 200, null) playsound(meal, 'sound/misc/desecration-02.ogg', 75, 1) playsound(src, 'sound/items/eatfood.ogg', 100, 1) meal.forceMove(src) diff --git a/code/game/objects/items/holosign_creator.dm b/code/game/objects/items/holosign_creator.dm index 2fabe9eeca14b..a0ca150f9e3f5 100644 --- a/code/game/objects/items/holosign_creator.dm +++ b/code/game/objects/items/holosign_creator.dm @@ -62,7 +62,7 @@ else to_chat(user, "[src] is projecting at max capacity!") -/obj/item/holosign_creator/attack(mob/living/carbon/human/M, mob/user) +/obj/item/holosign_creator/attack_mob_target(mob/living/carbon/human/M, mob/user) return /obj/item/holosign_creator/attack_self(mob/user) diff --git a/code/game/objects/items/holy_weapons.dm b/code/game/objects/items/holy_weapons.dm index 39d03f44ab1e4..fcc4d3dce0f42 100644 --- a/code/game/objects/items/holy_weapons.dm +++ b/code/game/objects/items/holy_weapons.dm @@ -411,7 +411,7 @@ item_flags = ABSTRACT | DROPDEL w_class = WEIGHT_CLASS_HUGE hitsound = 'sound/weapons/sear.ogg' - damtype = BURN + damtype = /datum/damage/burn attack_verb = list("punched", "cross countered", "pummeled") block_upgrade_walk = 0 @@ -508,7 +508,7 @@ item_state = "multiverse" slot_flags = ITEM_SLOT_BELT -/obj/item/nullrod/claymore/multiverse/attack(mob/living/carbon/M, mob/living/carbon/user) +/obj/item/nullrod/claymore/multiverse/attack_mob_target(mob/living/carbon/M, mob/living/carbon/user) force = rand(1, 30) ..() diff --git a/code/game/objects/items/implants/implant_chem.dm b/code/game/objects/items/implants/implant_chem.dm index fbbbf51a79aac..9f5f6b3312b1e 100644 --- a/code/game/objects/items/implants/implant_chem.dm +++ b/code/game/objects/items/implants/implant_chem.dm @@ -57,7 +57,7 @@ desc = "A glass case containing a remote chemical implant." imp_type = /obj/item/implant/chem -/obj/item/implantcase/chem/attackby(obj/item/W, mob/user, params) +/obj/item/implantcase/chem/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/reagent_containers/syringe) && imp) W.afterattack(imp, user, TRUE, params) return TRUE diff --git a/code/game/objects/items/implants/implant_storage.dm b/code/game/objects/items/implants/implant_storage.dm index a0ad3b721cf53..cd53c8de80572 100644 --- a/code/game/objects/items/implants/implant_storage.dm +++ b/code/game/objects/items/implants/implant_storage.dm @@ -17,7 +17,7 @@ I.add_mob_blood(implantee) lostimplant.do_quick_empty() implantee.visible_message("A bluespace pocket opens around [src] as it exits [implantee], spewing out its contents and rupturing the surrounding tissue!") - implantee.apply_damage(20, BRUTE, BODY_ZONE_CHEST) + implantee.apply_damage(/datum/damage_source/internal_rupture, /datum/damage/brute, 20, BODY_ZONE_CHEST) qdel(lostimplant) return ..() diff --git a/code/game/objects/items/implants/implantcase.dm b/code/game/objects/items/implants/implantcase.dm index 8999086d185fc..9b4acecd2ad6a 100644 --- a/code/game/objects/items/implants/implantcase.dm +++ b/code/game/objects/items/implants/implantcase.dm @@ -23,25 +23,26 @@ reagents = null -/obj/item/implantcase/attackby(obj/item/W, mob/user, params) +/obj/item/implantcase/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/pen)) if(!user.is_literate()) to_chat(user, "You scribble illegibly on the side of [src]!") - return + return TRUE var/t = stripped_input(user, "What would you like the label to be?", name, null) if(user.get_active_held_item() != W) - return + return TRUE if(!user.canUseTopic(src, BE_CLOSE)) - return + return TRUE if(t) name = "implant case - '[t]'" else name = "implant case" + return TRUE else if(istype(W, /obj/item/implanter)) var/obj/item/implanter/I = W if(I.imp) if(imp || I.imp.imp_in) - return + return TRUE I.imp.forceMove(src) imp = I.imp I.imp = null @@ -50,13 +51,13 @@ else if(imp) if(I.imp) - return + return TRUE imp.forceMove(I) I.imp = imp imp = null update_icon() I.update_icon() - + return TRUE else return ..() diff --git a/code/game/objects/items/implants/implanter.dm b/code/game/objects/items/implants/implanter.dm index bfa06589c23cd..c05fabcc85481 100644 --- a/code/game/objects/items/implants/implanter.dm +++ b/code/game/objects/items/implants/implanter.dm @@ -21,7 +21,7 @@ icon_state = "implanter0" -/obj/item/implanter/attack(mob/living/M, mob/user) +/obj/item/implanter/attack_mob_target(mob/living/M, mob/user) if(!istype(M)) return if(user && imp) @@ -42,20 +42,21 @@ else to_chat(user, "[src] fails to implant [M].") -/obj/item/implanter/attackby(obj/item/W, mob/user, params) +/obj/item/implanter/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/pen)) if(!user.is_literate()) to_chat(user, "You prod at [src] with [W]!") - return + return TRUE var/t = stripped_input(user, "What would you like the label to be?", name, null) if(user.get_active_held_item() != W) - return + return TRUE if(!user.canUseTopic(src, BE_CLOSE)) - return + return TRUE if(t) name = "implanter ([t])" else name = "implanter" + return TRUE else return ..() diff --git a/code/game/objects/items/implants/implantpad.dm b/code/game/objects/items/implants/implantpad.dm index 82fdf8131cb98..77df693566545 100644 --- a/code/game/objects/items/implants/implantpad.dm +++ b/code/game/objects/items/implants/implantpad.dm @@ -47,13 +47,14 @@ updateSelfDialog() update_icon() -/obj/item/implantpad/attackby(obj/item/implantcase/C, mob/user, params) +/obj/item/implantpad/item_interact(obj/item/implantcase/C, mob/user, params) if(istype(C, /obj/item/implantcase) && !case) if(!user.transferItemToLoc(C, src)) - return + return TRUE case = C updateSelfDialog() update_icon() + return TRUE else return ..() diff --git a/code/game/objects/items/inducer.dm b/code/game/objects/items/inducer.dm index f0d32cf422051..64dcf1aa62f33 100644 --- a/code/game/objects/items/inducer.dm +++ b/code/game/objects/items/inducer.dm @@ -33,15 +33,12 @@ if(cell && !(. & EMP_PROTECT_CONTENTS)) cell.emp_act(severity) -/obj/item/inducer/attack_obj(obj/O, mob/living/carbon/user) - if(user.a_intent == INTENT_HARM) - return ..() - +/obj/item/inducer/interact_with(atom/target, mob/user, params) if(cantbeused(user)) - return + return TRUE - if(recharge(O, user)) - return + if(recharge(target, user)) + return TRUE return ..() @@ -60,37 +57,37 @@ return FALSE -/obj/item/inducer/attackby(obj/item/W, mob/user) +/obj/item/inducer/item_interact(obj/item/W, mob/user) if(W.tool_behaviour == TOOL_SCREWDRIVER) W.play_tool_sound(src) if(!opened) to_chat(user, "You unscrew the battery compartment.") opened = TRUE update_icon() - return + return TRUE else to_chat(user, "You close the battery compartment.") opened = FALSE update_icon() - return + return TRUE if(istype(W, /obj/item/stock_parts/cell)) if(opened) if(!cell) if(!user.transferItemToLoc(W, src)) - return + return TRUE to_chat(user, "You insert [W] into [src].") cell = W update_icon() - return + return TRUE else to_chat(user, "[src] already has \a [cell] installed!") - return + return TRUE if(cantbeused(user)) - return + return TRUE if(recharge(W, user)) - return + return TRUE return ..() @@ -144,7 +141,7 @@ recharging = FALSE -/obj/item/inducer/attack(mob/M, mob/user) +/obj/item/inducer/attack_mob_target(mob/M, mob/user) if(user.a_intent == INTENT_HARM) return ..() diff --git a/code/game/objects/items/kitchen.dm b/code/game/objects/items/kitchen.dm index a871a441ff57c..8f4f756ab3972 100644 --- a/code/game/objects/items/kitchen.dm +++ b/code/game/objects/items/kitchen.dm @@ -36,7 +36,7 @@ playsound(src, 'sound/items/eatfood.ogg', 50, 1) return BRUTELOSS -/obj/item/kitchen/fork/attack(mob/living/carbon/M, mob/living/carbon/user) +/obj/item/kitchen/fork/attack_mob_target(mob/living/carbon/M, mob/living/carbon/user) if(!istype(M)) return ..() @@ -49,15 +49,9 @@ M.reagents.add_reagent(forkload.type, 1) icon_state = "fork" forkload = null + return ..() - else if(user.zone_selected == BODY_ZONE_PRECISE_EYES) - if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50)) - M = user - return eyestab(M,user) - else - return ..() - -/obj/item/kitchen/knife/poison/attack(mob/living/M, mob/user) +/obj/item/kitchen/knife/poison/attack_mob_target(mob/living/M, mob/user) if (!istype(M)) return . = ..() @@ -96,14 +90,6 @@ AddComponent(/datum/component/butchering, 80 - force, 100, force - 10) //bonus chance increases depending on force -/obj/item/kitchen/knife/attack(mob/living/carbon/M, mob/living/carbon/user) - if(user.zone_selected == BODY_ZONE_PRECISE_EYES) - if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50)) - M = user - return eyestab(M,user) - else - return ..() - /obj/item/kitchen/knife/suicide_act(mob/user) user.visible_message(pick("[user] is slitting [user.p_their()] wrists with the [src.name]! It looks like [user.p_theyre()] trying to commit suicide.", \ "[user] is slitting [user.p_their()] throat with the [src.name]! It looks like [user.p_theyre()] trying to commit suicide.", \ diff --git a/code/game/objects/items/latexballoon.dm b/code/game/objects/items/latexballoon.dm index ca61f9fe5f675..47c999cd82391 100644 --- a/code/game/objects/items/latexballoon.dm +++ b/code/game/objects/items/latexballoon.dm @@ -49,10 +49,11 @@ if(temperature > T0C+100) burst() -/obj/item/latexballon/attackby(obj/item/W, mob/user, params) +/obj/item/latexballon/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/tank)) var/obj/item/tank/T = W blow(T, user) - return + return TRUE if (W.is_sharp() || W.is_hot() || is_pointed(W)) burst() + return ..() diff --git a/code/game/objects/items/mail.dm b/code/game/objects/items/mail.dm index 963d2f56385e2..527ebd38e5506 100644 --- a/code/game/objects/items/mail.dm +++ b/code/game/objects/items/mail.dm @@ -128,7 +128,7 @@ postmark_image.appearance_flags |= RESET_COLOR add_overlay(postmark_image) -/obj/item/mail/attackby(obj/item/W, mob/user, params) +/obj/item/mail/item_interact(obj/item/W, mob/user, params) // Destination tagging if(istype(W, /obj/item/dest_tagger)) var/obj/item/dest_tagger/destination_tag = W @@ -138,6 +138,8 @@ to_chat(user, "*[tag]*") sort_tag = destination_tag.currTag playsound(loc, 'sound/machines/twobeep_high.ogg', 100, 1) + return TRUE + return ..() /obj/item/mail/attack_self(mob/user) if(recipient_ref) diff --git a/code/game/objects/items/manuals.dm b/code/game/objects/items/manuals.dm index 968ce6317c124..6193b80fcfd64 100644 --- a/code/game/objects/items/manuals.dm +++ b/code/game/objects/items/manuals.dm @@ -424,7 +424,8 @@ H.bleed_rate = 5 H.gib_animation() sleep(3) - H.adjustBruteLoss(1000) //to make the body super-bloody + var/datum/damage_source/explosion/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(H, BRUTE, 1000, null) //to make the body super-bloody H.spawn_gibs() H.spill_organs() H.spread_bodyparts() diff --git a/code/game/objects/items/melee/energy.dm b/code/game/objects/items/melee/energy.dm index ba3b679c356fe..cad5b837f393c 100644 --- a/code/game/objects/items/melee/energy.dm +++ b/code/game/objects/items/melee/energy.dm @@ -141,7 +141,7 @@ sword_color = "red" var/hitcost = 50 -/obj/item/melee/transforming/energy/sword/cyborg/attack(mob/M, var/mob/living/silicon/robot/R) +/obj/item/melee/transforming/energy/sword/cyborg/attack_mob_target(mob/M, var/mob/living/silicon/robot/R) if(R.cell) var/obj/item/stock_parts/cell/C = R.cell if(active && !(C.use(hitcost))) @@ -211,7 +211,7 @@ /obj/item/melee/transforming/energy/sword/saber/purple possible_colors = list("purple" = LIGHT_COLOR_LAVENDER) -/obj/item/melee/transforming/energy/sword/saber/attackby(obj/item/W, mob/living/user, params) +/obj/item/melee/transforming/energy/sword/saber/item_interact(obj/item/W, mob/living/user, params) if(W.tool_behaviour == TOOL_MULTITOOL) if(!hacked) hacked = TRUE @@ -223,6 +223,7 @@ user.update_inv_hands() else balloon_alert(user, "It's already fabulous!") + return TRUE else return ..() diff --git a/code/game/objects/items/melee/misc.dm b/code/game/objects/items/melee/misc.dm index 4cb503ea7afe9..f6ea2a12b281c 100644 --- a/code/game/objects/items/melee/misc.dm +++ b/code/game/objects/items/melee/misc.dm @@ -126,11 +126,13 @@ if(!QDELETED(affecting) && affecting.dismemberable && affecting.owner == user && !QDELETED(user)) playsound(user, hitsound, 25, 1) affecting.dismember(BRUTE) - user.adjustBruteLoss(20) + var/datum/damage_source/damage_source = GET_DAMAGE_SOURCE(damtype) + damage_source.apply_direct(user, BRUTE, 20, null) /obj/item/melee/sabre/proc/manual_suicide(mob/living/user, originally_nodropped) if(!QDELETED(user)) - user.adjustBruteLoss(200) + var/datum/damage_source/damage_source = GET_DAMAGE_SOURCE(damtype) + damage_source.apply_direct(user, BRUTE, 200, null) user.death(FALSE) REMOVE_TRAIT(src, TRAIT_NODROP, SABRE_SUICIDE_TRAIT) @@ -232,10 +234,9 @@ /obj/item/melee/classic_baton/police name = "police baton" -/obj/item/melee/classic_baton/police/attack(mob/living/target, mob/living/user) +/obj/item/melee/classic_baton/police/attack_mob_target(mob/living/target, mob/living/user) if(!on) return ..() - var/def_check = target.getarmor(type = MELEE, penetration = armour_penetration) add_fingerprint(user) if((HAS_TRAIT(user, TRAIT_CLUMSY)) && prob(50)) @@ -243,11 +244,7 @@ user.adjustStaminaLoss(stamina_damage) additional_effects_carbon(user) // user is the target here - if(ishuman(user)) - var/mob/living/carbon/human/H = user - H.apply_damage(2*force, BRUTE, BODY_ZONE_HEAD) - else - user.take_bodypart_damage(2*force) + deal_attack(user, target, BODY_ZONE_HEAD, override_damage = 2 * force) return if(iscyborg(target)) // We don't stun if we're on harm. @@ -291,8 +288,10 @@ user.do_attack_animation(target) playsound(get_turf(src), on_stun_sound, 75, 1, -1) additional_effects_carbon(target, user) + var/datum/damage_source/source = GET_DAMAGE_SOURCE(damage_source) if((user.zone_selected == BODY_ZONE_HEAD) || (user.zone_selected == BODY_ZONE_CHEST)) - target.apply_damage(stamina_damage, STAMINA, BODY_ZONE_CHEST, def_check) + // Uses the default armour penetration source of the current held thing + source.deal_attack(user, src, target, /datum/damage/stamina, stamina_damage, BODY_ZONE_CHEST) log_combat(user, target, "stunned", src) target.visible_message(desc["visiblestun"], desc["localstun"]) if((user.zone_selected == BODY_ZONE_R_LEG) || (user.zone_selected == BODY_ZONE_L_LEG)) @@ -300,11 +299,11 @@ log_combat(user, target, "tripped", src) target.visible_message(desc["visibletrip"], desc["localtrip"]) if(user.zone_selected == BODY_ZONE_L_ARM) - target.apply_damage(50, STAMINA, BODY_ZONE_L_ARM, def_check) + source.deal_attack(user, src, target, /datum/damage/stamina, 50, BODY_ZONE_L_ARM) log_combat(user, target, "disarmed", src) target.visible_message(desc["visibledisarm"], desc["localdisarm"]) if(user.zone_selected == BODY_ZONE_R_ARM) - target.apply_damage(50, STAMINA, BODY_ZONE_R_ARM, def_check) + source.deal_attack(user, src, target, /datum/damage/stamina, 50, BODY_ZONE_R_ARM) log_combat(user, target, "disarmed", src) target.visible_message(desc["visibledisarm"], desc["localdisarm"]) @@ -463,7 +462,7 @@ /obj/item/melee/classic_baton/retractible_stun/proc/check_disabled(mob/living/target, mob/living/user) return FALSE -/obj/item/melee/classic_baton/retractible_stun/attack(mob/living/target, mob/living/user) +/obj/item/melee/classic_baton/retractible_stun/attack_mob_target(mob/living/target, mob/living/user) if(!on) return ..() @@ -480,11 +479,8 @@ user.adjustStaminaLoss(stamina_damage) additional_effects_carbon(user) // user is the target here - if(ishuman(user)) - var/mob/living/carbon/human/H = user - H.apply_damage(2*force, BRUTE, BODY_ZONE_HEAD) - else - user.take_bodypart_damage(2*force) + var/datum/damage_source/source = GET_DAMAGE_SOURCE(damage_source) + source.deal_attack(user, src, target, /datum/damage/brute, 2 * force, BODY_ZONE_HEAD) return if(iscyborg(target)) // We don't stun if we're on harm. @@ -703,7 +699,7 @@ attack_verb = list("flogged", "whipped", "lashed", "disciplined") hitsound = 'sound/weapons/whip.ogg' -/obj/item/melee/curator_whip/attack(mob/living/target, mob/living/user) +/obj/item/melee/curator_whip/attack_mob_target(mob/living/target, mob/living/user) . = ..() if(!ishuman(target)) return @@ -776,20 +772,21 @@ playsound(src.loc, 'sound/weapons/batonextend.ogg', 50, 1) add_fingerprint(user) -/obj/item/melee/roastingstick/attackby(atom/target, mob/user) - ..() +/obj/item/melee/roastingstick/item_interact(atom/target, mob/user) if (istype(target, /obj/item/reagent_containers/food/snacks/sausage)) if (!on) to_chat(user, "You must extend [src] to attach anything to it!") - return + return TRUE if (held_sausage) to_chat(user, "[held_sausage] is already attached to [src]!") - return + return TRUE if (user.transferItemToLoc(target, src)) held_sausage = target else to_chat(user, "[target] doesn't seem to want to get on [src]!") - update_icon() + update_icon() + return TRUE + return ..() /obj/item/melee/roastingstick/attack_hand(mob/user) ..() @@ -869,7 +866,7 @@ var/cooldown = 0 var/knockbackpower = 6 -/obj/item/melee/knockback_stick/attack(mob/living/target, mob/living/user) +/obj/item/melee/knockback_stick/attack_mob_target(mob/living/target, mob/living/user) add_fingerprint(user) if(cooldown <= world.time) diff --git a/code/game/objects/items/melee/transforming.dm b/code/game/objects/items/melee/transforming.dm index 8d0b3c587120e..a00eaac0d431d 100644 --- a/code/game/objects/items/melee/transforming.dm +++ b/code/game/objects/items/melee/transforming.dm @@ -37,7 +37,7 @@ if(transform_weapon(user)) clumsy_transform_effect(user) -/obj/item/melee/transforming/attack(mob/living/target, mob/living/carbon/human/user) +/obj/item/melee/transforming/attack_mob_target(mob/living/target, mob/living/carbon/human/user) var/nemesis_faction = FALSE if(LAZYLEN(nemesis_factions)) for(var/F in target.faction) diff --git a/code/game/objects/items/miscellaneous.dm b/code/game/objects/items/miscellaneous.dm index 3a8fa5aae0941..13eb43e732935 100644 --- a/code/game/objects/items/miscellaneous.dm +++ b/code/game/objects/items/miscellaneous.dm @@ -278,7 +278,7 @@ var/maximum_size = 2 //one human, two pets, unlimited tiny mobs, but no big boys like megafauna var/kidnappingcoefficient = 1 -/obj/item/clothing/head/that/bluespace/attackby(obj/item/W, mob/user, params) +/obj/item/clothing/head/that/bluespace/item_interact(obj/item/W, mob/user, params) . = ..() if(istype(W, /obj/item/upgradewand)) var/obj/item/upgradewand/wand = W @@ -289,6 +289,8 @@ maximum_size = 4 to_chat(user, "You upgrade the [src] with the [wand].
") playsound(user, 'sound/weapons/emitter2.ogg', 25, 1, -1) + return TRUE + return ..() /obj/item/clothing/head/that/bluespace/afterattack(atom/target, mob/user, proximity_flag, click_parameters) . = ..() diff --git a/code/game/objects/items/mjolnir.dm b/code/game/objects/items/mjolnir.dm index bac7f387dba4a..e0db278eefc91 100644 --- a/code/game/objects/items/mjolnir.dm +++ b/code/game/objects/items/mjolnir.dm @@ -42,7 +42,7 @@ target.throw_at(throw_target, 200, 4) return -/obj/item/mjolnir/attack(mob/living/M, mob/user) +/obj/item/mjolnir/attack_mob_target(mob/living/M, mob/user) ..() if(ISWIELDED(src)) playsound(src.loc, "sparks", 50, 1) diff --git a/code/game/objects/items/pet_carrier.dm b/code/game/objects/items/pet_carrier.dm index 5efe3a176391e..5ab37fbb1a2e3 100644 --- a/code/game/objects/items/pet_carrier.dm +++ b/code/game/objects/items/pet_carrier.dm @@ -81,7 +81,7 @@ playsound(user, 'sound/machines/boltsup.ogg', 30, TRUE) update_icon() -/obj/item/pet_carrier/attack(mob/living/target, mob/living/user) +/obj/item/pet_carrier/attack_mob_target(mob/living/target, mob/living/user) if(user.a_intent == INTENT_HARM) return ..() if(!open) diff --git a/code/game/objects/items/pitchfork.dm b/code/game/objects/items/pitchfork.dm index 4217d42c7e5e5..5637a2ea27ee1 100644 --- a/code/game/objects/items/pitchfork.dm +++ b/code/game/objects/items/pitchfork.dm @@ -65,16 +65,12 @@ var/mob/living/U = user U.visible_message("As [U] picks [src] up, [U]'s arms briefly catch fire.", \ "\"As you pick up [src] your arms ignite, reminding you of all your past sins.\"") - if(ishuman(U)) - var/mob/living/carbon/human/H = U - H.apply_damage(rand(force/2, force), BURN, pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM)) - else - U.adjustFireLoss(rand(force/2,force)) + U.apply_damage(/datum/damage_source/magic, /datum/damage/burn, rand(force/2, force), pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM)) -/obj/item/pitchfork/demonic/attack(mob/target, mob/living/carbon/human/user) +/obj/item/pitchfork/demonic/attack_mob_target(mob/target, mob/living/carbon/human/user) if(user.mind && user.owns_soul() && !is_devil(user)) to_chat(user, "[src] burns in your hands.") - user.apply_damage(rand(force/2, force), BURN, pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM)) + user.apply_damage(/datum/damage_source/magic, /datum/damage/burn, rand(force/2, force), pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM)) ..() /obj/item/pitchfork/demonic/ascended/afterattack(atom/target, mob/user, proximity) diff --git a/code/game/objects/items/plushes.dm b/code/game/objects/items/plushes.dm index c027d1201b52b..6722fa3a8054c 100644 --- a/code/game/objects/items/plushes.dm +++ b/code/game/objects/items/plushes.dm @@ -116,12 +116,12 @@ else to_chat(user, "You try to pet [src], but it has no stuffing. Aww...") -/obj/item/toy/plush/attackby(obj/item/I, mob/living/user, params) +/obj/item/toy/plush/item_interact(obj/item/I, mob/living/user, params) if(I.is_sharp()) if(!grenade) if(!stuffed) to_chat(user, "You already murdered it!") - return + return TRUE if(!divine) user.visible_message("[user] tears out the stuffing from [src]!", "You rip a bunch of the stuffing from [src]. Murderer.") I.play_tool_sound(src) @@ -132,25 +132,25 @@ to_chat(user, "You remove the grenade from [src].") user.put_in_hands(grenade) grenade = null - return + return TRUE if(istype(I, /obj/item/grenade)) if(stuffed) to_chat(user, "You need to remove some stuffing first!") - return + return TRUE if(grenade) to_chat(user, "[src] already has a grenade!") - return + return TRUE if(!user.transferItemToLoc(I, src)) - return + return TRUE user.visible_message("[user] slides [grenade] into [src].", \ "You slide [I] into [src].") grenade = I var/turf/grenade_turf = get_turf(src) log_game("[key_name(user)] added a grenade ([I.name]) to [src] at [AREACOORD(grenade_turf)].") - return + return TRUE if(istype(I, /obj/item/toy/plush)) love(I, user) - return + return TRUE return ..() /obj/item/toy/plush/proc/love(obj/item/toy/plush/Kisser, mob/living/user) //~<3 diff --git a/code/game/objects/items/pneumaticCannon.dm b/code/game/objects/items/pneumaticCannon.dm index 61a115980ad44..d97388241a45e 100644 --- a/code/game/objects/items/pneumaticCannon.dm +++ b/code/game/objects/items/pneumaticCannon.dm @@ -70,18 +70,18 @@ out += "[icon2html(tank, user)] It has \a [tank] mounted onto it." . += out.Join("\n") -/obj/item/pneumatic_cannon/attackby(obj/item/W, mob/user, params) - if(user.a_intent == INTENT_HARM) - return ..() +/obj/item/pneumatic_cannon/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/tank/internals)) if(!tank) var/obj/item/tank/internals/IT = W if(IT.volume <= 3) to_chat(user, "\The [IT] is too small for \the [src].") - return + return TRUE updateTank(W, 0, user) + return TRUE else if(W.type == type) to_chat(user, "You're fairly certain that putting a pneumatic cannon inside another pneumatic cannon would cause a spacetime disruption.") + return TRUE else if(W.tool_behaviour == TOOL_WRENCH) switch(pressureSetting) if(1) @@ -91,14 +91,19 @@ if(3) pressureSetting = 1 to_chat(user, "You tweak \the [src]'s pressure output to [pressureSetting].") + return TRUE else if(W.tool_behaviour == TOOL_SCREWDRIVER) if(tank) updateTank(tank, 1, user) + return TRUE else if(loadedWeightClass >= maxWeightClass) to_chat(user, "\The [src] can't hold any more items!") + return TRUE else if(isitem(W)) var/obj/item/IW = W load_item(IW, user) + return TRUE + return ..() /obj/item/pneumatic_cannon/proc/can_load_item(obj/item/I, mob/user) if(!istype(I)) //Players can't load non items, this allows for admin varedit inserts. diff --git a/code/game/objects/items/powerfist.dm b/code/game/objects/items/powerfist.dm index 0614f8d6d24c9..978a79368cde6 100644 --- a/code/game/objects/items/powerfist.dm +++ b/code/game/objects/items/powerfist.dm @@ -32,13 +32,13 @@ . += "Its pressure gauge reads [round(tank.air_contents.total_moles(), 0.01)] mol at [round(tank.air_contents.return_pressure(),0.01)] kPa." -/obj/item/melee/powerfist/attackby(obj/item/W, mob/user, params) +/obj/item/melee/powerfist/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/tank/internals)) if(!tank) var/obj/item/tank/internals/IT = W if(IT.volume <= 3) to_chat(user, "\The [IT] is too small for \the [src].") - return + return TRUE updateTank(W, 0, user) else if(W.tool_behaviour == TOOL_WRENCH) switch(fisto_setting) @@ -50,9 +50,12 @@ fisto_setting = 1 W.play_tool_sound(src) to_chat(user, "You tweak \the [src]'s piston valve to [fisto_setting].") + return TRUE else if(W.tool_behaviour == TOOL_SCREWDRIVER) if(tank) updateTank(tank, 1, user) + return TRUE + return ..() /obj/item/melee/powerfist/proc/updateTank(obj/item/tank/internals/thetank, removing = 0, mob/living/carbon/human/user) if(removing) @@ -73,7 +76,7 @@ tank = thetank -/obj/item/melee/powerfist/attack(mob/living/target, mob/living/user) +/obj/item/melee/powerfist/attack_mob_target(mob/living/target, mob/living/user) if(!tank) to_chat(user, "\The [src] can't operate without a source of gas!") return diff --git a/code/game/objects/items/religion.dm b/code/game/objects/items/religion.dm index 316e537f4ce54..aad606d3c15d3 100644 --- a/code/game/objects/items/religion.dm +++ b/code/game/objects/items/religion.dm @@ -62,7 +62,7 @@ return /obj/item/banner/proc/inspiration(mob/living/carbon/human/H) - H.adjustBruteLoss(-15) + H.adjustBruteLossAbstract(-15) H.adjustFireLoss(-15) H.AdjustStun(-40) H.AdjustKnockdown(-40) diff --git a/code/game/objects/items/robot/robot_items.dm b/code/game/objects/items/robot/robot_items.dm index bf46dd8fd3f4f..93eb8852dfec3 100644 --- a/code/game/objects/items/robot/robot_items.dm +++ b/code/game/objects/items/robot/robot_items.dm @@ -10,8 +10,7 @@ icon_state = "elecarm" var/charge_cost = 30 -/obj/item/borg/stun/attack(mob/living/M, mob/living/user) - var/armor_block = M.run_armor_check(attack_flag = STAMINA) +/obj/item/borg/stun/attack_mob_target(mob/living/M, mob/living/user) if(ishuman(M)) var/mob/living/carbon/human/H = M if(H.check_shields(src, 0, "[M]'s [name]", MELEE_ATTACK)) @@ -21,9 +20,8 @@ var/mob/living/silicon/robot/R = user if(!R.cell.use(charge_cost)) return - M.apply_damage(80, STAMINA, blocked = armor_block) - user.do_attack_animation(M) - M.apply_effect(EFFECT_STUTTER, 5) + var/datum/damage_source/stun/stun_source = FIND_DAMAGE_SOURCE + stun_source.deal_attack(user, src, M, /datum/damage/stamina, 80) M.visible_message("[user] has prodded [M] with [src]!", \ "[user] has prodded you with [src]!") @@ -64,7 +62,7 @@ if(3) to_chat(user, "ERROR: ARM ACTUATORS OVERLOADED.") -/obj/item/borg/cyborghug/attack(mob/living/M, mob/living/silicon/robot/user) +/obj/item/borg/cyborghug/attack_mob_target(mob/living/M, mob/living/silicon/robot/user) if(M == user) return switch(mode) @@ -136,7 +134,8 @@ user.visible_message("[user] crushes [M]!", \ "You crush [M]!") playsound(loc, 'sound/weapons/smash.ogg', 50, 1, -1) - M.adjustBruteLoss(15) + var/datum/damage_source/crush/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(M, BRUTE, 15, null) user.cell.charge -= 300 ccooldown = world.time + 10 @@ -908,15 +907,14 @@ update_icon() return else - stored.melee_attack_chain(user, A, params) + stored.use_on(user, A, params) return . = ..() -/obj/item/borg/apparatus/attackby(obj/item/W, mob/user, params) +/obj/item/borg/apparatus/item_interact(obj/item/W, mob/user, params) if(stored) - W.melee_attack_chain(user, stored, params) - return - . = ..() + return W.use_on(user, stored, params) + return ..() ///////////////// //beaker holder// diff --git a/code/game/objects/items/robot/robot_parts.dm b/code/game/objects/items/robot/robot_parts.dm index ea09a028e6856..95ef4b4375747 100644 --- a/code/game/objects/items/robot/robot_parts.dm +++ b/code/game/objects/items/robot/robot_parts.dm @@ -137,7 +137,7 @@ chest.cell = temp_cell return TRUE -/obj/item/robot_suit/attackby(obj/item/W, mob/user, params) +/obj/item/robot_suit/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/stack/sheet/iron)) var/obj/item/stack/sheet/iron/M = W @@ -152,54 +152,58 @@ user.put_in_inactive_hand(B) else to_chat(user, "You need one sheet of iron to start building ED-209!") - return + return TRUE else if(istype(W, /obj/item/bodypart/l_leg/robot)) if(l_leg) - return + return TRUE if(!user.transferItemToLoc(W, src)) - return + return TRUE W.icon_state = initial(W.icon_state) W.cut_overlays() l_leg = W update_icon() + return TRUE else if(istype(W, /obj/item/bodypart/r_leg/robot)) if(src.r_leg) - return + return TRUE if(!user.transferItemToLoc(W, src)) - return + return TRUE W.icon_state = initial(W.icon_state) W.cut_overlays() r_leg = W update_icon() + return TRUE else if(istype(W, /obj/item/bodypart/l_arm/robot)) if(l_arm) - return + return TRUE if(!user.transferItemToLoc(W, src)) - return + return TRUE W.icon_state = initial(W.icon_state) W.cut_overlays() l_arm = W update_icon() + return TRUE else if(istype(W, /obj/item/bodypart/r_arm/robot)) if(r_arm) - return + return TRUE if(!user.transferItemToLoc(W, src)) - return + return TRUE W.icon_state = initial(W.icon_state)//in case it is a dismembered robotic limb W.cut_overlays() r_arm = W update_icon() + return TRUE else if(istype(W, /obj/item/bodypart/chest/robot)) var/obj/item/bodypart/chest/robot/CH = W if(chest) - return + return TRUE if(CH.wired && CH.cell) if(!user.transferItemToLoc(CH, src)) - return + return TRUE CH.icon_state = initial(CH.icon_state) //in case it is a dismembered robotic limb CH.cut_overlays() chest = CH @@ -208,76 +212,79 @@ to_chat(user, "You need to attach wires to it first!") else to_chat(user, "You need to attach a cell to it first!") + return TRUE else if(istype(W, /obj/item/bodypart/head/robot)) var/obj/item/bodypart/head/robot/HD = W for(var/X in HD.contents) if(istype(X, /obj/item/organ)) to_chat(user, "There are organs inside [HD]!") - return + return TRUE if(head) - return + return TRUE if(HD.flash2 && HD.flash1) if(!user.transferItemToLoc(HD, src)) - return + return TRUE HD.icon_state = initial(HD.icon_state)//in case it is a dismembered robotic limb HD.cut_overlays() head = HD update_icon() else to_chat(user, "You need to attach a flash to it first!") + return TRUE else if (W.tool_behaviour == TOOL_MULTITOOL) if(check_completion()) Interact(user) else to_chat(user, "The endoskeleton must be assembled before debugging can begin!") + return TRUE else if(istype(W, /obj/item/mmi)) var/obj/item/mmi/M = W if(check_completion()) if(!chest.cell) to_chat(user, "The endoskeleton still needs a power cell!") - return + return TRUE if(!isturf(loc)) to_chat(user, "You can't put [M] in, the frame has to be standing on the ground to be perfectly precise!") - return + return TRUE if(!M.brainmob) to_chat(user, "Sticking an empty [M.name] into the frame would sort of defeat the purpose!") - return + return TRUE var/mob/living/brain/BM = M.brainmob if(!BM.key || !BM.mind) to_chat(user, "The MMI indicates that their mind is completely unresponsive; there's no point!") - return + return TRUE if(!BM.client) //braindead to_chat(user, "The MMI indicates that their mind is currently inactive; it might change!") - return + return TRUE if(BM.stat == DEAD || BM.suiciding || (M.brain && (M.brain.brain_death || M.brain.suicided))) to_chat(user, "Sticking a dead brain into the frame would sort of defeat the purpose!") - return + return TRUE if(M.brain?.organ_flags & ORGAN_FAILING) to_chat(user, "The MMI indicates that the brain is damaged!") - return + return TRUE if(is_banned_from(BM.ckey, JOB_NAME_CYBORG) || BM.client.get_exp_living(TRUE) <= MINUTES_REQUIRED_BASIC) to_chat(user, "This [M.name] is not compatible, try a different one!") - return + return TRUE if(QDELETED(src) || QDELETED(BM) || QDELETED(user) || !Adjacent(user)) if(!QDELETED(M)) to_chat(user, "This [M.name] does not seem to fit!") - return + return TRUE if(!user.temporarilyRemoveItemFromInventory(W)) - return + return TRUE var/mob/living/silicon/robot/O = new /mob/living/silicon/robot/nocell(get_turf(loc)) if(!O) - return + return TRUE if(M.laws && M.laws.id != DEFAULT_AI_LAWID) aisync = 0 @@ -333,19 +340,20 @@ else to_chat(user, "The MMI must go in after everything else!") + return TRUE else if(istype(W, /obj/item/borg/upgrade/ai)) var/obj/item/borg/upgrade/ai/M = W if(check_completion()) if(!chest.cell) to_chat(user, "The endoskeleton still needs a power cell!") - return + return TRUE if(!isturf(loc)) to_chat(user, "You cannot install[M], the frame has to be standing on the ground to be perfectly precise!") - return + return TRUE if(!user.temporarilyRemoveItemFromInventory(M)) to_chat(user, "[M] is stuck to your hand!") - return + return TRUE qdel(M) var/mob/living/silicon/robot/O = new /mob/living/silicon/robot/shell(get_turf(src)) @@ -371,9 +379,12 @@ if(!locomotion) O.lockcharge = TRUE O.update_mobility() + return TRUE else if(istype(W, /obj/item/pen)) to_chat(user, "You need to use a multitool to name [src]!") + return TRUE + else return ..() diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index c186f7203aeb4..bdb6b576a9011 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -428,12 +428,11 @@ repair_amount = initial(repair_amount) powercost = initial(powercost) if(cyborg.getBruteLoss()) - cyborg.adjustBruteLoss(repair_amount) + cyborg.adjustBruteLossAbstract(repair_amount) else if(cyborg.getFireLoss()) cyborg.adjustFireLoss(repair_amount) playsound(cyborg.loc, 'sound/items/welder2.ogg', 10) //Quiet so it isn't obnoxious, but still making itself known cyborg.cell.use(powercost) - cyborg.updatehealth() else to_chat(cyborg, "Unit fully repaired. [src] deactivated.") deactivate_sr() diff --git a/code/game/objects/items/sharpener.dm b/code/game/objects/items/sharpener.dm index daed28fd27ce5..c7eaacbb48138 100644 --- a/code/game/objects/items/sharpener.dm +++ b/code/game/objects/items/sharpener.dm @@ -11,30 +11,30 @@ var/requires_sharpness = 1 -/obj/item/sharpener/attackby(obj/item/I, mob/user, params) +/obj/item/sharpener/item_interact(obj/item/I, mob/user, params) if(used) to_chat(user, "The sharpening block is too worn to use again!") - return + return TRUE if(I.force >= max || I.throwforce >= max)//no esword sharpening to_chat(user, "[I] is much too powerful to sharpen further!") - return + return TRUE if(requires_sharpness && !I.is_sharp()) to_chat(user, "You can only sharpen items that are already sharp, such as knives!") - return + return TRUE if(istype(I, /obj/item/melee/transforming/energy)) to_chat(user, "You don't think \the [I] will be the thing getting modified if you use it on \the [src]!") - return + return TRUE var/signal_out = SEND_SIGNAL(I, COMSIG_ITEM_SHARPEN_ACT, increment, max) if(signal_out & COMPONENT_BLOCK_SHARPEN_MAXED) to_chat(user, "[I] is much too powerful to sharpen further!") - return + return TRUE if(signal_out & COMPONENT_BLOCK_SHARPEN_BLOCKED) to_chat(user, "[I] is not able to be sharpened right now!") - return + return TRUE if((signal_out & COMPONENT_BLOCK_SHARPEN_ALREADY) || (I.force > initial(I.force) && !signal_out)) to_chat(user, "[I] has already been refined before. It cannot be sharpened further!") - return + return TRUE if(!(signal_out & COMPONENT_BLOCK_SHARPEN_APPLIED)) I.force = clamp(I.force + increment, 0, max) user.visible_message("[user] sharpens [I] with [src]!", "You sharpen [I], making it much more deadly than before.") @@ -46,6 +46,7 @@ desc = "[desc] At least, it used to." used = 1 update_icon() + return TRUE /obj/item/sharpener/super name = "super whetstone" diff --git a/code/game/objects/items/shields.dm b/code/game/objects/items/shields.dm index 4bb85d92ddfba..1310101778805 100644 --- a/code/game/objects/items/shields.dm +++ b/code/game/objects/items/shields.dm @@ -21,7 +21,7 @@ var/attackforce = 0 if(isprojectile(hitby)) var/obj/projectile/P = hitby - if(P.damage_type != STAMINA)// disablers dont do shit to shields + if(P.damage_type != STAMINA_DAMTYPE)// disablers dont do shit to shields attackforce = (P.damage / 2) else if(isitem(hitby)) var/obj/item/I = hitby @@ -29,7 +29,7 @@ if(!I.damtype == BRUTE) attackforce = (attackforce / 2) attackforce = (attackforce * I.attack_weight) - if(I.damtype == STAMINA)//pure stamina damage wont affect blocks + if(I.damtype == STAMINA_DAMTYPE)//pure stamina damage wont affect blocks attackforce = 0 else if(isliving(hitby)) //not putting an anti stamina clause in here. only stamina damage simplemobs i know of are swarmers, and them eating shields makes sense var/mob/living/L = hitby @@ -53,11 +53,11 @@ else return ..() -/obj/item/shield/attackby(obj/item/weldingtool/W, mob/living/user, params) +/obj/item/shield/item_interact(obj/item/weldingtool/W, mob/living/user, params) if(istype(W)) if(obj_integrity < max_integrity) if(!W.tool_start_check(user, amount=0)) - return + return TRUE user.visible_message("[user] is welding the [src].", \ "You begin repairing the [src]]...") if(W.use_tool(src, user, 40, volume=50)) @@ -66,6 +66,7 @@ "You finish repairing some of the dents on [src].") else to_chat(user, "The [src] doesn't need repairing.") + return TRUE return ..() /obj/item/shield/examine(mob/user) @@ -102,12 +103,13 @@ var/cooldown = 0 //shield bash cooldown. based on world.time transparent = TRUE -/obj/item/shield/riot/attackby(obj/item/W, mob/user, params) +/obj/item/shield/riot/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/melee/baton)) if(cooldown < world.time - 25) user.visible_message("[user] bashes [src] with [W]!") playsound(user.loc, 'sound/effects/shieldbash.ogg', 50, 1) cooldown = world.time + return TRUE else if(istype(W, /obj/item/stack/sheet/mineral/titanium)) if (obj_integrity >= max_integrity) to_chat(user, "[src] is already in perfect condition.") @@ -116,6 +118,7 @@ T.use(1) obj_integrity = max_integrity to_chat(user, "You repair [src] with [T].") + return TRUE else return ..() @@ -193,8 +196,8 @@ . = ..() embedded_flash = new(src) -/obj/item/shield/riot/flash/attack(mob/living/M, mob/user) - . = embedded_flash.attack(M, user) +/obj/item/shield/riot/flash/attack_mob_target(mob/living/M, mob/user) + . = embedded_flash.attack_mob_target(M, user) update_icon() /obj/item/shield/riot/flash/attack_self(mob/living/carbon/user) @@ -208,24 +211,24 @@ update_icon() -/obj/item/shield/riot/flash/attackby(obj/item/W, mob/user) +/obj/item/shield/riot/flash/item_interact(obj/item/W, mob/user) if(istype(W, /obj/item/assembly/flash/handheld)) var/obj/item/assembly/flash/handheld/flash = W if(flash.burnt_out) to_chat(user, "No sense replacing it with a broken bulb.") - return + return TRUE else to_chat(user, "You begin to replace the bulb.") if(do_after(user, 20, target = user)) if(flash.burnt_out || !flash || QDELETED(flash)) - return + return TRUE playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE) qdel(embedded_flash) embedded_flash = flash flash.forceMove(src) update_icon() - return - ..() + return TRUE + return ..() /obj/item/shield/riot/flash/emp_act(severity) . = ..() diff --git a/code/game/objects/items/signs.dm b/code/game/objects/items/signs.dm index 05c042ec6e23a..a101e6ec8d33b 100644 --- a/code/game/objects/items/signs.dm +++ b/code/game/objects/items/signs.dm @@ -6,7 +6,7 @@ w_class = WEIGHT_CLASS_BULKY attack_verb = list("bashed","smacked") resistance_flags = FLAMMABLE - + var/label = "" var/last_wave = 0 @@ -28,9 +28,10 @@ name = "[label] sign" desc = "It reads: [label]" -/obj/item/picket_sign/attackby(obj/item/W, mob/user, params) +/obj/item/picket_sign/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/pen) || istype(W, /obj/item/toy/crayon)) retext(user) + return TRUE else return ..() diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index 988b1341f3313..8a5ae0a99776a 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -29,7 +29,7 @@ create_reagents(REAGENT_AMOUNT_PER_ITEM) reagents.add_reagent_list(reagent) -/obj/item/stack/medical/attack(mob/living/M, mob/user) +/obj/item/stack/medical/attack_mob_target(mob/living/M, mob/user) if(!M || !user || (isliving(M) && !M.can_inject(user, TRUE))) //If no mob, user and if we can't inject the mob just return return @@ -95,7 +95,7 @@ user.visible_message("[user] starts to apply [src] on [user.p_them()]self...", "You begin applying [src] on yourself...") if(!do_after(user, self_delay, M)) return - //After the do_mob to ensure metabolites have had time to process at least one tick. + //After the do_mob to ensure metabolites have had time to process at least one tick. if(reagent && (C.reagents.get_reagent_amount(/datum/reagent/metabolite/medicine/styptic_powder) || C.reagents.get_reagent_amount(/datum/reagent/metabolite/medicine/silver_sulfadiazine))) to_chat(user, "That stuff really hurt! You'll need to wait for the pain to go away before you can apply [src] to your wounds again, maybe someone else can help put it on for you.") return @@ -154,16 +154,17 @@ heal_brute = TRUE //Enables gauze to be used on simplemobs for healing max_amount = 12 -/obj/item/stack/medical/gauze/attackby(obj/item/I, mob/user, params) +/obj/item/stack/medical/gauze/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_WIRECUTTER || I.is_sharp()) if(get_amount() < 2) to_chat(user, "You need at least two gauzes to do this!") - return + return TRUE new /obj/item/stack/sheet/cotton/cloth(user.drop_location()) user.visible_message("[user] cuts [src] into pieces of cloth with [I].", \ "You cut [src] into pieces of cloth with [I].", \ "You hear cutting.") use(2) + return TRUE else return ..() diff --git a/code/game/objects/items/stacks/rods/rods.dm b/code/game/objects/items/stacks/rods/rods.dm index c4740895e710c..c874ff383c454 100644 --- a/code/game/objects/items/stacks/rods/rods.dm +++ b/code/game/objects/items/stacks/rods/rods.dm @@ -44,11 +44,11 @@ else icon_state = "rods" -/obj/item/stack/rods/attackby(obj/item/W, mob/user, params) +/obj/item/stack/rods/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_WELDER) if(get_amount() < 2) to_chat(user, "You need at least two rods to do this!") - return + return TRUE if(W.use_tool(src, user, 0, volume=40)) var/obj/item/stack/sheet/iron/new_item = new(usr.loc) @@ -61,6 +61,7 @@ R.use(2) if (!R && replace) user.put_in_hands(new_item) + return TRUE else if(istype(W, /obj/item/reagent_containers/food/snacks)) var/obj/item/reagent_containers/food/snacks/S = W @@ -71,6 +72,7 @@ else var/obj/item/reagent_containers/food/snacks/customizable/A = new/obj/item/reagent_containers/food/snacks/customizable/kebab(get_turf(src)) A.initialize_custom_food(src, S, user) + return TRUE else return ..() diff --git a/code/game/objects/items/stacks/sheets/mineral/glass.dm b/code/game/objects/items/stacks/sheets/mineral/glass.dm index accee2d559f84..32daeb809c478 100644 --- a/code/game/objects/items/stacks/sheets/mineral/glass.dm +++ b/code/game/objects/items/stacks/sheets/mineral/glass.dm @@ -31,17 +31,18 @@ /obj/item/stack/sheet/glass/get_recipes() return GLOB.glass_recipes -/obj/item/stack/sheet/glass/attackby(obj/item/W, mob/user, params) +/obj/item/stack/sheet/glass/item_interact(obj/item/W, mob/user, params) add_fingerprint(user) if(istype(W, /obj/item/stack/cable_coil)) var/obj/item/stack/cable_coil/CC = W if (get_amount() < 1 || CC.get_amount() < 5) to_chat(user, "You attach wire to the [name].") new /obj/item/stack/light_w(user.loc, 5, TRUE, user) + return TRUE else if(istype(W, /obj/item/stack/rods)) var/obj/item/stack/rods/V = W if (V.get_amount() >= 1 && get_amount() >= 1) @@ -53,7 +54,7 @@ user.put_in_hands(RG) else to_chat(user, "You need one rod and one sheet of glass to make reinforced glass!") - return + return TRUE else return ..() @@ -72,10 +73,6 @@ grind_results = list(/datum/reagent/silicon = 20, /datum/reagent/iron = 10) point_value = 4 -/obj/item/stack/sheet/rglass/attackby(obj/item/W, mob/user, params) - add_fingerprint(user) - ..() - /obj/item/stack/sheet/rglass/cyborg materials = list() var/datum/robot_energy_storage/glasource @@ -114,9 +111,7 @@ /obj/item/stack/sheet/plasmaglass/get_recipes() return GLOB.pglass_recipes -/obj/item/stack/sheet/plasmaglass/attackby(obj/item/W, mob/user, params) - add_fingerprint(user) - +/obj/item/stack/sheet/plasmaglass/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/stack/rods)) var/obj/item/stack/rods/V = W if (V.get_amount() >= 1 && get_amount() >= 1) @@ -128,7 +123,7 @@ user.put_in_hands(RG) else to_chat(user, "You need one rod and one sheet of plasma glass to make reinforced plasma glass!") - return + return TRUE else return ..() @@ -247,17 +242,18 @@ var/mob/living/carbon/human/H = user if(!H.gloves && !HAS_TRAIT(H, TRAIT_PIERCEIMMUNE)) // golems, etc to_chat(H, "[src] cuts into your hand!") - H.apply_damage(force*0.5, BRUTE, hit_hand) + H.apply_damage(/datum/damage_source/skin_prick, /datum/damage/brute, force * 0.5, hit_hand) else if(ismonkey(user)) var/mob/living/carbon/monkey/M = user if(!HAS_TRAIT(M, TRAIT_PIERCEIMMUNE)) to_chat(M, "[src] cuts into your hand!") - M.apply_damage(force*0.5, BRUTE, hit_hand) + M.apply_damage(/datum/damage_source/skin_prick, /datum/damage/brute, force * 0.5, hit_hand) -/obj/item/shard/attackby(obj/item/I, mob/user, params) +/obj/item/shard/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/lightreplacer)) - I.attackby(src, user) + use_on(user, I) + return TRUE else return ..() diff --git a/code/game/objects/items/stacks/sheets/mineral/materials.dm b/code/game/objects/items/stacks/sheets/mineral/materials.dm index ab94d94cd5045..e60ab6a4dda7e 100644 --- a/code/game/objects/items/stacks/sheets/mineral/materials.dm +++ b/code/game/objects/items/stacks/sheets/mineral/materials.dm @@ -91,11 +91,11 @@ Mineral Sheets /obj/item/stack/sheet/mineral/plasma/get_recipes() return GLOB.plasma_recipes -/obj/item/stack/sheet/mineral/plasma/attackby(obj/item/W as obj, mob/user as mob, params) +/// BACONTODO: Make it so attacking this ignites it too +/obj/item/stack/sheet/mineral/plasma/item_interact(obj/item/W as obj, mob/user as mob, params) if(W.is_hot() > 300)//If the temperature of the object is over 300, then ignite plasma_ignition(amount/5, user) - else - return ..() + return ..() /obj/item/stack/sheet/mineral/plasma/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > 300) @@ -208,15 +208,14 @@ Mineral Sheets grind_results = list(/datum/reagent/carbon = 20) novariants = TRUE -/obj/item/stack/sheet/mineral/coal/attackby(obj/item/W, mob/user, params) +/// BACONTODO: Attacking needs to ignite this too +/obj/item/stack/sheet/mineral/coal/item_interact(obj/item/W, mob/user, params) if(W.is_hot() > 300)//If the temperature of the object is over 300, then ignite var/turf/T = get_turf(src) message_admins("Coal ignited by [ADMIN_LOOKUPFLW(user)] in [ADMIN_VERBOSEJMP(T)]") log_game("Coal ignited by [key_name(user)] in [AREACOORD(T)]") fire_act(W.is_hot()) - return TRUE - else - return ..() + return ..() /obj/item/stack/sheet/mineral/coal/fire_act(exposed_temperature, exposed_volume) atmos_spawn_air("co2=[amount*10];TEMP=[exposed_temperature]") diff --git a/code/game/objects/items/stacks/sheets/mineral/telecrystal.dm b/code/game/objects/items/stacks/sheets/mineral/telecrystal.dm index 381b0aca074f0..b3a1a70f6eca1 100644 --- a/code/game/objects/items/stacks/sheets/mineral/telecrystal.dm +++ b/code/game/objects/items/stacks/sheets/mineral/telecrystal.dm @@ -9,7 +9,7 @@ item_flags = NOBLUDGEON | ISWEAPON merge_type = /obj/item/stack/sheet/telecrystal -/obj/item/stack/sheet/telecrystal/attack(mob/target, mob/user) +/obj/item/stack/sheet/telecrystal/attack_mob_target(mob/target, mob/user) if(target == user) //You can't go around smacking people with crystals to find out if they have an uplink or not. for(var/obj/item/implant/uplink/I in target) if(I?.imp_in) diff --git a/code/game/objects/items/stacks/sheets/miscellaneous/miscellaneous_mats.dm b/code/game/objects/items/stacks/sheets/miscellaneous/miscellaneous_mats.dm index e785088bfa128..7483c44d675cc 100644 --- a/code/game/objects/items/stacks/sheets/miscellaneous/miscellaneous_mats.dm +++ b/code/game/objects/items/stacks/sheets/miscellaneous/miscellaneous_mats.dm @@ -49,7 +49,7 @@ GLOBAL_LIST_INIT(sandbag_recipes, list ( \ icon_state = "sandbags" w_class = WEIGHT_CLASS_TINY -/obj/item/emptysandbag/attackby(obj/item/W, mob/user, params) +/obj/item/emptysandbag/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/stack/ore/glass)) var/obj/item/stack/ore/glass/G = W to_chat(user, "You fill the sandbag.") @@ -58,6 +58,7 @@ GLOBAL_LIST_INIT(sandbag_recipes, list ( \ if (Adjacent(user) && !issilicon(user)) user.put_in_hands(I) G.use(1) + return TRUE else return ..() @@ -110,7 +111,7 @@ GLOBAL_LIST_INIT(sandbag_recipes, list ( \ return GLOB.cardboard_recipes -/obj/item/stack/sheet/cardboard/attackby(obj/item/I, mob/user, params) +/obj/item/stack/sheet/cardboard/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/stamp/clown) && !istype(loc, /obj/item/storage)) var/atom/droploc = drop_location() if(use(1)) @@ -118,6 +119,7 @@ GLOBAL_LIST_INIT(sandbag_recipes, list ( \ to_chat(user, "You stamp the cardboard! It's a clown box! Honk!") if (amount >= 0) new/obj/item/storage/box/clown(droploc) //bugfix + return TRUE else . = ..() diff --git a/code/game/objects/items/stacks/sheets/organic/hides.dm b/code/game/objects/items/stacks/sheets/organic/hides.dm index 0914e09bec9c5..790a7db346167 100644 --- a/code/game/objects/items/stacks/sheets/organic/hides.dm +++ b/code/game/objects/items/stacks/sheets/organic/hides.dm @@ -131,7 +131,7 @@ //Step one to make leather - dehairing -/obj/item/stack/sheet/animalhide/attackby(obj/item/W, mob/user, params) +/obj/item/stack/sheet/animalhide/item_interact(obj/item/W, mob/user, params) if(W.is_sharp()) playsound(loc, 'sound/weapons/slice.ogg', 50, 1, -1) user.visible_message("[user] starts cutting hair off \the [src].", "You start cutting the hair off \the [src]...", "You hear the sound of a knife rubbing against flesh.") @@ -139,6 +139,7 @@ to_chat(user, "You cut the hair from this [src.singular_name].") new /obj/item/stack/sheet/leather/hairlesshide(user.drop_location(), 1) use(1) + return TRUE else return ..() diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index e51845d150755..98b3e5102b8bb 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -426,11 +426,12 @@ F.add_fingerprint(user) zero_amount() -/obj/item/stack/attackby(obj/item/W, mob/user, params) +/obj/item/stack/item_interact(obj/item/W, mob/user, params) if(merge_check(W)) var/obj/item/stack/S = W if(merge(S)) to_chat(user, "Your [S.name] stack now contains [S.get_amount()] [S.singular_name]\s.") + return TRUE else return ..() diff --git a/code/game/objects/items/stacks/tiles/light.dm b/code/game/objects/items/stacks/tiles/light.dm index c87be20bc7ae1..dad19e74328d3 100644 --- a/code/game/objects/items/stacks/tiles/light.dm +++ b/code/game/objects/items/stacks/tiles/light.dm @@ -15,16 +15,17 @@ max_amount = 60 grind_results = list(/datum/reagent/silicon = 20, /datum/reagent/copper = 5) -/obj/item/stack/light_w/attackby(obj/item/O, mob/user, params) +/obj/item/stack/light_w/item_interact(obj/item/O, mob/user, params) if(!istype(O, /obj/item/stack/sheet/iron)) return ..() var/obj/item/stack/sheet/iron/M = O if(!M.use(1)) to_chat(user, "You need one iron sheet to finish the light tile!") - return + return TRUE new /obj/item/stack/tile/light(user.drop_location(), null, TRUE, user) to_chat(user, "You make a light tile.") use(1) + return TRUE /obj/item/stack/light_w/wirecutter_act(mob/living/user, obj/item/I) var/atom/Tsec = user.drop_location() @@ -55,13 +56,14 @@ else state = 0 //fine -/obj/item/stack/tile/light/attackby(obj/item/O, mob/user, params) +/obj/item/stack/tile/light/item_interact(obj/item/O, mob/user, params) if(O.tool_behaviour == TOOL_CROWBAR) new/obj/item/stack/sheet/iron(user.loc) amount-- new/obj/item/stack/light_w(user.loc) if(amount <= 0) qdel(src) + return TRUE else return ..() @@ -70,5 +72,6 @@ is_cyborg = 1 cost = 125 -/obj/item/stack/tile/light/cyborg/attackby(obj/item/O, mob/user, params) - return +// Do not allow inserting things +/obj/item/stack/tile/light/cyborg/item_interact(obj/item/O, mob/user, params) + return FALSE diff --git a/code/game/objects/items/stacks/tiles/tile_types.dm b/code/game/objects/items/stacks/tiles/tile_types.dm index a1fbf740b261b..6c4ac60db5f57 100644 --- a/code/game/objects/items/stacks/tiles/tile_types.dm +++ b/code/game/objects/items/stacks/tiles/tile_types.dm @@ -27,15 +27,15 @@ tile_reskin_types = tile_reskin_list(tile_reskin_types) -/obj/item/stack/tile/attackby(obj/item/W, mob/user, params) +/obj/item/stack/tile/item_interact(obj/item/W, mob/user, params) if (W.tool_behaviour == TOOL_WELDER) if(get_amount() < 4) to_chat(user, "You need at least four tiles to do this!") - return + return TRUE if(!mineralType) to_chat(user, "You can not reform this!") - return + return TRUE if(W.use_tool(src, user, 0, volume=40)) if(mineralType == "plasma") @@ -43,7 +43,7 @@ user.visible_message("[user.name] sets the plasma tiles on fire!", \ "You set the plasma tiles on fire!") qdel(src) - return + return TRUE if (mineralType == "iron") var/obj/item/stack/sheet/iron/new_item = new(user.loc) @@ -69,6 +69,7 @@ R.use(4) if (!R && replace) user.put_in_hands(new_item) + return TRUE else return ..() @@ -82,7 +83,7 @@ turf_type = /turf/open/floor/grass resistance_flags = FLAMMABLE -/obj/item/stack/tile/grass/attackby(obj/item/W, mob/user, params) +/obj/item/stack/tile/grass/item_interact(obj/item/W, mob/user, params) if((W.tool_behaviour == TOOL_SHOVEL) && params) to_chat(user, "You start digging up [src].") playsound(src, 'sound/effects/shovel_dig.ogg', 50, 1) @@ -91,6 +92,7 @@ user.visible_message("[user] digs up [src].", "You uproot [src].") playsound(src, 'sound/effects/shovel_dig.ogg', 50, 1) qdel(src) + return TRUE else return ..() diff --git a/code/game/objects/items/storage/bags.dm b/code/game/objects/items/storage/bags.dm index eb45b899e2614..a79e0b093bde4 100644 --- a/code/game/objects/items/storage/bags.dm +++ b/code/game/objects/items/storage/bags.dm @@ -332,7 +332,7 @@ var/datum/component/storage/STR = GetComponent(/datum/component/storage) STR.insert_preposition = "on" -/obj/item/storage/bag/tray/attack(mob/living/M, mob/living/user) +/obj/item/storage/bag/tray/attack_mob_target(mob/living/M, mob/living/user) . = ..() // Drop all the things. All of them. var/list/obj/item/oldContents = contents.Copy() diff --git a/code/game/objects/items/storage/book.dm b/code/game/objects/items/storage/book.dm index ca57ac8d7251d..826359aec5efc 100644 --- a/code/game/objects/items/storage/book.dm +++ b/code/game/objects/items/storage/book.dm @@ -149,7 +149,7 @@ SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "blessing", /datum/mood_event/blessing) return 1 -/obj/item/storage/book/bible/attack(mob/living/M, mob/living/carbon/human/user, heal_mode = TRUE) +/obj/item/storage/book/bible/attack_mob_target(mob/living/M, mob/living/carbon/human/user, heal_mode = TRUE) if (!user.IsAdvancedToolUser()) to_chat(user, "You don't have the dexterity to do this!") @@ -277,7 +277,7 @@ throw_range = 7 force = 18 hitsound = 'sound/weapons/sear.ogg' - damtype = BURN + damtype = /datum/damage/burn name = "Syndicate Tome" attack_verb = list("attacked", "burned", "blessed", "damned", "scorched") var/uses = 1 @@ -288,12 +288,12 @@ uses -= 1 to_chat(H, "You try to open the book AND IT BITES YOU!") playsound(src.loc, 'sound/effects/snap.ogg', 50, 1) - H.apply_damage(5, BRUTE, pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM)) + H.apply_damage(/datum/damage_source/sharp/light, /datum/damage/brute, 5, H.get_active_hand()) to_chat(H, "Your name appears on the inside cover, in blood.") var/ownername = H.real_name desc += "The name [ownername] is written in blood inside the cover." -/obj/item/storage/book/bible/syndicate/attack(mob/living/M, mob/living/carbon/human/user, heal_mode = TRUE) +/obj/item/storage/book/bible/syndicate/attack_mob_target(mob/living/M, mob/living/carbon/human/user, heal_mode = TRUE) if (user.a_intent == INTENT_HELP) return ..() else diff --git a/code/game/objects/items/storage/boxes.dm b/code/game/objects/items/storage/boxes.dm index d78829f1889a6..28cafe3f481f0 100644 --- a/code/game/objects/items/storage/boxes.dm +++ b/code/game/objects/items/storage/boxes.dm @@ -72,9 +72,9 @@ qdel(src) user.put_in_hands(I) -/obj/item/storage/box/attackby(obj/item/W, mob/user, params) +/obj/item/storage/box/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/stack/package_wrap)) - return 0 + return TRUE return ..() //Locker overloading issue solving boxes @@ -764,10 +764,12 @@ /obj/item/storage/box/matches/PopulateContents() SEND_SIGNAL(src, COMSIG_TRY_STORAGE_FILL_TYPE, /obj/item/match) -/obj/item/storage/box/matches/attackby(obj/item/match/W as obj, mob/user as mob, params) +/obj/item/storage/box/matches/item_interact(obj/item/match/W as obj, mob/user as mob, params) if(istype(W, /obj/item/match)) W.matchignite() playsound(src.loc, 'sound/items/matchstick_lit.ogg', 100, 1) + return TRUE + return ..() /obj/item/storage/box/lights name = "box of replacement bulbs" @@ -850,18 +852,19 @@ desc = "A colorful cardboard box for the clown" illustration = "clown" -/obj/item/storage/box/clown/attackby(obj/item/I, mob/user, params) +/obj/item/storage/box/clown/item_interact(obj/item/I, mob/user, params) if((istype(I, /obj/item/bodypart/l_arm/robot)) || (istype(I, /obj/item/bodypart/r_arm/robot))) if(contents.len) //prevent accidently deleting contents to_chat(user, "You need to empty [src] out first!") - return + return TRUE if(!user.temporarilyRemoveItemFromInventory(I)) - return + return TRUE qdel(I) to_chat(user, "You add some wheels to the [src]! You've got a honkbot assembly now! Honk!") var/obj/item/bot_assembly/honkbot/A = new qdel(src) user.put_in_hands(A) + return TRUE else return ..() @@ -965,20 +968,20 @@ icon_state = "[item_state]" else icon_state = "[item_state]_closed" -/obj/item/storage/box/papersack/attackby(obj/item/W, mob/user, params) +/obj/item/storage/box/papersack/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/pen)) //if a pen is used on the sack, dialogue to change its design appears if(contents.len) to_chat(user, "You can't modify [src] with items still inside!") - return + return TRUE var/list/designs = list(NODESIGN, NANOTRASEN, SYNDI, HEART, SMILEY, "Cancel") var/switchDesign = input("Select a Design:", "Paper Sack Design", designs[1]) in sort_list(designs) if(get_dist(usr, src) > 1) to_chat(usr, "You have moved too far away!") - return + return TRUE var/choice = designs.Find(switchDesign) if(design == designs[choice] || designs[choice] == "Cancel") - return 0 + return TRUE to_chat(usr, "You make some modifications to [src] using your pen.") design = designs[choice] icon_state = "paperbag_[design]" @@ -994,19 +997,18 @@ desc = "A paper sack with a heart etched onto the side." if(SMILEY) desc = "A paper sack with a crude smile etched onto the side." - return 0 + return TRUE else if(W.is_sharp()) if(!contents.len) if(item_state == "paperbag_None") user.show_message("You cut eyeholes into [src].", MSG_VISUAL) new /obj/item/clothing/head/papersack(user.loc) qdel(src) - return 0 else if(item_state == "paperbag_SmileyFace") user.show_message("You cut eyeholes into [src] and modify the design.", MSG_VISUAL) new /obj/item/clothing/head/papersack/smiley(user.loc) qdel(src) - return 0 + return TRUE return ..() #undef NODESIGN diff --git a/code/game/objects/items/storage/fancy.dm b/code/game/objects/items/storage/fancy.dm index 6086e37c675f4..0dba2815ad4a9 100644 --- a/code/game/objects/items/storage/fancy.dm +++ b/code/game/objects/items/storage/fancy.dm @@ -199,7 +199,7 @@ else cut_overlays() -/obj/item/storage/fancy/cigarettes/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob) +/obj/item/storage/fancy/cigarettes/attack_mob_target(mob/living/carbon/M as mob, mob/living/carbon/user as mob) if(!ismob(M)) return diff --git a/code/game/objects/items/storage/firstaid.dm b/code/game/objects/items/storage/firstaid.dm index 615419e31acfd..6496c2eae8fe2 100644 --- a/code/game/objects/items/storage/firstaid.dm +++ b/code/game/objects/items/storage/firstaid.dm @@ -400,18 +400,18 @@ generate_items_inside(items_inside,src) //medibot assembly -/obj/item/storage/firstaid/attackby(obj/item/bodypart/S, mob/user, params) +/obj/item/storage/firstaid/item_interact(obj/item/bodypart/S, mob/user, params) if((!istype(S, /obj/item/bodypart/l_arm/robot)) && (!istype(S, /obj/item/bodypart/r_arm/robot))) return ..() //Making a medibot! if(contents.len >= 1) to_chat(user, "You need to empty [src] out first!") - return + return TRUE if(!src.skin_type) to_chat(user, "[src] cannot be used to make a medibot!") - return + return TRUE var/obj/item/bot_assembly/medbot/A = new A.skin = src.skin_type @@ -423,6 +423,7 @@ A.firstaid = type qdel(S) qdel(src) + return TRUE /* * Pill Bottles diff --git a/code/game/objects/items/storage/lockbox.dm b/code/game/objects/items/storage/lockbox.dm index 6bca42420136f..df0c8fd5b0621 100644 --- a/code/game/objects/items/storage/lockbox.dm +++ b/code/game/objects/items/storage/lockbox.dm @@ -19,12 +19,12 @@ STR.max_items = 4 STR.locked = TRUE -/obj/item/storage/lockbox/attackby(obj/item/W, mob/user, params) +/obj/item/storage/lockbox/item_interact(obj/item/W, mob/user, params) var/locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED) if(W.GetID()) if(broken) to_chat(user, "It appears to be broken.") - return + return TRUE if(allowed(user)) SEND_SIGNAL(src, COMSIG_TRY_STORAGE_SET_LOCKSTATE, !locked) locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED) @@ -33,19 +33,20 @@ item_state = "[base_icon_state]+l" to_chat(user, "You lock the [src.name]!") SEND_SIGNAL(src, COMSIG_TRY_STORAGE_HIDE_ALL) - return + return TRUE else icon_state = "[base_icon_state]" item_state = "[base_icon_state]" to_chat(user, "You unlock the [src.name]!") - return + return TRUE else to_chat(user, "Access Denied.") - return + return TRUE if(!locked) return ..() else to_chat(user, "It's locked!") + return FALSE /obj/item/storage/lockbox/should_emag(mob/user) return !broken && ..() diff --git a/code/game/objects/items/storage/secure.dm b/code/game/objects/items/storage/secure.dm index 6483796775c39..dfdb679941061 100644 --- a/code/game/objects/items/storage/secure.dm +++ b/code/game/objects/items/storage/secure.dm @@ -36,20 +36,20 @@ if(can_hack_open) . += "The service panel is currently [open ? "unscrewed" : "screwed shut"]." -/obj/item/storage/secure/attackby(obj/item/W, mob/user, params) +/obj/item/storage/secure/item_interact(obj/item/W, mob/user, params) if(can_hack_open && SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED)) if (W.tool_behaviour == TOOL_SCREWDRIVER) if (W.use_tool(src, user, 20)) open = !open to_chat(user, "You [open ? "open" : "close"] the service panel.") - return + return TRUE if (W.tool_behaviour == TOOL_WIRECUTTER) to_chat(user, "[src] is protected from this sort of tampering, yet it appears the internal memory wires can still be pulsed.") - return + return TRUE if ((W.tool_behaviour == TOOL_MULTITOOL)) if(l_hacking) to_chat(user, "This safe is already being hacked.") - return + return TRUE if(open) to_chat(user, "Now attempting to reset internal memory, please hold.") l_hacking = TRUE @@ -58,11 +58,11 @@ l_set = FALSE l_hacking = FALSE - return + return TRUE to_chat(user, "You must unscrew the service panel before you can pulse the wiring.") - return + return TRUE - // -> storage/attackby() what with handle insertion, etc + // -> storage/item_interact() what with handle insertion, etc return ..() /obj/item/storage/secure/attack_self(mob/user) @@ -228,5 +228,5 @@ It remains quite flush against the wall, and there only seems to be enough room new /obj/item/card/id/captains_spare(src) /obj/item/storage/secure/safe/caps_spare/rust_heretic_act() - take_damage(damage_amount = 100, damage_type = BRUTE, damage_flag = MELEE, armour_penetration = 100) + take_damage(damage_amount = 100, damage_type = BRUTE, damage_flag = MELEE) return TRUE diff --git a/code/game/objects/items/storage/toolbox.dm b/code/game/objects/items/storage/toolbox.dm index 2d5b4f8ec0eec..8cc9cb0c5f8c7 100644 --- a/code/game/objects/items/storage/toolbox.dm +++ b/code/game/objects/items/storage/toolbox.dm @@ -117,7 +117,7 @@ force = 19 + power throwforce = 22 + power -/obj/item/storage/toolbox/mechanical/old/clean/attack(mob/target, mob/living/user) +/obj/item/storage/toolbox/mechanical/old/clean/attack_mob_target(mob/target, mob/living/user) calc_damage() ..() @@ -263,7 +263,7 @@ new /obj/item/ammo_box/a762(src) //floorbot assembly -/obj/item/storage/toolbox/attackby(obj/item/stack/tile/plasteel/T, mob/user, params) +/obj/item/storage/toolbox/item_interact(obj/item/stack/tile/plasteel/T, mob/user, params) var/list/allowed_toolbox = list(/obj/item/storage/toolbox/emergency, //which toolboxes can be made into floorbots /obj/item/storage/toolbox/electrical, /obj/item/storage/toolbox/mechanical, @@ -271,13 +271,12 @@ /obj/item/storage/toolbox/syndicate) if(!istype(T, /obj/item/stack/tile/plasteel)) - ..() - return + return ..() if(!is_type_in_list(src, allowed_toolbox) && (type != /obj/item/storage/toolbox)) - return + return TRUE if(contents.len >= 1) to_chat(user, "They won't fit in, as there is already stuff inside!") - return + return TRUE if(T.use(10)) var/obj/item/bot_assembly/floorbot/B = new B.toolbox = type @@ -296,6 +295,7 @@ B.update_icon() to_chat(user, "You add the tiles into the empty [name]. They protrude from the top.") qdel(src) + return TRUE else to_chat(user, "You need 10 floor tiles to start building a floorbot!") - return + return TRUE diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm index 62af59007e1cc..75b06924ca3ec 100644 --- a/code/game/objects/items/stunbaton.dm +++ b/code/game/objects/items/stunbaton.dm @@ -88,7 +88,7 @@ else . += "\The [src] does not have a power source installed." -/obj/item/melee/baton/attackby(obj/item/W, mob/user, params) +/obj/item/melee/baton/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/stock_parts/cell)) var/obj/item/stock_parts/cell/C = W if(cell) @@ -102,6 +102,7 @@ cell = W balloon_alert(user, "You insert the power cell.") update_icon() + return TRUE else if(W.tool_behaviour == TOOL_SCREWDRIVER) if(cell) @@ -111,6 +112,7 @@ balloon_alert(user, "You remove the power cell.") turned_on = FALSE update_icon() + return TRUE else return ..() @@ -128,7 +130,7 @@ update_icon() add_fingerprint(user) -/obj/item/melee/baton/attack(mob/M, mob/living/carbon/human/user) +/obj/item/melee/baton/attack_mob_target(mob/M, mob/living/carbon/human/user) if(turned_on && HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50) && !(obj_flags & OBJ_EMPED)) user.visible_message("[user] accidentally hits [user.p_them()]self with [src], electrocuting themselves badly!", \ "You accidentally hit yourself with [src], electrocuting yourself badly!") @@ -176,14 +178,8 @@ if(!deductcharge(hitcost)) return FALSE - var/obj/item/bodypart/affecting = target.get_bodypart(ran_zone(user.zone_selected)) - var/armor_block = target.run_armor_check(affecting, STAMINA) - // L.adjustStaminaLoss(stunforce) - target.apply_damage(stunforce, STAMINA, affecting, armor_block) - target.apply_effect(EFFECT_STUTTER, stunforce) - SEND_SIGNAL(target, COMSIG_LIVING_MINOR_SHOCK) //Only used for nanites - target.stuttering = 20 - target.do_jitter_animation(20) + var/datum/damage_source/source = GET_DAMAGE_SOURCE(/datum/damage_source/stun) + source.deal_attack(user, src, target, /datum/damage/stamina, stunforce, ran_zone(user.zone_selected)) if(user) target.lastattacker = user.real_name target.lastattackerckey = user.ckey diff --git a/code/game/objects/items/tanks/tank_types.dm b/code/game/objects/items/tanks/tank_types.dm index 1564274214637..5a36185a5a4e9 100644 --- a/code/game/objects/items/tanks/tank_types.dm +++ b/code/game/objects/items/tanks/tank_types.dm @@ -89,16 +89,17 @@ /obj/item/tank/internals/plasma/populate_gas() air_contents.set_moles(GAS_PLASMA, (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)) -/obj/item/tank/internals/plasma/attackby(obj/item/W, mob/user, params) +/obj/item/tank/internals/plasma/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/flamethrower)) var/obj/item/flamethrower/F = W if ((!F.status)||(F.ptank)) - return + return TRUE if(!user.transferItemToLoc(src, F)) - return + return TRUE src.master = F F.ptank = src F.update_icon() + return TRUE else return ..() diff --git a/code/game/objects/items/tanks/tanks.dm b/code/game/objects/items/tanks/tanks.dm index 2ebdc264ddadb..f3be32515a6d0 100644 --- a/code/game/objects/items/tanks/tanks.dm +++ b/code/game/objects/items/tanks/tanks.dm @@ -141,17 +141,15 @@ H.bleed_rate = 5 H.gib_animation() sleep(3) - H.adjustBruteLoss(1000) //to make the body super-bloody + // The pressure will blow everything on the inside out + var/datum/damage_source/forceful_laceration/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(H, BRUTE, 1000, null) //to make the body super-bloody H.spawn_gibs() H.spill_organs() H.spread_bodyparts() return (BRUTELOSS) -/obj/item/tank/attackby(obj/item/W, mob/user, params) - add_fingerprint(user) - return ..() - /obj/item/tank/ui_state(mob/user) return GLOB.hands_state diff --git a/code/game/objects/items/tanks/watertank.dm b/code/game/objects/items/tanks/watertank.dm index 65e5db330a8fd..6ce64ca413b0a 100644 --- a/code/game/objects/items/tanks/watertank.dm +++ b/code/game/objects/items/tanks/watertank.dm @@ -87,10 +87,10 @@ M.putItemFromInventoryInHandIfPossible(src, H.held_index) return ..() -/obj/item/watertank/attackby(obj/item/W, mob/user, params) +/obj/item/watertank/item_interact(obj/item/W, mob/user, params) if(W == noz) remove_noz() - return 1 + return TRUE else return ..() diff --git a/code/game/objects/items/teleportation.dm b/code/game/objects/items/teleportation.dm index d1dee414c8895..375f279fe74b9 100644 --- a/code/game/objects/items/teleportation.dm +++ b/code/game/objects/items/teleportation.dm @@ -391,7 +391,7 @@ continue // Run armour checks and apply damage var/armor_block = target.run_armor_check(BODY_ZONE_CHEST, MELEE) - target.apply_damage(25, BRUTE, blocked = armor_block) + target.apply_damage(/datum/damage_source/impact, /datum/damage/brute, 25, BODY_ZONE_CHEST) target.Paralyze(10 * (100 - armor_block) / 100) target.Knockdown(40 * (100 - armor_block) / 100) // Check if we successfully knocked them down diff --git a/code/game/objects/items/teleprod.dm b/code/game/objects/items/teleprod.dm index 18bdba2682c84..269999dc18747 100644 --- a/code/game/objects/items/teleprod.dm +++ b/code/game/objects/items/teleprod.dm @@ -6,7 +6,7 @@ item_state = "teleprod" slot_flags = null -/obj/item/melee/baton/cattleprod/teleprod/attack(mob/living/carbon/M, mob/living/carbon/user)//handles making things teleport when hit +/obj/item/melee/baton/cattleprod/teleprod/attack_mob_target(mob/living/carbon/M, mob/living/carbon/user)//handles making things teleport when hit ..() if(turned_on && HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50)) user.visible_message("[user] accidentally hits [user.p_them()]self with [src]!", \ @@ -28,7 +28,7 @@ SEND_SIGNAL(M, COMSIG_LIVING_MINOR_SHOCK) do_teleport(M, get_turf(M), 15, channel = TELEPORT_CHANNEL_BLUESPACE) -/obj/item/melee/baton/cattleprod/attackby(obj/item/I, mob/user, params)//handles sticking a crystal onto a stunprod to make a teleprod +/obj/item/melee/baton/cattleprod/item_interact(obj/item/I, mob/user, params)//handles sticking a crystal onto a stunprod to make a teleprod if(istype(I, /obj/item/stack/ore/bluespace_crystal)) if(!cell) var/obj/item/stack/ore/bluespace_crystal/BSC = I @@ -41,5 +41,6 @@ log_crafting(user, S, TRUE) else user.visible_message("You can't put the crystal onto the stunprod while it has a power cell installed!") + return TRUE else return ..() diff --git a/code/game/objects/items/theft_tools.dm b/code/game/objects/items/theft_tools.dm index f22f9a5e77ca4..1f0e5a243f3f8 100644 --- a/code/game/objects/items/theft_tools.dm +++ b/code/game/objects/items/theft_tools.dm @@ -24,9 +24,10 @@ STOP_PROCESSING(SSobj, src) return ..() -/obj/item/nuke_core/attackby(obj/item/nuke_core_container/container, mob/user) +/obj/item/nuke_core/item_interact(obj/item/nuke_core_container/container, mob/user) if(istype(container)) container.load(src, user) + return TRUE else return ..() @@ -73,13 +74,13 @@ if(ismob(loc)) to_chat(loc, "[src] is permanently sealed, [core]'s radiation is contained.") -/obj/item/nuke_core_container/attackby(obj/item/nuke_core/core, mob/user) +/obj/item/nuke_core_container/item_interact(obj/item/nuke_core/core, mob/user) if(istype(core)) if(!user.temporarilyRemoveItemFromInventory(core)) to_chat(user, "The [core] is stuck to your hand!") - return else load(core, user) + return TRUE else return ..() @@ -133,24 +134,27 @@ /obj/item/nuke_core/supermatter_sliver/can_be_pulled(user) // no drag memes return FALSE -/obj/item/nuke_core/supermatter_sliver/attackby(obj/item/W, mob/living/user, params) +///BACONTODO: Attackby here since harm mode shouldnt let you safely use a suermatter +/obj/item/nuke_core/supermatter_sliver/item_interact(obj/item/W, mob/living/user, params) if(istype(W, /obj/item/hemostat/supermatter)) var/obj/item/hemostat/supermatter/tongs = W if (tongs.sliver) to_chat(user, "\The [tongs] is already holding a supermatter sliver!") - return FALSE + return TRUE forceMove(tongs) tongs.sliver = src tongs.update_icon() to_chat(user, "You carefully pick up [src] with [tongs].") + return TRUE else if(istype(W, /obj/item/scalpel/supermatter) || istype(W, /obj/item/nuke_core_container/supermatter/)) // we don't want it to dust - return + return TRUE else to_chat(user, "As it touches \the [src], both \the [src] and \the [W] burst into dust!") radiation_pulse(user, 100) playsound(src, 'sound/effects/supermatter.ogg', 50, 1) qdel(W) qdel(src) + return TRUE /obj/item/nuke_core/supermatter_sliver/pickup(mob/living/user) ..() @@ -193,10 +197,11 @@ if(ismob(loc)) to_chat(loc, "[src] is permanently sealed, [sliver] is safely contained.") -/obj/item/nuke_core_container/supermatter/attackby(obj/item/hemostat/supermatter/tongs, mob/user) +/obj/item/nuke_core_container/supermatter/item_interact(obj/item/hemostat/supermatter/tongs, mob/user) if(istype(tongs)) //try to load shard into core load(tongs, user) + return TRUE else return ..() @@ -206,7 +211,7 @@ icon = 'icons/obj/nuke_tools.dmi' icon_state = "supermatter_scalpel" toolspeed = 0.5 - damtype = BURN + damtype = /datum/damage/burn usesound = 'sound/weapons/bladeslice.ogg' var/usesLeft @@ -220,7 +225,7 @@ icon = 'icons/obj/nuke_tools.dmi' icon_state = "supermatter_tongs" toolspeed = 0.75 - damtype = BURN + damtype = /datum/damage/burn var/obj/item/nuke_core/supermatter_sliver/sliver /obj/item/hemostat/supermatter/Destroy() diff --git a/code/game/objects/items/tools/powertools.dm b/code/game/objects/items/tools/powertools.dm index 57447b8904e8c..5204d732ceed1 100644 --- a/code/game/objects/items/tools/powertools.dm +++ b/code/game/objects/items/tools/powertools.dm @@ -69,18 +69,6 @@ user.visible_message("[user] is pressing [src] against [user.p_their()] head! It looks like [user.p_theyre()] trying to commit suicide!") return BRUTELOSS -/obj/item/powertool/hand_drill/attack(mob/living/M, mob/living/user) - if(!istype(M) || tool_behaviour != TOOL_SCREWDRIVER) - return ..() - if(user.zone_selected != BODY_ZONE_PRECISE_EYES && user.zone_selected != BODY_ZONE_HEAD) - return ..() - if(HAS_TRAIT(user, TRAIT_PACIFISM)) - to_chat(user, "You don't want to harm [M]!") - return - if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50)) - M = user - return eyestab(M,user) - //Jaws of life /obj/item/powertool/jaws_of_life @@ -148,7 +136,7 @@ playsound(loc,pick('sound/misc/desecration-01.ogg','sound/misc/desecration-02.ogg','sound/misc/desecration-01.ogg') ,50, 1, -1) return BRUTELOSS -/obj/item/powertool/jaws_of_life/attack(mob/living/carbon/C, mob/living/user) +/obj/item/powertool/jaws_of_life/attack_mob_target(mob/living/carbon/C, mob/living/user) if(tool_behaviour == TOOL_WIRECUTTER && istype(C) && C.handcuffed) user.visible_message("[user] cuts [C]'s restraints with [src]!") log_combat(user, C, "cut handcuffs from") diff --git a/code/game/objects/items/tools/screwdriver.dm b/code/game/objects/items/tools/screwdriver.dm index 3d0820099f5c7..a6bbbd43d8bd1 100644 --- a/code/game/objects/items/tools/screwdriver.dm +++ b/code/game/objects/items/tools/screwdriver.dm @@ -52,18 +52,6 @@ if(prob(75)) pixel_y = rand(0, 16) -/obj/item/screwdriver/attack(mob/living/carbon/M, mob/living/carbon/user) - if(!istype(M)) - return ..() - if(user.zone_selected != BODY_ZONE_PRECISE_EYES && user.zone_selected != BODY_ZONE_HEAD) - return ..() - if(HAS_TRAIT(user, TRAIT_PACIFISM)) - to_chat(user, "You don't want to harm [M]!") - return - if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50)) - M = user - return eyestab(M,user) - /obj/item/screwdriver/brass name = "brass screwdriver" desc = "A screwdriver made of brass. The handle feels freezing cold." diff --git a/code/game/objects/items/tools/weldingtool.dm b/code/game/objects/items/tools/weldingtool.dm index 7050a76a5d3de..75e21a00ba2c0 100644 --- a/code/game/objects/items/tools/weldingtool.dm +++ b/code/game/objects/items/tools/weldingtool.dm @@ -72,7 +72,7 @@ switch(welding) if(0) force = 3 - damtype = BRUTE + damtype = /datum/damage/brute update_icon() if(!can_off_process) STOP_PROCESSING(SSobj, src) @@ -80,7 +80,7 @@ //Welders left on now use up fuel, but lets not have them run out quite that fast if(1) force = 15 - damtype = BURN + damtype = /datum/damage/burn burned_fuel_for += delta_time if(burned_fuel_for >= WELDER_FUEL_BURN_INTERVAL) use(1) @@ -95,14 +95,17 @@ return (FIRELOSS) -/obj/item/weldingtool/attackby(obj/item/I, mob/user, params) +/obj/item/weldingtool/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_SCREWDRIVER) flamethrower_screwdriver(I, user) + update_icon() + return TRUE else if(istype(I, /obj/item/stack/rods)) flamethrower_rods(I, user) + update_icon() + return TRUE else - . = ..() - update_icon() + return ..() /obj/item/weldingtool/proc/explode() var/turf/T = get_turf(loc) @@ -204,7 +207,7 @@ balloon_alert(user, "You turn [src] on.") playsound(loc, acti_sound, 50, 1) force = 15 - damtype = BURN + damtype = /datum/damage/burn hitsound = 'sound/items/welder.ogg' update_icon() START_PROCESSING(SSobj, src) @@ -221,7 +224,7 @@ set_welding(FALSE) force = 3 - damtype = BRUTE + damtype = /datum/damage/brute hitsound = "swing_hit" update_icon() diff --git a/code/game/objects/items/tools/wirecutters.dm b/code/game/objects/items/tools/wirecutters.dm index a21ee3a523953..c912f99053012 100644 --- a/code/game/objects/items/tools/wirecutters.dm +++ b/code/game/objects/items/tools/wirecutters.dm @@ -49,7 +49,7 @@ base_overlay.appearance_flags = RESET_COLOR add_overlay(base_overlay) -/obj/item/wirecutters/attack(mob/living/carbon/C, mob/user) +/obj/item/wirecutters/attack_mob_target(mob/living/carbon/C, mob/user) if(istype(C) && C.handcuffed && istype(C.handcuffed, /obj/item/restraints/handcuffs/cable)) user.visible_message("[user] cuts [C]'s restraints with [src]!") qdel(C.handcuffed) diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index 41c3dd6466be3..34773c7820d64 100644 --- a/code/game/objects/items/toys.dm +++ b/code/game/objects/items/toys.dm @@ -49,7 +49,7 @@ . = ..() create_reagents(10) -/obj/item/toy/balloon/attack(mob/living/carbon/human/M, mob/user) +/obj/item/toy/balloon/attack_mob_target(mob/living/carbon/human/M, mob/user) return /obj/item/toy/balloon/afterattack(atom/A as mob|obj, mob/user, proximity) @@ -68,7 +68,7 @@ desc = "A translucent balloon with some form of liquid sloshing around in it." update_icon() -/obj/item/toy/balloon/attackby(obj/item/I, mob/user, params) +/obj/item/toy/balloon/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/reagent_containers/glass)) if(I.reagents) if(I.reagents.total_volume <= 0) @@ -80,8 +80,10 @@ to_chat(user, "You fill the balloon with the contents of [I].") I.reagents.trans_to(src, 10, transfered_by = user) update_icon() + return TRUE else if(I.is_sharp()) balloon_burst() + return ..() else return ..() @@ -175,7 +177,7 @@ . = ..() . += "There [bullets == 1 ? "is" : "are"] [bullets] cap\s left." -/obj/item/toy/gun/attackby(obj/item/toy/ammo/gun/A, mob/user, params) +/obj/item/toy/gun/item_interact(obj/item/toy/ammo/gun/A, mob/user, params) if(istype(A, /obj/item/toy/ammo/gun)) if (src.bullets >= 7) @@ -193,7 +195,7 @@ A.amount_left -= 7 - src.bullets src.bullets = 7 A.update_icon() - return 1 + return TRUE else return ..() @@ -269,11 +271,10 @@ add_fingerprint(user) // Copied from /obj/item/melee/transforming/energy/sword/attackby -/obj/item/toy/sword/attackby(obj/item/W, mob/living/user, params) +/obj/item/toy/sword/item_interact(obj/item/W, mob/living/user, params) if(istype(W, /obj/item/toy/sword)) if(HAS_TRAIT(W, TRAIT_NODROP) || HAS_TRAIT(src, TRAIT_NODROP)) to_chat(user, "\the [HAS_TRAIT(src, TRAIT_NODROP) ? src : W] is stuck to your hand, you can't attach it to \the [HAS_TRAIT(src, TRAIT_NODROP) ? W : src]!") - return else to_chat(user, "You attach the ends of the two plastic swords, making a single double-bladed toy! You're fake-cool.") var/obj/item/dualsaber/toy/newSaber = new /obj/item/dualsaber/toy(user.loc) @@ -282,6 +283,7 @@ newSaber.saber_color = "rainbow" qdel(W) qdel(src) + return TRUE else if(W.tool_behaviour == TOOL_MULTITOOL) if(!hacked) hacked = TRUE @@ -293,6 +295,7 @@ user.update_inv_hands() else to_chat(user, "It's already fabulous!") + return TRUE else return ..() @@ -781,31 +784,33 @@ user.visible_message("[user] shuffles the deck.", "You shuffle the deck.") cooldown = world.time -/obj/item/toy/cards/deck/attackby(obj/item/I, mob/living/user, params) +/obj/item/toy/cards/deck/item_interact(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/toy/cards/singlecard)) var/obj/item/toy/cards/singlecard/SC = I if(SC.parentdeck == src) if(!user.temporarilyRemoveItemFromInventory(SC)) to_chat(user, "The card is stuck to your hand, you can't add it to the deck!") - return + return TRUE cards += SC.cardname user.visible_message("[user] adds a card to the bottom of the deck.","You add the card to the bottom of the deck.") qdel(SC) else to_chat(user, "You can't mix cards from other decks!") update_icon() + return TRUE else if(istype(I, /obj/item/toy/cards/cardhand)) var/obj/item/toy/cards/cardhand/CH = I if(CH.parentdeck == src) if(!user.temporarilyRemoveItemFromInventory(CH)) to_chat(user, "The hand of cards is stuck to your hand, you can't add it to the deck!") - return + return TRUE cards += CH.currenthand user.visible_message("[user] puts [user.p_their()] hand of cards in the deck.", "You put the hand of cards in the deck.") qdel(CH) else to_chat(user, "You can't mix cards from other decks!") update_icon() + return TRUE else return ..() @@ -889,7 +894,7 @@ cardUser << browse(null, "window=cardhand") return -/obj/item/toy/cards/cardhand/attackby(obj/item/toy/cards/singlecard/C, mob/living/user, params) +/obj/item/toy/cards/cardhand/item_interact(obj/item/toy/cards/singlecard/C, mob/living/user, params) if(istype(C)) if(C.parentdeck == src.parentdeck) src.currenthand += C.cardname @@ -899,6 +904,7 @@ update_sprite() else to_chat(user, "You can't mix cards from other decks!") + return TRUE else return ..() @@ -971,7 +977,7 @@ src.name = "card" src.pixel_x = -5 -/obj/item/toy/cards/singlecard/attackby(obj/item/I, mob/living/user, params) +/obj/item/toy/cards/singlecard/item_interact(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/toy/cards/singlecard/)) var/obj/item/toy/cards/singlecard/C = I if(C.parentdeck == src.parentdeck) @@ -986,6 +992,7 @@ user.put_in_active_hand(H) else to_chat(user, "You can't mix cards from other decks!") + return TRUE if(istype(I, /obj/item/toy/cards/cardhand/)) var/obj/item/toy/cards/cardhand/H = I @@ -997,6 +1004,7 @@ H.update_sprite() else to_chat(user, "You can't mix cards from other decks!") + return TRUE else return ..() @@ -1619,9 +1627,6 @@ . = ..() . += "The Coin Gobbler holds [money] credits." -/obj/item/gobbler/attackby() - return - /obj/item/gobbler/attack_self(mob/user) if(cooldown > world.time) return @@ -1680,7 +1685,7 @@ icon_state = "disco_active" var/flip_cooldown = 0 -/obj/item/dance_trance/attack() +/obj/item/dance_trance/attack_mob_target() if(flip_cooldown < world.time) flip_mobs() return ..() diff --git a/code/game/objects/items/trash.dm b/code/game/objects/items/trash.dm index b27c6af8d2e84..829b1fdf58ee3 100644 --- a/code/game/objects/items/trash.dm +++ b/code/game/objects/items/trash.dm @@ -101,5 +101,5 @@ pixel_x = rand(-4,4) pixel_y = rand(-4,4) -/obj/item/trash/attack(mob/M, mob/living/user) +/obj/item/trash/attack_mob_target(mob/M, mob/living/user) return diff --git a/code/game/objects/items/weaponry.dm b/code/game/objects/items/weaponry.dm index 8744e83071072..45c86b517243c 100644 --- a/code/game/objects/items/weaponry.dm +++ b/code/game/objects/items/weaponry.dm @@ -23,7 +23,7 @@ oranges says: This is a meme relating to the english translation of the ss13 rus mrdoombringer sez: and remember kids, if you try and PR a fix for this item's grammar, you are admitting that you are, indeed, a newfriend. for further reading, please see: https://github.com/tgstation/tgstation/pull/30173 and https://translate.google.com/translate?sl=auto&tl=en&js=y&prev=_t&hl=en&ie=UTF-8&u=%2F%2Flurkmore.to%2FSS13&edit-text=&act=url */ -/obj/item/banhammer/attack(mob/M, mob/user) +/obj/item/banhammer/attack_mob_target(mob/M, mob/user) if(user.zone_selected == BODY_ZONE_HEAD) M.visible_message("[user] are stroking the head of [M] with a bangammer", "[user] are stroking the head with a bangammer", "you hear a bangammer stroking a head"); else @@ -145,7 +145,7 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301 if(nuke_disk) . += "It's holding the nuke disk!" -/obj/item/claymore/highlander/attack(mob/living/target, mob/living/user) +/obj/item/claymore/highlander/attack_mob_target(mob/living/target, mob/living/user) . = ..() if(!QDELETED(target) && iscarbon(target) && target.stat == DEAD && target.mind && target.mind.special_role == "highlander") user.fully_heal() //STEAL THE LIFE OF OUR FALLEN FOES @@ -283,19 +283,20 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301 materials = list(/datum/material/iron=1150, /datum/material/glass=75) attack_verb = list("hit", "bludgeoned", "whacked", "bonked") -/obj/item/wirerod/attackby(obj/item/I, mob/user, params) +/obj/item/wirerod/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/shard)) var/obj/item/spear/S = new /obj/item/spear remove_item_from_storage(user) if (!user.transferItemToLoc(I, S)) - return + return TRUE S.CheckParts(list(I)) qdel(src) user.put_in_hands(S) log_crafting(user, S, TRUE) to_chat(user, "You fasten the glass shard to the top of the rod with the cable.") + return TRUE else if(istype(I, /obj/item/assembly/igniter) && !(HAS_TRAIT(I, TRAIT_NODROP))) var/obj/item/melee/baton/cattleprod/P = new /obj/item/melee/baton/cattleprod @@ -309,6 +310,7 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301 user.put_in_hands(P) log_crafting(user, P, TRUE) + return TRUE else return ..() @@ -595,7 +597,7 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301 if(part) part.drop_limb() -/obj/item/mounted_chainsaw/super/attack(mob/living/target) +/obj/item/mounted_chainsaw/super/attack_mob_target(mob/living/target) ..() target.Knockdown(4) @@ -706,7 +708,7 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301 homerun_ready = 1 ..() -/obj/item/melee/baseball_bat/attack(mob/living/target, mob/living/user) +/obj/item/melee/baseball_bat/attack_mob_target(mob/living/target, mob/living/user) . = ..() var/atom/throw_target = get_edge_target_turf(target, user.dir) if(homerun_ready) @@ -801,7 +803,7 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301 /// How many smaller table smacks we can do before we're out var/table_smacks_left = 3 -/obj/item/slapper/attack(mob/living/M, mob/living/carbon/human/user) +/obj/item/slapper/attack_mob_target(mob/living/M, mob/living/carbon/human/user) if(ishuman(M)) var/mob/living/carbon/human/L = M if(L && L.dna && L.dna.species) @@ -871,7 +873,7 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301 name = "\improper ACME Extendo-Hand" desc = "A novelty extendo-hand produced by the ACME corporation. Originally designed to knock out roadrunners." -/obj/item/extendohand/attack(atom/M, mob/living/carbon/human/user) +/obj/item/extendohand/attack_mob_target(atom/M, mob/living/carbon/human/user) var/dist = get_dist(M, user) if(dist < reach) to_chat(user, "[M] is too close to use [src] on.") @@ -890,7 +892,7 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301 item_flags = DROPDEL | ABSTRACT | ISWEAPON attack_verb = list("is left hanging by") -/obj/item/highfive/attack(mob/target, mob/user) +/obj/item/highfive/attack_mob_target(mob/target, mob/user) if(target == user) to_chat(user, "You can't high-five yourself! Go get a friend!") else if(ishuman(target) && (target.stat == CONSCIOUS) && (istype(target.get_active_held_item(), /obj/item/highfive)) ) @@ -919,14 +921,14 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301 var/breakforce = 30 var/stamforce = 15 -/obj/item/club/attack(mob/living/M, mob/living/user) +/obj/item/club/attack_mob_target(mob/living/M, mob/living/user) if(ishuman(M)) var/mob/living/carbon/human/H = M if(H.check_shields(src, breakforce)) return else - var/def_check = H.getarmor(type = MELEE) - H.apply_damage(stamforce, STAMINA, blocked = def_check) + var/datum/damage_source/source = GET_DAMAGE_SOURCE(damage_source) + source.deal_attack(user, src, M, /datum/damage/stamina, stamforce) return ..() /obj/item/club/tailclub diff --git a/code/game/objects/noose.dm b/code/game/objects/noose.dm index 3ea669528fc79..72791e8e86b98 100644 --- a/code/game/objects/noose.dm +++ b/code/game/objects/noose.dm @@ -14,7 +14,7 @@ flags_1 = NODECONSTRUCT_1 var/mutable_appearance/overlay -/obj/structure/chair/noose/attackby(obj/item/W, mob/user, params) +/obj/structure/chair/noose/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_WIRECUTTER) user.visible_message("[user] cuts the noose.", "You cut the noose.") if(has_buckled_mobs()) @@ -23,12 +23,13 @@ if(buckled_mob.has_gravity()) buckled_mob.visible_message("[buckled_mob] falls over and hits the ground!") to_chat(buckled_mob, "You fall over and hit the ground!") - buckled_mob.adjustBruteLoss(10) + var/datum/damage_source/impact/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(buckled_mob, BRUTE, 10, null) var/obj/item/stack/cable_coil/C = new(get_turf(src)) C.amount = 25 qdel(src) - return - ..() + return TRUE + return ..() /obj/structure/chair/noose/Initialize(mapload) . = ..() diff --git a/code/game/objects/obj_defense.dm b/code/game/objects/obj_defense.dm index 7387b1e86cb9f..19e3d8ed6bdde 100644 --- a/code/game/objects/obj_defense.dm +++ b/code/game/objects/obj_defense.dm @@ -1,6 +1,6 @@ //the essential proc to call when an obj must receive damage of any kind. -/obj/proc/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir, armour_penetration = 0) +/obj/proc/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir) if(QDELETED(src)) stack_trace("[src] taking damage after deletion") return @@ -8,7 +8,6 @@ play_attack_sound(damage_amount, damage_type, damage_flag) if((resistance_flags & INDESTRUCTIBLE) || obj_integrity <= 0) return - damage_amount = run_obj_armor(damage_amount, damage_type, damage_flag, attack_dir, armour_penetration) if(damage_amount < DAMAGE_PRECISION) return . = damage_amount @@ -23,7 +22,7 @@ obj_destruction(damage_flag) //returns the damage value of the attack after processing the obj's various armor protections -/obj/proc/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir, armour_penetration = 0) +/obj/proc/run_obj_armor(damage_type, damage_flag = 0, attack_dir, armour_penetration = 0) switch(damage_type) if(BRUTE) if(BURN) @@ -34,7 +33,7 @@ armor_protection = armor.getRating(damage_flag) if(armor_protection) //Only apply weak-against-armor/hollowpoint effects if there actually IS armor. armor_protection = CLAMP(armor_protection - armour_penetration, min(armor_protection, 0), 100) - return round(damage_amount * (100 - armor_protection)*0.01, DAMAGE_PRECISION) + return armor_protection //the sound played when the obj is damaged. /obj/proc/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0) @@ -74,7 +73,7 @@ if(P.suppressed != SUPPRESSED_VERY) visible_message("[src] is hit by \a [P]!", null, null, COMBAT_MESSAGE_RANGE) if(!QDELETED(src)) //Bullet on_hit effect might have already destroyed this object - take_damage(P.damage, P.damage_type, P.armor_flag, 0, turn(P.dir, 180), P.armour_penetration) + take_damage(P.damage, P.damage_type, P.damage_source, 0, turn(P.dir, 180), P.armour_penetration) /obj/proc/hulk_damage() return 150 //the damage hulks do on punches to this object, is affected by melee armor @@ -101,7 +100,7 @@ return take_damage(400, BRUTE, MELEE, 0, get_dir(src, B)) -/obj/proc/attack_generic(mob/user, damage_amount = 0, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, armor_penetration = 0) //used by attack_alien, attack_animal, and attack_slime +/obj/proc/attack_generic(mob/user, damage_amount = 0, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, armor_penetration = 0) //used by attack_alien, attack_animal, and after_attacked_by_slime user.do_attack_animation(src) user.changeNext_move(CLICK_CD_MELEE) return take_damage(damage_amount, damage_type, damage_flag, sound_effect, get_dir(src, user), armor_penetration) @@ -136,14 +135,6 @@ var/amt = max(0, ((force - (move_resist * MOVE_FORCE_CRUSH_RATIO)) / (move_resist * MOVE_FORCE_CRUSH_RATIO)) * 10) take_damage(amt, BRUTE) -/obj/attack_slime(mob/living/simple_animal/slime/M) - if(!M.is_adult) - return - var/damage = rand(15) - if(M.transformeffects & SLIME_EFFECT_RED) - damage *= 1.1 - attack_generic(M, damage, MELEE, 1) - /obj/mech_melee_attack(obj/mecha/M) M.do_attack_animation(src) var/play_soundeffect = 0 diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index c8300027bae86..cc78c56852143 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -6,7 +6,9 @@ /// ONLY FOR MAPPING: Sets flags from a string list, handled in Initialize. Usage: set_obj_flags = "EMAGGED;!CAN_BE_HIT" to set EMAGGED and clear CAN_BE_HIT. var/set_obj_flags - var/damtype = BRUTE + /// The type of the damage source we use. Never instantiated + var/damage_source = /datum/damage_source/blunt/light + var/damtype = /datum/damage/brute var/force = 0 var/datum/armor/armor @@ -422,7 +424,7 @@ /obj/handle_ricochet(obj/projectile/P) . = ..() if(. && ricochet_damage_mod) - take_damage(P.damage * ricochet_damage_mod, P.damage_type, P.armor_flag, 0, turn(P.dir, 180), P.armour_penetration) // pass along ricochet_damage_mod damage to the structure for the ricochet + take_damage(P.damage * ricochet_damage_mod, P.damage_type, P.damage_source, 0, turn(P.dir, 180), P.armour_penetration) // pass along ricochet_damage_mod damage to the structure for the ricochet /obj/update_overlays() . = ..() diff --git a/code/game/objects/structures/ai_core.dm b/code/game/objects/structures/ai_core.dm index 82ca8fbdf6a2d..e00118ec09e70 100644 --- a/code/game/objects/structures/ai_core.dm +++ b/code/game/objects/structures/ai_core.dm @@ -70,11 +70,11 @@ return FALSE return TRUE -/obj/structure/AIcore/latejoin_inactive/attackby(obj/item/P, mob/user, params) +/obj/structure/AIcore/latejoin_inactive/item_interact(obj/item/P, mob/user, params) if(P.tool_behaviour == TOOL_MULTITOOL) active = !active to_chat(user, "You [active? "activate" : "deactivate"] \the [src]'s transmitters.") - return + return TRUE return ..() /obj/structure/AIcore/latejoin_inactive/Initialize(mapload) @@ -85,42 +85,43 @@ GLOB.latejoin_ai_cores -= src return ..() -/obj/structure/AIcore/attackby(obj/item/P, mob/user, params) +/obj/structure/AIcore/item_interact(obj/item/P, mob/user, params) if(P.tool_behaviour == TOOL_WRENCH) - return default_unfasten_wrench(user, P, 20) + default_unfasten_wrench(user, P, 20) + return TRUE if(!anchored) if(P.tool_behaviour == TOOL_WELDER && can_deconstruct) if(state != EMPTY_CORE) to_chat(user, "The core must be empty to deconstruct it!") - return + return TRUE if(!P.tool_start_check(user, amount=0)) - return + return TRUE to_chat(user, "You start to deconstruct the frame...") if(P.use_tool(src, user, 20, volume=50) && state == EMPTY_CORE) to_chat(user, "You deconstruct the frame.") deconstruct(TRUE) - return + return TRUE else switch(state) if(EMPTY_CORE) if(istype(P, /obj/item/circuitboard/aicore)) if(!user.transferItemToLoc(P, src)) - return + return TRUE playsound(loc, 'sound/items/deconstruct.ogg', 50, 1) to_chat(user, "You place the circuit board inside the frame.") update_icon() state = CIRCUIT_CORE circuit = P - return + return TRUE if(CIRCUIT_CORE) if(P.tool_behaviour == TOOL_SCREWDRIVER) P.play_tool_sound(src) to_chat(user, "You screw the circuit board into place.") state = SCREWED_CORE update_icon() - return + return TRUE if(P.tool_behaviour == TOOL_CROWBAR) P.play_tool_sound(src) to_chat(user, "You remove the circuit board.") @@ -128,14 +129,14 @@ update_icon() circuit.forceMove(loc) circuit = null - return + return TRUE if(SCREWED_CORE) if(P.tool_behaviour == TOOL_SCREWDRIVER && circuit) P.play_tool_sound(src) to_chat(user, "You unfasten the circuit board.") state = CIRCUIT_CORE update_icon() - return + return TRUE if(istype(P, /obj/item/stack/cable_coil)) var/obj/item/stack/cable_coil/C = P if(C.get_amount() >= 5) @@ -147,7 +148,7 @@ update_icon() else to_chat(user, "You need five lengths of cable to wire the AI core!") - return + return TRUE if(CABLED_CORE) if(P.tool_behaviour == TOOL_WIRECUTTER) if(brain) @@ -158,7 +159,7 @@ state = SCREWED_CORE update_icon() new /obj/item/stack/cable_coil(drop_location(), 5) - return + return TRUE if(istype(P, /obj/item/stack/sheet/rglass)) var/obj/item/stack/sheet/rglass/G = P @@ -171,45 +172,45 @@ update_icon() else to_chat(user, "You need two sheets of reinforced glass to insert them into the AI core!") - return + return TRUE if(istype(P, /obj/item/aiModule)) if(brain && brain.laws.id != DEFAULT_AI_LAWID) to_chat(user, "The installed [brain.name] already has set laws!") - return + return TRUE var/obj/item/aiModule/module = P module.install(laws, user) - return + return TRUE if(istype(P, /obj/item/mmi) && !brain) var/obj/item/mmi/M = P if(!M.brainmob) to_chat(user, "Sticking an empty [M.name] into the frame would sort of defeat the purpose!") - return + return TRUE if(M.brainmob.stat == DEAD) to_chat(user, "Sticking a dead [M.name] into the frame would sort of defeat the purpose!") - return + return TRUE if(!M.brainmob.client) to_chat(user, "Sticking an inactive [M.name] into the frame would sort of defeat the purpose.") - return + return TRUE if(!CONFIG_GET(flag/allow_ai) || (is_banned_from(M.brainmob.ckey, JOB_NAME_AI) && !QDELETED(src) && !QDELETED(user) && !QDELETED(M) && !QDELETED(user) && Adjacent(user))) if(!QDELETED(M)) to_chat(user, "This [M.name] does not seem to fit!") - return + return TRUE if(!M.brainmob.mind) to_chat(user, "This [M.name] is mindless!") - return + return TRUE if(!user.transferItemToLoc(M,src)) - return + return TRUE brain = M to_chat(user, "You add [M.name] to the frame.") update_icon() - return + return TRUE if(P.tool_behaviour == TOOL_CROWBAR && brain) P.play_tool_sound(src) @@ -217,7 +218,7 @@ brain.forceMove(loc) brain = null update_icon() - return + return TRUE if(GLASS_CORE) if(P.tool_behaviour == TOOL_CROWBAR) @@ -226,7 +227,7 @@ state = CABLED_CORE update_icon() new /obj/item/stack/sheet/rglass(loc, 2) - return + return TRUE if(P.tool_behaviour == TOOL_SCREWDRIVER) P.play_tool_sound(src) @@ -249,18 +250,18 @@ else state = AI_READY_CORE update_icon() - return + return TRUE if(AI_READY_CORE) if(istype(P, /obj/item/aicard)) - return //handled by /obj/structure/ai_core/transfer_ai() + return TRUE //handled by /obj/structure/ai_core/transfer_ai() if(P.tool_behaviour == TOOL_SCREWDRIVER) P.play_tool_sound(src) to_chat(user, "You disconnect the monitor.") state = GLASS_CORE update_icon() - return + return TRUE return ..() /obj/structure/AIcore/update_icon() diff --git a/code/game/objects/structures/aliens.dm b/code/game/objects/structures/aliens.dm index bdf0deb8349c3..8a75fd525c549 100644 --- a/code/game/objects/structures/aliens.dm +++ b/code/game/objects/structures/aliens.dm @@ -11,7 +11,7 @@ icon = 'icons/mob/alien.dmi' max_integrity = 100 -/obj/structure/alien/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir) +/obj/structure/alien/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir, armour_penetration = 0) if(damage_flag == MELEE) switch(damage_type) if(BRUTE) diff --git a/code/game/objects/structures/artstuff.dm b/code/game/objects/structures/artstuff.dm index a5cb0d73bd659..120a942113ff2 100644 --- a/code/game/objects/structures/artstuff.dm +++ b/code/game/objects/structures/artstuff.dm @@ -14,7 +14,7 @@ var/obj/item/canvas/painting = null //Adding canvases -/obj/structure/easel/attackby(obj/item/I, mob/user, params) +/obj/structure/easel/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/canvas)) var/obj/item/canvas/canvas = I user.dropItemToGround(canvas) @@ -22,6 +22,7 @@ canvas.forceMove(get_turf(src)) canvas.layer = layer+0.1 user.visible_message("[user] puts \the [canvas] on \the [src].", "You place \the [canvas] on \the [src].") + return TRUE else return ..() @@ -89,11 +90,9 @@ ui.set_autoupdate(FALSE) ui.open() -/obj/item/canvas/attackby(obj/item/I, mob/living/user, params) - if(user.a_intent == INTENT_HELP) - ui_interact(user) - else - return ..() +/obj/item/canvas/item_interact(obj/item/I, mob/living/user, params) + ui_interact(user) + return TRUE /obj/item/canvas/ui_data(mob/user) . = ..() @@ -264,11 +263,13 @@ . = ..() SSpersistence.painting_frames -= src -/obj/structure/sign/painting/attackby(obj/item/I, mob/user, params) +/obj/structure/sign/painting/item_interact(obj/item/I, mob/user, params) if(!current_canvas && istype(I, /obj/item/canvas)) frame_canvas(user,I) + return TRUE else if(current_canvas && current_canvas.painting_name == initial(current_canvas.painting_name) && istype(I,/obj/item/pen)) try_rename(user) + return TRUE else return ..() diff --git a/code/game/objects/structures/barsigns.dm b/code/game/objects/structures/barsigns.dm index 958517e701d94..14a729058c8d0 100644 --- a/code/game/objects/structures/barsigns.dm +++ b/code/game/objects/structures/barsigns.dm @@ -73,7 +73,7 @@ return pick_sign(user) -/obj/structure/sign/barsign/attackby(obj/item/I, mob/user) +/obj/structure/sign/barsign/item_interact(obj/item/I, mob/user) if(I.tool_behaviour == TOOL_SCREWDRIVER) if(!panel_open) to_chat(user, "You open the maintenance panel.") @@ -89,18 +89,20 @@ else set_sign(new /datum/barsign/hiddensigns/empbarsign) panel_open = FALSE + return TRUE else if(istype(I, /obj/item/stack/cable_coil) && panel_open) var/obj/item/stack/cable_coil/C = I if(!broken) to_chat(user, "This sign is functioning properly!") - return + return TRUE if(C.use(2)) to_chat(user, "You replace the burnt wiring.") broken = FALSE else to_chat(user, "You need at least two lengths of cable!") + return TRUE else return ..() diff --git a/code/game/objects/structures/beds_chairs/bed.dm b/code/game/objects/structures/beds_chairs/bed.dm index e6aae91066d56..9421c10a96ae7 100644 --- a/code/game/objects/structures/beds_chairs/bed.dm +++ b/code/game/objects/structures/beds_chairs/bed.dm @@ -47,10 +47,11 @@ /obj/structure/bed/attack_paw(mob/user) return attack_hand(user) -/obj/structure/bed/attackby(obj/item/W, mob/user, params) +/obj/structure/bed/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_WRENCH && !(flags_1&NODECONSTRUCT_1)) W.play_tool_sound(src) deconstruct(TRUE) + return TRUE else return ..() @@ -74,12 +75,12 @@ move_resist = MOVE_FORCE_WEAK var/foldabletype = /obj/item/deployable/rollerbed -/obj/structure/bed/roller/attackby(obj/item/W, mob/user, params) +/obj/structure/bed/roller/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/deployable/rollerbed/robo)) var/obj/item/deployable/rollerbed/robo/R = W if(R.loaded) to_chat(user, "You already have a roller bed docked!") - return + return TRUE if(has_buckled_mobs()) if(buckled_mobs.len > 1) diff --git a/code/game/objects/structures/beds_chairs/bench.dm b/code/game/objects/structures/beds_chairs/bench.dm index 5875696f3f741..b03b36df92e0c 100644 --- a/code/game/objects/structures/beds_chairs/bench.dm +++ b/code/game/objects/structures/beds_chairs/bench.dm @@ -72,7 +72,7 @@ cover = mutable_appearance('icons/obj/beds_chairs/benches.dmi', "[icon_state]_cover", color = cover_color) //this supports colouring, but not the base bench add_overlay(cover) -/obj/structure/chair/fancy/bench/corporate/attacked_by(obj/item/I, mob/living/user) +/obj/structure/chair/fancy/bench/corporate/on_attacked(obj/item/I, mob/living/user) . = ..() if(istype(I, /obj/item/toy/crayon)) var/obj/item/toy/crayon/C = I diff --git a/code/game/objects/structures/beds_chairs/chair.dm b/code/game/objects/structures/beds_chairs/chair.dm index 62501363e11ea..753d470246f53 100644 --- a/code/game/objects/structures/beds_chairs/chair.dm +++ b/code/game/objects/structures/beds_chairs/chair.dm @@ -74,15 +74,16 @@ B.setDir(dir) qdel(src) -/obj/structure/chair/attackby(obj/item/W, mob/user, params) +/obj/structure/chair/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_WRENCH && !(flags_1 & NODECONSTRUCT_1)) to_chat(user, "You start deconstructing [src]...") if(W.use_tool(src, user, 30, volume=50)) playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1) deconstruct(TRUE, 1) + return TRUE else if(istype(W, /obj/item/assembly/shock_kit)) if(!user.temporarilyRemoveItemFromInventory(W)) - return + return TRUE var/obj/item/assembly/shock_kit/SK = W var/obj/structure/chair/e_chair/E = new /obj/structure/chair/e_chair(src.loc) playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1) @@ -91,6 +92,7 @@ SK.forceMove(E) SK.master = E qdel(src) + return TRUE else return ..() @@ -195,10 +197,10 @@ . = ..() update_armrest() -/obj/structure/chair/fancy/attackby(obj/item/I, mob/living/user) +/obj/structure/chair/fancy/item_interact(obj/item/I, mob/living/user) . = ..() if(!colorable) - return + return ..() if(istype(I, /obj/item/toy/crayon)) var/obj/item/toy/crayon/C = I var/new_color = C.paint_color @@ -206,10 +208,12 @@ hsl[3] = max(hsl[3], 0.4) var/list/rgb = hsl2rgb(arglist(hsl)) color = "#[num2hex(rgb[1], 2)][num2hex(rgb[2], 2)][num2hex(rgb[3], 2)]" + . = TRUE if(color) cut_overlay(armrest) armrest = GetArmrest() update_armrest() + return . || ..() /obj/structure/chair/fancy/Initialize(mapload) armrest = GetArmrest() diff --git a/code/game/objects/structures/bedsheet_bin.dm b/code/game/objects/structures/bedsheet_bin.dm index b26314ec37c13..b743f1b122c59 100644 --- a/code/game/objects/structures/bedsheet_bin.dm +++ b/code/game/objects/structures/bedsheet_bin.dm @@ -41,36 +41,38 @@ update_icon() ..() -/obj/structure/bedsheetbin/attackby(obj/item/I, mob/user, params) +/obj/structure/bedsheetbin/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/bedsheet)) if(!user.transferItemToLoc(I, src)) - return + return TRUE sheets.Add(I) amount++ to_chat(user, "You put [I] in [src].") update_icon() else if(default_unfasten_wrench(user, I, 5)) - return + return TRUE else if(I.tool_behaviour == TOOL_SCREWDRIVER) if(flags_1 & NODECONSTRUCT_1) - return + return TRUE if(amount) to_chat(user, "The [src] must be empty first!") - return + return TRUE if(I.use_tool(src, user, 5, volume=50)) to_chat(user, "You disassemble the [src].") new /obj/item/stack/rods(loc, 2) qdel(src) + return TRUE else if(amount && !hidden && I.w_class < WEIGHT_CLASS_BULKY) //make sure there's sheets to hide it among, make sure nothing else is hidden in there. if(!user.transferItemToLoc(I, src)) to_chat(user, "\The [I] is stuck to your hand, you cannot hide it among the sheets!") - return + return TRUE hidden = I to_chat(user, "You hide [I] among the sheets.") - + return TRUE + return ..() /obj/structure/bedsheetbin/attack_paw(mob/user) return attack_hand(user) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index aa808e6aea703..9cc5373c2d0c5 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -284,9 +284,9 @@ if(!broken && !(flags_1 & NODECONSTRUCT_1)) bust_open() -/obj/structure/closet/attackby(obj/item/W, mob/user, params) +/obj/structure/closet/item_interact(obj/item/W, mob/user, params) if(user in src) - return + return ..() if(src.tool_interact(W,user)) return 1 // No afterattack else diff --git a/code/game/objects/structures/crates_lockers/closets/bodybag.dm b/code/game/objects/structures/crates_lockers/closets/bodybag.dm index 4a1f104680db3..4d057cd2f754a 100644 --- a/code/game/objects/structures/crates_lockers/closets/bodybag.dm +++ b/code/game/objects/structures/crates_lockers/closets/bodybag.dm @@ -27,28 +27,30 @@ QDEL_NULL(foldedbag_instance) return ..() -/obj/structure/closet/body_bag/attackby(obj/item/I, mob/user, params) +/obj/structure/closet/body_bag/item_interact(obj/item/I, mob/user, params) if (istype(I, /obj/item/pen) || istype(I, /obj/item/toy/crayon)) if(!user.is_literate()) to_chat(user, "You scribble illegibly on [src]!") - return + return TRUE var/t = stripped_input(user, "What would you like the label to be?", name, null, 53) if(user.get_active_held_item() != I) - return + return TRUE if(!user.canUseTopic(src, BE_CLOSE)) - return + return TRUE if(t) name = "body bag - [t]" tagged = 1 update_icon() else name = "body bag" - return + return TRUE else if(I.tool_behaviour == TOOL_WIRECUTTER) to_chat(user, "You cut the tag off [src].") name = "body bag" tagged = 0 update_icon() + return TRUE + return ..() /obj/structure/closet/body_bag/update_icon() ..() diff --git a/code/game/objects/structures/crates_lockers/closets/secure/personal.dm b/code/game/objects/structures/crates_lockers/closets/secure/personal.dm index d9bec0c8ba199..04b50abf74656 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/personal.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/personal.dm @@ -36,7 +36,7 @@ new /obj/item/instrument/piano_synth(src) new /obj/item/radio/headset( src ) -/obj/structure/closet/secure_closet/personal/attackby(obj/item/W, mob/user, params) +/obj/structure/closet/secure_closet/personal/item_interact(obj/item/W, mob/user, params) var/obj/item/card/id/I = W.GetID() if(istype(I)) if(broken) @@ -54,5 +54,6 @@ desc = "Owned by [I.registered_name]." else to_chat(user, "Access Denied.") + return TRUE else return ..() diff --git a/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm b/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm index 93e5011c30fe5..a673b641666ea 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm @@ -7,7 +7,7 @@ armor = list(MELEE = 30, BULLET = 50, LASER = 50, ENERGY = 100, BOMB = 0, BIO = 0, RAD = 0, FIRE = 80, ACID = 80, STAMINA = 0) secure = TRUE -/obj/structure/closet/secure_closet/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir) +/obj/structure/closet/secure_closet/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir, armour_penetration = 0) if(damage_flag == MELEE && damage_amount < 20) return 0 . = ..() diff --git a/code/game/objects/structures/crates_lockers/crates/bins.dm b/code/game/objects/structures/crates_lockers/crates/bins.dm index 9cbc4ec468bf7..a937405d8951d 100644 --- a/code/game/objects/structures/crates_lockers/crates/bins.dm +++ b/code/game/objects/structures/crates_lockers/crates/bins.dm @@ -26,7 +26,7 @@ else add_overlay("largebino") -/obj/structure/closet/crate/bin/attackby(obj/item/W, mob/user, params) +/obj/structure/closet/crate/bin/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/storage/bag/trash)) var/obj/item/storage/bag/trash/T = W to_chat(user, "You fill the bag.") diff --git a/code/game/objects/structures/crates_lockers/crates/large.dm b/code/game/objects/structures/crates_lockers/crates/large.dm index e9bd2e1b47d1a..d3a314dad53be 100644 --- a/code/game/objects/structures/crates_lockers/crates/large.dm +++ b/code/game/objects/structures/crates_lockers/crates/large.dm @@ -20,7 +20,7 @@ else to_chat(user, "You need a crowbar to pry this open!") -/obj/structure/closet/crate/large/attackby(obj/item/W, mob/user, params) +/obj/structure/closet/crate/large/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_CROWBAR) if(manifest) tear_manifest(user) @@ -37,12 +37,9 @@ AM.forceMove(T) qdel(src) + return TRUE else - if(user.a_intent == INTENT_HARM) //Only return ..() if intent is harm, otherwise return 0 or just end it. - return ..() //Stops it from opening and turning invisible when items are used on it. - - else - to_chat(user, "You need a crowbar to pry this open!") - return FALSE //Just stop. Do nothing. Don't turn into an invisible sprite. Don't open like a locker. - //The large crate has no non-attack interactions other than the crowbar, anyway. + to_chat(user, "You need a crowbar to pry this open!") + return FALSE //Just stop. Do nothing. Don't turn into an invisible sprite. Don't open like a locker. + //The large crate has no non-attack interactions other than the crowbar, anyway. diff --git a/code/game/objects/structures/crates_lockers/crates/secure.dm b/code/game/objects/structures/crates_lockers/crates/secure.dm index 7330195e67081..e657c71b0aad5 100644 --- a/code/game/objects/structures/crates_lockers/crates/secure.dm +++ b/code/game/objects/structures/crates_lockers/crates/secure.dm @@ -10,7 +10,7 @@ icon_door = "crate" icon_door_override = TRUE -/obj/structure/closet/crate/secure/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir) +/obj/structure/closet/crate/secure/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir, armour_penetration = 0) if(damage_flag == MELEE && damage_amount < 25) return 0 . = ..() diff --git a/code/game/objects/structures/displaycase.dm b/code/game/objects/structures/displaycase.dm index ba3ff3240c553..e7bf64a2851ca 100644 --- a/code/game/objects/structures/displaycase.dm +++ b/code/game/objects/structures/displaycase.dm @@ -137,7 +137,7 @@ else if(!open) . += "[initial(icon_state)]_closed" -/obj/structure/displaycase/attackby(obj/item/W, mob/user, params) +/obj/structure/displaycase/item_interact(obj/item/W, mob/user, params) if(W.GetID() && !broken && openable) if(open) //You do not require access to close a case, only to open it. to_chat(user, "You close [src].") @@ -147,10 +147,11 @@ else to_chat(user, "You open [src].") toggle_lock(user) + return TRUE else if(W.tool_behaviour == TOOL_WELDER && user.a_intent == INTENT_HELP && !broken) if(obj_integrity < max_integrity) if(!W.tool_start_check(user, amount=5)) - return + return TRUE to_chat(user, "You begin repairing [src]...") if(W.use_tool(src, user, 40, amount=5, volume=50)) @@ -159,7 +160,7 @@ to_chat(user, "You repair [src].") else to_chat(user, "[src] is already in good condition!") - return + return TRUE else if(!alert && W.tool_behaviour == TOOL_CROWBAR && openable) //Only applies to the lab cage and player made display cases if(broken) if(showpiece) @@ -172,6 +173,7 @@ if(W.use_tool(src, user, 20)) to_chat(user, "You [open ? "close":"open"] [src].") toggle_lock(user) + return TRUE else if(open && !showpiece) if(showpiece_type && !istype(W, showpiece_type)) to_chat(user, "This doesn't belong in this kind of display.") @@ -180,17 +182,19 @@ showpiece = W to_chat(user, "You put [W] on display.") update_icon() + return TRUE else if(glass_fix && broken && istype(W, /obj/item/stack/sheet/glass)) var/obj/item/stack/sheet/glass/G = W if(G.get_amount() < 2) to_chat(user, "You need two glass sheets to fix the case!") - return + return TRUE to_chat(user, "You start fixing [src]...") if(do_after(user, 20, target = src)) G.use(2) broken = FALSE obj_integrity = max_integrity update_icon() + return TRUE else return ..() @@ -234,7 +238,7 @@ var/obj/item/electronics/airlock/electronics -/obj/structure/displaycase_chassis/attackby(obj/item/I, mob/user, params) +/obj/structure/displaycase_chassis/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_WRENCH) //The player can only deconstruct the wooden frame to_chat(user, "You start disassembling [src]...") I.play_tool_sound(src) @@ -242,6 +246,7 @@ playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1) new /obj/item/stack/sheet/wood(get_turf(src), 5) qdel(src) + return TRUE else if(istype(I, /obj/item/electronics/airlock)) to_chat(user, "You start installing the electronics into [src]...") @@ -249,6 +254,7 @@ if(do_after(user, 30, target = src) && user.transferItemToLoc(I,src)) electronics = I to_chat(user, "You install the airlock electronics.") + return TRUE else if(istype(I, /obj/item/stock_parts/manipulator)) var/obj/item/stock_parts/manipulator/M = I @@ -264,12 +270,13 @@ sale.req_access = electronics.accesses qdel(src) qdel(M) + return TRUE else if(istype(I, /obj/item/stack/sheet/glass)) var/obj/item/stack/sheet/glass/G = I if(G.get_amount() < 10) to_chat(user, "You need ten glass sheets to do this!") - return + return TRUE to_chat(user, "You start adding [G] to [src]...") if(do_after(user, 20, target = src)) G.use(10) @@ -282,6 +289,7 @@ else display.req_access = electronics.accesses qdel(src) + return TRUE else return ..() @@ -321,14 +329,12 @@ GLOB.trophy_cases -= src return ..() -/obj/structure/displaycase/trophy/attackby(obj/item/W, mob/living/user, params) +/obj/structure/displaycase/trophy/item_interact(obj/item/W, mob/living/user, params) if(!user.Adjacent(src)) //no TK museology - return - if(user.a_intent == INTENT_HARM) - return ..() + return TRUE if(W.tool_behaviour == TOOL_WELDER && !broken) - return ..() + return TRUE if(user.is_holding_item_of_type(/obj/item/key/displaycase)) if(added_roundstart) @@ -336,24 +342,24 @@ to_chat(user, "You [!is_locked ? "un" : ""]lock the case.") else to_chat(user, "The lock is stuck shut!") - return + return TRUE if(is_locked) to_chat(user, "The case is shut tight with an old-fashioned physical lock. Maybe you should ask the curator for the key?") - return + return TRUE if(!added_roundstart) to_chat(user, "You've already put something new in this case!") - return + return TRUE if(is_type_in_typecache(W, GLOB.blacklisted_cargo_types)) to_chat(user, "The case rejects the [W]!") - return + return TRUE for(var/a in W.GetAllContents()) if(is_type_in_typecache(a, GLOB.blacklisted_cargo_types)) to_chat(user, "The case rejects the [W]!") - return + return TRUE if(user.transferItemToLoc(W, src)) @@ -383,8 +389,7 @@ else to_chat(user, "\The [W] is stuck to your hand, you can't put it in the [src.name]!") - - return + return TRUE /obj/structure/displaycase/trophy/dump() if (showpiece) @@ -541,21 +546,21 @@ to_chat(usr, "The cost is now set to [sale_price].") . = TRUE -/obj/structure/displaycase/forsale/attackby(obj/item/I, mob/living/user, params) +/obj/structure/displaycase/forsale/item_interact(obj/item/I, mob/living/user, params) if(isidcard(I)) //Card Registration var/obj/item/card/id/potential_acc = I if(!potential_acc.registered_account) to_chat(user, "This ID card has no account registered!") - return + return TRUE if(payments_acc == potential_acc.registered_account) playsound(src, 'sound/machines/click.ogg', 20, TRUE) toggle_lock() - return + return TRUE if(istype(I, /obj/item/modular_computer)) return TRUE ui_update() - . = ..() + return ..() /obj/structure/displaycase/forsale/multitool_act(mob/living/user, obj/item/I) diff --git a/code/game/objects/structures/door_assembly.dm b/code/game/objects/structures/door_assembly.dm index 3adb0b8c64364..e875cf59f6cfc 100644 --- a/code/game/objects/structures/door_assembly.dm +++ b/code/game/objects/structures/door_assembly.dm @@ -50,18 +50,21 @@ else . += "There is a small paper placard on the assembly[doorname]." -/obj/structure/door_assembly/attackby(obj/item/W, mob/user, params) +/obj/structure/door_assembly/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/pen)) var/t = stripped_input(user, "Enter the name for the door.", name, created_name,MAX_NAME_LEN) if(!t) - return + return TRUE if(!in_range(src, usr) && loc != usr) - return + return TRUE created_name = t + update_name() + update_icon() + return TRUE else if((W.tool_behaviour == TOOL_WELDER) && (mineral || glass || !anchored )) if(!W.tool_start_check(user, amount=0)) - return + return TRUE if(mineral) var/obj/item/stack/sheet/mineral/mineral_path = text2path("/obj/item/stack/sheet/mineral/[mineral]") @@ -88,6 +91,9 @@ if(W.use_tool(src, user, 40, volume=50)) to_chat(user, "You disassemble the airlock assembly.") deconstruct(TRUE) + update_name() + update_icon() + return TRUE else if(W.tool_behaviour == TOOL_WRENCH) if(!anchored ) @@ -104,7 +110,7 @@ if(W.use_tool(src, user, 40, volume=100)) if(anchored) - return + return TRUE to_chat(user, "You secure the airlock assembly.") name = "secured airlock assembly" setAnchored(TRUE) @@ -117,23 +123,29 @@ "You hear wrenching.") if(W.use_tool(src, user, 40, volume=100)) if(!anchored) - return + return TRUE to_chat(user, "You unsecure the airlock assembly.") name = "airlock assembly" setAnchored(FALSE) + update_name() + update_icon() + return TRUE else if(istype(W, /obj/item/stack/cable_coil) && state == AIRLOCK_ASSEMBLY_NEEDS_WIRES && anchored ) if(!W.tool_start_check(user, amount=1)) - return + return TRUE user.visible_message("[user] wires the airlock assembly.", \ "You start to wire the airlock assembly...") if(W.use_tool(src, user, 40, amount=1)) if(state != AIRLOCK_ASSEMBLY_NEEDS_WIRES) - return + return TRUE state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS to_chat(user, "You wire the airlock assembly.") name = "wired airlock assembly" + update_name() + update_icon() + return TRUE else if((W.tool_behaviour == TOOL_WIRECUTTER) && state == AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS ) user.visible_message("[user] cuts the wires from the airlock assembly.", \ @@ -141,11 +153,14 @@ if(W.use_tool(src, user, 40, volume=100)) if(state != AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS) - return + return TRUE to_chat(user, "You cut the wires from the airlock assembly.") new/obj/item/stack/cable_coil(get_turf(user), 1) state = AIRLOCK_ASSEMBLY_NEEDS_WIRES name = "secured airlock assembly" + update_name() + update_icon() + return TRUE else if(istype(W, /obj/item/electronics/airlock) && state == AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS ) W.play_tool_sound(src, 100) @@ -153,14 +168,17 @@ "You start to install electronics into the airlock assembly...") if(do_after(user, 40, target = src)) if( state != AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS ) - return + return TRUE if(!user.transferItemToLoc(W, src)) - return + return TRUE to_chat(user, "You install the airlock electronics.") state = AIRLOCK_ASSEMBLY_NEEDS_SCREWDRIVER name = "near finished airlock assembly" electronics = W + update_name() + update_icon() + return TRUE else if(istype(W, /obj/item/electroadaptive_pseudocircuit) && state == AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS ) var/obj/item/electroadaptive_pseudocircuit/EP = W @@ -175,10 +193,10 @@ if(do_after(user, 40, target = src)) if( state != AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS ) qdel(AE) - return + return TRUE if(!user.transferItemToLoc(AE, src)) qdel(AE) - return + return TRUE to_chat(user, "You install the electroadaptive pseudocircuit.") state = AIRLOCK_ASSEMBLY_NEEDS_SCREWDRIVER @@ -186,6 +204,9 @@ electronics = AE else qdel(AE) + update_name() + update_icon() + return TRUE else if((W.tool_behaviour == TOOL_CROWBAR) && state == AIRLOCK_ASSEMBLY_NEEDS_SCREWDRIVER ) @@ -194,7 +215,7 @@ if(W.use_tool(src, user, 40, volume=100)) if(state != AIRLOCK_ASSEMBLY_NEEDS_SCREWDRIVER) - return + return TRUE to_chat(user, "You remove the airlock electronics.") state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS name = "wired airlock assembly" @@ -205,6 +226,9 @@ ae = electronics electronics = null ae.forceMove(src.loc) + update_name() + update_icon() + return TRUE else if(istype(W, /obj/item/stack/sheet) && (!glass || !mineral)) var/obj/item/stack/sheet/G = W @@ -218,7 +242,7 @@ "You start to install [G.name] into the airlock assembly...") if(do_after(user, 40, target = src)) if(G.get_amount() < 1 || glass) - return + return TRUE if(G.type == /obj/item/stack/sheet/rglass) to_chat(user, "You install [G.name] windows into the airlock assembly.") heat_proof_finished = 1 //reinforced glass makes the airlock heat-proof @@ -237,7 +261,7 @@ "You start to install [G.name] into the airlock assembly...") if(do_after(user, 40, target = src)) if(G.get_amount() < 2 || mineral) - return + return TRUE to_chat(user, "You install [M] plating into the airlock assembly.") G.use(2) var/mineralassembly = text2path("/obj/structure/door_assembly/door_assembly_[M]") @@ -249,6 +273,9 @@ to_chat(user, "You cannot add [G] to [src]!") else to_chat(user, "You cannot add [G] to [src]!") + update_name() + update_icon() + return TRUE else if((W.tool_behaviour == TOOL_SCREWDRIVER) && state == AIRLOCK_ASSEMBLY_NEEDS_SCREWDRIVER ) user.visible_message("[user] finishes the airlock.", \ @@ -280,10 +307,11 @@ electronics.forceMove(door) door.update_icon() qdel(src) + update_name() + update_icon() + return TRUE else return ..() - update_name() - update_icon() /obj/structure/door_assembly/update_icon() cut_overlays() diff --git a/code/game/objects/structures/dresser.dm b/code/game/objects/structures/dresser.dm index 79b91e3cb78b0..df979beb9c66e 100644 --- a/code/game/objects/structures/dresser.dm +++ b/code/game/objects/structures/dresser.dm @@ -6,12 +6,13 @@ density = TRUE anchored = TRUE -/obj/structure/dresser/attackby(obj/item/I, mob/user, params) +/obj/structure/dresser/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_WRENCH) to_chat(user, "You begin to [anchored ? "unwrench" : "wrench"] [src].") if(I.use_tool(src, user, 20, volume=50)) to_chat(user, "You successfully [anchored ? "unwrench" : "wrench"] [src].") setAnchored(!anchored) + return TRUE else return ..() diff --git a/code/game/objects/structures/electricchair.dm b/code/game/objects/structures/electricchair.dm index 88759fcc64ba8..f927f48901867 100644 --- a/code/game/objects/structures/electricchair.dm +++ b/code/game/objects/structures/electricchair.dm @@ -10,14 +10,14 @@ . = ..() add_overlay(mutable_appearance('icons/obj/beds_chairs/chairs.dmi', "echair_over", MOB_LAYER + 1)) -/obj/structure/chair/e_chair/attackby(obj/item/W, mob/user, params) +/obj/structure/chair/e_chair/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_WRENCH) var/obj/structure/chair/C = new /obj/structure/chair(loc) W.play_tool_sound(src) C.setDir(dir) qdel(src) part.forceMove(loc) - return + return TRUE . = ..() /obj/structure/chair/e_chair/proc/shock() diff --git a/code/game/objects/structures/extinguisher.dm b/code/game/objects/structures/extinguisher.dm index b2f0233c94c07..df0df114037e0 100644 --- a/code/game/objects/structures/extinguisher.dm +++ b/code/game/objects/structures/extinguisher.dm @@ -46,7 +46,7 @@ stored_extinguisher = null update_icon() -/obj/structure/extinguisher_cabinet/attackby(obj/item/I, mob/user, params) +/obj/structure/extinguisher_cabinet/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_WRENCH && !stored_extinguisher) to_chat(user, "You start unsecuring [name]...") I.play_tool_sound(src) @@ -54,22 +54,24 @@ playsound(loc, 'sound/items/deconstruct.ogg', 50, 1) to_chat(user, "You unsecure [name].") deconstruct(TRUE) - return + return TRUE if(iscyborg(user) || isalien(user)) - return + return ..() if(istype(I, /obj/item/extinguisher)) if(!stored_extinguisher && opened) if(!user.transferItemToLoc(I, src)) - return + return TRUE stored_extinguisher = I to_chat(user, "You place [I] in [src].") update_icon() return TRUE else toggle_cabinet(user) + return TRUE else if(user.a_intent != INTENT_HARM) toggle_cabinet(user) + return TRUE else return ..() diff --git a/code/game/objects/structures/false_walls.dm b/code/game/objects/structures/false_walls.dm index 6495129b37905..a43e262e00d37 100644 --- a/code/game/objects/structures/false_walls.dm +++ b/code/game/objects/structures/false_walls.dm @@ -84,31 +84,34 @@ qdel(src) return T -/obj/structure/falsewall/attackby(obj/item/W, mob/user, params) +/obj/structure/falsewall/item_interact(obj/item/W, mob/user, params) if(opening) to_chat(user, "You must wait until the door has stopped moving!") - return + return ..() if(W.tool_behaviour == TOOL_SCREWDRIVER) if(density) var/turf/T = get_turf(src) if(T.density) to_chat(user, "[src] is blocked!") - return + return TRUE if(!isfloorturf(T)) to_chat(user, "[src] bolts must be tightened on the floor!") - return + return TRUE user.visible_message("[user] tightens some bolts on the wall.", "You tighten the bolts on the wall.") ChangeToWall() else to_chat(user, "You can't reach, close it first!") + return TRUE else if(W.tool_behaviour == TOOL_WELDER) if(W.use_tool(src, user, 0, volume=50)) dismantle(user, TRUE) + return TRUE else if(istype(W, /obj/item/pickaxe/drill/jackhammer)) W.play_tool_sound(src) dismantle(user, TRUE) + return TRUE else return ..() @@ -154,10 +157,11 @@ to_chat(user, "The outer grille is fully intact.") return null -/obj/structure/falsewall/reinforced/attackby(obj/item/tool, mob/user) - ..() +/obj/structure/falsewall/reinforced/item_interact(obj/item/tool, mob/user) if(tool.tool_behaviour == TOOL_WIRECUTTER) dismantle(user, TRUE, tool) + return TRUE + return ..() /* * Uranium Falsewalls @@ -177,7 +181,7 @@ var/active = null var/last_event = 0 -/obj/structure/falsewall/uranium/attackby(obj/item/W, mob/user, params) +/obj/structure/falsewall/uranium/item_interact(obj/item/W, mob/user, params) radiate() return ..() @@ -261,13 +265,11 @@ mineral = /obj/item/stack/sheet/mineral/plasma walltype = /turf/closed/wall/mineral/plasma -/obj/structure/falsewall/plasma/attackby(obj/item/W, mob/user, params) +/obj/structure/falsewall/plasma/item_interact(obj/item/W, mob/user, params) if(W.is_hot() > 300) if(plasma_ignition(6, user)) new /obj/structure/girder/displaced(loc) - - else - return ..() + return ..() /obj/structure/falsewall/plasma/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > 300) diff --git a/code/game/objects/structures/fence.dm b/code/game/objects/structures/fence.dm index 27672ffa8215c..57de58bb5ba89 100644 --- a/code/game/objects/structures/fence.dm +++ b/code/game/objects/structures/fence.dm @@ -57,18 +57,18 @@ icon_state = "straight_cut3" hole_size = LARGE_HOLE -/obj/structure/fence/attackby(obj/item/W, mob/user) +/obj/structure/fence/item_interact(obj/item/W, mob/user) if(W.tool_behaviour == TOOL_WIRECUTTER) if(!cuttable) to_chat(user, "This section of the fence can't be cut.") - return + return TRUE if(invulnerable) to_chat(user, "This fence is too strong to cut through.") - return + return TRUE var/current_stage = hole_size if(current_stage >= MAX_HOLE_SIZE) to_chat(user, "This fence has too much cut out of it already.") - return + return TRUE user.visible_message("\The [user] starts cutting through \the [src] with \the [W].",\ "You start cutting through \the [src] with \the [W].") @@ -86,8 +86,8 @@ RemoveElement(/datum/element/climbable) update_cut_status() - - return TRUE + return TRUE + return ..() /obj/structure/fence/proc/update_cut_status() if(!cuttable) diff --git a/code/game/objects/structures/fireaxe.dm b/code/game/objects/structures/fireaxe.dm index a9f1c9f3ec988..5b482f897a77d 100644 --- a/code/game/objects/structures/fireaxe.dm +++ b/code/game/objects/structures/fireaxe.dm @@ -23,13 +23,14 @@ QDEL_NULL(fireaxe) return ..() -/obj/structure/fireaxecabinet/attackby(obj/item/I, mob/user, params) +/obj/structure/fireaxecabinet/item_interact(obj/item/I, mob/user, params) if(iscyborg(user) || I.tool_behaviour == TOOL_MULTITOOL) toggle_lock(user) + return TRUE else if(I.tool_behaviour == TOOL_WELDER && user.a_intent == INTENT_HELP && !broken) if(obj_integrity < max_integrity) if(!I.tool_start_check(user, amount=2)) - return + return TRUE to_chat(user, "You begin repairing [src].") if(I.use_tool(src, user, 40, volume=50, amount=2)) @@ -38,31 +39,33 @@ to_chat(user, "You repair [src].") else to_chat(user, "[src] is already in good condition!") - return + return TRUE else if(istype(I, /obj/item/stack/sheet/glass) && broken) var/obj/item/stack/sheet/glass/G = I if(G.get_amount() < 2) to_chat(user, "You need two glass sheets to fix [src]!") - return + return TRUE to_chat(user, "You start fixing [src]...") if(do_after(user, 20, target = src) && G.use(2)) broken = 0 obj_integrity = max_integrity update_appearance() + return TRUE else if(open || broken) if(istype(I, /obj/item/fireaxe) && !fireaxe) var/obj/item/fireaxe/F = I if(F && ISWIELDED(F)) to_chat(user, "Unwield the [F.name] first.") - return + return TRUE if(!user.transferItemToLoc(F, src)) - return + return TRUE fireaxe = F to_chat(user, "You place the [F.name] back in the [name].") update_appearance() - return + return TRUE else if(!broken) toggle_open() + return TRUE else return ..() diff --git a/code/game/objects/structures/fireplace.dm b/code/game/objects/structures/fireplace.dm index 13eaacdfa589f..1c63799c52ae7 100644 --- a/code/game/objects/structures/fireplace.dm +++ b/code/game/objects/structures/fireplace.dm @@ -37,20 +37,21 @@ ignite() return TRUE -/obj/structure/fireplace/attackby(obj/item/T, mob/user) +/obj/structure/fireplace/item_interact(obj/item/T, mob/user) if(istype(T, /obj/item/stack/sheet/wood)) var/obj/item/stack/sheet/wood/wood = T var/space_remaining = MAXIMUM_BURN_TIMER - burn_time_remaining() var/space_for_logs = round(space_remaining / LOG_BURN_TIMER) if(space_for_logs < 1) to_chat(user, "You can't fit any more of [T] in [src]!") - return + return TRUE var/logs_used = min(space_for_logs, wood.amount) wood.use(logs_used) adjust_fuel_timer(LOG_BURN_TIMER * logs_used) user.visible_message("[user] tosses some \ wood into [src].", "You add \ some fuel to [src].") + return TRUE else if(istype(T, /obj/item/paper_bin)) var/obj/item/paper_bin/paper_bin = T user.visible_message("[user] throws [T] into \ @@ -58,14 +59,16 @@ ") adjust_fuel_timer(PAPER_BURN_TIMER * paper_bin.total_paper) qdel(paper_bin) + return TRUE else if(istype(T, /obj/item/paper)) user.visible_message("[user] throws [T] into \ [src].", "You throw [T] into [src].\ ") adjust_fuel_timer(PAPER_BURN_TIMER) qdel(T) + return TRUE else if(try_light(T,user)) - return + return TRUE else . = ..() diff --git a/code/game/objects/structures/flora.dm b/code/game/objects/structures/flora.dm index 7cc8bf747b9e7..dd5490a7d7e8b 100644 --- a/code/game/objects/structures/flora.dm +++ b/code/game/objects/structures/flora.dm @@ -12,7 +12,7 @@ layer = FLY_LAYER var/log_amount = 10 -/obj/structure/flora/tree/attackby(obj/item/W, mob/user, params) +/obj/structure/flora/tree/item_interact(obj/item/W, mob/user, params) if(log_amount && (!(flags_1 & NODECONSTRUCT_1))) if(W.is_sharp() && W.force > 0) if(W.hitsound) @@ -28,6 +28,7 @@ S.name = "[name] stump" qdel(src) + return TRUE else return ..() diff --git a/code/game/objects/structures/fluff.dm b/code/game/objects/structures/fluff.dm index 28641d2e25ba8..936cfb4b883c8 100644 --- a/code/game/objects/structures/fluff.dm +++ b/code/game/objects/structures/fluff.dm @@ -10,7 +10,7 @@ opacity = FALSE var/deconstructible = TRUE -/obj/structure/fluff/attackby(obj/item/I, mob/living/user, params) +/obj/structure/fluff/item_interact(obj/item/I, mob/living/user, params) if(I.tool_behaviour == TOOL_WRENCH && deconstructible) user.visible_message("[user] starts disassembling [src]...", "You start disassembling [src]...") I.play_tool_sound(src) @@ -19,7 +19,7 @@ playsound(user, 'sound/items/deconstruct.ogg', 50, 1) new/obj/item/stack/sheet/iron(drop_location()) qdel(src) - return + return TRUE ..() /obj/structure/fluff/empty_terrarium //Empty terrariums are created when a preserved terrarium in a lavaland seed vault is activated. diff --git a/code/game/objects/structures/girders.dm b/code/game/objects/structures/girders.dm index 74c01cb144705..c4abee27ad12d 100644 --- a/code/game/objects/structures/girders.dm +++ b/code/game/objects/structures/girders.dm @@ -28,7 +28,7 @@ if(GIRDER_DISASSEMBLED) . += "[src] is disassembled! You probably shouldn't be able to see this examine message." -/obj/structure/girder/attackby(obj/item/W, mob/user, params) +/obj/structure/girder/item_interact(obj/item/W, mob/user, params) add_fingerprint(user) if(istype(W, /obj/item/gun/energy/plasmacutter)) @@ -37,177 +37,180 @@ balloon_alert(user, "You slice apart [src].") new /obj/item/stack/sheet/iron(loc, 2, TRUE, user) qdel(src) - return + return TRUE else if(istype(W, /obj/item/pickaxe/drill/jackhammer)) to_chat(user, "You smash through [src]!") new /obj/item/stack/sheet/iron(get_turf(src)) W.play_tool_sound(src) qdel(src) + return TRUE else if(istype(W, /obj/item/stack)) if(iswallturf(loc)) balloon_alert(user, "You try to make a wall, but there is aleady one here!") - return + return TRUE if(!isfloorturf(loc)) balloon_alert(user, "You need a floor to make a wall!") - return + return TRUE if (locate(/obj/structure/falsewall) in loc.contents) balloon_alert(user, "You try to make a wall here, but a false wall is already in your way!") - return + return TRUE if(istype(W, /obj/item/stack/rods)) var/obj/item/stack/rods/S = W if(state == GIRDER_DISPLACED) if(S.get_amount() < 2) to_chat(user, "You need at least two rods to create a false wall!") - return + return TRUE balloon_alert(user, "You start building a reinforced false wall...") if(do_after(user, 20, target = src)) if(S.get_amount() < 2) - return + return TRUE S.use(2) balloon_alert(user, "You create a false wall.") var/obj/structure/falsewall/iron/FW = new (loc) transfer_fingerprints_to(FW) qdel(src) - return + return TRUE else if(S.get_amount() < 5) to_chat(user, "You need at least five rods to add plating!") - return + return TRUE balloon_alert(user, "You start adding plating...") if(do_after(user, 40, target = src)) if(S.get_amount() < 5) - return + return TRUE S.use(5) balloon_alert(user, "You add plating.") var/turf/T = get_turf(src) T.PlaceOnTop(/turf/closed/wall/mineral/iron) transfer_fingerprints_to(T) qdel(src) - return + return TRUE if(!istype(W, /obj/item/stack/sheet)) - return + return TRUE var/obj/item/stack/sheet/S = W if(istype(S, /obj/item/stack/sheet/iron)) if(state == GIRDER_DISPLACED) if(S.get_amount() < 2) to_chat(user, "You need two sheets of iron to create a false wall!") - return + return TRUE balloon_alert(user, "You start building false wall...") if(do_after(user, 20, target = src)) if(S.get_amount() < 2) - return + return TRUE S.use(2) balloon_alert(user, "You create a false wall.") var/obj/structure/falsewall/F = new (loc) transfer_fingerprints_to(F) qdel(src) - return + return TRUE else if(S.get_amount() < 2) to_chat(user, "You need two sheets of iron to finish a wall!") - return + return TRUE balloon_alert(user, "You start adding plating...") if (do_after(user, 40, target = src)) if(S.get_amount() < 2) - return + return TRUE S.use(2) balloon_alert(user, "You add plating.") var/turf/T = get_turf(src) T.PlaceOnTop(/turf/closed/wall) transfer_fingerprints_to(T) qdel(src) - return + return TRUE if(istype(S, /obj/item/stack/sheet/plasteel)) if(state == GIRDER_DISPLACED) if(S.get_amount() < 2) to_chat(user, "You need at least two sheets to create a false wall!") - return + return TRUE balloon_alert(user, "You start building reinforced false wall...") if(do_after(user, 20, target = src)) if(S.get_amount() < 2) - return + return TRUE S.use(2) balloon_alert(user, "You create a reinforced false wall.") var/obj/structure/falsewall/reinforced/FW = new (loc) transfer_fingerprints_to(FW) qdel(src) - return + return TRUE else if(state == GIRDER_REINF) if(S.get_amount() < 1) - return + return TRUE balloon_alert(user, "You start finilizing reinforced wall...") if(do_after(user, 50, target = src)) if(S.get_amount() < 1) - return + return TRUE S.use(1) balloon_alert(user, "You finish the reinforced wall.") var/turf/T = get_turf(src) T.PlaceOnTop(/turf/closed/wall/r_wall) transfer_fingerprints_to(T) qdel(src) - return + return TRUE else if(S.get_amount() < 1) - return + return TRUE balloon_alert(user, "You start reinforcing [src]...") if(do_after(user, 60, target = src)) if(S.get_amount() < 1) - return + return TRUE S.use(1) balloon_alert(user, "You finish reinforcing [src].") var/obj/structure/girder/reinforced/R = new (loc) transfer_fingerprints_to(R) qdel(src) - return + return TRUE if(S.sheettype && S.sheettype != "runed") var/M = S.sheettype if(state == GIRDER_DISPLACED) if(S.get_amount() < 2) to_chat(user, "You need at least two sheets to create a false wall!") - return + return TRUE if(do_after(user, 20, target = src)) if(S.get_amount() < 2) - return + return TRUE S.use(2) balloon_alert(user, "You create a false wall.") var/F = text2path("/obj/structure/falsewall/[M]") var/obj/structure/FW = new F (loc) transfer_fingerprints_to(FW) qdel(src) - return + return TRUE else if(S.get_amount() < 2) to_chat(user, "You need at least two sheets to add plating!") - return + return TRUE balloon_alert(user, "You start adding plating...") if (do_after(user, 40, target = src)) if(S.get_amount() < 2) - return + return TRUE S.use(2) balloon_alert(user, "You add plating.") var/turf/T = get_turf(src) T.PlaceOnTop(text2path("/turf/closed/wall/mineral/[M]")) transfer_fingerprints_to(T) qdel(src) - return + return TRUE add_hiddenprint(user) + return TRUE else if(istype(W, /obj/item/pipe)) var/obj/item/pipe/P = W if(P.pipe_type in list(0, 1, 5)) //simple pipes, simple bends, and simple manifolds. if(!user.transferItemToLoc(P, drop_location())) - return + return TRUE balloon_alert(user, "You fit the pipe into [src].") + return TRUE else return ..() @@ -329,11 +332,11 @@ icon_state= "cultgirder" can_displace = FALSE -/obj/structure/girder/cult/attackby(obj/item/W, mob/user, params) +/obj/structure/girder/cult/item_interact(obj/item/W, mob/user, params) add_fingerprint(user) if(W.tool_behaviour == TOOL_WELDER) if(!W.tool_start_check(user, amount=0)) - return + return TRUE balloon_alert(user, "You start slicing apart [src]...") if(W.use_tool(src, user, 40, volume=50)) @@ -345,7 +348,9 @@ if(R) transfer_fingerprints_to(R) qdel(src) + return TRUE + /// BACONTODO: This should smash walls on harm intent too else if(istype(W, /obj/item/pickaxe/drill/jackhammer)) to_chat(user, "Your jackhammer smashes through [src]!") var/drop_loc = drop_location() @@ -356,21 +361,23 @@ transfer_fingerprints_to(R) W.play_tool_sound(src) qdel(src) + return TRUE else if(istype(W, /obj/item/stack/sheet/runed_metal)) var/obj/item/stack/sheet/runed_metal/R = W if(R.get_amount() < 1) to_chat(user, "You need at least one sheet of runed metal to construct a runed wall!") - return 0 + return TRUE user.visible_message("[user] begins laying runed metal on [src]...", "You begin constructing a runed wall...") if(do_after(user, 50, target = src)) if(R.get_amount() < 1) - return + return TRUE user.visible_message("[user] plates [src] with runed metal.", "You construct a runed wall.") R.use(1) var/turf/T = get_turf(src) T.PlaceOnTop(/turf/closed/wall/mineral/cult) qdel(src) + return TRUE else return ..() @@ -417,11 +424,11 @@ icon_state = "wall_gear" can_displace = FALSE -/obj/structure/girder/bronze/attackby(obj/item/W, mob/living/user, params) +/obj/structure/girder/bronze/item_interact(obj/item/W, mob/living/user, params) add_fingerprint(user) if(W.tool_behaviour == TOOL_WELDER) if(!W.tool_start_check(user, amount = 0)) - return + return TRUE balloon_alert(user, "You start slicing apart [src]...") if(W.use_tool(src, user, 40, volume=50)) balloon_alert(user, "You slice apart [src].") @@ -432,6 +439,7 @@ if(B) transfer_fingerprints_to(B) qdel(src) + return TRUE else if(istype(W, /obj/item/pickaxe/drill/jackhammer)) to_chat(user, "Your jackhammer smashes through [src]!") @@ -443,21 +451,23 @@ transfer_fingerprints_to(B) W.play_tool_sound(src) qdel(src) + return TRUE else if(istype(W, /obj/item/stack/sheet/bronze)) var/obj/item/stack/sheet/bronze/B = W if(B.get_amount() < 2) to_chat(user, "You need at least two bronze sheets to build a bronze wall!") - return FALSE + return TRUE user.visible_message("[user] begins plating [src] with bronze...", "You begin constructing a bronze wall...") if(do_after(user, 50, target = src)) if(B.get_amount() < 2) - return + return TRUE user.visible_message("[user] plates [src] with bronze!", "You construct a bronze wall.") B.use(2) var/turf/T = get_turf(src) T.PlaceOnTop(/turf/closed/wall/mineral/bronze) qdel(src) + return TRUE else return ..() diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index c1784d4cbf8ae..159fa24768294 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -146,20 +146,21 @@ if(istype(caller)) . = . || (caller.pass_flags & PASSGRILLE) -/obj/structure/grille/attackby(obj/item/W, mob/user, params) +/obj/structure/grille/item_interact(obj/item/W, mob/user, params) user.changeNext_move(CLICK_CD_MELEE) add_fingerprint(user) if(W.tool_behaviour == TOOL_WIRECUTTER) if(!shock(user, 100)) W.play_tool_sound(src, 100) deconstruct() + return TRUE else if((W.tool_behaviour == TOOL_SCREWDRIVER) && (isturf(loc) || anchored)) if(!shock(user, 90)) W.play_tool_sound(src, 100) setAnchored(!anchored) user.visible_message("[user] [anchored ? "fastens" : "unfastens"] [src].", \ "You [anchored ? "fasten [src] to" : "unfasten [src] from"] the floor.") - return + return TRUE else if(istype(W, /obj/item/stack/rods) && broken) var/obj/item/stack/rods/R = W if(!shock(user, 90)) @@ -168,7 +169,7 @@ new grille_type(src.loc) R.use(1) qdel(src) - return + return TRUE //window placing begin else if(is_glass_sheet(W)) @@ -176,20 +177,20 @@ var/obj/item/stack/ST = W if (ST.get_amount() < 2) to_chat(user, "You need at least two sheets of glass for that!") - return + return TRUE var/dir_to_set = SOUTHWEST if(!anchored) to_chat(user, "[src] needs to be fastened to the floor first!") - return + return TRUE for(var/obj/structure/window/WINDOW in loc) to_chat(user, "There is already a window there!") - return + return TRUE to_chat(user, "You start placing the window...") if(do_after(user,20, target = src)) if(!src.loc || !anchored) //Grille broken or unanchored while waiting - return + return TRUE for(var/obj/structure/window/WINDOW in loc) //Another window already installed on grille - return + return TRUE var/obj/structure/window/WD if(istype(W, /obj/item/stack/sheet/plasmarglass)) WD = new/obj/structure/window/plasma/reinforced/fulltile(drop_location()) //reinforced plasma window @@ -208,7 +209,7 @@ WD.state = 0 ST.use(2) to_chat(user, "You place [WD] on [src].") - return + return TRUE //window placing end else if(istype(W, /obj/item/shard) || !shock(user, 70)) diff --git a/code/game/objects/structures/guillotine.dm b/code/game/objects/structures/guillotine.dm index 3fa02ac03fbfb..89f1148e20426 100644 --- a/code/game/objects/structures/guillotine.dm +++ b/code/game/objects/structures/guillotine.dm @@ -137,7 +137,8 @@ addtimer(CALLBACK(C, TYPE_PROC_REF(/mob, emote), "clap"), delay_offset * 0.3) delay_offset++ else - H.apply_damage(15 * blade_sharpness, BRUTE, head) + // Even though its blunt, its going to be sharp and heavy + H.apply_damage(/datum/damage_source/sharp/heavy, /datum/damage/brute, 15 * blade_sharpness, head) log_combat(user, H, "dropped the blade on", src, " non-fatally") H.emote("scream") @@ -147,11 +148,11 @@ blade_status = GUILLOTINE_BLADE_DROPPED icon_state = "guillotine" -/obj/structure/guillotine/attackby(obj/item/W, mob/user, params) +/obj/structure/guillotine/item_interact(obj/item/W, mob/user, params) if (istype(W, /obj/item/sharpener)) add_fingerprint(user) if (blade_status == GUILLOTINE_BLADE_SHARPENING) - return + return TRUE if (blade_status == GUILLOTINE_BLADE_RAISED) if (blade_sharpness < GUILLOTINE_BLADE_MAX_SHARP) @@ -162,16 +163,16 @@ "You sharpen the large blade of the guillotine.") blade_sharpness += 1 playsound(src, 'sound/items/unsheath.ogg', 100, 1) - return + return TRUE else blade_status = GUILLOTINE_BLADE_RAISED - return + return TRUE else to_chat(user, "The blade is sharp enough!") - return + return TRUE else to_chat(user, "You need to raise the blade in order to sharpen it!") - return + return TRUE else return ..() diff --git a/code/game/objects/structures/guncase.dm b/code/game/objects/structures/guncase.dm index 23af240fed820..ff1e383f19fe4 100644 --- a/code/game/objects/structures/guncase.dm +++ b/code/game/objects/structures/guncase.dm @@ -34,24 +34,19 @@ else add_overlay("[icon_state]_door") -/obj/structure/guncase/attackby(obj/item/I, mob/user, params) +/obj/structure/guncase/item_interact(obj/item/I, mob/user, params) if(iscyborg(user) || isalien(user)) - return + return ..() if(istype(I, gun_category) && open) if(LAZYLEN(contents) < capacity) if(!user.transferItemToLoc(I, src)) - return + return TRUE to_chat(user, "You place [I] in [src].") update_appearance() else to_chat(user, "[src] is full.") - return - - else if(user.a_intent != INTENT_HARM) - open = !open - update_appearance() - else - return ..() + return TRUE + return ..() /obj/structure/guncase/attack_hand(mob/user) . = ..() diff --git a/code/game/objects/structures/janicart.dm b/code/game/objects/structures/janicart.dm index 95b2f951b7c70..dd7251a6b0aac 100644 --- a/code/game/objects/structures/janicart.dm +++ b/code/game/objects/structures/janicart.dm @@ -52,18 +52,19 @@ mymop = null update_icon() -/obj/structure/janitorialcart/attackby(obj/item/I, mob/user, params) +/obj/structure/janitorialcart/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/mop)) var/obj/item/mop/m=I if(m.reagents.total_volume < m.reagents.maximum_volume) if (wet_mop(m, user)) - return + return TRUE if(!mymop) m.janicart_insert(user, src) else balloon_alert(user, "Already has \a [mymop]!") to_chat(user, "There is already \a [mymop] in [src]!") + return TRUE else if(istype(I, /obj/item/pushbroom)) if(!mybroom) var/obj/item/pushbroom/b=I @@ -71,6 +72,7 @@ else balloon_alert(user, "Already has \a [mybroom]!") to_chat(user, "There is already \a [mybroom] in [src]!") + return TRUE else if(istype(I, /obj/item/storage/bag/trash)) if(!mybag) var/obj/item/storage/bag/trash/t=I @@ -78,6 +80,7 @@ else balloon_alert(user, "Already has \a [mybag]!") to_chat(user, "There is already \a [mybag] in [src]!") + return TRUE else if(istype(I, /obj/item/reagent_containers/spray/cleaner)) if(!myspray) put_in_cart(I, user) @@ -86,6 +89,7 @@ else balloon_alert(user, "Already has \a [myspray]!") to_chat(user, "There is already \a [myspray] in [src]!") + return TRUE else if(istype(I, /obj/item/lightreplacer)) if(!myreplacer) var/obj/item/lightreplacer/l=I @@ -93,6 +97,7 @@ else balloon_alert(user, "Already has \a [myreplacer]!") to_chat(user, "There is already \a [myreplacer] in [src]!") + return TRUE else if(istype(I, /obj/item/clothing/suit/caution)) if(signs < max_signs) put_in_cart(I, user) @@ -101,8 +106,10 @@ else balloon_alert(user, "The sign rack is full!") to_chat(user, "The [src] can't hold any more signs!") + return TRUE else if(mybag) mybag.attackby(I, user) + return TRUE else if(I.tool_behaviour == TOOL_CROWBAR) user.balloon_alert_to_viewers("Starts dumping [src]...", "Started dumping [src]...") user.visible_message("[user] begins to dump the contents of [src].", "You begin to dump the contents of [src]...") @@ -111,6 +118,7 @@ to_chat(usr, "You dump the contents of [src]'s bucket onto the floor.") reagents.reaction(src.loc) src.reagents.clear_reagents() + return TRUE else return ..() diff --git a/code/game/objects/structures/kitchen_spike.dm b/code/game/objects/structures/kitchen_spike.dm index 7baea226b00e2..e663ab9e2685f 100644 --- a/code/game/objects/structures/kitchen_spike.dm +++ b/code/game/objects/structures/kitchen_spike.dm @@ -10,10 +10,10 @@ anchored = FALSE max_integrity = 200 -/obj/structure/kitchenspike_frame/attackby(obj/item/I, mob/user, params) +/obj/structure/kitchenspike_frame/item_interact(obj/item/I, mob/user, params) add_fingerprint(user) if(default_unfasten_wrench(user, I)) - return + return TRUE else if(istype(I, /obj/item/stack/rods)) var/obj/item/stack/rods/R = I if(R.get_amount() >= 4) @@ -22,9 +22,10 @@ var/obj/F = new /obj/structure/kitchenspike(src.loc) transfer_fingerprints_to(F) qdel(src) + return TRUE else if(I.tool_behaviour == TOOL_WELDER) if(!I.tool_start_check(user, amount=0)) - return + return TRUE to_chat(user, "You begin cutting \the [src] apart...") if(I.use_tool(src, user, 50, volume=50)) visible_message("[user] slices apart \the [src].", @@ -32,7 +33,7 @@ "You hear welding.") new /obj/item/stack/sheet/iron(src.loc, 4) qdel(src) - return + return TRUE else return ..() @@ -77,7 +78,8 @@ L.forceMove(drop_location()) L.emote("scream") L.add_splatter_floor() - L.adjustBruteLoss(30) + var/datum/damage_source/sharp/heavy/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(L, BRUTE, 30, null) L.setDir(2) buckle_mob(L, force=1) var/matrix/m180 = matrix(L.transform) @@ -115,7 +117,8 @@ "[M] struggles to break free from [src]!",\ "You struggle to break free from [src], exacerbating your wounds! (Stay still for two minutes.)",\ "You hear a wet squishing noise..") - M.adjustBruteLoss(30) + var/datum/damage_source/sharp/heavy/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(M, BRUTE, 30, null) if(!do_after(M, 1200, target = src, timed_action_flags = IGNORE_RESTRAINED)) if(M && M.buckled) to_chat(M, "You fail to free yourself!") @@ -129,7 +132,8 @@ m180.Turn(180) animate(M, transform = m180, time = 3) M.pixel_y = M.base_pixel_y + PIXEL_Y_OFFSET_LYING - M.adjustBruteLoss(30) + var/datum/damage_source/sharp/heavy/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(M, BRUTE, 30, null) src.visible_message("[M] falls free of [src]!") unbuckle_mob(M,force=1) M.emote("scream") diff --git a/code/game/objects/structures/ladders.dm b/code/game/objects/structures/ladders.dm index ac810ddd96bf2..cd400dd99b745 100644 --- a/code/game/objects/structures/ladders.dm +++ b/code/game/objects/structures/ladders.dm @@ -154,18 +154,18 @@ to_chat(user, "[src] seems to resist all attempts to deconstruct it!") return FALSE -/obj/structure/ladder/attackby(obj/item/I, mob/user, params) +/obj/structure/ladder/item_interact(obj/item/I, mob/user, params) user.changeNext_move(CLICK_CD_MELEE) add_fingerprint(user) - if(!(resistance_flags & INDESTRUCTIBLE)) - if(I.tool_behaviour == TOOL_WELDER) + if(I.tool_behaviour == TOOL_WELDER) + if(!(resistance_flags & INDESTRUCTIBLE)) if(!I.tool_start_check(user, amount=0)) - return FALSE + return TRUE to_chat(user, "You begin cutting [src]...") if(I.use_tool(src, user, 50, volume=100)) user.visible_message("[user] cuts [src].", \ - "You cut [src].") + "You cut [src].") I.play_tool_sound(src, 100) var/drop_loc = drop_location() var/obj/R = new /obj/item/stack/rods(drop_loc, 10) @@ -174,10 +174,11 @@ if(R) transfer_fingerprints_to(R) qdel(src) - return TRUE - else - to_chat(user, "[src] seems to resist all attempts to deconstruct it!") - return FALSE + return TRUE + else + to_chat(user, "[src] seems to resist all attempts to deconstruct it!") + return TRUE + return ..() /obj/structure/ladder/attack_robot(mob/living/silicon/robot/R) if(R.Adjacent(src)) diff --git a/code/game/objects/structures/lattice.dm b/code/game/objects/structures/lattice.dm index 4f2ece534f413..2e725fe43fd73 100644 --- a/code/game/objects/structures/lattice.dm +++ b/code/game/objects/structures/lattice.dm @@ -36,15 +36,16 @@ /obj/structure/lattice/ratvar_act() new /obj/structure/lattice/clockwork(loc) -/obj/structure/lattice/attackby(obj/item/C, mob/user, params) +/obj/structure/lattice/item_interact(obj/item/C, mob/user, params) if(resistance_flags & INDESTRUCTIBLE) - return + return TRUE if(C.tool_behaviour == TOOL_WIRECUTTER) to_chat(user, "Slicing [name] joints ...") deconstruct() + return TRUE else var/turf/T = get_turf(src) - return T.attackby(C, user) //hand this off to the turf instead (for building plating, catwalks, etc) + return T.item_interact(C, user, params) /obj/structure/lattice/deconstruct(disassembled = TRUE) if(!(flags_1 & NODECONSTRUCT_1)) diff --git a/code/game/objects/structures/lavaland/geyser.dm b/code/game/objects/structures/lavaland/geyser.dm index 0ed3926978cdb..93234d070bd0f 100644 --- a/code/game/objects/structures/lavaland/geyser.dm +++ b/code/game/objects/structures/lavaland/geyser.dm @@ -60,9 +60,10 @@ var/plunge_mod = 1 //time*plunge_mod = total time we take to plunge an object var/reinforced = FALSE //whether we do heavy duty stuff like geysers -/obj/item/plunger/attack_obj(obj/O, mob/living/user) - if(!O.plunger_act(src, user, reinforced)) +/obj/item/plunger/interact_with(obj/target, mob/user, params) + if(istype(target) && !target.plunger_act(src, user, reinforced)) return ..() + return TRUE /obj/item/plunger/reinforced name = "reinforced plunger" diff --git a/code/game/objects/structures/loom.dm b/code/game/objects/structures/loom.dm index 28ff5a8de732f..5eb453b016398 100644 --- a/code/game/objects/structures/loom.dm +++ b/code/game/objects/structures/loom.dm @@ -10,9 +10,9 @@ density = TRUE anchored = TRUE -/obj/structure/loom/attackby(obj/item/I, mob/user) +/obj/structure/loom/item_interact(obj/item/I, mob/user) if(weave(I, user)) - return + return TRUE return ..() /obj/structure/loom/wrench_act(mob/living/user, obj/item/I) diff --git a/code/game/objects/structures/manned_turret.dm b/code/game/objects/structures/manned_turret.dm index a9ad8a66a82a1..3c23fc1f2e86f 100644 --- a/code/game/objects/structures/manned_turret.dm +++ b/code/game/objects/structures/manned_turret.dm @@ -200,14 +200,10 @@ /obj/item/gun_control/CanItemAutoclick() return TRUE -/obj/item/gun_control/attack_obj(obj/O, mob/living/user) - user.changeNext_move(CLICK_CD_MELEE) - O.attacked_by(src, user) - -/obj/item/gun_control/attack(mob/living/M, mob/living/user) +/obj/item/gun_control/attack_mob_target(mob/living/M, mob/living/user) M.lastattacker = user.real_name M.lastattackerckey = user.ckey - M.attacked_by(src, user) + M.on_attacked(src, user) add_fingerprint(user) /obj/item/gun_control/afterattack(atom/targeted_atom, mob/user, flag, params) diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm index de83e3d47ae59..f87c234be24b0 100644 --- a/code/game/objects/structures/mineral_doors.dm +++ b/code/game/objects/structures/mineral_doors.dm @@ -122,13 +122,10 @@ icon_state = "[initial(icon_state)][door_opened ? "open":""]" return ..() -/obj/structure/mineral_door/attackby(obj/item/I, mob/user) +/obj/structure/mineral_door/item_interact(obj/item/I, mob/user) if(pickaxe_door(user, I)) - return - else if(user.a_intent != INTENT_HARM) - return attack_hand(user) - else - return ..() + return TRUE + return attack_hand(user) /obj/structure/mineral_door/setAnchored(anchorvalue) //called in default_unfasten_wrench() chain . = ..() @@ -254,11 +251,10 @@ /obj/structure/mineral_door/transparent/plasma/welder_act(mob/living/user, obj/item/I) return -/obj/structure/mineral_door/transparent/plasma/attackby(obj/item/W, mob/user, params) +/obj/structure/mineral_door/transparent/plasma/item_interact(obj/item/W, mob/user, params) if(W.is_hot() > 300) plasma_ignition(6, user) - else - return ..() + return ..() /obj/structure/mineral_door/transparent/plasma/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > 300) @@ -295,11 +291,9 @@ /obj/structure/mineral_door/wood/crowbar_act(mob/living/user, obj/item/I) return crowbar_door(user, I) -/obj/structure/mineral_door/wood/attackby(obj/item/I, mob/living/user) +/obj/structure/mineral_door/wood/item_interact(obj/item/I, mob/living/user) if(I.is_hot()) fire_act(I.is_hot()) - return - return ..() /obj/structure/mineral_door/paperframe @@ -330,19 +324,19 @@ /obj/structure/mineral_door/paperframe/crowbar_act(mob/living/user, obj/item/I) return crowbar_door(user, I) -/obj/structure/mineral_door/paperframe/attackby(obj/item/I, mob/living/user) +/obj/structure/mineral_door/paperframe/item_interact(obj/item/I, mob/living/user) if(I.is_hot()) //BURN IT ALL DOWN JIM fire_act(I.is_hot()) - return + return TRUE - if((user.a_intent != INTENT_HARM) && istype(I, /obj/item/paper) && (obj_integrity < max_integrity)) + if(istype(I, /obj/item/paper) && obj_integrity < max_integrity) user.visible_message("[user] starts to patch the holes in [src].", "You start patching some of the holes in [src]!") if(do_after(user, 20, src)) obj_integrity = min(obj_integrity+4,max_integrity) qdel(I) user.visible_message("[user] patches some of the holes in [src].", "You patch some of the holes in [src]!") return TRUE - + return TRUE return ..() /obj/structure/mineral_door/paperframe/ComponentInitialize() diff --git a/code/game/objects/structures/mop_bucket.dm b/code/game/objects/structures/mop_bucket.dm index 85c18f859a90e..13242e2f37c50 100644 --- a/code/game/objects/structures/mop_bucket.dm +++ b/code/game/objects/structures/mop_bucket.dm @@ -11,7 +11,7 @@ . = ..() create_reagents(100, OPENCONTAINER) -/obj/structure/mopbucket/attackby(obj/item/I, mob/user, params) +/obj/structure/mopbucket/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/mop)) if(reagents.total_volume < 1) to_chat(user, "[src] is out of water!
") @@ -20,9 +20,10 @@ to_chat(user, "You wet [I] in [src].") playsound(loc, 'sound/effects/slosh.ogg', 25, 1) update_icon() + return TRUE else - . = ..() update_icon() + return ..() /obj/structure/mopbucket/update_icon() cut_overlays() diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm index 388d58bfaddcc..4cfe66b0da93c 100644 --- a/code/game/objects/structures/morgue.dm +++ b/code/game/objects/structures/morgue.dm @@ -82,21 +82,22 @@ GLOBAL_LIST_EMPTY(bodycontainers) //Let them act as spawnpoints for revenants an return return attack_hand(user) -/obj/structure/bodycontainer/attackby(obj/P, mob/user, params) +/obj/structure/bodycontainer/item_interact(obj/P, mob/user, params) add_fingerprint(user) if(istype(P, /obj/item/pen)) if(!user.is_literate()) to_chat(user, "You scribble illegibly on the side of [src]!") - return + return TRUE var/t = stripped_input(user, "What would you like the label to be?", "[name]", null) if (user.get_active_held_item() != P) - return + return TRUE if(!user.canUseTopic(src, BE_CLOSE)) - return + return TRUE if (t) name = "[initial(name)]- '[t]'" else name = initial(name) + return TRUE else return ..() @@ -348,16 +349,17 @@ GLOBAL_LIST_EMPTY(crematoriums) else to_chat(user, "That's not connected to anything!") -/obj/structure/tray/attackby(obj/P, mob/user, params) +/obj/structure/tray/item_interact(obj/P, mob/user, params) if(!istype(P, /obj/item/riding_offhand)) return ..() var/obj/item/riding_offhand/riding_item = P var/mob/living/carried_mob = riding_item.rider if(carried_mob == user) //Piggyback user. - return + return TRUE user.unbuckle_mob(carried_mob) MouseDrop_T(carried_mob, user) + return TRUE /obj/structure/tray/MouseDrop_T(atom/movable/O as mob|obj, mob/user) if(!ismovable(O) || O.anchored || !Adjacent(user) || !user.Adjacent(O) || O.loc == user) diff --git a/code/game/objects/structures/noticeboard.dm b/code/game/objects/structures/noticeboard.dm index 8513d9835c88b..e14aa92774c98 100644 --- a/code/game/objects/structures/noticeboard.dm +++ b/code/game/objects/structures/noticeboard.dm @@ -27,19 +27,20 @@ icon_state = "nboard0[notices]" //attaching papers!! -/obj/structure/noticeboard/attackby(obj/item/O, mob/user, params) +/obj/structure/noticeboard/item_interact(obj/item/O, mob/user, params) if(istype(O, /obj/item/paper) || istype(O, /obj/item/photo)) if(!allowed(user)) to_chat(user, "You are not authorized to add notices") - return + return TRUE if(notices < MAX_NOTICES) if(!user.transferItemToLoc(O, src)) - return + return TRUE notices++ icon_state = "nboard0[notices]" to_chat(user, "You pin the [O] to the noticeboard.") else to_chat(user, "The notice board is full") + return TRUE else return ..() diff --git a/code/game/objects/structures/popout_cake.dm b/code/game/objects/structures/popout_cake.dm index 5ec12cc547464..1fdc674cada89 100644 --- a/code/game/objects/structures/popout_cake.dm +++ b/code/game/objects/structures/popout_cake.dm @@ -74,7 +74,7 @@ user.forceMove(get_turf(src)) occupant = null -/obj/structure/popout_cake/attackby(obj/item/W, mob/user, params) +/obj/structure/popout_cake/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_SCREWDRIVER && used_string == TRUE) user.visible_message("[user] sticks the [W] inside [src] and stars fiddling around!", \ "", \ - "You successfully rewind the string inside [src]!") + return TRUE if(W.is_sharp()) user.visible_message("[user] begins cutting into [src] with [W]!", "There's no space for [src] inside!") @@ -103,9 +103,9 @@ strong_surprise = TRUE user.visible_message("After some fiddling, [user] inserts [W] into [src]!", "You attach [W] to the hidden mechanism inside!") qdel(W) - return FALSE + return TRUE else - ..() + return ..() /obj/structure/popout_cake/proc/do_popout() if(isnull(occupant)) diff --git a/code/game/objects/structures/railings.dm b/code/game/objects/structures/railings.dm index 63f6d714d20d8..d8b7f3830202d 100644 --- a/code/game/objects/structures/railings.dm +++ b/code/game/objects/structures/railings.dm @@ -32,14 +32,13 @@ AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS ,null,CALLBACK(src, PROC_REF(can_be_rotated)),CALLBACK(src, PROC_REF(after_rotation))) -/obj/structure/railing/attackby(obj/item/I, mob/living/user, params) - ..() +/obj/structure/railing/item_interact(obj/item/I, mob/living/user, params) add_fingerprint(user) if(I.tool_behaviour == TOOL_WELDER && user.a_intent == INTENT_HELP) if(obj_integrity < max_integrity) if(!I.tool_start_check(user, amount=0)) - return + return TRUE to_chat(user, "You begin repairing [src]...") if(I.use_tool(src, user, 40, volume=50)) @@ -47,7 +46,8 @@ to_chat(user, "You repair [src].") else to_chat(user, "[src] is already in good condition!") - return + return TRUE + return ..() /obj/structure/railing/wirecutter_act(mob/living/user, obj/item/I) . = ..() diff --git a/code/game/objects/structures/reflector.dm b/code/game/objects/structures/reflector.dm index 8e5097c01230f..4e6cfdfac2bad 100644 --- a/code/game/objects/structures/reflector.dm +++ b/code/game/objects/structures/reflector.dm @@ -78,20 +78,20 @@ P.decayedRange = max(P.decayedRange--, 0) return BULLET_ACT_FORCE_PIERCE -/obj/structure/reflector/attackby(obj/item/W, mob/user, params) +/obj/structure/reflector/item_interact(obj/item/W, mob/user, params) if(admin) - return + return ..() if(W.tool_behaviour == TOOL_SCREWDRIVER) can_rotate = !can_rotate to_chat(user, "You [can_rotate ? "unlock" : "lock"] [src]'s rotation.") W.play_tool_sound(src) - return + return TRUE if(W.tool_behaviour == TOOL_WRENCH) if(anchored) to_chat(user, "Unweld [src] from the floor first!") - return + return TRUE user.visible_message("[user] starts to dismantle [src].", "You start to dismantle [src]...") if(W.use_tool(src, user, 80, volume=50)) to_chat(user, "You dismantle [src].") @@ -99,10 +99,11 @@ if(buildstackamount) new buildstacktype(drop_location(), buildstackamount) qdel(src) + return TRUE else if(W.tool_behaviour == TOOL_WELDER) if(obj_integrity < max_integrity) if(!W.tool_start_check(user, amount=0)) - return + return TRUE user.visible_message("[user] starts to repair [src].", "You begin repairing [src]...", @@ -114,7 +115,7 @@ else if(!anchored) if(!W.tool_start_check(user, amount=0)) - return + return TRUE user.visible_message("[user] starts to weld [src] to the floor.", "You start to weld [src] to the floor...", @@ -124,7 +125,7 @@ to_chat(user, "You weld [src] to the floor.") else if(!W.tool_start_check(user, amount=0)) - return + return TRUE user.visible_message("[user] starts to cut [src] free from the floor.", "You start to cut [src] free from the floor...", @@ -132,11 +133,12 @@ if (W.use_tool(src, user, 20, volume=50)) setAnchored(FALSE) to_chat(user, "You cut [src] free from the floor.") + return TRUE //Finishing the frame else if(istype(W, /obj/item/stack/sheet)) if(finished) - return + return TRUE var/obj/item/stack/sheet/S = W if(istype(S, /obj/item/stack/sheet/glass)) if(S.use(5)) @@ -144,18 +146,19 @@ qdel(src) else to_chat(user, "You need five sheets of glass to create a reflector!") - return + return TRUE if(istype(S, /obj/item/stack/sheet/rglass)) if(S.use(10)) new /obj/structure/reflector/double(drop_location()) qdel(src) else to_chat(user, "You need ten sheets of reinforced glass to create a double reflector!") - return + return TRUE if(istype(S, /obj/item/stack/sheet/mineral/diamond)) if(S.use(1)) new /obj/structure/reflector/box(drop_location()) qdel(src) + return TRUE else return ..() diff --git a/code/game/objects/structures/safe.dm b/code/game/objects/structures/safe.dm index eefd83fbeb1d4..55eb722b186d6 100644 --- a/code/game/objects/structures/safe.dm +++ b/code/game/objects/structures/safe.dm @@ -153,22 +153,23 @@ FLOOR SAFES updateUsrDialog() -/obj/structure/safe/attackby(obj/item/I, mob/user, params) +/obj/structure/safe/item_interact(obj/item/I, mob/user, params) if(open) . = 1 //no afterattack if(I.w_class + space <= maxspace) space += I.w_class if(!user.transferItemToLoc(I, src)) to_chat(user, "\The [I] is stuck to your hand, you cannot put it in the safe!") - return + return TRUE to_chat(user, "You put [I] in [src].") updateUsrDialog() - return + return TRUE else to_chat(user, "[I] won't fit in [src].") - return + return TRUE else if(istype(I, /obj/item/clothing/neck/stethoscope)) to_chat(user, "Hold [I] in one of your hands while you manipulate the dial!") + return TRUE else return ..() diff --git a/code/game/objects/structures/showcase.dm b/code/game/objects/structures/showcase.dm index c7d4f98f248f4..3166832138ae7 100644 --- a/code/game/objects/structures/showcase.dm +++ b/code/game/objects/structures/showcase.dm @@ -108,7 +108,7 @@ //Showcases can be any sprite, so it makes sense that they can't be constructed. //However if a player wants to move an existing showcase or remove one, this is for that. -/obj/structure/showcase/attackby(obj/item/W, mob/user) +/obj/structure/showcase/item_interact(obj/item/W, mob/user) if(W.tool_behaviour == TOOL_SCREWDRIVER && !anchored) if(deconstruction_state == SHOWCASE_SCREWDRIVERED) to_chat(user, "You screw the screws back into the showcase.") @@ -118,15 +118,18 @@ to_chat(user, "You unscrew the screws.") W.play_tool_sound(src, 100) deconstruction_state = SHOWCASE_SCREWDRIVERED + return TRUE if(W.tool_behaviour == TOOL_CROWBAR && deconstruction_state == SHOWCASE_SCREWDRIVERED) if(W.use_tool(src, user, 20, volume=100)) to_chat(user, "You start to crowbar the showcase apart...") new /obj/item/stack/sheet/iron(drop_location(), 4) qdel(src) + return TRUE if(deconstruction_state == SHOWCASE_CONSTRUCTED && default_unfasten_wrench(user, W)) - return + return TRUE + return ..() //Feedback is given in examine because showcases can basically have any sprite assigned to them diff --git a/code/game/objects/structures/shower.dm b/code/game/objects/structures/shower.dm index 3ce45ef6557c8..9a8799ec23efa 100644 --- a/code/game/objects/structures/shower.dm +++ b/code/game/objects/structures/shower.dm @@ -22,7 +22,7 @@ desc = "A shower frame, that needs 2 plastic sheets to finish construction." anchored = FALSE -/obj/structure/showerframe/attackby(obj/item/I, mob/living/user, params) +/obj/structure/showerframe/item_interact(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/stack/sheet/plastic)) balloon_alert(user, "You start constructing a shower...") if(do_after(user, 4 SECONDS, target = src)) @@ -31,7 +31,7 @@ var/obj/machinery/shower/new_shower = new /obj/machinery/shower(loc) new_shower.setDir(dir) qdel(src) - return + return TRUE return ..() /obj/structure/showerframe/Initialize(mapload) @@ -76,9 +76,10 @@ var/turf/open/tile = loc tile.MakeSlippery(TURF_WET_WATER, min_wet_time = 5 SECONDS, wet_time_to_add = 1 SECONDS) -/obj/machinery/shower/attackby(obj/item/I, mob/user, params) +/obj/machinery/shower/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_ANALYZER) to_chat(user, "The water temperature seems to be [current_temperature].") + return TRUE else return ..() diff --git a/code/game/objects/structures/signs/_signs.dm b/code/game/objects/structures/signs/_signs.dm index 5c126938a2691..d276f24f11a8f 100644 --- a/code/game/objects/structures/signs/_signs.dm +++ b/code/game/objects/structures/signs/_signs.dm @@ -24,7 +24,7 @@ if(BURN) playsound(loc, 'sound/items/welder.ogg', 80, 1) -/obj/structure/sign/attackby(obj/item/I, mob/user, params) +/obj/structure/sign/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_WRENCH && buildable_sign) user.visible_message("[user] starts removing [src]...", \ "You start unfastening [src].") @@ -38,7 +38,7 @@ SB.sign_path = type SB.setDir(dir) qdel(src) - return + return TRUE else if(istype(I, /obj/item/pen) && buildable_sign) var/list/sign_types = list("Secure Area", "Biohazard", "High Voltage", "Radiation", "Hard Vacuum Ahead", "Disposal: Leads To Space", "Danger: Fire", "No Smoking", "Medbay", "Science", "Chemistry", \ "Hydroponics", "Xenobiology") @@ -75,10 +75,10 @@ //Make sure user is adjacent still if(!Adjacent(user)) - return + return TRUE if(!sign_type) - return + return TRUE //It's import to clone the pixel layout information //Otherwise signs revert to being on the turf and @@ -87,6 +87,7 @@ newsign.pixel_x = pixel_x newsign.pixel_y = pixel_y qdel(src) + return TRUE else return ..() diff --git a/code/game/objects/structures/statues.dm b/code/game/objects/structures/statues.dm index 734e4850ddd2c..f58d028a59867 100644 --- a/code/game/objects/structures/statues.dm +++ b/code/game/objects/structures/statues.dm @@ -10,15 +10,15 @@ var/material_drop_type = /obj/item/stack/sheet/iron CanAtmosPass = ATMOS_PASS_DENSITY -/obj/structure/statue/attackby(obj/item/W, mob/living/user, params) +/obj/structure/statue/item_interact(obj/item/W, mob/living/user, params) add_fingerprint(user) user.changeNext_move(CLICK_CD_MELEE) if(!(flags_1 & NODECONSTRUCT_1)) if(default_unfasten_wrench(user, W)) - return + return TRUE if(W.tool_behaviour == TOOL_WELDER) if(!W.tool_start_check(user, amount=0)) - return FALSE + return TRUE user.visible_message("[user] is slicing apart the [name].", \ "You are slicing apart the [name]...") @@ -26,7 +26,7 @@ user.visible_message("[user] slices apart the [name].", \ "You slice apart the [name]!") deconstruct(TRUE) - return + return TRUE return ..() /obj/structure/statue/attack_hand(mob/living/user) @@ -68,7 +68,7 @@ desc = "This statue has a sickening green colour." icon_state = "eng" -/obj/structure/statue/uranium/attackby(obj/item/W, mob/user, params) +/obj/structure/statue/uranium/item_interact(obj/item/W, mob/user, params) radiate() return ..() @@ -115,11 +115,10 @@ plasma_ignition(6, Proj?.firer) . = ..() -/obj/structure/statue/plasma/attackby(obj/item/W, mob/user, params) +/obj/structure/statue/plasma/item_interact(obj/item/W, mob/user, params) if(W.is_hot() > 300)//If the temperature of the object is over 300, then ignite plasma_ignition(6, user) - else - return ..() + return ..() //////////////////////gold/////////////////////////////////////// @@ -210,7 +209,7 @@ honk() ..() -/obj/structure/statue/bananium/attackby(obj/item/W, mob/user, params) +/obj/structure/statue/bananium/item_interact(obj/item/W, mob/user, params) honk() return ..() diff --git a/code/game/objects/structures/table_frames.dm b/code/game/objects/structures/table_frames.dm index 42f036e48b770..148c35742b835 100644 --- a/code/game/objects/structures/table_frames.dm +++ b/code/game/objects/structures/table_frames.dm @@ -21,25 +21,26 @@ var/framestack = /obj/item/stack/rods var/framestackamount = 2 -/obj/structure/table_frame/attackby(obj/item/I, mob/user, params) +/obj/structure/table_frame/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_WRENCH) to_chat(user, "You start disassembling [src]...") I.play_tool_sound(src) if(I.use_tool(src, user, 30)) playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1) deconstruct(TRUE) - return + return TRUE var/obj/item/stack/material = I if (istype(I, /obj/item/stack) && material?.tableVariant) if(material.get_amount() < 1) to_chat(user, "You need one [material.name] sheet to do this!") - return + return TRUE if(!check_turf_contents(user)) - return + return TRUE to_chat(user, "You start adding [material] to [src]...") if(do_after(user, 20, target = src) && material.use(1)) make_new_table(material.tableVariant, user) + return TRUE else return ..() @@ -80,7 +81,7 @@ framestackamount = 2 resistance_flags = FLAMMABLE -/obj/structure/table_frame/wood/attackby(obj/item/I, mob/user, params) +/obj/structure/table_frame/wood/item_interact(obj/item/I, mob/user, params) if (istype(I, /obj/item/stack)) var/obj/item/stack/material = I var/toConstruct // stores the table variant @@ -98,6 +99,7 @@ to_chat(user, "You start adding [material] to [src]...") if(do_after(user, 20, target = src) && material.use(1)) make_new_table(toConstruct) + return TRUE else return ..() @@ -109,7 +111,7 @@ framestack = /obj/item/stack/sheet/brass framestackamount = 1 -/obj/structure/table_frame/brass/attackby(obj/item/I, mob/user, params) +/obj/structure/table_frame/brass/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/stack/sheet/brass)) var/obj/item/stack/sheet/brass/W = I if(W.get_amount() < 1) @@ -120,6 +122,7 @@ to_chat(user, "You start adding [W] to [src]...") if(do_after(user, 20, target = src) && W.use(1)) make_new_table(/obj/structure/table/brass) + return TRUE else return ..() diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index b710fb7aef3f0..386ed540670e2 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -151,7 +151,7 @@ if(pushed_mob.loc != loc) //Something prevented the tabling return pushed_mob.Knockdown(30) - pushed_mob.apply_damage(40, STAMINA) + pushed_mob.apply_damage(/datum/damage_source/impact, /datum/damage/stamina, 40) if(user.mind?.martial_art?.smashes_tables) deconstruct(FALSE) playsound(pushed_mob, "sound/effects/tableslam.ogg", 90, TRUE) @@ -162,8 +162,8 @@ /obj/structure/table/proc/tableheadsmash(mob/living/user, mob/living/pushed_mob) pushed_mob.Knockdown(30) - pushed_mob.apply_damage(40, BRUTE, BODY_ZONE_HEAD) - pushed_mob.apply_damage(60, STAMINA) + pushed_mob.apply_damage(/datum/damage_source/impact, /datum/damage/brute, 40, BODY_ZONE_HEAD) + pushed_mob.apply_damage(/datum/damage_source/impact, /datum/damage/stamina, 60) take_damage(50) if(user.mind?.martial_art?.smashes_tables) deconstruct(FALSE) @@ -173,35 +173,35 @@ log_combat(user, pushed_mob, "head slammed", null, "against [src]") SEND_SIGNAL(pushed_mob, COMSIG_ADD_MOOD_EVENT, "table", /datum/mood_event/table_headsmash) -/obj/structure/table/attackby(obj/item/I, mob/user, params) +/obj/structure/table/item_interact(obj/item/I, mob/user, params) var/list/modifiers = params2list(params) if(!(flags_1 & NODECONSTRUCT_1)) if(I.tool_behaviour == TOOL_SCREWDRIVER && deconstruction_ready && user.a_intent != INTENT_HELP) to_chat(user, "You start disassembling [src]...") if(I.use_tool(src, user, 20, volume=50)) deconstruct(TRUE) - return + return TRUE if(I.tool_behaviour == TOOL_WRENCH && deconstruction_ready && user.a_intent != INTENT_HELP) to_chat(user, "You start deconstructing [src]...") if(I.use_tool(src, user, 40, volume=50)) playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1) deconstruct(TRUE, 1) - return + return TRUE if(istype(I, /obj/item/storage/bag/tray)) var/obj/item/storage/bag/tray/T = I if(T.contents.len > 0) // If the tray isn't empty SEND_SIGNAL(I, COMSIG_TRY_STORAGE_QUICK_EMPTY, drop_location()) user.visible_message("[user] empties [I] on [src].") - return + return TRUE // If the tray IS empty, continue on (tray will be placed on the table like other items) if(istype(I, /obj/item/riding_offhand)) var/obj/item/riding_offhand/riding_item = I var/mob/living/carried_mob = riding_item.rider if(carried_mob == user) //Piggyback user. - return + return TRUE switch(user.a_intent) if(INTENT_HARM) user.unbuckle_mob(carried_mob) @@ -225,17 +225,16 @@ tablepush(user, carried_mob) return TRUE - if(user.a_intent != INTENT_HARM && !(I.item_flags & ABSTRACT)) + if(!(I.item_flags & ABSTRACT)) if(user.transferItemToLoc(I, drop_location(), silent = FALSE)) //Center the icon where the user clicked. if(!LAZYACCESS(modifiers, ICON_X) || !LAZYACCESS(modifiers, ICON_Y)) - return + return TRUE //Clamp it so that the icon never moves more than 16 pixels in either direction (thus leaving the table turf) I.pixel_x = clamp(text2num(LAZYACCESS(modifiers, ICON_X)) - 16, -(world.icon_size/2), world.icon_size/2) I.pixel_y = clamp(text2num(LAZYACCESS(modifiers, ICON_Y)) - 16, -(world.icon_size/2), world.icon_size/2) - return 1 - else - return ..() + return TRUE + return ..() /obj/structure/table/deconstruct(disassembled = TRUE, wrench_disassembly = 0) @@ -474,10 +473,10 @@ else return "The top cover is firmly welded on." -/obj/structure/table/reinforced/attackby(obj/item/W, mob/user, params) +/obj/structure/table/reinforced/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_WELDER) if(!W.tool_start_check(user, amount=0)) - return + return TRUE if(deconstruction_ready) to_chat(user, "You start strengthening the reinforced table...") @@ -489,6 +488,7 @@ if (W.use_tool(src, user, 50, volume=50)) to_chat(user, "You weaken the table.") deconstruction_ready = 1 + return TRUE else . = ..() @@ -660,15 +660,14 @@ if(O.loc != src.loc) step(O, get_dir(O, src)) -/obj/structure/rack/attackby(obj/item/W, mob/user, params) +/obj/structure/rack/item_interact(obj/item/W, mob/user, params) if (W.tool_behaviour == TOOL_WRENCH && !(flags_1&NODECONSTRUCT_1) && user.a_intent != INTENT_HELP) W.play_tool_sound(src) deconstruct(TRUE) - return - if(user.a_intent == INTENT_HARM) - return ..() + return TRUE if(user.transferItemToLoc(W, drop_location())) - return 1 + return TRUE + return ..() /obj/structure/rack/attack_paw(mob/living/user) attack_hand(user) @@ -719,10 +718,11 @@ materials = list(/datum/material/iron=2000) var/building = FALSE -/obj/item/rack_parts/attackby(obj/item/W, mob/user, params) +/obj/item/rack_parts/item_interact(obj/item/W, mob/user, params) if (W.tool_behaviour == TOOL_WRENCH) new /obj/item/stack/sheet/iron(user.loc) qdel(src) + return TRUE else . = ..() diff --git a/code/game/objects/structures/tank_dispenser.dm b/code/game/objects/structures/tank_dispenser.dm index 86fe56833374e..8250363bee5d2 100644 --- a/code/game/objects/structures/tank_dispenser.dm +++ b/code/game/objects/structures/tank_dispenser.dm @@ -38,7 +38,7 @@ if(5 to TANK_DISPENSER_CAPACITY) add_overlay("plasma-5") -/obj/structure/tank_dispenser/attackby(obj/item/I, mob/user, params) +/obj/structure/tank_dispenser/item_interact(obj/item/I, mob/user, params) var/full if(istype(I, /obj/item/tank/internals/plasma)) if(plasmatanks < TANK_DISPENSER_CAPACITY) @@ -52,26 +52,24 @@ full = TRUE else if(I.tool_behaviour == TOOL_WRENCH) default_unfasten_wrench(user, I, time = 20) - return + return TRUE else if(user.a_intent != INTENT_HARM) to_chat(user, "[I] does not fit into [src].") - return - else - return ..() + return TRUE if(full) to_chat(user, "[src] can't hold any more of [I].") - return + return TRUE if(!user.transferItemToLoc(I, src)) if(istype(I, /obj/item/tank/internals/plasma)) plasmatanks-- else if(istype(I, /obj/item/tank/internals/oxygen)) oxygentanks-- - return + return TRUE to_chat(user, "You put [I] in [src].") update_icon() ui_update() - + return TRUE /obj/structure/tank_dispenser/ui_state(mob/user) return GLOB.physical_state diff --git a/code/game/objects/structures/target_stake.dm b/code/game/objects/structures/target_stake.dm index 6f5d5463cfb82..2743b1d97c764 100644 --- a/code/game/objects/structures/target_stake.dm +++ b/code/game/objects/structures/target_stake.dm @@ -37,16 +37,20 @@ if(pinned_target) pinned_target.forceMove(loc) -/obj/structure/target_stake/attackby(obj/item/target/T, mob/user) +/obj/structure/target_stake/item_interact(obj/item/target/T, mob/user) if(pinned_target) - return - if(istype(T) && user.transferItemToLoc(T, drop_location())) + return TRUE + if(istype(T)) + if (!user.transferItemToLoc(T, drop_location())) + return TRUE pinned_target = T T.pinnedLoc = src T.density = TRUE T.layer = OBJ_LAYER + 0.01 handle_density() to_chat(user, "You slide the target into the stake.") + return TRUE + return ..() /obj/structure/target_stake/attack_hand(mob/user) . = ..() diff --git a/code/game/objects/structures/transit_tubes/station.dm b/code/game/objects/structures/transit_tubes/station.dm index b082356aa00a3..0881e4fcd4248 100644 --- a/code/game/objects/structures/transit_tubes/station.dm +++ b/code/game/objects/structures/transit_tubes/station.dm @@ -97,10 +97,11 @@ break -/obj/structure/transit_tube/station/attackby(obj/item/W, mob/user, params) +/obj/structure/transit_tube/station/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_CROWBAR) for(var/obj/structure/transit_tube_pod/P in loc) P.deconstruct(FALSE, user) + return TRUE else return ..() diff --git a/code/game/objects/structures/transit_tubes/transit_tube.dm b/code/game/objects/structures/transit_tubes/transit_tube.dm index c21ce6df8de6a..efbc8ce4f0de7 100644 --- a/code/game/objects/structures/transit_tubes/transit_tube.dm +++ b/code/game/objects/structures/transit_tubes/transit_tube.dm @@ -31,12 +31,12 @@ if(current_size >= STAGE_FIVE) deconstruct(FALSE) -/obj/structure/transit_tube/attackby(obj/item/W, mob/user, params) +/obj/structure/transit_tube/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_WRENCH) if(tube_construction) for(var/obj/structure/transit_tube_pod/pod in src.loc) to_chat(user, "Remove the pod first!") - return + return TRUE user.visible_message("[user] starts to detach \the [src].", "You start to detach the [name]...") if(W.use_tool(src, user, 2 SECONDS, volume=50)) to_chat(user, "You detach the [name].") @@ -45,9 +45,11 @@ transfer_fingerprints_to(R) R.add_fingerprint(user) qdel(src) + return TRUE else if(W.tool_behaviour == TOOL_CROWBAR) for(var/obj/structure/transit_tube_pod/pod in src.loc) pod.attackby(W, user) + return TRUE else return ..() diff --git a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm index ddcdb05e101a7..50eaf11ff0177 100644 --- a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm +++ b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm @@ -28,7 +28,7 @@ else icon_state = "pod" -/obj/structure/transit_tube_pod/attackby(obj/item/I, mob/user, params) +/obj/structure/transit_tube_pod/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_CROWBAR) if(!moving) I.play_tool_sound(src) @@ -37,6 +37,7 @@ empty_pod() else deconstruct(TRUE, user) + return TRUE else return ..() diff --git a/code/game/objects/structures/traps.dm b/code/game/objects/structures/traps.dm index 9208589a3b815..a81231679a878 100644 --- a/code/game/objects/structures/traps.dm +++ b/code/game/objects/structures/traps.dm @@ -216,7 +216,8 @@ /obj/structure/trap/damage/trap_effect(mob/living/L) to_chat(L, "The ground quakes beneath your feet!") L.Paralyze(100) - L.adjustBruteLoss(35) + var/datum/damage_source/magic/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(L, BRUTE, 35, null) /obj/structure/trap/damage/flare() ..() diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index fb4d5e1c3285e..670f61ffd07a4 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -25,7 +25,9 @@ user.changeNext_move(CLICK_CD_MELEE) playsound(src.loc, "swing_hit", 25, 1) swirlie.visible_message("[user] slams the toilet seat onto [swirlie]'s head!", "[user] slams the toilet seat onto your head!", "You hear reverberating porcelain.") - swirlie.adjustBruteLoss(5) + // The toilet seat has the power of a battle hammer + var/datum/damage_source/blunt/heavy/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(swirlie, BRUTE, 5, null) else if(user.pulling && user.a_intent == INTENT_GRAB && isliving(user.pulling)) user.changeNext_move(CLICK_CD_MELEE) @@ -50,7 +52,8 @@ else playsound(src.loc, 'sound/effects/bang.ogg', 25, 1) GM.visible_message("[user] slams [GM.name] into [src]!", "[user] slams you into [src]!") - GM.adjustBruteLoss(5) + var/datum/damage_source/impact/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(GM, BRUTE, 5, null) else to_chat(user, "You need a tighter grip!") @@ -74,7 +77,7 @@ icon_state = "toilet[open][cistern]" -/obj/structure/toilet/attackby(obj/item/I, mob/living/user, params) +/obj/structure/toilet/item_interact(obj/item/I, mob/living/user, params) if(I.tool_behaviour == TOOL_CROWBAR) to_chat(user, "You start to [cistern ? "replace the lid on the cistern" : "lift the lid off the cistern"]...") playsound(loc, 'sound/effects/stonedoor_openclose.ogg', 50, 1) @@ -82,29 +85,31 @@ user.visible_message("[user] [cistern ? "replaces the lid on the cistern" : "lifts the lid off the cistern"]!", "You [cistern ? "replace the lid on the cistern" : "lift the lid off the cistern"]!", "You hear grinding porcelain.") cistern = !cistern update_icon() + return TRUE else if(cistern) if(user.a_intent != INTENT_HARM) if(I.w_class > WEIGHT_CLASS_NORMAL) to_chat(user, "[I] does not fit!") - return + return TRUE if(w_items + I.w_class > WEIGHT_CLASS_HUGE) to_chat(user, "The cistern is full!") - return + return TRUE if(!user.transferItemToLoc(I, src)) to_chat(user, "\The [I] is stuck to your hand, you cannot put it in the cistern!") - return + return TRUE w_items += I.w_class to_chat(user, "You carefully place [I] into the cistern.") + return TRUE else if(istype(I, /obj/item/reagent_containers)) if (!open) - return + return TRUE var/obj/item/reagent_containers/RG = I RG.reagents.add_reagent(/datum/reagent/water, min(RG.volume - RG.reagents.total_volume, RG.amount_per_transfer_from_this)) to_chat(user, "You fill [RG] from [src]. Gross.") - else - return ..() + return TRUE + return ..() /obj/structure/toilet/secret var/secret_type = null @@ -140,7 +145,8 @@ return user.changeNext_move(CLICK_CD_MELEE) user.visible_message("[user] slams [GM] into [src]!", "You slam [GM] into [src]!") - GM.adjustBruteLoss(8) + var/datum/damage_source/impact/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(GM, BRUTE, 8, null) else to_chat(user, "You need a tighter grip!") @@ -157,19 +163,20 @@ else ..() -/obj/structure/urinal/attackby(obj/item/I, mob/living/user, params) +/obj/structure/urinal/item_interact(obj/item/I, mob/living/user, params) if(exposed) if (hiddenitem) to_chat(user, "There is already something in the drain enclosure.") - return + return TRUE if(I.w_class > 1) to_chat(user, "[I] is too large for the drain enclosure.") - return + return TRUE if(!user.transferItemToLoc(I, src)) to_chat(user, "\[I] is stuck to your hand, you cannot put it in the drain enclosure!") - return + return TRUE hiddenitem = I to_chat(user, "You place [I] into the drain enclosure.") + return TRUE else return ..() @@ -225,7 +232,7 @@ desc = "A sink frame, that needs 2 plastic sheets to finish construction." anchored = FALSE -/obj/structure/sinkframe/attackby(obj/item/I, mob/living/user, params) +/obj/structure/sinkframe/item_interact(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/stack/sheet/plastic)) balloon_alert(user, "You start constructing a sink...") if(do_after(user, 4 SECONDS, target = src)) @@ -234,7 +241,7 @@ var/obj/structure/sink/new_sink = new /obj/structure/sink(loc) new_sink.setDir(dir) qdel(src) - return + return TRUE return ..() /obj/structure/sinkframe/Initialize(mapload) @@ -287,10 +294,10 @@ else SEND_SIGNAL(user, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD) -/obj/structure/sink/attackby(obj/item/O, mob/living/user, params) +/obj/structure/sink/item_interact(obj/item/O, mob/living/user, params) if(busy) to_chat(user, "Someone's already washing here!") - return + return ..() if(istype(O, /obj/item/reagent_containers)) var/obj/item/reagent_containers/RG = O @@ -300,7 +307,7 @@ to_chat(user, "You fill [RG] from [src].") return TRUE to_chat(user, "\The [RG] is full.") - return FALSE + return TRUE if(istype(O, /obj/item/melee/baton)) var/obj/item/melee/baton/B = O @@ -314,43 +321,40 @@ user.visible_message("[user] shocks [user.p_them()]self while attempting to wash the active [B.name]!", \ "You unwisely attempt to wash [B] while it's still on.") playsound(src, "sparks", 50, 1) - return + return TRUE if(istype(O, /obj/item/mop)) O.reagents.add_reagent(dispensedreagent, 5) to_chat(user, "You wet [O] in [src].") playsound(loc, 'sound/effects/slosh.ogg', 25, 1) - return + return TRUE if(istype(O, /obj/item/stack/medical/gauze)) var/obj/item/stack/medical/gauze/G = O new /obj/item/reagent_containers/glass/rag(src.loc) to_chat(user, "You tear off a strip of gauze and make a rag.") G.use(1) - return + return TRUE if(!istype(O)) - return + return ..() if(O.item_flags & ABSTRACT) //Abstract items like grabs won't wash. No-drop items will though because it's still technically an item in your hand. - return + return TRUE - if(user.a_intent != INTENT_HARM) - to_chat(user, "You start washing [O]...") - busy = TRUE - if(!do_after(user, 40, target = src)) - busy = FALSE - return 1 + to_chat(user, "You start washing [O]...") + busy = TRUE + if(!do_after(user, 40, target = src)) busy = FALSE - SEND_SIGNAL(O, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD) - O.acid_level = 0 - create_reagents(5) - reagents.add_reagent(dispensedreagent, 5) - reagents.reaction(O, TOUCH) - user.visible_message("[user] washes [O] using [src].", \ - "You wash [O] using [src].") - return 1 - else - return ..() + return TRUE + busy = FALSE + SEND_SIGNAL(O, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD) + O.acid_level = 0 + create_reagents(5) + reagents.add_reagent(dispensedreagent, 5) + reagents.reaction(O, TOUCH) + user.visible_message("[user] washes [O] using [src].", \ + "You wash [O] using [src].") + return TRUE /obj/structure/sink/deconstruct(disassembled = TRUE) new /obj/item/stack/sheet/iron (loc, 3) @@ -374,7 +378,7 @@ . = ..() icon_state = "puddle" -/obj/structure/sink/puddle/attackby(obj/item/O, mob/user, params) +/obj/structure/sink/puddle/item_interact(obj/item/O, mob/user, params) icon_state = "puddle-splash" . = ..() icon_state = "puddle" @@ -416,9 +420,10 @@ set_opacity(FALSE) open = TRUE -/obj/structure/curtain/attackby(obj/item/W, mob/user) +/obj/structure/curtain/item_interact(obj/item/W, mob/user) if (istype(W, /obj/item/toy/crayon)) color = tgui_color_picker(user,"","Choose Color",color) + return TRUE else return ..() diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm index bdc4bb8cf90f4..fd885529a7c1c 100644 --- a/code/game/objects/structures/windoor_assembly.dm +++ b/code/game/objects/structures/windoor_assembly.dm @@ -93,14 +93,14 @@ leaving.Bump(src) return COMPONENT_ATOM_BLOCK_EXIT -/obj/structure/windoor_assembly/attackby(obj/item/W, mob/user, params) +/obj/structure/windoor_assembly/item_interact(obj/item/W, mob/user, params) //I really should have spread this out across more states but thin little windoors are hard to sprite. add_fingerprint(user) switch(state) if("01") if(W.tool_behaviour == TOOL_WELDER && !anchored) if(!W.tool_start_check(user, amount=0)) - return + return TRUE user.visible_message("[user] disassembles the windoor assembly.", "You start to disassemble the windoor assembly...") @@ -111,30 +111,35 @@ if(secure) new /obj/item/stack/rods(get_turf(src), 4, TRUE, user) qdel(src) - return + //Update to reflect changes(if applicable) + update_appearance() + return TRUE //Wrenching an unsecure assembly anchors it in place. Step 4 complete if(W.tool_behaviour == TOOL_WRENCH && !anchored) for(var/obj/machinery/door/window/WD in loc) if(WD.dir == dir) to_chat(user, "There is already a windoor in that location!") - return + return TRUE user.visible_message("[user] secures the windoor assembly to the floor.", "You start to secure the windoor assembly to the floor...") if(W.use_tool(src, user, 40, volume=100)) if(anchored) - return + return TRUE for(var/obj/machinery/door/window/WD in loc) if(WD.dir == dir) to_chat(user, "There is already a windoor in that location!") - return + return TRUE to_chat(user, "You secure the windoor assembly.") setAnchored(TRUE) if(secure) name = "secure anchored windoor assembly" else name = "anchored windoor assembly" + //Update to reflect changes(if applicable) + update_appearance() + return TRUE //Unwrenching an unsecure assembly un-anchors it. Step 4 undone else if(W.tool_behaviour == TOOL_WRENCH && anchored) @@ -143,25 +148,28 @@ if(W.use_tool(src, user, 40, volume=100)) if(!anchored) - return + return TRUE to_chat(user, "You unsecure the windoor assembly.") setAnchored(FALSE) if(secure) name = "secure windoor assembly" else name = "windoor assembly" + //Update to reflect changes(if applicable) + update_appearance() + return TRUE //Adding plasteel makes the assembly a secure windoor assembly. Step 2 (optional) complete. else if(istype(W, /obj/item/stack/sheet/plasteel) && !secure) var/obj/item/stack/sheet/plasteel/P = W if(P.get_amount() < 2) to_chat(user, "You need more plasteel to do this!") - return + return TRUE to_chat(user, "You start to reinforce the windoor with plasteel...") if(do_after(user,40, target = src)) if(!src || secure || P.get_amount() < 2) - return + return TRUE P.use(2) to_chat(user, "You reinforce the windoor.") @@ -170,6 +178,9 @@ name = "secure anchored windoor assembly" else name = "secure windoor assembly" + //Update to reflect changes(if applicable) + update_appearance() + return TRUE //Adding cable to the assembly. Step 5 complete. else if(istype(W, /obj/item/stack/cable_coil) && anchored) @@ -177,17 +188,20 @@ if(do_after(user, 40, target = src)) if(!src || !anchored || src.state != "01") - return + return TRUE var/obj/item/stack/cable_coil/CC = W if(!CC.use(1)) to_chat(user, "You need more cable to do this!") - return + return TRUE to_chat(user, "You wire the windoor.") state = "02" if(secure) name = "secure wired windoor assembly" else name = "wired windoor assembly" + //Update to reflect changes(if applicable) + update_appearance() + return TRUE else return ..() @@ -199,7 +213,7 @@ if(W.use_tool(src, user, 40, volume=100)) if(state != "02") - return + return TRUE to_chat(user, "You cut the windoor wires.") new/obj/item/stack/cable_coil(get_turf(user), 1) @@ -208,11 +222,14 @@ name = "secure anchored windoor assembly" else name = "anchored windoor assembly" + //Update to reflect changes(if applicable) + update_appearance() + return TRUE //Adding airlock electronics for access. Step 6 complete. else if(istype(W, /obj/item/electronics/airlock)) if(!user.transferItemToLoc(W, src)) - return + return TRUE W.play_tool_sound(src, 100) user.visible_message("[user] installs the electronics into the airlock assembly.", "You start to install electronics into the airlock assembly...") @@ -220,12 +237,15 @@ if(do_after(user, 40, target = src)) if(!src || electronics) W.forceMove(drop_location()) - return + return TRUE to_chat(user, "You install the airlock electronics.") name = "near finished windoor assembly" electronics = W else W.forceMove(drop_location()) + //Update to reflect changes(if applicable) + update_appearance() + return TRUE //Adding an electroadaptive pseudocircuit for access. Step 6 complete. else if(istype(W, /obj/item/electroadaptive_pseudocircuit)) @@ -237,7 +257,7 @@ AE.unres_sides = EP.electronics.unres_sides if(!user.transferItemToLoc(AE, src)) qdel(AE) - return + return TRUE AE.play_tool_sound(src, 100) user.visible_message("[user] installs the electronics into the airlock assembly.", "You start to install electronics into the airlock assembly...") @@ -245,17 +265,20 @@ if(do_after(user, 40, target = src)) if(!src || electronics) qdel(AE) - return + return TRUE to_chat(user, "You install the electroadaptive pseudocircuit.") name = "near finished windoor assembly" electronics = AE else qdel(AE) + //Update to reflect changes(if applicable) + update_appearance() + return TRUE //Screwdriver to remove airlock electronics. Step 6 undone. else if(W.tool_behaviour == TOOL_SCREWDRIVER) if(!electronics) - return + return TRUE user.visible_message("[user] removes the electronics from the airlock assembly.", "You start to uninstall electronics from the airlock assembly...") @@ -267,21 +290,24 @@ ae = electronics electronics = null ae.forceMove(drop_location()) + return TRUE else if(istype(W, /obj/item/pen)) var/t = stripped_input(user, "Enter the name for the door.", name, created_name,MAX_NAME_LEN) if(!t) - return + return TRUE if(!in_range(src, usr) && loc != usr) - return + return TRUE created_name = t - return + //Update to reflect changes(if applicable) + update_appearance() + return TRUE //Crowbar to complete the assembly, Step 7 complete. else if(W.tool_behaviour == TOOL_CROWBAR) if(!electronics) to_chat(usr, "The assembly is missing electronics!") - return + return TRUE user << browse(null, "window=windoor_access") user.visible_message("[user] pries the windoor into the frame.", "You start prying the windoor into the frame...") @@ -335,13 +361,10 @@ windoor.name = created_name qdel(src) windoor.close() - - - else - return ..() - - //Update to reflect changes(if applicable) - update_appearance() + //Update to reflect changes(if applicable) + update_appearance() + return TRUE + return ..() /obj/structure/windoor_assembly/ComponentInitialize() . = ..() diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 9b4ccdb196164..d94bf675a7372 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -171,21 +171,21 @@ /obj/structure/window/attack_paw(mob/user) return attack_hand(user) -/obj/structure/window/attack_generic(mob/user, damage_amount = 0, damage_type = BRUTE, damage_flag = 0, sound_effect = 1) //used by attack_alien, attack_animal, and attack_slime +/obj/structure/window/attack_generic(mob/user, damage_amount = 0, damage_type = BRUTE, damage_flag = 0, sound_effect = 1) //used by attack_alien, attack_animal, and after_attacked_by_slime if(!can_be_reached(user)) return ..() -/obj/structure/window/attackby(obj/item/I, mob/living/user, params) +/obj/structure/window/item_interact(obj/item/I, mob/living/user, params) if(!can_be_reached(user)) - return 1 //skip the afterattack + return ..() add_fingerprint(user) - if(I.tool_behaviour == TOOL_WELDER && user.a_intent == INTENT_HELP) + if(I.tool_behaviour == TOOL_WELDER) if(obj_integrity < max_integrity) if(!I.tool_start_check(user, amount=0)) - return + return TRUE to_chat(user, "You begin repairing [src]...") if(I.use_tool(src, user, 40, volume=50)) @@ -194,7 +194,7 @@ to_chat(user, "You repair [src].") else to_chat(user, "[src] is already in good condition!") - return + return TRUE if(!(flags_1&NODECONSTRUCT_1)) if(I.tool_behaviour == TOOL_SCREWDRIVER) @@ -215,7 +215,7 @@ if(I.use_tool(src, user, decon_speed, extra_checks = CALLBACK(src, PROC_REF(check_anchored), anchored))) setAnchored(!anchored) to_chat(user, "You [anchored ? "fasten the window to":"unfasten the window from"] the floor.") - return + return TRUE else if(I.tool_behaviour == TOOL_CROWBAR && reinf && (state == WINDOW_OUT_OF_FRAME || state == WINDOW_IN_FRAME)) @@ -224,7 +224,7 @@ if(I.use_tool(src, user, decon_speed, extra_checks = CALLBACK(src, PROC_REF(check_state_and_anchored), state, anchored))) state = (state == WINDOW_OUT_OF_FRAME ? WINDOW_IN_FRAME : WINDOW_OUT_OF_FRAME) to_chat(user, "You pry the window [state == WINDOW_IN_FRAME ? "into":"out of"] the frame.") - return + return TRUE else if(I.tool_behaviour == TOOL_WRENCH && !anchored) I.play_tool_sound(src, 75) @@ -234,7 +234,7 @@ playsound(src, 'sound/items/Deconstruct.ogg', 50, 1) to_chat(user, "You successfully disassemble [src].") qdel(src) - return + return TRUE return ..() /obj/structure/window/setAnchored(anchorvalue) @@ -729,12 +729,9 @@ QUEUE_SMOOTH(src) -/obj/structure/window/paperframe/attackby(obj/item/W, mob/user) +/obj/structure/window/paperframe/item_interact(obj/item/W, mob/user) if(W.is_hot()) fire_act(W.is_hot()) - return - if(user.a_intent == INTENT_HARM) - return ..() if(istype(W, /obj/item/paper) && obj_integrity < max_integrity) user.visible_message("[user] starts to patch the holes in \the [src].") if(do_after(user, 20, target = src)) @@ -743,9 +740,9 @@ user.visible_message("[user] patches some of the holes in \the [src].") if(obj_integrity == max_integrity) update_appearance() - return - ..() + return TRUE update_appearance() + return ..() /obj/structure/window/bronze name = "brass window" diff --git a/code/game/turfs/closed/minerals.dm b/code/game/turfs/closed/minerals.dm index c8171f581e529..c058b3feef4ce 100644 --- a/code/game/turfs/closed/minerals.dm +++ b/code/game/turfs/closed/minerals.dm @@ -56,18 +56,17 @@ return ..() -/turf/closed/mineral/attackby(obj/item/I, mob/user, params) - if (!user.IsAdvancedToolUser()) - to_chat(usr, "You don't have the dexterity to do this!") - return - +/turf/closed/mineral/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_MINING) + if (!user.IsAdvancedToolUser()) + to_chat(usr, "You don't have the dexterity to do this!") + return TRUE var/turf/T = user.loc if (!isturf(T)) - return + return TRUE if(last_act + (40 * I.toolspeed) > world.time)//prevents message spam - return + return TRUE last_act = world.time to_chat(user, "You start picking...") @@ -76,6 +75,7 @@ to_chat(user, "You finish cutting into the rock.") gets_drilled(user) SSblackbox.record_feedback("tally", "pick_used_mining", 1, I.type) + return TRUE else return attack_hand(user) @@ -450,10 +450,11 @@ det_time = rand(8,10) //So you don't know exactly when the hot potato will explode . = ..() -/turf/closed/mineral/gibtonite/attackby(obj/item/I, mob/user, params) +/turf/closed/mineral/gibtonite/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/mining_scanner) || istype(I, /obj/item/t_scanner/adv_mining_scanner) && stage == 1) user.visible_message("[user] holds [I] to [src]...", "You use [I] to locate where to cut off the chain reaction and attempt to stop it...") defuse() + return TRUE ..() /turf/closed/mineral/gibtonite/proc/explosive_reaction(mob/user = null, triggered_by_explosion = 0) diff --git a/code/game/turfs/closed/wall/mineral_walls.dm b/code/game/turfs/closed/wall/mineral_walls.dm index b5c06cbb081c2..42d9a1c474b23 100644 --- a/code/game/turfs/closed/wall/mineral_walls.dm +++ b/code/game/turfs/closed/wall/mineral_walls.dm @@ -112,7 +112,7 @@ radiate() . = ..() -/turf/closed/wall/mineral/uranium/attackby(obj/item/W, mob/user, params) +/turf/closed/wall/mineral/uranium/item_interact(obj/item/W, mob/user, params) radiate() ..() @@ -131,7 +131,7 @@ smoothing_groups = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_PLASMA_WALLS) canSmoothWith = list(SMOOTH_GROUP_PLASMA_WALLS) -/turf/closed/wall/mineral/plasma/attackby(obj/item/W, mob/user, params) +/turf/closed/wall/mineral/plasma/item_interact(obj/item/W, mob/user, params) if(W.is_hot() > 300)//If the temperature of the object is over 300, then ignite if(plasma_ignition(6)) new /obj/structure/girder/displaced(loc) @@ -161,14 +161,14 @@ smoothing_groups = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_WOOD_WALLS) canSmoothWith = list(SMOOTH_GROUP_WOOD_WALLS) -/turf/closed/wall/mineral/wood/attackby(obj/item/W, mob/user) +/turf/closed/wall/mineral/wood/item_interact(obj/item/W, mob/user) if(W.is_sharp() && W.force) var/duration = (48/W.force) * 2 //In seconds, for now. if(istype(W, /obj/item/hatchet) || istype(W, /obj/item/fireaxe)) duration /= 4 //Much better with hatchets and axes. if(do_after(user, duration*10, target=src)) //Into deciseconds. dismantle_wall(FALSE,FALSE) - return + return TRUE return ..() /turf/closed/wall/mineral/wood/nonmetal diff --git a/code/game/turfs/closed/walls.dm b/code/game/turfs/closed/walls.dm index 716660669e0b6..f5289abe1bc2f 100644 --- a/code/game/turfs/closed/walls.dm +++ b/code/game/turfs/closed/walls.dm @@ -169,15 +169,15 @@ playsound(src, 'sound/weapons/genhit.ogg', 25, 1) add_fingerprint(user) -/turf/closed/wall/attackby(obj/item/W, mob/user, params) +/turf/closed/wall/item_interact(obj/item/W, mob/user, params) user.changeNext_move(CLICK_CD_MELEE) if (!user.IsAdvancedToolUser()) to_chat(user, "You don't have the dexterity to do this!") - return + return ..() //get the user's location if(!isturf(user.loc)) - return //can't do this stuff whilst inside objects and such + return TRUE //can't do this stuff whilst inside objects and such add_fingerprint(user) @@ -185,7 +185,7 @@ //the istype cascade has been spread among various procs for easy overriding if(try_clean(W, user, T) || try_wallmount(W, user, T) || try_decon(W, user, T) || try_destroy(W, user, T)) - return + return TRUE return ..() diff --git a/code/game/turfs/open/chasm.dm b/code/game/turfs/open/chasm.dm index 4bf25572b931d..e3c255bca7b8f 100644 --- a/code/game/turfs/open/chasm.dm +++ b/code/game/turfs/open/chasm.dm @@ -51,7 +51,7 @@ underlay_appearance.icon_state = "basalt" return TRUE -/turf/open/chasm/attackby(obj/item/C, mob/user, params, area/area_restriction) +/turf/open/chasm/item_interact(obj/item/C, mob/user, params, area/area_restriction) ..() if(istype(C, /obj/item/stack/rods)) var/obj/item/stack/rods/R = C @@ -64,7 +64,7 @@ new /obj/structure/lattice(src) else to_chat(user, "You need one rod to build a lattice.") - return + return TRUE if(istype(C, /obj/item/stack/tile/plasteel)) var/obj/structure/lattice/L = locate(/obj/structure/lattice, src) if(L) @@ -79,6 +79,8 @@ to_chat(user, "You need one floor tile to build a floor!") else to_chat(user, "The plating is going to need some support! Place iron rods first.") + return TRUE + return ..() /// Lets people walk into chasms. /turf/open/chasm/CanAllowThrough(atom/movable/mover, border_dir) diff --git a/code/game/turfs/open/floor.dm b/code/game/turfs/open/floor.dm index 96bf1d6613eee..8f2525b1829f0 100644 --- a/code/game/turfs/open/floor.dm +++ b/code/game/turfs/open/floor.dm @@ -140,14 +140,15 @@ W.update_icon() return W -/turf/open/floor/attackby(obj/item/C, mob/user, params) +/turf/open/floor/item_interact(obj/item/C, mob/user, params) if(!C || !user) - return 1 + return TRUE if(..()) - return 1 + return TRUE if(intact && istype(C, /obj/item/stack/tile)) try_replace_tile(C, user, params) - return 0 + return TRUE + return ..() /turf/open/floor/crowbar_act(mob/living/user, obj/item/I) return intact ? pry_tile(I, user) : FALSE diff --git a/code/game/turfs/open/floor/dock_floor.dm b/code/game/turfs/open/floor/dock_floor.dm index 085eae6db2602..4cc253097111b 100644 --- a/code/game/turfs/open/floor/dock_floor.dm +++ b/code/game/turfs/open/floor/dock_floor.dm @@ -35,7 +35,7 @@ return TRUE return TRUE -/turf/open/floor/dock/drydock/attackby(obj/item/C, mob/user, params) +/turf/open/floor/dock/drydock/item_interact(obj/item/C, mob/user, params) ..() var/can_build = CanBuildHere() if(istype(C, /obj/item/stack/rods)) diff --git a/code/game/turfs/open/floor/fancy_floor.dm b/code/game/turfs/open/floor/fancy_floor.dm index 030054ddc223c..3df3819cbbd3a 100644 --- a/code/game/turfs/open/floor/fancy_floor.dm +++ b/code/game/turfs/open/floor/fancy_floor.dm @@ -106,7 +106,7 @@ . = ..() update_icon() -/turf/open/floor/grass/attackby(obj/item/C, mob/user, params) +/turf/open/floor/grass/item_interact(obj/item/C, mob/user, params) if((C.tool_behaviour == TOOL_SHOVEL) && params) new ore_type(src, 2) user.visible_message("[user] digs up [src].", "You [turfverb] [src].") diff --git a/code/game/turfs/open/floor/light_floor.dm b/code/game/turfs/open/floor/light_floor.dm index e9820b80c461c..1daaa694e44b1 100644 --- a/code/game/turfs/open/floor/light_floor.dm +++ b/code/game/turfs/open/floor/light_floor.dm @@ -75,7 +75,7 @@ /turf/open/floor/light/attack_ai(mob/user) return attack_hand(user) -/turf/open/floor/light/attackby(obj/item/C, mob/user, params) +/turf/open/floor/light/item_interact(obj/item/C, mob/user, params) if(..()) return if(istype(C, /obj/item/light/bulb)) //only for light tiles diff --git a/code/game/turfs/open/floor/mineral_floor.dm b/code/game/turfs/open/floor/mineral_floor.dm index 1d5b68cf7ef6f..7a2bd86fe5cee 100644 --- a/code/game/turfs/open/floor/mineral_floor.dm +++ b/code/game/turfs/open/floor/mineral_floor.dm @@ -43,7 +43,7 @@ if(exposed_temperature > 300) PlasmaBurn(exposed_temperature) -/turf/open/floor/mineral/plasma/attackby(obj/item/W, mob/user, params) +/turf/open/floor/mineral/plasma/on_attacked(obj/item/I, mob/living/user) if(W.is_hot() > 300)//If the temperature of the object is over 300, then ignite message_admins("Plasma flooring was ignited by [ADMIN_LOOKUPFLW(user)] in [ADMIN_VERBOSEJMP(src)]") log_game("Plasma flooring was ignited by [key_name(user)] in [AREACOORD(src)]") @@ -195,7 +195,7 @@ if(isliving(arrived)) squeak() -/turf/open/floor/mineral/bananium/attackby(obj/item/W, mob/user, params) +/turf/open/floor/mineral/bananium/on_attacked(obj/item/I, mob/living/user) .=..() if(!.) honk() @@ -249,7 +249,7 @@ if(isliving(arrived)) radiate() -/turf/open/floor/mineral/uranium/attackby(obj/item/W, mob/user, params) +/turf/open/floor/mineral/uranium/item_interact(obj/item/C, mob/user, params) .=..() if(!.) radiate() diff --git a/code/game/turfs/open/floor/plating.dm b/code/game/turfs/open/floor/plating.dm index 3e92a6bb566e0..c20f7733f1c9e 100644 --- a/code/game/turfs/open/floor/plating.dm +++ b/code/game/turfs/open/floor/plating.dm @@ -49,30 +49,28 @@ if(!broken && !burnt) icon_state = icon_plating //Because asteroids are 'platings' too. -/turf/open/floor/plating/attackby(obj/item/C, mob/user, params) - if(..()) - return +/turf/open/floor/plating/item_interact(obj/item/C, mob/user, params) if(istype(C, /obj/item/stack/rods) && attachment_holes) if(broken || burnt) to_chat(user, "Repair the plating first!") - return + return TRUE if(locate(/obj/structure/lattice/catwalk/over, src)) - return + return TRUE if (istype(C, /obj/item/stack/rods)) var/obj/item/stack/rods/R = C if (R.use(2)) to_chat(user, "You lay down the catwalk.") playsound(src, 'sound/weapons/Genhit.ogg', 50, 1) new /obj/structure/lattice/catwalk/over(src) - return + return TRUE if(istype(C, /obj/item/stack/sheet/iron) && attachment_holes) if(broken || burnt) to_chat(user, "Repair the plating first!") - return + return TRUE var/obj/item/stack/sheet/iron/R = C if (R.get_amount() < 1) to_chat(user, "You need one sheet to make a reinforced floor!") - return + return TRUE else to_chat(user, "You begin reinforcing the floor...") if(do_after(user, 30, target = src)) @@ -81,16 +79,16 @@ playsound(src, 'sound/items/deconstruct.ogg', 80, 1) R.use(1) to_chat(user, "You reinforce the floor.") - return + return TRUE else if(istype(C, /obj/item/stack/tile) && !locate(/obj/structure/lattice/catwalk, src)) if(!broken && !burnt) for(var/obj/O in src) for(var/M in O.buckled_mobs) to_chat(user, "Someone is buckled to \the [O]! Unbuckle [M] to move \him out of the way.") - return + return TRUE var/obj/item/stack/tile/W = C if(!W.use(1)) - return + return TRUE var/turf/open/floor/T = PlaceOnTop(W.turf_type, flags = CHANGETURF_INHERIT_AIR) if(istype(W, /obj/item/stack/tile/light)) //TODO: get rid of this ugly check somehow var/obj/item/stack/tile/light/L = W @@ -99,6 +97,8 @@ playsound(src, 'sound/weapons/genhit.ogg', 50, 1) else to_chat(user, "This section is too damaged to support a tile! Use a welder to fix the damage.") + return TRUE + return ..() /turf/open/floor/plating/welder_act(mob/living/user, obj/item/I) if((broken || burnt) && I.use_tool(src, user, 0, volume=80)) @@ -128,7 +128,7 @@ /turf/open/floor/plating/foam/break_tile() return //jetfuel can't break steel foam... -/turf/open/floor/plating/foam/attackby(obj/item/I, mob/user, params) +/turf/open/floor/plating/foam/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/stack/tile/plasteel)) var/obj/item/stack/tile/plasteel/P = I if(P.use(1)) @@ -138,6 +138,7 @@ to_chat(user, "You reinforce the foamed plating with tiling.") playsound(src, 'sound/weapons/Genhit.ogg', 50, TRUE) ChangeTurf(/turf/open/floor/plating, flags = CHANGETURF_INHERIT_AIR) + return TRUE else playsound(src, 'sound/weapons/tap.ogg', 100, TRUE) //The attack sound is muffled by the foam itself user.changeNext_move(CLICK_CD_MELEE) @@ -148,6 +149,7 @@ ScrapeAway(flags = CHANGETURF_INHERIT_AIR) else to_chat(user, "You hit [src], to no effect!") + return TRUE /turf/open/floor/plating/foam/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd) if(the_rcd.mode == RCD_FLOORWALL) diff --git a/code/game/turfs/open/floor/plating/asteroid.dm b/code/game/turfs/open/floor/plating/asteroid.dm index 61c0b4f7443d2..c3891768ef33e 100644 --- a/code/game/turfs/open/floor/plating/asteroid.dm +++ b/code/game/turfs/open/floor/plating/asteroid.dm @@ -53,28 +53,29 @@ /turf/open/floor/plating/asteroid/MakeDry() return -/turf/open/floor/plating/asteroid/attackby(obj/item/W, mob/user, params) - . = ..() - if(!.) - if(W.tool_behaviour == TOOL_SHOVEL || W.tool_behaviour == TOOL_MINING) - if(!can_dig(user)) - return TRUE +/turf/open/floor/plating/asteroid/item_interact(obj/item/W, mob/user, params) + if(W.tool_behaviour == TOOL_SHOVEL || W.tool_behaviour == TOOL_MINING) + if(!can_dig(user)) + return TRUE - if(!isturf(user.loc)) - return + if(!isturf(user.loc)) + return TRUE - to_chat(user, "You start digging...") + to_chat(user, "You start digging...") - if(W.use_tool(src, user, 40, volume=50)) - if(!can_dig(user)) - return TRUE - to_chat(user, "You dig a hole.") - getDug() - SSblackbox.record_feedback("tally", "pick_used_mining", 1, W.type) + if(W.use_tool(src, user, 40, volume=50)) + if(!can_dig(user)) return TRUE - else if(istype(W, /obj/item/storage/bag/ore)) - for(var/obj/item/stack/ore/O in src) - SEND_SIGNAL(W, COMSIG_PARENT_ATTACKBY, O) + to_chat(user, "You dig a hole.") + getDug() + SSblackbox.record_feedback("tally", "pick_used_mining", 1, W.type) + return TRUE + return TRUE + else if(istype(W, /obj/item/storage/bag/ore)) + for(var/obj/item/stack/ore/O in src) + SEND_SIGNAL(W, COMSIG_PARENT_ATTACKBY, O) + return TRUE + return ..() /turf/open/floor/plating/asteroid/ex_act(severity, target) . = SEND_SIGNAL(src, COMSIG_ATOM_EX_ACT, severity, target) diff --git a/code/game/turfs/open/openspace.dm b/code/game/turfs/open/openspace.dm index c666f9af175cc..d0af8f0d4f351 100644 --- a/code/game/turfs/open/openspace.dm +++ b/code/game/turfs/open/openspace.dm @@ -74,7 +74,7 @@ /turf/open/openspace/proc/CanBuildHere() return can_build_on -/turf/open/openspace/attackby(obj/item/C, mob/user, params) +/turf/open/openspace/item_interact(obj/item/C, mob/user, params) ..() if(!CanBuildHere()) return diff --git a/code/game/turfs/open/space/space.dm b/code/game/turfs/open/space/space.dm index 0e6b1d581e878..69ee2e6255e41 100644 --- a/code/game/turfs/open/space/space.dm +++ b/code/game/turfs/open/space/space.dm @@ -110,17 +110,16 @@ /turf/open/space/handle_slip() return -/turf/open/space/attackby(obj/item/C, mob/user, params) - ..() +/turf/open/space/item_interact(obj/item/C, mob/user, params) if(!CanBuildHere()) - return + return ..() if(istype(C, /obj/item/stack/rods)) var/obj/item/stack/rods/R = C var/obj/structure/lattice/L = locate(/obj/structure/lattice, src) var/obj/structure/lattice/catwalk/W = locate(/obj/structure/lattice/catwalk, src) if(W) to_chat(user, "There is already a catwalk here!") - return + return TRUE if(L) if(R.use(1)) to_chat(user, "You construct a catwalk.") @@ -128,14 +127,14 @@ new/obj/structure/lattice/catwalk(src) else to_chat(user, "You need two rods to build a catwalk!") - return + return TRUE if(R.use(1)) to_chat(user, "You construct a lattice.") playsound(src, 'sound/weapons/genhit.ogg', 50, 1) ReplaceWithLattice() else to_chat(user, "You need one rod to build a lattice.") - return + return TRUE if(istype(C, /obj/item/stack/tile/plasteel)) var/obj/structure/lattice/L = locate(/obj/structure/lattice, src) if(L) @@ -149,6 +148,8 @@ to_chat(user, "You need one floor tile to build a floor!") else to_chat(user, "The plating is going to need some support! Place iron rods first.") + return TRUE + return ..() /turf/open/space/Entered(atom/movable/arrived, atom/old_loc, list/atom/old_locs) . = ..() diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index f56ae01bdb9d5..b25ef5e4c76ec 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -243,7 +243,7 @@ GLOBAL_LIST_EMPTY(created_baseturf_lists) C.wiringGuiUpdate(user) C.is_empty(user) -/turf/attackby(obj/item/C, mob/user, params) +/turf/item_interact(obj/item/C, mob/user, params) if(..()) return TRUE if(can_lay_cable() && istype(C, /obj/item/stack/cable_coil)) @@ -251,14 +251,13 @@ GLOBAL_LIST_EMPTY(created_baseturf_lists) for(var/obj/structure/cable/LC in src) if(!LC.d1 || !LC.d2) LC.attackby(C,user) - return + return TRUE coil.place_turf(src, user) return TRUE else if(istype(C, /obj/item/rcl)) handleRCL(C, user) - - return FALSE + return TRUE //There's a lot of QDELETED() calls here if someone can figure out how to optimize this but not runtime when something gets deleted by a Bump/CanPass/Cross call, lemme know or go ahead and fix this mess - kevinz000 /turf/Enter(atom/movable/mover) diff --git a/code/modules/admin/smites/apply_damage.dm b/code/modules/admin/smites/apply_damage.dm index 6355910c50e7f..aebd1fe835ae0 100644 --- a/code/modules/admin/smites/apply_damage.dm +++ b/code/modules/admin/smites/apply_damage.dm @@ -4,10 +4,10 @@ /datum/smite/apply_damage/effect(client/user, mob/living/target) . = ..() - var/list/damage_list = list(BRUTE, BURN, CLONE, OXY, STAMINA, TOX) + var/list/damage_list = subtypesof(/datum/damage) var/damage_punishment = tgui_input_list("Choose a damage type", sort_list(damage_list)) var/damage_amount = tgui_input_number("Choose an amount") if(isnull(damage_punishment) || isnull(damage_amount)) //The user pressed "Cancel" return - target.apply_damage_type(damage_amount, damage_punishment) + target.apply_damage(/datum/damage_source/magic/abstract, damage_amount, damage_punishment) diff --git a/code/modules/admin/smites/bsa.dm b/code/modules/admin/smites/bsa.dm index 7df6bc8ad42c0..6c105ade70cde 100644 --- a/code/modules/admin/smites/bsa.dm +++ b/code/modules/admin/smites/bsa.dm @@ -25,7 +25,8 @@ /* no_organs = */ TRUE, ) else - target.adjustBruteLoss(min(BSA_MAX_DAMAGE, target.health - 1)) + var/datum/damage_source/explosion/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(target, BRUTE, min(BSA_MAX_DAMAGE, target.health - 1), null) target.Paralyze(BSA_PARALYZE_TIME) target.stuttering = BSA_STUTTER_TIME diff --git a/code/modules/admin/view_variables/topic.dm b/code/modules/admin/view_variables/topic.dm index 9a0956174b0a2..49a1549b4585d 100644 --- a/code/modules/admin/view_variables/topic.dm +++ b/code/modules/admin/view_variables/topic.dm @@ -89,7 +89,7 @@ var/newamt switch(Text) if("brute") - L.adjustBruteLoss(amount,TRUE,TRUE) + L.adjustBruteLossAbstract(amount,TRUE) newamt = L.getBruteLoss() if("fire") L.adjustFireLoss(amount,TRUE,TRUE) @@ -104,7 +104,7 @@ L.adjustOrganLoss(ORGAN_SLOT_BRAIN, amount) newamt = L.getOrganLoss(ORGAN_SLOT_BRAIN) if("clone") - L.adjustCloneLoss(amount) + L.adjustCloneLossAbstract(amount) newamt = L.getCloneLoss() if("stamina") L.adjustStaminaLoss(amount) diff --git a/code/modules/antagonists/abductor/equipment/abduction_gear.dm b/code/modules/antagonists/abductor/equipment/abduction_gear.dm index d2ddcc8a9b231..dd8a8b82f48eb 100644 --- a/code/modules/antagonists/abductor/equipment/abduction_gear.dm +++ b/code/modules/antagonists/abductor/equipment/abduction_gear.dm @@ -188,7 +188,7 @@ icon_state = "gizmo_scan" to_chat(user, "You switch the device to [mode==GIZMO_SCAN? "SCAN": "MARK"] MODE") -/obj/item/abductor/gizmo/attack(mob/living/M, mob/user) +/obj/item/abductor/gizmo/attack_mob_target(mob/living/M, mob/user) if(!ScientistCheck(user)) return if(!console) @@ -463,7 +463,7 @@ Congratulations! You are now trained for invasive xenobiology research!"} icon_state = "wonderprodProbe" item_state = "wonderprodProbe" -/obj/item/abductor/baton/attack(mob/target, mob/living/user) +/obj/item/abductor/baton/attack_mob_target(mob/target, mob/living/user) if(!AbductorCheck(user)) return @@ -658,9 +658,9 @@ Congratulations! You are now trained for invasive xenobiology research!"} . = ..() make_syndie() -/obj/item/radio/headset/abductor/attackby(obj/item/W, mob/user, params) +/obj/item/radio/headset/abductor/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_SCREWDRIVER) - return // Stops humans from disassembling abductor headsets. + return TRUE // Stops humans from disassembling abductor headsets. return ..() /obj/item/abductor_machine_beacon @@ -760,7 +760,7 @@ Congratulations! You are now trained for invasive xenobiology research!"} framestack = /obj/item/stack/sheet/mineral/abductor framestackamount = 1 -/obj/structure/table_frame/abductor/attackby(obj/item/I, mob/user, params) +/obj/structure/table_frame/abductor/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_WRENCH) to_chat(user, "You start disassembling [src]...") I.play_tool_sound(src) @@ -769,28 +769,30 @@ Congratulations! You are now trained for invasive xenobiology research!"} for(var/i in 1 to framestackamount) new framestack(get_turf(src)) qdel(src) - return + return TRUE if(istype(I, /obj/item/stack/sheet/mineral/abductor)) var/obj/item/stack/sheet/P = I if(P.get_amount() < 1) to_chat(user, "You need one alien alloy sheet to do this!") - return + return TRUE to_chat(user, "You start adding [P] to [src]...") if(do_after(user, 50, target = src)) P.use(1) new /obj/structure/table/abductor(src.loc) qdel(src) - return + return TRUE if(istype(I, /obj/item/stack/sheet/mineral/silver)) var/obj/item/stack/sheet/P = I if(P.get_amount() < 1) to_chat(user, "You need one sheet of silver to do this!") - return + return TRUE to_chat(user, "You start adding [P] to [src]...") if(do_after(user, 50, target = src)) P.use(1) new /obj/structure/table/optable/abductor(src.loc) qdel(src) + return TRUE + return FALSE /obj/structure/table/abductor name = "alien table" diff --git a/code/modules/antagonists/abductor/machinery/console.dm b/code/modules/antagonists/abductor/machinery/console.dm index e56a20a22cee3..61aede58e4b63 100644 --- a/code/modules/antagonists/abductor/machinery/console.dm +++ b/code/modules/antagonists/abductor/machinery/console.dm @@ -243,11 +243,13 @@ vest = V return TRUE -/obj/machinery/abductor/console/attackby(obj/O, mob/user, params) +/obj/machinery/abductor/console/item_interact(obj/O, mob/user, params) if(istype(O, /obj/item/abductor/gizmo) && AddGizmo(O)) to_chat(user, "You link the tool to the console.") + return TRUE else if(istype(O, /obj/item/clothing/suit/armor/abductor/vest) && AddVest(O)) to_chat(user, "You link the vest to the console.") + return TRUE else return ..() diff --git a/code/modules/antagonists/abductor/machinery/dispenser.dm b/code/modules/antagonists/abductor/machinery/dispenser.dm index 64483e6893611..d624bb45881c3 100644 --- a/code/modules/antagonists/abductor/machinery/dispenser.dm +++ b/code/modules/antagonists/abductor/machinery/dispenser.dm @@ -63,14 +63,15 @@ Dispense(gland_id) return TRUE -/obj/machinery/abductor/gland_dispenser/attackby(obj/item/W, mob/user, params) +/obj/machinery/abductor/gland_dispenser/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/organ/heart/gland)) if(!user.transferItemToLoc(W, src)) - return + return TRUE for(var/i in 1 to gland_colors.len) if(gland_types[i] == W.type) amounts[i]++ ui_update() + return TRUE else return ..() diff --git a/code/modules/antagonists/blob/blob_mobs.dm b/code/modules/antagonists/blob/blob_mobs.dm index 380769c59a49d..af4a651a3de35 100644 --- a/code/modules/antagonists/blob/blob_mobs.dm +++ b/code/modules/antagonists/blob/blob_mobs.dm @@ -240,7 +240,7 @@ icon_dead = "blobbernaut_dead" health = 200 maxHealth = 200 - damage_coeff = list(BRUTE = 0.5, BURN = 1, TOX = 1, CLONE = 1, STAMINA = 0, OXY = 1) + damage_coeff = list(BRUTE = 0.5, BURN = 1, TOX = 1, CLONE = 1, STAMINA_DAMTYPE = 0, OXY = 1) melee_damage = 20 obj_damage = 60 attacktext = "slams" @@ -290,10 +290,9 @@ I.color = overmind.blobstrain.complementary_color flick_overlay_view(I, src, 8) -/mob/living/simple_animal/hostile/blob/blobbernaut/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/blob/blobbernaut/updatehealth() . = ..() - if(updating_health) - update_health_hud() + update_health_hud() /mob/living/simple_animal/hostile/blob/blobbernaut/update_health_hud() if(hud_used) diff --git a/code/modules/antagonists/blob/blobstrains/blazing_oil.dm b/code/modules/antagonists/blob/blobstrains/blazing_oil.dm index 42fb6feb1a791..d692c314e5da0 100644 --- a/code/modules/antagonists/blob/blobstrains/blazing_oil.dm +++ b/code/modules/antagonists/blob/blobstrains/blazing_oil.dm @@ -37,6 +37,6 @@ M.adjust_fire_stacks(round(reac_volume/10)) M.IgniteMob() if(M) - M.apply_damage(0.8*reac_volume, BURN) + M.apply_damage(/datum/damage_source/chemical, /datum/damage/burn, 0.8*reac_volume) if(iscarbon(M)) M.emote("scream") diff --git a/code/modules/antagonists/blob/blobstrains/cryogenic_poison.dm b/code/modules/antagonists/blob/blobstrains/cryogenic_poison.dm index b019146f0bc6a..8482285c2ed15 100644 --- a/code/modules/antagonists/blob/blobstrains/cryogenic_poison.dm +++ b/code/modules/antagonists/blob/blobstrains/cryogenic_poison.dm @@ -22,10 +22,11 @@ M.reagents.add_reagent(/datum/reagent/consumable/frostoil, 0.3*reac_volume) M.reagents.add_reagent(/datum/reagent/consumable/ice, 0.3*reac_volume) M.reagents.add_reagent(/datum/reagent/blob/cryogenic_poison, 0.3*reac_volume) - M.apply_damage(0.2*reac_volume, BRUTE) + M.apply_damage(/datum/damage_source/chemical, /datum/damage/brute, 0.2*reac_volume) /datum/reagent/blob/cryogenic_poison/on_mob_life(mob/living/carbon/M) - M.adjustBruteLoss(0.3*REAGENTS_EFFECT_MULTIPLIER, 0) + var/datum/damage_source/chemical/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(M, BRUTE, 0.3*REAGENTS_EFFECT_MULTIPLIER, null, 0) M.adjustFireLoss(0.3*REAGENTS_EFFECT_MULTIPLIER, 0) M.adjustToxLoss(0.3*REAGENTS_EFFECT_MULTIPLIER, 0) . = 1 diff --git a/code/modules/antagonists/blob/blobstrains/electromagnetic_web.dm b/code/modules/antagonists/blob/blobstrains/electromagnetic_web.dm index 13331561436d5..9ea4d1ea98703 100644 --- a/code/modules/antagonists/blob/blobstrains/electromagnetic_web.dm +++ b/code/modules/antagonists/blob/blobstrains/electromagnetic_web.dm @@ -35,4 +35,4 @@ if(prob(reac_volume*2)) M.emp_act(EMP_LIGHT) if(M) - M.apply_damage(reac_volume, BURN) + M.apply_damage(/datum/damage_source/chemical, /datum/damage/burn, reac_volume) diff --git a/code/modules/antagonists/blob/blobstrains/energized_jelly.dm b/code/modules/antagonists/blob/blobstrains/energized_jelly.dm index dc4033f2f2284..7f9f8d485e718 100644 --- a/code/modules/antagonists/blob/blobstrains/energized_jelly.dm +++ b/code/modules/antagonists/blob/blobstrains/energized_jelly.dm @@ -32,4 +32,4 @@ M.losebreath += round(0.2*reac_volume) M.adjustStaminaLoss(reac_volume) if(M) - M.apply_damage(0.6*reac_volume, OXY) + M.apply_damage(/datum/damage_source/chemical, /datum/damage/suffocation, 0.6 * reac_volume) diff --git a/code/modules/antagonists/blob/blobstrains/explosive_lattice.dm b/code/modules/antagonists/blob/blobstrains/explosive_lattice.dm index b4b95e46dfd26..317c09566caaf 100644 --- a/code/modules/antagonists/blob/blobstrains/explosive_lattice.dm +++ b/code/modules/antagonists/blob/blobstrains/explosive_lattice.dm @@ -34,8 +34,8 @@ if(FACTION_BLOB in L.faction) //no friendly fire continue var/aoe_volume = ..(L, TOUCH, initial_volume, 0, L.get_permeability_protection(), O) - L.apply_damage(0.4*aoe_volume, BRUTE) + L.apply_damage(/datum/damage_source/explosion, /datum/damage/burn, 0.4 * aoe_volume) if(M) - M.apply_damage(0.6*reac_volume, BRUTE) + M.apply_damage(/datum/damage_source/explosion, /datum/damage/burn, 0.6 * reac_volume) else - M.apply_damage(0.6*reac_volume, BRUTE) + M.apply_damage(/datum/damage_source/chemical, /datum/damage/brute, 0.6 * reac_volume) diff --git a/code/modules/antagonists/blob/blobstrains/networked_fibers.dm b/code/modules/antagonists/blob/blobstrains/networked_fibers.dm index 3e71daf27d27a..c65f831a6dfef 100644 --- a/code/modules/antagonists/blob/blobstrains/networked_fibers.dm +++ b/code/modules/antagonists/blob/blobstrains/networked_fibers.dm @@ -34,6 +34,6 @@ /datum/reagent/blob/networked_fibers/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) reac_volume = ..() - M.apply_damage(0.6*reac_volume, BRUTE) + M.apply_damage(/datum/damage_source/chemical, /datum/damage/brute, 0.6 * reac_volume) if(M) - M.apply_damage(0.6*reac_volume, BURN) + M.apply_damage(/datum/damage_source/chemical, /datum/damage/burn, 0.6 * reac_volume) diff --git a/code/modules/antagonists/blob/blobstrains/pressurized_slime.dm b/code/modules/antagonists/blob/blobstrains/pressurized_slime.dm index cc77b2fc298aa..27eba24d2d276 100644 --- a/code/modules/antagonists/blob/blobstrains/pressurized_slime.dm +++ b/code/modules/antagonists/blob/blobstrains/pressurized_slime.dm @@ -45,8 +45,8 @@ T.MakeSlippery(TURF_WET_LUBE, min_wet_time = 10 SECONDS, wet_time_to_add = 5 SECONDS) M.adjust_fire_stacks(-(reac_volume / 10)) M.ExtinguishMob() - M.apply_damage(0.4*reac_volume, BRUTE) + M.apply_damage(/datum/damage_source/chemical, /datum/damage/brute, 0.4 * reac_volume) if(M) - M.apply_damage(0.4*reac_volume, OXY) + M.apply_damage(/datum/damage_source/chemical, /datum/damage/suffocation, 0.4 * reac_volume) if(M) - M.adjustStaminaLoss(reac_volume) + M.apply_damage(/datum/damage_source/chemical, /datum/damage/stamina, reac_volume) diff --git a/code/modules/antagonists/blob/blobstrains/reactive_spines.dm b/code/modules/antagonists/blob/blobstrains/reactive_spines.dm index fed527ad1f0e6..3af1359bdaa16 100644 --- a/code/modules/antagonists/blob/blobstrains/reactive_spines.dm +++ b/code/modules/antagonists/blob/blobstrains/reactive_spines.dm @@ -28,4 +28,5 @@ /datum/reagent/blob/reactive_spines/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) if(M.stat == DEAD || istype(M, /mob/living/simple_animal/hostile/blob)) return 0 //the dead, and blob mobs, don't cause reactions - M.adjustBruteLoss(0.8*reac_volume) + var/datum/damage_source/chemical/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(M, BRUTE, 0.8*reac_volume, null) diff --git a/code/modules/antagonists/blob/blobstrains/regenerative_materia.dm b/code/modules/antagonists/blob/blobstrains/regenerative_materia.dm index 24606fc053522..a35c0145d2439 100644 --- a/code/modules/antagonists/blob/blobstrains/regenerative_materia.dm +++ b/code/modules/antagonists/blob/blobstrains/regenerative_materia.dm @@ -20,7 +20,7 @@ if(M.reagents) M.reagents.add_reagent(/datum/reagent/blob/regenerative_materia, 0.2*reac_volume) M.reagents.add_reagent(/datum/reagent/toxin/spore, 0.2*reac_volume) - M.apply_damage(0.7*reac_volume, TOX) + M.apply_damage(/datum/damage_source/chemical, /datum/damage/toxin, 0.7 * reac_volume) /datum/reagent/blob/regenerative_materia/on_mob_life(mob/living/carbon/C) C.adjustToxLoss(1*REAGENTS_EFFECT_MULTIPLIER) diff --git a/code/modules/antagonists/blob/blobstrains/replicating_foam.dm b/code/modules/antagonists/blob/blobstrains/replicating_foam.dm index c9cdba3224f84..7dac94b3091e3 100644 --- a/code/modules/antagonists/blob/blobstrains/replicating_foam.dm +++ b/code/modules/antagonists/blob/blobstrains/replicating_foam.dm @@ -33,4 +33,4 @@ /datum/reagent/blob/replicating_foam/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) reac_volume = ..() - M.apply_damage(0.7*reac_volume, BRUTE) + M.apply_damage(/datum/damage_source/chemical, /datum/damage/brute, 0.7 * reac_volume) diff --git a/code/modules/antagonists/blob/blobstrains/shifting_fragments.dm b/code/modules/antagonists/blob/blobstrains/shifting_fragments.dm index c36e27c79a282..cc6f272fe0b07 100644 --- a/code/modules/antagonists/blob/blobstrains/shifting_fragments.dm +++ b/code/modules/antagonists/blob/blobstrains/shifting_fragments.dm @@ -34,4 +34,4 @@ /datum/reagent/blob/shifting_fragments/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) reac_volume = ..() - M.apply_damage(0.7*reac_volume, BRUTE) + M.apply_damage(/datum/damage_source/chemical, /datum/damage/brute, 0.7 * reac_volume) diff --git a/code/modules/antagonists/blob/blobstrains/synchronous_mesh.dm b/code/modules/antagonists/blob/blobstrains/synchronous_mesh.dm index 351c578aa1b9a..b157c879f4e43 100644 --- a/code/modules/antagonists/blob/blobstrains/synchronous_mesh.dm +++ b/code/modules/antagonists/blob/blobstrains/synchronous_mesh.dm @@ -32,9 +32,9 @@ /datum/reagent/blob/synchronous_mesh/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) reac_volume = ..() - M.apply_damage(0.2*reac_volume, BRUTE) + M.apply_damage(/datum/damage_source/chemical, /datum/damage/brute, 0.2 * reac_volume) if(M && reac_volume) for(var/obj/structure/blob/B in range(1, M)) //if the target is completely surrounded, this is 2.4*reac_volume bonus damage, total of 2.6*reac_volume if(M) B.blob_attack_animation(M) //show them they're getting a bad time - M.apply_damage(0.3*reac_volume, BRUTE) + M.apply_damage(/datum/damage_source/chemical, /datum/damage/brute, 0.3 * reac_volume) diff --git a/code/modules/antagonists/blob/blobstrains/zombifying_pods.dm b/code/modules/antagonists/blob/blobstrains/zombifying_pods.dm index 5a165e8bf4aaa..df0262ef57cc2 100644 --- a/code/modules/antagonists/blob/blobstrains/zombifying_pods.dm +++ b/code/modules/antagonists/blob/blobstrains/zombifying_pods.dm @@ -34,7 +34,7 @@ /datum/reagent/blob/zombifying_pods/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message, touch_protection, mob/camera/blob/O) reac_volume = ..() - M.apply_damage(0.6*reac_volume, TOX) + M.apply_damage(/datum/damage_source/chemical, /datum/damage/toxin, 0.6 * reac_volume) if(O && ishuman(M) && M.stat == UNCONSCIOUS) M.death() //sleeping in a fight? bad plan. var/points = rand(5, 10) diff --git a/code/modules/antagonists/blob/structures/_blob.dm b/code/modules/antagonists/blob/structures/_blob.dm index 0a19077457a36..e005eb9c86d81 100644 --- a/code/modules/antagonists/blob/structures/_blob.dm +++ b/code/modules/antagonists/blob/structures/_blob.dm @@ -221,7 +221,7 @@ /obj/structure/blob/hulk_damage() return 15 -/obj/structure/blob/attackby(obj/item/I, mob/user, params) +/obj/structure/blob/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_ANALYZER) user.changeNext_move(CLICK_CD_MELEE) to_chat(user, "The analyzer beeps once, then reports:
") @@ -232,6 +232,7 @@ else to_chat(user, "Blob core neutralized. Critical mass no longer attainable.") to_chat(user, typereport(user).Join("\n")) + return TRUE else return ..() @@ -267,7 +268,7 @@ if(BURN) playsound(src.loc, 'sound/items/welder.ogg', 100, 1) -/obj/structure/blob/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir) +/obj/structure/blob/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir, armour_penetration = 0) switch(damage_type) if(BRUTE) damage_amount *= brute_resist diff --git a/code/modules/antagonists/changeling/powers/biodegrade.dm b/code/modules/antagonists/changeling/powers/biodegrade.dm index 9e647bafaa580..051c2f383a34f 100644 --- a/code/modules/antagonists/changeling/powers/biodegrade.dm +++ b/code/modules/antagonists/changeling/powers/biodegrade.dm @@ -23,7 +23,7 @@ to_chat(user, "We discrete an acidic solution from our pours onto [user.pulledby].") to_chat(target, "A burning glob of acid pours onto your hand!") target.Paralyze(20) - target.apply_damage(5, BURN, pick(BODY_ZONE_PRECISE_L_HAND, BODY_ZONE_PRECISE_R_HAND)) + target.apply_damage(/datum/damage_source/acid_burns, /datum/damage/burn, 5, pick(BODY_ZONE_PRECISE_L_HAND, BODY_ZONE_PRECISE_R_HAND)) target.emote("scream") target.stop_pulling() . = TRUE diff --git a/code/modules/antagonists/changeling/powers/mutations.dm b/code/modules/antagonists/changeling/powers/mutations.dm index 34ad063d6e5bd..8e447f741d26b 100644 --- a/code/modules/antagonists/changeling/powers/mutations.dm +++ b/code/modules/antagonists/changeling/powers/mutations.dm @@ -308,7 +308,7 @@ for(var/obj/item/I in H.held_items) if(I.is_sharp()) C.visible_message("[H] impales [C] with [H.p_their()] [I.name]!", "[H] impales you with [H.p_their()] [I.name]!") - C.apply_damage(I.force, BRUTE, BODY_ZONE_CHEST) + C.apply_damage(/datum/damage_source/sharp/heavy, /datum/damage/brute, I.force, BODY_ZONE_CHEST) H.do_item_attack_animation(C, used_item = I) H.add_mob_blood(C) playsound(get_turf(H),I.hitsound,75,1) diff --git a/code/modules/antagonists/clock_cult/clockwork_turfs.dm b/code/modules/antagonists/clock_cult/clockwork_turfs.dm index 2a789423715b5..4bb307b28ec8f 100644 --- a/code/modules/antagonists/clock_cult/clockwork_turfs.dm +++ b/code/modules/antagonists/clock_cult/clockwork_turfs.dm @@ -394,9 +394,10 @@ /obj/machinery/door/airlock/clockwork/ratvar_act() return 0 -/obj/machinery/door/airlock/clockwork/attackby(obj/item/I, mob/living/user, params) +/obj/machinery/door/airlock/clockwork/item_interact(obj/item/I, mob/living/user, params) if(!attempt_construction(I, user)) return ..() + return TRUE /obj/machinery/door/airlock/clockwork/allowed(mob/M) if(is_servant_of_ratvar(M)) diff --git a/code/modules/antagonists/clock_cult/items/clockwork_weapon.dm b/code/modules/antagonists/clock_cult/items/clockwork_weapon.dm index 5906f8a4d9551..0e7e504c32384 100644 --- a/code/modules/antagonists/clock_cult/items/clockwork_weapon.dm +++ b/code/modules/antagonists/clock_cult/items/clockwork_weapon.dm @@ -36,7 +36,7 @@ if(is_servant_of_ratvar(user) && clockwork_hint) . += clockwork_hint -/obj/item/clockwork/weapon/attack(mob/living/target, mob/living/user) +/obj/item/clockwork/weapon/attack_mob_target(mob/living/target, mob/living/user) if(!is_reebe(user.z)) return ..() //Gain a slight buff when fighting near to the Ark. @@ -130,15 +130,14 @@ to_chat(user, "You strike [target] with an electromagnetic pulse!") playsound(user, 'sound/magic/lightningshock.ogg', 40) -/obj/item/clockwork/weapon/brass_sword/attack_obj(obj/O, mob/living/user) - ..() - if(!(istype(O, /obj/mecha) && is_reebe(user.z))) +/obj/item/clockwork/weapon/brass_sword/afterattack(atom/target, mob/user, proximity_flag, click_parameters) + . = ..() + if(!(istype(target, /obj/mecha) && is_reebe(user.z))) return if(!COOLDOWN_FINISHED(src, emp_cooldown)) return COOLDOWN_START(src, emp_cooldown, 20 SECONDS) - var/obj/mecha/target = O target.emp_act(EMP_HEAVY) new /obj/effect/temp_visual/emp/pulse(target.loc) addtimer(CALLBACK(src, PROC_REF(send_message), user), 20 SECONDS) @@ -179,7 +178,7 @@ magazine.give_round(CB) update_icon() -/obj/item/gun/ballistic/bow/clockbolt/attackby(obj/item/I, mob/user, params) +/obj/item/gun/ballistic/bow/clockbolt/item_interact(obj/item/I, mob/user, params) return /obj/item/ammo_box/magazine/internal/bow/clockcult diff --git a/code/modules/antagonists/clock_cult/items/integration_cog.dm b/code/modules/antagonists/clock_cult/items/integration_cog.dm index 6c2ba0c8b3b38..2babf2fa29b5e 100644 --- a/code/modules/antagonists/clock_cult/items/integration_cog.dm +++ b/code/modules/antagonists/clock_cult/items/integration_cog.dm @@ -5,15 +5,15 @@ clockwork_desc = "A sharp cog that can cut through and be inserted into APCs to extract power for the gateway." item_flags = ISWEAPON -/obj/item/clockwork/integration_cog/attack_obj(obj/O, mob/living/user) +/obj/item/clockwork/integration_cog/interact_with(atom/target, mob/user, params) if(!is_servant_of_ratvar(user)) return ..() - if(!istype(O, /obj/machinery/power/apc)) + if(!istype(target, /obj/machinery/power/apc)) return ..() - var/obj/machinery/power/apc/A = O + var/obj/machinery/power/apc/A = target if(A.integration_cog) to_chat(user, "There is already \an [src] in \the [A].") - return + return TRUE if(!A.panel_open) //Cut open the panel to_chat(user, "You begin cutting open \the [A].") @@ -21,8 +21,8 @@ to_chat(user, "You cut open \the [A] with \the [src].") A.panel_open = TRUE A.update_icon() - return - return + return TRUE + return TRUE //Insert the cog to_chat(user, "You begin inserting \the [src] into \the [A].") if(do_after(user, 40, target=A)) @@ -42,3 +42,4 @@ if(GLOB.clockcult_eminence) var/mob/living/simple_animal/eminence/eminence = GLOB.clockcult_eminence eminence.cog_change() + return TRUE diff --git a/code/modules/antagonists/clock_cult/mobs/clockwork_marauder.dm b/code/modules/antagonists/clock_cult/mobs/clockwork_marauder.dm index 2e7bfb21164af..973252eab7767 100644 --- a/code/modules/antagonists/clock_cult/mobs/clockwork_marauder.dm +++ b/code/modules/antagonists/clock_cult/mobs/clockwork_marauder.dm @@ -20,7 +20,7 @@ GLOBAL_LIST_EMPTY(clockwork_marauders) move_resist = MOVE_FORCE_OVERPOWERING mob_size = MOB_SIZE_LARGE pass_flags = PASSTABLE - damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0) + damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA_DAMTYPE = 0, OXY = 0) attacktext = "slices" attack_sound = 'sound/weapons/bladeslice.ogg' @@ -60,9 +60,9 @@ GLOBAL_LIST_EMPTY(clockwork_marauders) new item(get_turf(src)) qdel(src) -/mob/living/simple_animal/hostile/clockwork_marauder/attacked_by(obj/item/I, mob/living/user) +/mob/living/simple_animal/hostile/clockwork_marauder/on_attacked(obj/item/I, mob/living/user) if(istype(I, /obj/item/nullrod)) - apply_damage(15, BURN) + apply_damage(/datum/damage_source/magic, /datum/damage/burn, 15) if(shield_health > 0) damage_shield() playsound(src,'sound/hallucinations/veryfar_noise.ogg',40,1) diff --git a/code/modules/antagonists/clock_cult/mobs/eminence.dm b/code/modules/antagonists/clock_cult/mobs/eminence.dm index 06056a2d9e95f..e78c32c0606d0 100644 --- a/code/modules/antagonists/clock_cult/mobs/eminence.dm +++ b/code/modules/antagonists/clock_cult/mobs/eminence.dm @@ -17,7 +17,7 @@ see_in_dark = 8 lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE unsuitable_atmos_damage = 0 - damage_coeff = list(BRUTE = 0, BURN = 0, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0) + damage_coeff = list(BRUTE = 0, BURN = 0, TOX = 0, CLONE = 0, STAMINA_DAMTYPE = 0, OXY = 0) atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0) minbodytemp = 0 maxbodytemp = INFINITY @@ -63,7 +63,7 @@ /mob/living/simple_animal/eminence/gib() return -/mob/living/simple_animal/eminence/UnarmedAttack(atom/A) +/mob/living/simple_animal/eminence/primary_interact(atom/A) return FALSE /mob/living/simple_animal/eminence/start_pulling(atom/movable/AM, state, force = move_force, supress_message = FALSE) diff --git a/code/modules/antagonists/clock_cult/scriptures/abstraction_crystal.dm b/code/modules/antagonists/clock_cult/scriptures/abstraction_crystal.dm index 31c6330918c98..64076260bf142 100644 --- a/code/modules/antagonists/clock_cult/scriptures/abstraction_crystal.dm +++ b/code/modules/antagonists/clock_cult/scriptures/abstraction_crystal.dm @@ -87,7 +87,8 @@ GLOBAL_LIST_INIT(abstraction_crystals, list()) damage_crystal(health_lost) var/required_health = (linked_crystal.obj_integrity / linked_crystal.max_integrity) * maxHealth var/health_delta_needed = max(health - required_health, 0) - adjustCloneLoss(health_delta_needed) //Adjust clone loss so that our health = crystals health + var/datum/damage_source/magic/abstract/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(owner, CLONE, health_delta_needed) //Adjust clone loss so that our health = crystals health last_check_health = health if(incapacitated() || get_dist(src, linked_crystal) > ABSTRACTION_CRYSTAL_RANGE) linked_crystal.deconstruct(FALSE) diff --git a/code/modules/antagonists/clock_cult/scriptures/ocular_warden.dm b/code/modules/antagonists/clock_cult/scriptures/ocular_warden.dm index 9494d3a34d3a9..5f7c01187ac5f 100644 --- a/code/modules/antagonists/clock_cult/scriptures/ocular_warden.dm +++ b/code/modules/antagonists/clock_cult/scriptures/ocular_warden.dm @@ -51,7 +51,7 @@ if(!target) return dir = get_dir(get_turf(src), get_turf(target)) - target.apply_damage(max(10 - (get_dist(src, target)*2.5), 5)*delta_time, BURN) + target.apply_damage(/datum/damage_source/magic, /datum/damage/burn, max(10 - (get_dist(src, target)*2.5), 5)*delta_time, ran_zone()) new /obj/effect/temp_visual/ratvar/ocular_warden(get_turf(target)) new /obj/effect/temp_visual/ratvar/ocular_warden(get_turf(src)) playsound(get_turf(target), 'sound/machines/clockcult/ocularwarden-dot1.ogg', 60, TRUE) diff --git a/code/modules/antagonists/clock_cult/scriptures/prosperity_prism.dm b/code/modules/antagonists/clock_cult/scriptures/prosperity_prism.dm index 3a954e39edd8d..ba1ac3490c417 100644 --- a/code/modules/antagonists/clock_cult/scriptures/prosperity_prism.dm +++ b/code/modules/antagonists/clock_cult/scriptures/prosperity_prism.dm @@ -74,7 +74,7 @@ if(use_power(2)) L.adjustToxLoss(-50*delta_time, FALSE, TRUE) L.adjustStaminaLoss(-50*delta_time) - L.adjustBruteLoss(-10*delta_time) + L.adjustBruteLossAbstract(-10*delta_time) L.adjustFireLoss(-10*delta_time) new /obj/effect/temp_visual/heal(get_turf(L), "#45dd8a") for(var/datum/reagent/R in L.reagents.reagent_list) diff --git a/code/modules/antagonists/clock_cult/scriptures/sentinels_compromise.dm b/code/modules/antagonists/clock_cult/scriptures/sentinels_compromise.dm index e7922c0a0072e..8945034c5dbf6 100644 --- a/code/modules/antagonists/clock_cult/scriptures/sentinels_compromise.dm +++ b/code/modules/antagonists/clock_cult/scriptures/sentinels_compromise.dm @@ -32,10 +32,10 @@ if(M.stat == DEAD) return FALSE var/total_damage = (M.getBruteLoss() + M.getFireLoss() + M.getOxyLoss() + M.getCloneLoss()) * 0.6 - M.adjustBruteLoss(-M.getBruteLoss() * 0.6, FALSE) + M.adjustBruteLossAbstract(-M.getBruteLoss() * 0.6) M.adjustFireLoss(-M.getFireLoss() * 0.6, FALSE) M.adjustOxyLoss(-M.getOxyLoss() * 0.6, FALSE) - M.adjustCloneLoss(-M.getCloneLoss() * 0.6, TRUE) + M.adjustCloneLossAbstract(-M.getCloneLoss() * 0.6, TRUE) M.blood_volume = BLOOD_VOLUME_NORMAL M.reagents.remove_reagent(/datum/reagent/water/holywater, INFINITY) M.set_nutrition(NUTRITION_LEVEL_FULL) diff --git a/code/modules/antagonists/clock_cult/scriptures/sigil_of_vitality.dm b/code/modules/antagonists/clock_cult/scriptures/sigil_of_vitality.dm index 0d80bd2aa4790..cf2d857db07a9 100644 --- a/code/modules/antagonists/clock_cult/scriptures/sigil_of_vitality.dm +++ b/code/modules/antagonists/clock_cult/scriptures/sigil_of_vitality.dm @@ -65,11 +65,11 @@ if(GLOB.clockcult_vitality >= healing_performed * 0.3) GLOB.clockcult_vitality -= healing_performed * 0.3 //Do healing - M.adjustBruteLoss(-5, FALSE) + M.adjustBruteLossAbstract(-5, FALSE) M.adjustFireLoss(-5, FALSE) M.adjustOxyLoss(-5, FALSE) M.adjustToxLoss(-5, FALSE, TRUE) - M.adjustCloneLoss(-5) + M.adjustCloneLossAbstract(-5) else visible_message("\The [src] fails to heal [M]!", "There is insufficient vitality to heal your wounds!") else @@ -80,7 +80,8 @@ return M.Paralyze(10) var/before_cloneloss = M.getCloneLoss() - M.adjustCloneLoss(20, TRUE, TRUE) + var/datum/damage_source/magic/magic_source = FIND_DAMAGE_SOURCE + magic_source.apply_direct(M, CLONE, 20, forced = TRUE) var/after_cloneloss = M.getCloneLoss() if(before_cloneloss == after_cloneloss) visible_message("\The [src] fails to siphon [M]'s spirit!") diff --git a/code/modules/antagonists/clock_cult/scriptures/stargazer.dm b/code/modules/antagonists/clock_cult/scriptures/stargazer.dm index 4edfa82546b6e..b1fdc4b29e9aa 100644 --- a/code/modules/antagonists/clock_cult/scriptures/stargazer.dm +++ b/code/modules/antagonists/clock_cult/scriptures/stargazer.dm @@ -94,32 +94,30 @@ mobs_in_range = FALSE sg_light.close() -/obj/structure/destructible/clockwork/gear_base/stargazer/attackby(obj/item/I, mob/living/user, params) - if(user.a_intent != INTENT_HELP) - . = ..() - return +/obj/structure/destructible/clockwork/gear_base/stargazer/item_interact(obj/item/I, mob/living/user, params) if(!anchored) to_chat(user, "You need to anchor [src] to the floor first.") - return + return TRUE if(cooldowntime > world.time) to_chat(user, "[src] is still warming up, it will be ready in [DisplayTimeText(cooldowntime - world.time)].") - return + return TRUE if(HAS_TRAIT(I, TRAIT_STARGAZED)) to_chat(user, "[I] has already been enhanced!") - return + return TRUE to_chat(user, "You begin placing [I] onto [src].") if(do_after(user, 60, target=I)) if(cooldowntime > world.time) to_chat(user, "[src] is still warming up, it will be ready in [DisplayTimeText(cooldowntime - world.time)].") - return + return TRUE if(HAS_TRAIT(I, TRAIT_STARGAZED)) to_chat(user, "[I] has already been enhanced!") - return + return TRUE if(istype(I, /obj/item) && !istype(I, /obj/item/clothing) && I.force) upgrade_weapon(I, user) cooldowntime = world.time + STARGAZER_COOLDOWN - return + return TRUE to_chat(user, "You cannot upgrade [I].") + return TRUE /obj/structure/destructible/clockwork/gear_base/stargazer/proc/upgrade_weapon(obj/item/I, mob/living/user) //Prevent re-enchanting diff --git a/code/modules/antagonists/clock_cult/structure/clockwork_structure.dm b/code/modules/antagonists/clock_cult/structure/clockwork_structure.dm index a0a15af66d614..cdc88149476a6 100644 --- a/code/modules/antagonists/clock_cult/structure/clockwork_structure.dm +++ b/code/modules/antagonists/clock_cult/structure/clockwork_structure.dm @@ -26,7 +26,7 @@ else if(desc) . += desc -/obj/structure/destructible/clockwork/attacked_by(obj/item/I, mob/living/user) +/obj/structure/destructible/clockwork/on_attacked(obj/item/I, mob/living/user) if(immune_to_servant_attacks && is_servant_of_ratvar(user)) return . = ..() diff --git a/code/modules/antagonists/clock_cult/structure/gear_base.dm b/code/modules/antagonists/clock_cult/structure/gear_base.dm index 559a5ea32fa4f..e0bb65e22ff89 100644 --- a/code/modules/antagonists/clock_cult/structure/gear_base.dm +++ b/code/modules/antagonists/clock_cult/structure/gear_base.dm @@ -22,7 +22,7 @@ for(var/obj/structure/destructible/clockwork/sigil/transmission/ST in transmission_sigils) ST.linked_structures -= src -/obj/structure/destructible/clockwork/gear_base/attackby(obj/item/I, mob/user, params) +/obj/structure/destructible/clockwork/gear_base/item_interact(obj/item/I, mob/user, params) if(is_servant_of_ratvar(user) && I.tool_behaviour == TOOL_WRENCH) to_chat(user, "You begin to [anchored ? "unwrench" : "wrench"] [src].") if(I.use_tool(src, user, 20, volume=50)) diff --git a/code/modules/antagonists/clock_cult/structure/wall_gear.dm b/code/modules/antagonists/clock_cult/structure/wall_gear.dm index 660335d99f739..eea211b9a7793 100644 --- a/code/modules/antagonists/clock_cult/structure/wall_gear.dm +++ b/code/modules/antagonists/clock_cult/structure/wall_gear.dm @@ -22,10 +22,10 @@ /obj/structure/destructible/clockwork/wall_gear/emp_act(severity) return -/obj/structure/destructible/clockwork/wall_gear/attackby(obj/item/I, mob/user, params) +/obj/structure/destructible/clockwork/wall_gear/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_WRENCH) default_unfasten_wrench(user, I, 10) - return 1 + return TRUE else if(I.tool_behaviour == TOOL_SCREWDRIVER) if(anchored) to_chat(user, "[src] needs to be unsecured to disassemble it!") @@ -34,22 +34,22 @@ if(I.use_tool(src, user, 30, volume=100) && !anchored) to_chat(user, "You disassemble [src].") deconstruct(TRUE) - return 1 + return TRUE else if(istype(I, /obj/item/stack/sheet/brass)) var/obj/item/stack/sheet/brass/W = I if(W.get_amount() < 1) to_chat(user, "You need one brass sheet to do this!") - return + return TRUE var/turf/T = get_turf(src) if(iswallturf(T)) to_chat(user, "There is already a wall present!") - return + return TRUE if(!isfloorturf(T)) to_chat(user, "A floor must be present to build a [anchored ? "false ":""]wall!") - return + return TRUE if(locate(/obj/structure/falsewall) in T.contents) to_chat(user, "There is already a false wall present!") - return + return TRUE to_chat(user, "You start adding [W] to [src]...") if(do_after(user, 20, target = src)) var/brass_floor = FALSE @@ -64,7 +64,7 @@ qdel(src) else to_chat(user, "You need more brass to make a [anchored ? "false ":""]wall!") - return 1 + return TRUE return ..() /obj/structure/destructible/clockwork/wall_gear/deconstruct(disassembled = TRUE) diff --git a/code/modules/antagonists/clock_cult/traps/receivers/skewer.dm b/code/modules/antagonists/clock_cult/traps/receivers/skewer.dm index 377d63f93a9c5..29cb8f2501801 100644 --- a/code/modules/antagonists/clock_cult/traps/receivers/skewer.dm +++ b/code/modules/antagonists/clock_cult/traps/receivers/skewer.dm @@ -34,11 +34,7 @@ target_stabbed = TRUE to_chat(M, "You are impaled by [src]!") M.emote("scream") - M.apply_damage(5, BRUTE, BODY_ZONE_CHEST) - if(ishuman(M)) - var/mob/living/carbon/human/H = M - if(!H.bleed_rate) - H.bleed(30) + M.apply_damage(/datum/damage_source/sharp/heavy, /datum/damage/brute, 20, BODY_ZONE_CHEST) if(target_stabbed) if(!stab_overlay) stab_overlay = mutable_appearance('icons/obj/clockwork_objects.dmi', "brass_skewer_pokeybit", layer=ABOVE_MOB_LAYER) diff --git a/code/modules/antagonists/cult/blood_magic.dm b/code/modules/antagonists/cult/blood_magic.dm index 8eeb79dbdb4c9..7cbd7e4e5dd9a 100644 --- a/code/modules/antagonists/cult/blood_magic.dm +++ b/code/modules/antagonists/cult/blood_magic.dm @@ -381,7 +381,7 @@ /obj/item/melee/blood_magic/attack_self(mob/living/user) afterattack(user, user, TRUE) -/obj/item/melee/blood_magic/attack(mob/living/M, mob/living/carbon/user) +/obj/item/melee/blood_magic/attack_mob_target(mob/living/M, mob/living/carbon/user) if(!iscarbon(user) || !iscultist(user)) uses = 0 qdel(src) @@ -395,10 +395,7 @@ if(invocation) user.whisper(invocation, language = /datum/language/common) if(health_cost) - if(user.active_hand_index == 1) - user.apply_damage(health_cost, BRUTE, BODY_ZONE_L_ARM) - else - user.apply_damage(health_cost, BRUTE, BODY_ZONE_R_ARM) + user.apply_damage(/datum/damage_source/magic/abstract, /datum/damage/brute, health_cost, user.active_hand_index == 1 ? BODY_ZONE_L_ARM : BODY_ZONE_R_ARM) if(uses <= 0) qdel(src) else if(source) @@ -720,8 +717,7 @@ H.adjustOxyLoss((overall_damage*ratio) * (H.getOxyLoss() / overall_damage), 0) H.adjustToxLoss((overall_damage*ratio) * (H.getToxLoss() / overall_damage), 0) H.adjustFireLoss((overall_damage*ratio) * (H.getFireLoss() / overall_damage), 0) - H.adjustBruteLoss((overall_damage*ratio) * (H.getBruteLoss() / overall_damage), 0) - H.updatehealth() + H.adjustBruteLossAbstract((overall_damage*ratio) * (H.getBruteLoss() / overall_damage), 0) playsound(get_turf(H), 'sound/magic/staff_healing.ogg', 25) new /obj/effect/temp_visual/cult/sparks(get_turf(H)) user.Beam(H, icon_state="sendbeam", time = 15) diff --git a/code/modules/antagonists/cult/cult_items.dm b/code/modules/antagonists/cult/cult_items.dm index ddd669818fc8d..52f55679e056d 100644 --- a/code/modules/antagonists/cult/cult_items.dm +++ b/code/modules/antagonists/cult/cult_items.dm @@ -61,7 +61,7 @@ Striking a noncultist, however, will tear their flesh."} . = ..() AddComponent(/datum/component/butchering, 40, 100) -/obj/item/melee/cultblade/attack(mob/living/target, mob/living/carbon/human/user) +/obj/item/melee/cultblade/attack_mob_target(mob/living/target, mob/living/carbon/human/user) if(!iscultist(user)) user.visible_message("[user] cringes as they strike [target]!", \ "Your arm throbs and your brain hurts!") @@ -193,7 +193,7 @@ Striking a noncultist, however, will tear their flesh."} var/mob/living/carbon/human/H = target if(H.stat != CONSCIOUS) var/obj/item/soulstone/SS = new /obj/item/soulstone(src) - SS.attack(H, user) + SS.attack_mob_target(H, user) if(!LAZYLEN(SS.contents)) qdel(SS) if(istype(target, /obj/structure/constructshell) && contents.len) @@ -893,7 +893,8 @@ Striking a noncultist, however, will tear their flesh."} var/mob/living/L = target if(L.density) L.Paralyze(20) - L.adjustBruteLoss(45) + var/datum/damage_source/magic/religion/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(L, BRUTE, 45, null) playsound(L, 'sound/hallucinations/wail.ogg', 50, 1) L.emote("scream") user.Beam(temp_target, icon_state="blood_beam", time = 7, beam_type = /obj/effect/ebeam/blood) diff --git a/code/modules/antagonists/cult/cult_structures.dm b/code/modules/antagonists/cult/cult_structures.dm index c821f44aff308..cdf210535b2f5 100644 --- a/code/modules/antagonists/cult/cult_structures.dm +++ b/code/modules/antagonists/cult/cult_structures.dm @@ -167,9 +167,8 @@ continue new /obj/effect/temp_visual/heal(get_turf(src), "#960000") if(ishuman(L)) - L.adjustBruteLoss(-5*delta_time, 0) + L.adjustBruteLossAbstract(-5*delta_time) L.adjustFireLoss(-5*delta_time, 0) - L.updatehealth() if(L.blood_volume < BLOOD_VOLUME_NORMAL) L.blood_volume += 1.0 else if(isshade(L) || isconstruct(L)) diff --git a/code/modules/antagonists/cult/runes.dm b/code/modules/antagonists/cult/runes.dm index 3dc4b39cd7727..d0d9691121579 100644 --- a/code/modules/antagonists/cult/runes.dm +++ b/code/modules/antagonists/cult/runes.dm @@ -169,7 +169,8 @@ structure_check() searches for nearby cultist structures required for the invoca if(invocation) L.say(invocation, language = /datum/language/common, ignore_spam = TRUE, forced = "cult invocation") if(invoke_damage) - L.apply_damage(invoke_damage, BRUTE) + L.apply_damage(/datum/damage_source/magic/abstract, /datum/damage/brute, invoke_damage) + to_chat(L, "[src] saps your strength!") else if(istype(M, /obj/item/toy/plush/narplush)) var/obj/item/toy/plush/narplush/P = M @@ -272,7 +273,7 @@ structure_check() searches for nearby cultist structures required for the invoca var/brutedamage = convertee.getBruteLoss() var/burndamage = convertee.getFireLoss() if(brutedamage || burndamage) - convertee.adjustBruteLoss(-(brutedamage * 0.75)) + convertee.adjustBruteLossAbstract(-(brutedamage * 0.75)) convertee.adjustFireLoss(-(burndamage * 0.75)) convertee.visible_message("[convertee] writhes in pain \ [brutedamage || burndamage ? "even as [convertee.p_their()] wounds heal and close" : "as the markings below [convertee.p_them()] glow a bloody red"]!", \ @@ -541,18 +542,19 @@ structure_check() searches for nearby cultist structures required for the invoca else new /obj/eldritch/narsie(T) //Causes Nar'Sie to spawn even if the rune has been removed -/obj/effect/rune/narsie/attackby(obj/I, mob/user, params) //Since the narsie rune takes a long time to make, add logging to removal. +/obj/effect/rune/narsie/item_interact(obj/I, mob/user, params) //Since the narsie rune takes a long time to make, add logging to removal. if((istype(I, /obj/item/melee/cultblade/dagger) && iscultist(user))) user.visible_message("[user.name] begins erasing [src]...", "You begin erasing [src]...") if(do_after(user, 50, target = src)) //Prevents accidental erasures. log_game("Summon Narsie rune erased by [key_name(user)] with [I.name]") message_admins("[ADMIN_LOOKUPFLW(user)] erased a Narsie rune with [I.name]") - ..() + return TRUE else if(istype(I, /obj/item/nullrod)) //Begone foul magiks. You cannot hinder me. log_game("Summon Narsie rune erased by [key_name(user)] using a null rod") message_admins("[ADMIN_LOOKUPFLW(user)] erased a Narsie rune with a null rod") - ..() + return TRUE + return ..() //Rite of Resurrection: Requires a dead or inactive cultist. When reviving the dead, you can only perform one revival for every sacrifice your cult has carried out. /obj/effect/rune/raise_dead @@ -686,8 +688,7 @@ structure_check() searches for nearby cultist structures required for the invoca user.visible_message("[user] [carbon_user ? "places [user.p_their()] hands on":"stares intently at"] [src], and [density ? "the air above it begins to shimmer" : "the shimmer above it fades"].", \ "You channel [carbon_user ? "your life ":""]energy into [src], [density ? "temporarily preventing" : "allowing"] passage above it.") if(carbon_user) - var/mob/living/carbon/C = user - C.apply_damage(2, BRUTE, pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM)) + user.apply_damage(/datum/damage_source/magic/abstract, /datum/damage/brute, 2, pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM)) /obj/effect/rune/wall/proc/spread_density() for(var/R in GLOB.wall_runes) @@ -918,7 +919,7 @@ structure_check() searches for nearby cultist structures required for the invoca while(!QDELETED(src) && !QDELETED(user) && !QDELETED(new_human) && (user in T)) if(user.stat || new_human.InCritical()) break - user.apply_damage(0.1, BRUTE) + user.apply_damage(/datum/damage_source/magic/abstract, /datum/damage/brute, 0.1) sleep(1) qdel(N) diff --git a/code/modules/antagonists/devil/true_devil/_true_devil.dm b/code/modules/antagonists/devil/true_devil/_true_devil.dm index 7d7bb09837d1d..415d6c9cb8b85 100644 --- a/code/modules/antagonists/devil/true_devil/_true_devil.dm +++ b/code/modules/antagonists/devil/true_devil/_true_devil.dm @@ -118,9 +118,9 @@ return 2 -/mob/living/carbon/true_devil/attacked_by(obj/item/I, mob/living/user, def_zone) +/mob/living/carbon/true_devil/on_attacked(obj/item/I, mob/living/user, def_zone) var/weakness = check_weakness(I, user) - apply_damage(I.force * weakness, I.damtype, def_zone) + apply_damage(/datum/damage_source/magic/abstract, I.damtype, I.force * weakness, def_zone) var/message_verb = "" if(I.attack_verb?.len) message_verb = "[pick(I.attack_verb)]" @@ -164,13 +164,7 @@ if(.) switch(M.a_intent) if ("harm") - var/damage = rand(1, 5) - playsound(loc, "punch", 25, 1, -1) - visible_message("[M] punches [src]!", \ - "[M] punches you!") - adjustBruteLoss(damage) - log_combat(M, src, "attacked") - updatehealth() + M.deal_generic_attack(src) if ("disarm") if (!(mobility_flags & MOBILITY_STAND) && !ascended) //No stealing the arch devil's pitchfork. if (prob(5)) @@ -208,7 +202,7 @@ b_loss = 30 if(has_bane(BANE_LIGHT)) b_loss *=2 - adjustBruteLoss(b_loss) + apply_damage(/datum/damage_source/explosion, BRUTE, b_loss) return ..() diff --git a/code/modules/antagonists/fugitive/fugitive_ship.dm b/code/modules/antagonists/fugitive/fugitive_ship.dm index 9a609b98f890c..88225228ecd36 100644 --- a/code/modules/antagonists/fugitive/fugitive_ship.dm +++ b/code/modules/antagonists/fugitive/fugitive_ship.dm @@ -31,16 +31,16 @@ /obj/machinery/fugitive_capture/updateUsrDialog() return -/obj/machinery/fugitive_capture/attackby(obj/item/I, mob/user) +/obj/machinery/fugitive_capture/item_interact(obj/item/I, mob/user) if(!occupant && default_deconstruction_screwdriver(user, "[icon_state]", "[icon_state]",I)) update_icon() - return + return TRUE if(default_deconstruction_crowbar(I)) - return + return TRUE if(default_pry_open(I)) - return + return TRUE return ..() diff --git a/code/modules/antagonists/heretic/influences.dm b/code/modules/antagonists/heretic/influences.dm index 8b394c5d71477..d5011a3b0f8a7 100644 --- a/code/modules/antagonists/heretic/influences.dm +++ b/code/modules/antagonists/heretic/influences.dm @@ -239,17 +239,14 @@ return -/obj/effect/heretic_influence/attackby(obj/item/weapon, mob/user, params) - . = ..() - if(.) - return - +/obj/effect/heretic_influence/item_interact(obj/item/weapon, mob/user, params) // Using a codex will give you two knowledge points for draining. if(!being_drained && istype(weapon, /obj/item/codex_cicatrix)) var/obj/item/codex_cicatrix/codex = weapon codex.open_animation() INVOKE_ASYNC(src, PROC_REF(drain_influence), user, 2) return TRUE + return ..() /** diff --git a/code/modules/antagonists/heretic/items/heretic_blades.dm b/code/modules/antagonists/heretic/items/heretic_blades.dm index 1822cfe4089c1..b0c3c0714421b 100644 --- a/code/modules/antagonists/heretic/items/heretic_blades.dm +++ b/code/modules/antagonists/heretic/items/heretic_blades.dm @@ -17,7 +17,7 @@ attack_verb = list("attacks", "slashes", "stabs", "slices", "tears", "lacerates", "rips", "dices", "rends") var/after_use_message = "" -/obj/item/melee/sickly_blade/attack(mob/living/M, mob/living/user) +/obj/item/melee/sickly_blade/attack_mob_target(mob/living/M, mob/living/user) if(!IS_HERETIC_OR_MONSTER(user)) to_chat(user, "You feel a pulse of alien intellect lash out at your mind!") var/mob/living/carbon/human/human_user = user diff --git a/code/modules/antagonists/heretic/knowledge/rust_lore.dm b/code/modules/antagonists/heretic/knowledge/rust_lore.dm index 65c5e43c39c1e..57eef8ee2f775 100644 --- a/code/modules/antagonists/heretic/knowledge/rust_lore.dm +++ b/code/modules/antagonists/heretic/knowledge/rust_lore.dm @@ -122,7 +122,7 @@ if(!HAS_TRAIT(our_turf, TRAIT_RUSTY)) return - source.adjustBruteLoss(-2, FALSE) + source.adjustBruteLossAbstract(-2) source.adjustFireLoss(-2, FALSE) source.adjustToxLoss(-2, FALSE, forced = TRUE) source.adjustOxyLoss(-0.5, FALSE) @@ -317,7 +317,7 @@ if(!HAS_TRAIT(our_turf, TRAIT_RUSTY)) return - source.adjustBruteLoss(-4, FALSE) + source.adjustBruteLossAbstract(-4) source.adjustFireLoss(-4, FALSE) source.adjustToxLoss(-4, FALSE, forced = TRUE) source.adjustOxyLoss(-4, FALSE) diff --git a/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_buff.dm b/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_buff.dm index 025238b8cdf2f..f690ec92214ac 100644 --- a/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_buff.dm +++ b/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_buff.dm @@ -82,7 +82,7 @@ owner.adjustToxLoss(-amount, FALSE, TRUE) owner.adjustOxyLoss(-amount, FALSE) - owner.adjustBruteLoss(-amount, FALSE) + owner.adjustBruteLossAbstract(-amount) owner.adjustFireLoss(-amount) /* diff --git a/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_knowledge.dm b/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_knowledge.dm index 9d696dd4f9f4b..24e75f41ba4f0 100644 --- a/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_knowledge.dm +++ b/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_knowledge.dm @@ -480,7 +480,7 @@ if(heretic_mind) log_combat(heretic_mind.current, sac_target, "disemboweled via sacrifice") sac_target.spill_organs() - sac_target.apply_damage(250, BRUTE) + sac_target.apply_damage(/datum/damage_source/internal_rupture, /datum/damage/brute, 250) if(sac_target.stat != DEAD) sac_target.death() sac_target.visible_message( diff --git a/code/modules/antagonists/heretic/knowledge/starting_lore.dm b/code/modules/antagonists/heretic/knowledge/starting_lore.dm index f5b4bb3a7b753..d557749e82651 100644 --- a/code/modules/antagonists/heretic/knowledge/starting_lore.dm +++ b/code/modules/antagonists/heretic/knowledge/starting_lore.dm @@ -120,8 +120,7 @@ GLOBAL_LIST_INIT(heretic_start_knowledge, initialize_starting_knowledge()) if(our_replacement_heart) // Throw our current heart out of our chest, violently user.visible_message("[user]'s [our_heart.name] bursts suddenly out of [user.p_their()] chest!") - INVOKE_ASYNC(user, /mob/proc/emote, "scream") - user.apply_damage(20, BRUTE, BODY_ZONE_CHEST) + user.apply_damage(/datum/damage_source/internal_rupture, /datum/damage/brute, 20, BODY_ZONE_CHEST) // And put our organic heart in its place our_replacement_heart.Insert(user, special = TRUE, drop_if_replaced = TRUE) our_heart.throw_at(get_edge_target_turf(user, pick(GLOB.alldirs)), 2, 2) diff --git a/code/modules/antagonists/heretic/knowledge/void_lore.dm b/code/modules/antagonists/heretic/knowledge/void_lore.dm index c06f7283c9cc5..aaf1e40dfa65a 100644 --- a/code/modules/antagonists/heretic/knowledge/void_lore.dm +++ b/code/modules/antagonists/heretic/knowledge/void_lore.dm @@ -209,7 +209,7 @@ /datum/heretic_knowledge/void_blade_upgrade/proc/follow_up_attack(mob/living/user, mob/living/target) var/obj/item/melee/sickly_blade/blade = user.get_active_held_item() - blade?.melee_attack_chain(user, target) + blade?.use_on(user, target) /datum/heretic_knowledge/spell/voidpull name = "Void Pull" diff --git a/code/modules/antagonists/heretic/magic/blood_siphon.dm b/code/modules/antagonists/heretic/magic/blood_siphon.dm index 7ffbb964bad9d..14bf5aa2b334b 100644 --- a/code/modules/antagonists/heretic/magic/blood_siphon.dm +++ b/code/modules/antagonists/heretic/magic/blood_siphon.dm @@ -30,8 +30,8 @@ "You turn pale as a red glow enevelops you!", ) - real_target.adjustBruteLoss(20) - living_user.adjustBruteLoss(-20) + var/datum/damage_source/magic/damage_source = FIND_DAMAGE_SOURCE + living_user.adjustBruteLossAbstract(-damage_source.apply_direct(real_target, BRUTE, 20, null)) if(!living_user.blood_volume) return diff --git a/code/modules/antagonists/heretic/magic/mansus_grasp.dm b/code/modules/antagonists/heretic/magic/mansus_grasp.dm index b41a8fc8e46f8..ff3bd94787d82 100644 --- a/code/modules/antagonists/heretic/magic/mansus_grasp.dm +++ b/code/modules/antagonists/heretic/magic/mansus_grasp.dm @@ -74,12 +74,13 @@ if(SEND_SIGNAL(heretic, COMSIG_HERETIC_MANSUS_GRASP_ATTACK, hit) & COMPONENT_BLOCK_CHARGE_USE) return FALSE - hit.adjustBruteLoss(10) + var/datum/damage_source/magic/religion/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(hit, BRUTE, 10, null) if(iscarbon(hit)) var/mob/living/carbon/carbon_hit = hit carbon_hit.AdjustKnockdown(5 SECONDS) carbon_hit.adjustStaminaLoss(80) - carbon_hit.adjustBruteLoss(10) + damage_source.apply_direct(carbon_hit, BRUTE, 10, null) carbon_hit.silent = 3 SECONDS use_charge(heretic) diff --git a/code/modules/antagonists/heretic/magic/nightwatcher_rebirth.dm b/code/modules/antagonists/heretic/magic/nightwatcher_rebirth.dm index 9b63424954158..a8a87bb2196f2 100644 --- a/code/modules/antagonists/heretic/magic/nightwatcher_rebirth.dm +++ b/code/modules/antagonists/heretic/magic/nightwatcher_rebirth.dm @@ -28,7 +28,7 @@ target.adjustFireLoss(20) new /obj/effect/temp_visual/eldritch_smoke(target.drop_location()) - human_user.adjustBruteLoss(-10, FALSE) + human_user.adjustBruteLossAbstract(-10) human_user.adjustFireLoss(-10, FALSE) human_user.adjustToxLoss(-10, FALSE) human_user.adjustOxyLoss(-10, FALSE) diff --git a/code/modules/antagonists/heretic/magic/void_phase.dm b/code/modules/antagonists/heretic/magic/void_phase.dm index 79ae103984ad0..143395f1a6c8f 100644 --- a/code/modules/antagonists/heretic/magic/void_phase.dm +++ b/code/modules/antagonists/heretic/magic/void_phase.dm @@ -32,12 +32,14 @@ for(var/mob/living/living_mob in range(1, user) - user) if(IS_HERETIC_OR_MONSTER(living_mob)) continue - living_mob.adjustBruteLoss(40) + var/datum/damage_source/magic/religion/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(living_mob, BRUTE, 40, null) for(var/mob/living/living_mob in range(1, targeted_turf) - user) if(IS_HERETIC_OR_MONSTER(living_mob)) continue - living_mob.adjustBruteLoss(40) + var/datum/damage_source/magic/religion/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(living_mob, BRUTE, 40, null) do_teleport(user,targeted_turf,TRUE,no_effects = TRUE,channel=TELEPORT_CHANNEL_MAGIC) diff --git a/code/modules/antagonists/heretic/magic/void_pull.dm b/code/modules/antagonists/heretic/magic/void_pull.dm index 3dafc153a3e80..e9b2d186a82c8 100644 --- a/code/modules/antagonists/heretic/magic/void_pull.dm +++ b/code/modules/antagonists/heretic/magic/void_pull.dm @@ -17,7 +17,8 @@ for(var/mob/living/living_mob in range(1, user) - user) if(IS_HERETIC_OR_MONSTER(living_mob)) continue - living_mob.adjustBruteLoss(30) + var/datum/damage_source/magic/religion/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(living_mob, BRUTE, 30, null) playsound(user,'sound/magic/voidblink.ogg',100) new /obj/effect/temp_visual/voidin(user.drop_location()) diff --git a/code/modules/antagonists/heretic/structures/carving_knife.dm b/code/modules/antagonists/heretic/structures/carving_knife.dm index 75561fe8922e3..efbd449b9cd14 100644 --- a/code/modules/antagonists/heretic/structures/carving_knife.dm +++ b/code/modules/antagonists/heretic/structures/carving_knife.dm @@ -186,7 +186,7 @@ return return ..() -/obj/structure/trap/eldritch/attacked_by(obj/item/weapon, mob/living/user) +/obj/structure/trap/eldritch/on_attacked(obj/item/weapon, mob/living/user) if(istype(weapon, /obj/item/melee/rune_carver) || istype(weapon, /obj/item/nullrod)) loc.balloon_alert(user, "Carving dispelled") playsound(src, 'sound/items/sheath.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE, ignore_walls = FALSE) @@ -220,8 +220,8 @@ return var/mob/living/carbon/carbon_victim = victim carbon_victim.Paralyze(5 SECONDS) - carbon_victim.apply_damage(20, BRUTE, BODY_ZONE_R_LEG) - carbon_victim.apply_damage(20, BRUTE, BODY_ZONE_L_LEG) + carbon_victim.apply_damage(/datum/damage_source/blunt/heavy, /datum/damage/brute, 20, BODY_ZONE_R_LEG) + carbon_victim.apply_damage(/datum/damage_source/blunt/heavy, /datum/damage/brute, 20, BODY_ZONE_L_LEG) playsound(src, 'sound/magic/demon_attack1.ogg', 75, TRUE) /obj/structure/trap/eldritch/mad diff --git a/code/modules/antagonists/heretic/structures/mawed_crucible.dm b/code/modules/antagonists/heretic/structures/mawed_crucible.dm index 154b6ed7f7754..b34f28dd265a5 100644 --- a/code/modules/antagonists/heretic/structures/mawed_crucible.dm +++ b/code/modules/antagonists/heretic/structures/mawed_crucible.dm @@ -58,7 +58,7 @@ return "It's at [round(obj_integrity * 100 / max_integrity)]% stability." return ..() -/obj/structure/destructible/eldritch_crucible/attacked_by(obj/item/weapon, mob/living/user) +/obj/structure/destructible/eldritch_crucible/on_attacked(obj/item/weapon, mob/living/user) if(!iscarbon(user)) return ..() diff --git a/code/modules/antagonists/hivemind/spells/hivemind_panic.dm b/code/modules/antagonists/hivemind/spells/hivemind_panic.dm index fac83f363bfd5..cd66ab1cc02cc 100644 --- a/code/modules/antagonists/hivemind/spells/hivemind_panic.dm +++ b/code/modules/antagonists/hivemind/spells/hivemind_panic.dm @@ -21,7 +21,7 @@ if(target.stat == DEAD) continue target.Jitter(14) - target.apply_damage(35 + rand(0,15), STAMINA, target.get_bodypart(BODY_ZONE_HEAD)) + target.apply_damage(/datum/damage_source/mental_health, /datum/damage/stamina, 35 + rand(0,15), BODY_ZONE_HEAD) if(IS_HIVEHOST(target)) continue if(prob(20)) @@ -47,7 +47,7 @@ if(4) to_chat(target, "You feel nauseous as dread washes over you!") target.Dizzy(15) - target.apply_damage(30, STAMINA, target.get_bodypart(BODY_ZONE_HEAD)) + target.apply_damage(/datum/damage_source/mental_health, /datum/damage/stamina, 30, BODY_ZONE_HEAD) target.hallucination += 45 for(var/mob/living/silicon/target in targets) diff --git a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm index 946ea478f5c5a..eeacf8452656c 100644 --- a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm +++ b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm @@ -96,18 +96,18 @@ else return TRUE -/obj/machinery/nuclearbomb/attackby(obj/item/I, mob/user, params) +/obj/machinery/nuclearbomb/item_interact(obj/item/I, mob/user, params) if (istype(I, /obj/item/disk/nuclear)) if(!disk_check(I)) - return + return TRUE if(!user.transferItemToLoc(I, src)) - return + return TRUE auth = I update_ui_mode() playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, FALSE) add_fingerprint(user) ui_update() - return + return TRUE switch(deconstruction_state) if(NUKESTATE_INTACT) @@ -117,18 +117,18 @@ deconstruction_state = NUKESTATE_UNSCREWED to_chat(user, "You remove the screws from [src]'s front panel.") update_icon() - return + return TRUE if(NUKESTATE_PANEL_REMOVED) if(I.tool_behaviour == TOOL_WELDER) if(!I.tool_start_check(user, amount=1)) - return + return TRUE to_chat(user, "You start cutting [src]'s inner plate...") if(I.use_tool(src, user, 80, volume=100, amount=1)) to_chat(user, "You cut [src]'s inner plate.") deconstruction_state = NUKESTATE_WELDED update_icon() - return + return TRUE if(NUKESTATE_CORE_EXPOSED) if(istype(I, /obj/item/nuke_core_container)) var/obj/item/nuke_core_container/core_box = I @@ -141,10 +141,10 @@ core = null else to_chat(user, "You fail to load the plutonium core into [core_box]. [core_box] has already been used!") - return + return TRUE if(istype(I, /obj/item/stack/sheet/iron)) if(!I.tool_start_check(user, amount=20)) - return + return TRUE to_chat(user, "You begin repairing [src]'s inner metal plate...") if(I.use_tool(src, user, 100, amount=20)) @@ -152,7 +152,7 @@ deconstruction_state = NUKESTATE_PANEL_REMOVED STOP_PROCESSING(SSobj, core) update_icon() - return + return TRUE . = ..() /obj/machinery/nuclearbomb/crowbar_act(mob/user, obj/item/tool) @@ -557,7 +557,7 @@ else to_chat(user, "It's empty.") -/obj/machinery/nuclearbomb/beer/attackby(obj/item/W, mob/user, params) +/obj/machinery/nuclearbomb/beer/item_interact(obj/item/W, mob/user, params) if(W.is_refillable()) W.afterattack(keg, user, TRUE) // redirect refillable containers to the keg, allowing them to be filled return TRUE // pretend we handled the attack, too. @@ -719,14 +719,14 @@ This is here to make the tiles around the station mininuke change when it's arme if(isobserver(user) || HAS_TRAIT(user.mind, TRAIT_DISK_VERIFIER)) . += "The serial numbers on [src] are incorrect." -/obj/item/disk/nuclear/attackby(obj/item/I, mob/living/user, params) +/obj/item/disk/nuclear/item_interact(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/claymore/highlander) && !fake) var/obj/item/claymore/highlander/H = I if(H.nuke_disk) to_chat(user, "Wait... what?") qdel(H.nuke_disk) H.nuke_disk = null - return + return TRUE user.visible_message("[user] captures [src]!", "You've got the disk! Defend it with your life!") forceMove(H) H.nuke_disk = src diff --git a/code/modules/antagonists/overthrow/overthrow_converter.dm b/code/modules/antagonists/overthrow/overthrow_converter.dm index acbdce11e49eb..91d17e6229069 100644 --- a/code/modules/antagonists/overthrow/overthrow_converter.dm +++ b/code/modules/antagonists/overthrow/overthrow_converter.dm @@ -28,7 +28,7 @@ log_combat(user, target, "implanted", "\a [name]") return TRUE -/obj/item/overthrow_converter/attack(mob/living/carbon/human/M, mob/living/carbon/human/user) +/obj/item/overthrow_converter/attack_mob_target(mob/living/carbon/human/M, mob/living/carbon/human/user) if(!istype(M) || !istype(user)) return if(!uses) diff --git a/code/modules/antagonists/revenant/revenant.dm b/code/modules/antagonists/revenant/revenant.dm index 8f520a2712b10..2ca64dd266595 100644 --- a/code/modules/antagonists/revenant/revenant.dm +++ b/code/modules/antagonists/revenant/revenant.dm @@ -31,7 +31,7 @@ response_disarm = "swings through" response_harm = "punches through" unsuitable_atmos_damage = 0 - damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0) //I don't know how you'd apply those, but revenants no-sell them anyway. + damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA_DAMTYPE = 0, OXY = 0) //I don't know how you'd apply those, but revenants no-sell them anyway. atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0) minbodytemp = 0 maxbodytemp = INFINITY @@ -223,12 +223,13 @@ return //damage, gibbing, and dying -/mob/living/simple_animal/revenant/attackby(obj/item/W, mob/living/user, params) +///BACONTODO: Make this an on attack thing +/mob/living/simple_animal/revenant/on_attacked(obj/item/I, mob/living/user, nonharmfulhit) . = ..() if(istype(W, /obj/item/nullrod)) visible_message("[src] violently flinches!", \ "As \the [W] passes through you, you feel your essence draining away!") - adjustBruteLoss(25) //hella effective + apply_damage(/datum/damage_source/magic, BRUTE, 25, null) inhibited = TRUE update_action_buttons_icon() addtimer(CALLBACK(src, PROC_REF(reset_inhibit)), 30) @@ -237,16 +238,18 @@ inhibited = FALSE update_action_buttons_icon() -/mob/living/simple_animal/revenant/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/revenant/adjustHealth(amount, forced = FALSE) if(!forced && !revealed) return FALSE . = amount essence = max(0, essence-amount) - if(updating_health) - update_health_hud() if(!essence) death() +/mob/living/simple_animal/revenant/updatehealth() + . = ..() + update_health_hud() + /mob/living/simple_animal/revenant/dust(just_ash, drop_items, force) death() diff --git a/code/modules/antagonists/revolution/revolution.dm b/code/modules/antagonists/revolution/revolution.dm index 17591952189e6..da3e58a4d5ad6 100644 --- a/code/modules/antagonists/revolution/revolution.dm +++ b/code/modules/antagonists/revolution/revolution.dm @@ -246,7 +246,7 @@ owner.current.visible_message("The frame beeps contentedly, suppressing the disloyal personality traits from the MMI before initalizing it.", null, null, null, owner.current) to_chat(owner, "The frame's firmware detects and suppresses your unwanted personality traits! You feel more content with the leadership around these parts.") -//blunt trauma deconversions call this through species.dm spec_attacked_by() +//blunt trauma deconversions call this through species.dm spec_on_attacked() /datum/antagonist/rev/proc/remove_revolutionary(borged, deconverter) log_attack("[key_name(owner.current)] has been deconverted from the revolution by [ismob(deconverter) ? key_name(deconverter) : deconverter]!") if(borged) diff --git a/code/modules/antagonists/slaughter/slaughter.dm b/code/modules/antagonists/slaughter/slaughter.dm index fc7269fbf6afb..5685d6829c6aa 100644 --- a/code/modules/antagonists/slaughter/slaughter.dm +++ b/code/modules/antagonists/slaughter/slaughter.dm @@ -81,7 +81,7 @@ /obj/item/organ/heart/demon/update_icon() return //always beating visually -/obj/item/organ/heart/demon/attack(mob/M, mob/living/carbon/user, obj/target) +/obj/item/organ/heart/demon/attack_mob_target(mob/M, mob/living/carbon/user, obj/target) if(M != user) return ..() user.visible_message("[user] raises [src] to [user.p_their()] mouth and tears into it with [user.p_their()] teeth!", \ @@ -157,9 +157,9 @@ if(1) death() if(2) - adjustBruteLoss(60) + apply_damage(/datum/damage_source/explosion, BRUTE, 60, null) if(3) - adjustBruteLoss(30) + apply_damage(/datum/damage_source/explosion, BRUTE, 30, null) /mob/living/simple_animal/slaughter/laughter/proc/release_friends() if(!consumed_mobs) diff --git a/code/modules/antagonists/swarmer/swarmer.dm b/code/modules/antagonists/swarmer/swarmer.dm index 62286471a45f5..6854b338f6205 100644 --- a/code/modules/antagonists/swarmer/swarmer.dm +++ b/code/modules/antagonists/swarmer/swarmer.dm @@ -34,16 +34,17 @@ return to_chat(user, "Picking up the swarmer may cause it to activate. You should be careful about this.") -/obj/effect/mob_spawn/swarmer/attackby(obj/item/W, mob/user, params) - if(W.tool_behaviour == TOOL_SCREWDRIVER && user.a_intent != INTENT_HARM) +/obj/effect/mob_spawn/swarmer/item_interact(obj/item/W, mob/user, params) + if(W.tool_behaviour == TOOL_SCREWDRIVER) user.visible_message("[usr.name] deactivates [src].", "After some fiddling, you find a way to disable [src]'s power source.", "You hear clicking.") W.play_tool_sound(src, 50) new /obj/item/deactivated_swarmer(get_turf(src)) qdel(src) + return TRUE else - ..() + return ..() ////The Mob itself//// @@ -70,7 +71,7 @@ unsuitable_atmos_damage = 0 melee_damage = 15 melee_damage_type = STAMINA - damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0) + damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA_DAMTYPE = 0, OXY = 0) hud_possible = list(ANTAG_HUD, DIAG_STAT_HUD, DIAG_HUD) obj_damage = 0 environment_smash = ENVIRONMENT_SMASH_NONE diff --git a/code/modules/antagonists/wizard/equipment/artefact.dm b/code/modules/antagonists/wizard/equipment/artefact.dm index 8e1aa524513bc..5de487adb323c 100644 --- a/code/modules/antagonists/wizard/equipment/artefact.dm +++ b/code/modules/antagonists/wizard/equipment/artefact.dm @@ -59,11 +59,11 @@ if(spawn_amt_left <= 0) qdel(src) -/obj/effect/rend/attackby(obj/item/I, mob/user, params) +/obj/effect/rend/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/nullrod)) user.visible_message("[user] seals \the [src] with \the [I].") qdel(src) - return + return TRUE else return ..() @@ -184,7 +184,7 @@ throw_speed = 3 throw_range = 7 throwforce = 15 - damtype = BURN + damtype = /datum/damage/burn force = 15 hitsound = 'sound/items/welder2.ogg' @@ -240,7 +240,7 @@ /obj/item/necromantic_stone/unlimited unlimited = 1 -/obj/item/necromantic_stone/attack(mob/living/carbon/human/M, mob/living/carbon/human/user) +/obj/item/necromantic_stone/attack_mob_target(mob/living/carbon/human/M, mob/living/carbon/human/user) if(!istype(M)) return ..() @@ -323,7 +323,7 @@ resistance_flags = FLAMMABLE item_flags = ISWEAPON -/obj/item/voodoo/attackby(obj/item/I, mob/user, params) +/obj/item/voodoo/item_interact(obj/item/I, mob/user, params) if(target && cooldown < world.time) if(I.is_hot()) to_chat(target, "You suddenly feel very hot") @@ -339,7 +339,7 @@ target.adjustEarDamage(0,3) GiveHint(target) cooldown = world.time +cooldown_time - return + return TRUE if(!voodoo_link) if(I.loc == user && istype(I) && I.w_class <= WEIGHT_CLASS_SMALL) @@ -347,6 +347,8 @@ voodoo_link = I to_chat(user, "You attach [I] to the doll.") update_targets() + return TRUE + return ..() /obj/item/voodoo/check_eye(mob/user) if(loc != user) diff --git a/code/modules/antagonists/wizard/equipment/soulstone.dm b/code/modules/antagonists/wizard/equipment/soulstone.dm index 0da6810d298ce..6d00c670612e2 100644 --- a/code/modules/antagonists/wizard/equipment/soulstone.dm +++ b/code/modules/antagonists/wizard/equipment/soulstone.dm @@ -81,7 +81,7 @@ //////////////////////////////Capturing//////////////////////////////////////////////////////// -/obj/item/soulstone/attack(mob/living/carbon/human/M, mob/living/user) +/obj/item/soulstone/attack_mob_target(mob/living/carbon/human/M, mob/living/user) if(!iscultist(user) && !iswizard(user) && !usability) user.Unconscious(100) to_chat(user, "Your body is wracked with debilitating pain!") @@ -148,18 +148,19 @@ "A Wraith, which does high damage and can jaunt through walls, though it is quite fragile.\n"+\ "A Juggernaut, which is very hard to kill and can produce temporary walls, but is slow.
" -/obj/structure/constructshell/attackby(obj/item/O, mob/user, params) +/obj/structure/constructshell/item_interact(obj/item/O, mob/user, params) if(istype(O, /obj/item/soulstone)) var/obj/item/soulstone/SS = O if(!iscultist(user) && !iswizard(user) && !SS.purified) to_chat(user, "An overwhelming feeling of dread comes over you as you attempt to place the soulstone into the shell. It would be wise to be rid of this quickly.") user.Dizzy(30) - return + return TRUE if(SS.purified && iscultist(user)) SS.hot_potato(user) - return + return TRUE SS.transfer_soul("CONSTRUCT",src,user) SS.was_used() + return TRUE else return ..() diff --git a/code/modules/antagonists/wizard/equipment/spellbook.dm b/code/modules/antagonists/wizard/equipment/spellbook.dm index 24eff1e9037f2..448344c8ef18c 100644 --- a/code/modules/antagonists/wizard/equipment/spellbook.dm +++ b/code/modules/antagonists/wizard/equipment/spellbook.dm @@ -665,11 +665,11 @@ qdel(E) tab = categories[1] -/obj/item/spellbook/attackby(obj/item/O, mob/user, params) - if(refuses_refund) - to_chat(user, "Your book is powerless because of Wild Magic Manipulation ritual. The book doesn't accept the item.") - return +/obj/item/spellbook/item_interact(obj/item/O, mob/user, params) if(istype(O, /obj/item/antag_spawner/contract)) + if(refuses_refund) + to_chat(user, "Your book is powerless because of Wild Magic Manipulation ritual. The book doesn't accept the item.") + return TRUE var/obj/item/antag_spawner/contract/contract = O if(contract.used) to_chat(user, "The contract has been used, you can't get your points back now!") @@ -680,13 +680,19 @@ if(!isnull(CT.limit)) CT.limit++ qdel(O) + return TRUE else if(istype(O, /obj/item/antag_spawner/slaughter_demon)) + if(refuses_refund) + to_chat(user, "Your book is powerless because of Wild Magic Manipulation ritual. The book doesn't accept the item.") + return TRUE to_chat(user, "On second thought, maybe summoning a demon is a bad idea. You refund your points.") uses++ for(var/datum/spellbook_entry/item/bloodbottle/BB in entries) if(!isnull(BB.limit)) BB.limit++ qdel(O) + return TRUE + return ..() /obj/item/spellbook/proc/GetCategoryHeader(category) var/dat = "" diff --git a/code/modules/aquarium/aquarium.dm b/code/modules/aquarium/aquarium.dm index 5884be2514680..acd6f63eb1b1f 100644 --- a/code/modules/aquarium/aquarium.dm +++ b/code/modules/aquarium/aquarium.dm @@ -100,13 +100,13 @@ if(default_unfasten_wrench(user,I)) return TRUE -/obj/structure/aquarium/attackby(obj/item/I, mob/living/user, params) +/obj/structure/aquarium/item_interact(obj/item/I, mob/living/user, params) if(broken) var/obj/item/stack/sheet/glass/glass = I if(istype(glass)) if(glass.get_amount() < 2) to_chat(user, "You need two glass sheets to fix the case!") - return + return TRUE to_chat(user, "You start fixing [src]...") if(do_after(user, 2 SECONDS, target = src)) glass.use(2) diff --git a/code/modules/assembly/assembly.dm b/code/modules/assembly/assembly.dm index 0edd5726fd836..5e8f4b47d2e95 100644 --- a/code/modules/assembly/assembly.dm +++ b/code/modules/assembly/assembly.dm @@ -102,7 +102,7 @@ return secured -/obj/item/assembly/attackby(obj/item/W, mob/user, params) +/obj/item/assembly/item_interact(obj/item/W, mob/user, params) if(isassembly(W)) var/obj/item/assembly/A = W if((!A.secured) && (!secured)) @@ -111,7 +111,7 @@ to_chat(user, "You attach and secure \the [A] to \the [src]!") else to_chat(user, "Both devices must be in attachable mode to be attached together.") - return + return TRUE ..() /obj/item/assembly/screwdriver_act(mob/living/user, obj/item/I) diff --git a/code/modules/assembly/flash.dm b/code/modules/assembly/flash.dm index fa8add1392097..4efe4ec789801 100644 --- a/code/modules/assembly/flash.dm +++ b/code/modules/assembly/flash.dm @@ -141,18 +141,19 @@ if(holder) holder.update_icon() -/obj/item/assembly/flash/attackby(obj/item/W, mob/user, params) +/obj/item/assembly/flash/item_interact(obj/item/W, mob/user, params) . = ..() var/obj/item/flashbulb/newflash = W if(!istype(newflash)) - return + return ..() if(bulb) to_chat("You fail to put the bulb into \the [src] as it already has a bulb in it.") - return + return TRUE user.transferItemToLoc(newflash, src) bulb = newflash burnt_out = !bulb.check_working() update_icon() + return TRUE /obj/item/assembly/flash/proc/clown_check(mob/living/carbon/human/user) if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50)) @@ -284,7 +285,7 @@ else M.flash_act(2) -/obj/item/assembly/flash/attack(mob/living/M, mob/user) +/obj/item/assembly/flash/attack_mob_target(mob/living/M, mob/user) if(!try_use_flash(user)) return FALSE if(iscarbon(M)) @@ -345,7 +346,7 @@ /obj/item/assembly/flash/cyborg bulb = /obj/item/flashbulb/recharging/cyborg -/obj/item/assembly/flash/cyborg/attack(mob/living/M, mob/user) +/obj/item/assembly/flash/cyborg/attack_mob_target(mob/living/M, mob/user) ..() new /obj/effect/temp_visual/borgflash(get_turf(src)) @@ -353,8 +354,8 @@ ..() new /obj/effect/temp_visual/borgflash(get_turf(src)) -/obj/item/assembly/flash/cyborg/attackby(obj/item/W, mob/user, params) - return +/obj/item/assembly/flash/cyborg/item_interact(obj/item/W, mob/user, params) + return FALSE /obj/item/assembly/flash/cyborg/screwdriver_act(mob/living/user, obj/item/I) return diff --git a/code/modules/assembly/signaler.dm b/code/modules/assembly/signaler.dm index 1ed13726a57bd..7258dfd7aba38 100644 --- a/code/modules/assembly/signaler.dm +++ b/code/modules/assembly/signaler.dm @@ -112,7 +112,7 @@ if(.) update_icon() -/obj/item/assembly/signaler/attackby(obj/item/W, mob/user, params) +/obj/item/assembly/signaler/item_interact(obj/item/W, mob/user, params) if(issignaler(W)) var/obj/item/assembly/signaler/signaler2 = W if(secured && signaler2.secured) @@ -120,6 +120,7 @@ set_frequency(signaler2.frequency) to_chat(user, "You transfer the frequency and code of \the [signaler2.name] to \the [name]") ui_update() + return TRUE ..() /obj/item/assembly/signaler/proc/signal() @@ -207,10 +208,11 @@ user.suicide_log() user.gib() -/obj/item/assembly/signaler/anomaly/attackby(obj/item/I, mob/user, params) +/obj/item/assembly/signaler/anomaly/item_interact(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_ANALYZER) to_chat(user, "Analyzing... [src]'s stabilized field is fluctuating along frequency [format_frequency(frequency)], code [code].") - ..() + return TRUE + return ..() //Anomaly cores /obj/item/assembly/signaler/anomaly/pyro @@ -260,8 +262,9 @@ /obj/item/assembly/signaler/cyborg -/obj/item/assembly/signaler/cyborg/attackby(obj/item/W, mob/user, params) - return +/obj/item/assembly/signaler/cyborg/item_interact(obj/item/W, mob/user, params) + return FALSE + /obj/item/assembly/signaler/cyborg/screwdriver_act(mob/living/user, obj/item/I) return @@ -271,8 +274,8 @@ /obj/item/assembly/signaler/internal/ui_state(mob/user) return GLOB.inventory_state -/obj/item/assembly/signaler/internal/attackby(obj/item/W, mob/user, params) - return +/obj/item/assembly/signaler/internal/item_interact(obj/item/W, mob/user, params) + return FALSE /obj/item/assembly/signaler/internal/screwdriver_act(mob/living/user, obj/item/I) return diff --git a/code/modules/atmospherics/machinery/airalarm.dm b/code/modules/atmospherics/machinery/airalarm.dm index afb200857aaac..00767819db2f4 100644 --- a/code/modules/atmospherics/machinery/airalarm.dm +++ b/code/modules/atmospherics/machinery/airalarm.dm @@ -721,7 +721,7 @@ update_appearance() -/obj/machinery/airalarm/attackby(obj/item/W, mob/user, params) +/obj/machinery/airalarm/item_interact(obj/item/W, mob/user, params) switch(buildstage) if(2) if(W.tool_behaviour == TOOL_WIRECUTTER && panel_open && wires.is_all_cut()) @@ -730,19 +730,19 @@ new /obj/item/stack/cable_coil(loc, 5) buildstage = 1 update_icon() - return + return TRUE else if(W.tool_behaviour == TOOL_SCREWDRIVER) // Opening that Air Alarm up. W.play_tool_sound(src) panel_open = !panel_open to_chat(user, "The wires have been [panel_open ? "exposed" : "unexposed"].") update_icon() - return + return TRUE else if(istype(W, /obj/item/card/id) || istype(W, /obj/item/modular_computer/tablet/pda))// trying to unlock the interface with an ID card togglelock(user) - return + return TRUE else if(panel_open && is_wire_tool(W)) wires.interact(user) - return + return TRUE if(1) if(W.tool_behaviour == TOOL_CROWBAR) user.visible_message("[user.name] removes the electronics from [src.name].",\ @@ -755,13 +755,13 @@ playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1) buildstage = 0 update_icon() - return + return TRUE if(istype(W, /obj/item/stack/cable_coil)) var/obj/item/stack/cable_coil/cable = W if(cable.get_amount() < 5) to_chat(user, "You need five lengths of cable to wire the air alarm!") - return + return TRUE user.visible_message("[user.name] wires the air alarm.", \ "You start wiring the air alarm.") if (do_after(user, 20, target = src)) @@ -776,7 +776,7 @@ post_alert(0) buildstage = 2 update_icon() - return + return TRUE if(0) if(istype(W, /obj/item/electronics/airalarm)) if(user.temporarilyRemoveItemFromInventory(W)) @@ -784,24 +784,24 @@ buildstage = 1 update_icon() qdel(W) - return + return TRUE if(istype(W, /obj/item/electroadaptive_pseudocircuit)) var/obj/item/electroadaptive_pseudocircuit/P = W if(!P.adapt_circuit(user, 25)) - return + return TRUE user.visible_message("[user] fabricates a circuit and places it into [src].", \ "You adapt an air alarm circuit and slot it into the assembly.") buildstage = 1 update_icon() - return + return TRUE if(W.tool_behaviour == TOOL_WRENCH) to_chat(user, "You detach \the [src] from the wall.") W.play_tool_sound(src) new /obj/item/wallframe/airalarm( user.loc ) qdel(src) - return + return TRUE return ..() diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm index 73e6fb5c1b596..d6b5aeabbbb16 100644 --- a/code/modules/atmospherics/machinery/atmosmachinery.dm +++ b/code/modules/atmospherics/machinery/atmosmachinery.dm @@ -177,12 +177,12 @@ nodes[nodes.Find(reference)] = null update_icon() -/obj/machinery/atmospherics/attackby(obj/item/W, mob/user, params) +/obj/machinery/atmospherics/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/pipe)) //lets you autodrop var/obj/item/pipe/pipe = W if(user.dropItemToGround(pipe)) pipe.setPipingLayer(piping_layer) //align it with us - return TRUE + return TRUE else return ..() diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm index da64325b53671..7cddec97d20b4 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm @@ -323,30 +323,30 @@ if (do_after(user, 25, target=target)) close_machine(target) -/obj/machinery/atmospherics/components/unary/cryo_cell/attackby(obj/item/I, mob/user, params) +/obj/machinery/atmospherics/components/unary/cryo_cell/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/reagent_containers/glass)) . = 1 //no afterattack if(beaker) to_chat(user, "A beaker is already loaded into [src]!") - return + return TRUE if(!user.transferItemToLoc(I, src)) - return + return TRUE beaker = I user.visible_message("[user] places [I] in [src].", \ "You place [I] in [src].") var/reagentlist = pretty_string_from_reagent_list(I.reagents.reagent_list) log_game("[key_name(user)] added an [I] to cryo containing [reagentlist]") - return + return TRUE if(!on && !occupant && !state_open && (default_deconstruction_screwdriver(user, "pod-off", "pod-off", I)) \ || default_change_direction_wrench(user, I) \ || default_pry_open(I) \ || default_deconstruction_crowbar(I)) update_icon() - return + return TRUE else if(I.tool_behaviour == TOOL_SCREWDRIVER) to_chat(user, "You can't access the maintenance panel while the pod is " \ + (on ? "active" : (occupant ? "full" : "open")) + ".") - return + return TRUE return ..() diff --git a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm index 3e62873aa3906..0b294eaa7f064 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm @@ -133,14 +133,14 @@ ..() update_icon() -/obj/machinery/atmospherics/components/unary/thermomachine/attackby(obj/item/I, mob/user, params) +/obj/machinery/atmospherics/components/unary/thermomachine/item_interact(obj/item/I, mob/user, params) if(!on) if(default_deconstruction_screwdriver(user, icon_state_open, icon_state_off, I)) - return + return TRUE if(default_change_direction_wrench(user, I)) - return + return TRUE if(default_deconstruction_crowbar(I)) - return + return TRUE return ..() /obj/machinery/atmospherics/components/unary/thermomachine/default_change_direction_wrench(mob/user, obj/item/I) diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm index c03e608a92018..7d859635ba97e 100644 --- a/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm +++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm @@ -78,4 +78,4 @@ if(pipe_air.return_temperature() > heat_limit + 1) for(var/m in buckled_mobs) var/mob/living/buckled_mob = m - buckled_mob.apply_damage(delta_time * 2 * log(pipe_air.return_temperature() - heat_limit), BURN, BODY_ZONE_CHEST) + buckled_mob.apply_damage(/datum/damage_source/temperature, /datum/damage/burn, delta_time * 2 * log(pipe_air.return_temperature() - heat_limit)) diff --git a/code/modules/atmospherics/machinery/pipes/pipes.dm b/code/modules/atmospherics/machinery/pipes/pipes.dm index 4ace48b93e9cf..00a12c1f0fd60 100644 --- a/code/modules/atmospherics/machinery/pipes/pipes.dm +++ b/code/modules/atmospherics/machinery/pipes/pipes.dm @@ -68,11 +68,12 @@ /obj/machinery/atmospherics/pipe/remove_air_ratio(ratio) return parent.air.remove_ratio(ratio) -/obj/machinery/atmospherics/pipe/attackby(obj/item/W, mob/user, params) +/obj/machinery/atmospherics/pipe/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/pipe_meter)) var/obj/item/pipe_meter/meter = W user.dropItemToGround(meter) meter.setAttachLayer(piping_layer) + return TRUE else return ..() @@ -106,7 +107,7 @@ /obj/machinery/atmospherics/pipe/returnPipenets() . = list(parent) -/obj/machinery/atmospherics/pipe/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir) +/obj/machinery/atmospherics/pipe/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir, armour_penetration = 0) if(damage_flag == MELEE && damage_amount < 12) return 0 . = ..() diff --git a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm index deeac1ffdb61a..1d9bdd7e435a4 100644 --- a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm +++ b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm @@ -117,16 +117,17 @@ update_icon() return TRUE -/obj/machinery/portable_atmospherics/attackby(obj/item/W, mob/user, params) +/obj/machinery/portable_atmospherics/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/tank)) if(!(machine_stat & BROKEN)) var/obj/item/tank/T = W if(!user.transferItemToLoc(T, src)) - return + return TRUE to_chat(user, "[holding ? "In one smooth motion you pop [holding] out of [src]'s connector and replace it with [T]" : "You insert [T] into [src]"].") investigate_log("had its internal [holding] swapped with [T] by [key_name(user)].", INVESTIGATE_ATMOS) replace_tank(user, FALSE, T) update_icon() + return TRUE else if(W.tool_behaviour == TOOL_WRENCH) if(!(machine_stat & BROKEN)) if(connected_port) @@ -138,15 +139,15 @@ "You unfasten [src] from the port.", \ "You hear a ratchet.") update_icon() - return + return TRUE else var/obj/machinery/atmospherics/components/unary/portables_connector/possible_port = locate(/obj/machinery/atmospherics/components/unary/portables_connector) in loc if(!possible_port) to_chat(user, "Nothing happens.") - return + return TRUE if(!connect(possible_port)) to_chat(user, "[name] failed to connect to the port.") - return + return TRUE W.play_tool_sound(src) user.visible_message( \ "[user] connects [src].", \ @@ -154,10 +155,10 @@ "You hear a ratchet.") update_icon() investigate_log("was connected to [possible_port] by [key_name(user)].", INVESTIGATE_ATMOS) - else - return ..() + return TRUE + return ..() -/obj/machinery/portable_atmospherics/attacked_by(obj/item/I, mob/user) +/obj/machinery/portable_atmospherics/on_attacked(obj/item/I, mob/user) if(I.force < 10 && !(machine_stat & BROKEN)) take_damage(0) else diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm index c9e9a6b4cc25d..ed3184117accb 100644 --- a/code/modules/atmospherics/machinery/portable/scrubber.dm +++ b/code/modules/atmospherics/machinery/portable/scrubber.dm @@ -146,9 +146,10 @@ for(var/turf/AT in T.GetAtmosAdjacentTurfs(alldir = TRUE)) scrub(AT.return_air()) -/obj/machinery/portable_atmospherics/scrubber/huge/attackby(obj/item/W, mob/user) +/obj/machinery/portable_atmospherics/scrubber/huge/item_interact(obj/item/W, mob/user) if(default_unfasten_wrench(user, W)) if(!movable) on = FALSE + return TRUE else return ..() diff --git a/code/modules/awaymissions/capture_the_flag.dm b/code/modules/awaymissions/capture_the_flag.dm index e602f3b17804b..be80d706569db 100644 --- a/code/modules/awaymissions/capture_the_flag.dm +++ b/code/modules/awaymissions/capture_the_flag.dm @@ -201,7 +201,7 @@ else // The changes that you've been hit with no shield but not // instantly critted are low, but have some healing. - M.adjustBruteLoss(-2.5 * delta_time) + M.adjustBruteLossAbstract(-2.5 * delta_time) M.adjustFireLoss(-2.5 * delta_time) /obj/machinery/capture_the_flag/red @@ -298,7 +298,7 @@ if(istype(ghost)) attack_ghost(ghost) -/obj/machinery/capture_the_flag/attackby(obj/item/I, mob/user, params) +/obj/machinery/capture_the_flag/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/ctf)) var/obj/item/ctf/flag = I if(flag.team != src.team) @@ -310,6 +310,8 @@ to_chat(M, "[user.real_name] has captured \the [flag], scoring a point for [team] team! They now have [points]/[points_to_win] points!") if(points >= points_to_win) victory() + return TRUE + return ..() /obj/machinery/capture_the_flag/proc/victory() for(var/mob/M in GLOB.mob_list) @@ -701,8 +703,9 @@ if(controlling.control_points >= controlling.control_points_to_win) controlling.victory() -/obj/machinery/control_point/attackby(mob/user, params) +/obj/machinery/control_point/item_interact(mob/user, params) capture(user) + return TRUE /obj/machinery/control_point/attack_hand(mob/user) . = ..() diff --git a/code/modules/awaymissions/corpse.dm b/code/modules/awaymissions/corpse.dm index 8b51423d04069..ad9b27f59ae52 100644 --- a/code/modules/awaymissions/corpse.dm +++ b/code/modules/awaymissions/corpse.dm @@ -91,7 +91,8 @@ M.death(1) //Kills the new mob M.adjustOxyLoss(oxy_damage) - M.adjustBruteLoss(brute_damage) + var/datum/damage_source/abstract/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(M, BRUTE, brute_damage, null) M.adjustFireLoss(burn_damage) M.color = mob_color equip(M) diff --git a/code/modules/awaymissions/mission_code/Academy.dm b/code/modules/awaymissions/mission_code/Academy.dm index e77708ae14ef1..d7cf164ac841c 100644 --- a/code/modules/awaymissions/mission_code/Academy.dm +++ b/code/modules/awaymissions/mission_code/Academy.dm @@ -253,7 +253,8 @@ //Throw T.visible_message("Unseen forces throw [user]!") user.Stun(60) - user.adjustBruteLoss(50) + var/datum/damage_source/impact/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(user, BRUTE, 50, null) var/throw_dir = pick(GLOB.cardinals) var/atom/throw_target = get_edge_target_turf(user, throw_dir) user.throw_at(throw_target, 200, 4) diff --git a/code/modules/awaymissions/mission_code/Cabin.dm b/code/modules/awaymissions/mission_code/Cabin.dm index c212ff18a574e..4c303669e562c 100644 --- a/code/modules/awaymissions/mission_code/Cabin.dm +++ b/code/modules/awaymissions/mission_code/Cabin.dm @@ -53,13 +53,14 @@ active = FALSE toggleFirepit() -/obj/structure/firepit/attackby(obj/item/W,mob/living/user,params) +/obj/structure/firepit/item_interact(obj/item/W,mob/living/user,params) if(!active) var/msg = W.ignition_effect(src, user) if(msg) active = TRUE visible_message(msg) toggleFirepit() + return TRUE else return ..() else diff --git a/code/modules/awaymissions/mission_code/TheFactory.dm b/code/modules/awaymissions/mission_code/TheFactory.dm index 194c48de5ebb1..4cf597b09714c 100644 --- a/code/modules/awaymissions/mission_code/TheFactory.dm +++ b/code/modules/awaymissions/mission_code/TheFactory.dm @@ -762,7 +762,7 @@ icon_living = "facboss3" ranged_cooldown_time = 10//even faster -/mob/living/simple_animal/hostile/syndicate/factory/boss/updatehealth() +/mob/living/simple_animal/hostile/syndicate/factory/boss/on_damaged() ..() if(health <= 300) var/list/possible_sounds = list('sound/creatures/bosspain.ogg','sound/creatures/bosspain2.ogg') diff --git a/code/modules/awaymissions/mission_code/snowdin.dm b/code/modules/awaymissions/mission_code/snowdin.dm index b60af0f538dea..4a694d99d5735 100644 --- a/code/modules/awaymissions/mission_code/snowdin.dm +++ b/code/modules/awaymissions/mission_code/snowdin.dm @@ -154,13 +154,16 @@ light_power = 0.75 light_color = LIGHT_COLOR_PURPLE -/turf/open/lava/plasma/attackby(obj/item/I, mob/user, params) +/turf/open/lava/plasma/item_interact(obj/item/I, mob/user, params) var/obj/item/reagent_containers/glass/C = I + if (!istype(C)) + return ..() if(C.reagents.total_volume >= C.volume) to_chat(user, "[C] is full.") - return + return TRUE C.reagents.add_reagent(/datum/reagent/toxin/plasma, rand(5, 10)) user.visible_message("[user] scoops some plasma from the [src] with \the [C].", "You scoop out some plasma from the [src] using \the [C].") + return TRUE /turf/open/lava/plasma/burn_stuff(AM) . = 0 diff --git a/code/modules/awaymissions/signpost.dm b/code/modules/awaymissions/signpost.dm index a53384c6fac85..7370d20f16d41 100644 --- a/code/modules/awaymissions/signpost.dm +++ b/code/modules/awaymissions/signpost.dm @@ -30,7 +30,7 @@ else to_chat(user, "Nothing happens. You feel that this is a bad sign.") -/obj/structure/signpost/attackby(obj/item/W, mob/user, params) +/obj/structure/signpost/item_interact(obj/item/W, mob/user, params) return interact(user) /obj/structure/signpost/attack_paw(mob/user) @@ -39,14 +39,14 @@ /obj/structure/signpost/attack_hulk(mob/user, does_attack_animation = 0) return interact(user) -/obj/structure/signpost/attack_larva(mob/user) +/obj/structure/signpost/larva_attack_intercept(mob/user) return interact(user) /obj/structure/signpost/attack_robot(mob/user) if (Adjacent(user)) return interact(user) -/obj/structure/signpost/attack_slime(mob/user) +/obj/structure/signpost/after_attacked_by_slime(mob/user) return interact(user) /obj/structure/signpost/attack_animal(mob/user) diff --git a/code/modules/awaymissions/super_secret_room.dm b/code/modules/awaymissions/super_secret_room.dm index 81f6a5f036d98..28fa94b7088f7 100644 --- a/code/modules/awaymissions/super_secret_room.dm +++ b/code/modules/awaymissions/super_secret_room.dm @@ -89,7 +89,7 @@ speaking = FALSE times_spoken_to++ -/obj/structure/speaking_tile/attackby(obj/item/W, mob/user, params) +/obj/structure/speaking_tile/item_interact(obj/item/W, mob/user, params) return interact(user) /obj/structure/speaking_tile/attack_paw(mob/user) @@ -98,13 +98,13 @@ /obj/structure/speaking_tile/attack_hulk(mob/user, does_attack_animation = 0) return interact(user) -/obj/structure/speaking_tile/attack_larva(mob/user) +/obj/structure/speaking_tile/larva_attack_intercept(mob/user) return interact(user) /obj/structure/speaking_tile/attack_ai(mob/user) return interact(user) -/obj/structure/speaking_tile/attack_slime(mob/user) +/obj/structure/speaking_tile/after_attacked_by_slime(mob/user) return interact(user) /obj/structure/speaking_tile/attack_animal(mob/user) diff --git a/code/modules/bluespace_anchor/bluespace_anchor_deployer.dm b/code/modules/bluespace_anchor/bluespace_anchor_deployer.dm index ff29cdc103989..f391d7a6cbe19 100644 --- a/code/modules/bluespace_anchor/bluespace_anchor_deployer.dm +++ b/code/modules/bluespace_anchor/bluespace_anchor_deployer.dm @@ -47,12 +47,13 @@ new /obj/machinery/bluespace_anchor(get_turf(user), stored_cell) qdel(src) -/obj/item/bluespace_anchor/attackby(obj/item/I, mob/living/user, params) +/obj/item/bluespace_anchor/item_interact(obj/item/I, mob/living/user, params) var/obj/item/stock_parts/cell/cell = I if(!istype(cell)) return ..() if(power_cell) to_chat(user, "Remove the power cell inside [src] first!") - return + return TRUE set_cell(cell) to_chat(user, "You insert [cell] into [src].") + return TRUE diff --git a/code/modules/cargo/expressconsole.dm b/code/modules/cargo/expressconsole.dm index 803b167f1f982..2986e3196ff20 100644 --- a/code/modules/cargo/expressconsole.dm +++ b/code/modules/cargo/expressconsole.dm @@ -29,11 +29,11 @@ beacon.unlink_console() return ..() -/obj/machinery/computer/cargo/express/attackby(obj/item/W, mob/living/user, params) +/obj/machinery/computer/cargo/express/item_interact(obj/item/W, mob/living/user, params) if((istype(W, /obj/item/card/id) || istype(W, /obj/item/modular_computer/tablet/pda)) && allowed(user)) locked = !locked to_chat(user, "You [locked ? "lock" : "unlock"] the interface.") - return + return TRUE else if(istype(W, /obj/item/disk/cargo/bluespace_pod)) podType = /obj/structure/closet/supplypod/bluespacepod//doesnt effect circuit board, making reversal possible to_chat(user, "You insert the disk into [src], allowing for advanced supply delivery vehicles.") @@ -46,7 +46,8 @@ return TRUE else to_chat(user, "[src] is already linked to [sb].") - ..() + return TRUE + return ..() /obj/machinery/computer/cargo/express/on_emag(mob/user) ..() diff --git a/code/modules/cargo/supplypod.dm b/code/modules/cargo/supplypod.dm index 3996b929e3bd5..380db2be593b1 100644 --- a/code/modules/cargo/supplypod.dm +++ b/code/modules/cargo/supplypod.dm @@ -256,11 +256,13 @@ sleep(1) if (effectGib) //effectGib is on, that means whatever's underneath us better be fucking oof'd on - target_living.adjustBruteLoss(5000) //THATS A LOT OF DAMAGE (called just in case gib() doesnt work on em) + var/datum/damage_source/crush/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(target_living, BRUTE, 5000, null) //THATS A LOT OF DAMAGE (called just in case gib() doesnt work on em) if (!QDELETED(target_living)) target_living.gib() //After adjusting the fuck outta that brute loss we finish the job with some satisfying gibs else - target_living.adjustBruteLoss(damage) + var/datum/damage_source/crush/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(target_living, BRUTE, damage, null) var/explosion_sum = B[1] + B[2] + B[3] + B[4] if (explosion_sum != 0) //If the explosion list isn't all zeroes, call an explosion explosion(turf_underneath, B[1], B[2], B[3], flame_range = B[4], silent = effectQuiet, ignorecap = istype(src, /obj/structure/closet/supplypod/centcompod)) //less advanced equipment than bluespace pod, so larger explosion when landing diff --git a/code/modules/cargo/supplypod_beacon.dm b/code/modules/cargo/supplypod_beacon.dm index 499935060a9a5..bcb417aa5ae1b 100644 --- a/code/modules/cargo/supplypod_beacon.dm +++ b/code/modules/cargo/supplypod_beacon.dm @@ -83,13 +83,13 @@ else to_chat(user, "There is no linked console!") -/obj/item/supplypod_beacon/attackby(obj/item/W, mob/user) +/obj/item/supplypod_beacon/item_interact(obj/item/W, mob/user) if(istype(W, /obj/item/pen)) //give a tag that is visible from the linked express console var/new_beacon_name = stripped_input(user, "What would you like the tag to be?") if(!user.canUseTopic(src, BE_CLOSE)) return if(new_beacon_name) name += " ([tag])" - return + return TRUE else return ..() diff --git a/code/modules/client/verbs/suicide.dm b/code/modules/client/verbs/suicide.dm index c2943b1c67c54..195c6628b7183 100644 --- a/code/modules/client/verbs/suicide.dm +++ b/code/modules/client/verbs/suicide.dm @@ -63,7 +63,7 @@ //Do 200 damage divided by the number of damage types applied. if(damagetype & BRUTELOSS) - adjustBruteLoss(200/damage_mod) + apply_damage(/datum/damage_source/abstract, BRUTE, 200/damage_mod, null) if(damagetype & FIRELOSS) adjustFireLoss(200/damage_mod) diff --git a/code/modules/clothing/chameleon.dm b/code/modules/clothing/chameleon.dm index e1123759e9a30..602664033e2af 100644 --- a/code/modules/clothing/chameleon.dm +++ b/code/modules/clothing/chameleon.dm @@ -409,21 +409,21 @@ . = ..() chameleon_action.emp_randomise(INFINITY) -/obj/item/clothing/under/chameleon/attackby(obj/item/W, mob/user, params) +/obj/item/clothing/under/chameleon/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_MULTITOOL) if(chameleon_action.hidden) chameleon_action.hidden = FALSE actions += chameleon_action chameleon_action.Grant(user) log_game("[key_name(user)] has removed the disguise lock on the chameleon jumpsuit ([name]) with [W]") - return + return TRUE else chameleon_action.hidden = TRUE actions -= chameleon_action chameleon_action.Remove(user) log_game("[key_name(user)] has locked the disguise of the chameleon jumpsuit ([name]) with [W]") - return - . = ..() + return TRUE + return ..() /obj/item/clothing/suit/chameleon name = "armor" @@ -454,21 +454,21 @@ . = ..() chameleon_action.emp_randomise(INFINITY) -/obj/item/clothing/suit/chameleon/attackby(obj/item/W, mob/user, params) +/obj/item/clothing/suit/chameleon/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_MULTITOOL) if(chameleon_action.hidden) chameleon_action.hidden = FALSE actions += chameleon_action chameleon_action.Grant(user) log_game("[key_name(user)] has removed the disguise lock on the chameleon suit ([name]) with [W]") - return + return TRUE else chameleon_action.hidden = TRUE actions -= chameleon_action chameleon_action.Remove(user) log_game("[key_name(user)] has locked the disguise of the chameleon suit ([name]) with [W]") - return - . = ..() + return TRUE + return ..() /obj/item/clothing/glasses/chameleon name = "Optical Meson Scanner" @@ -498,20 +498,20 @@ . = ..() chameleon_action.emp_randomise(INFINITY) -/obj/item/clothing/glasses/chameleon/attackby(obj/item/W, mob/user, params) +/obj/item/clothing/glasses/chameleon/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_MULTITOOL) if(chameleon_action.hidden) chameleon_action.hidden = FALSE actions += chameleon_action chameleon_action.Grant(user) log_game("[key_name(user)] has removed the disguise lock on the chameleon glasses ([name]) with [W]") - return + return TRUE else chameleon_action.hidden = TRUE actions -= chameleon_action chameleon_action.Remove(user) log_game("[key_name(user)] has locked the disguise of the chameleon glasses ([name]) with [W]") - return + return TRUE . = ..() /obj/item/clothing/glasses/chameleon/flashproof @@ -551,20 +551,20 @@ . = ..() chameleon_action.emp_randomise(INFINITY) -/obj/item/clothing/gloves/chameleon/attackby(obj/item/W, mob/user, params) +/obj/item/clothing/gloves/chameleon/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_MULTITOOL) if(chameleon_action.hidden) chameleon_action.hidden = FALSE actions += chameleon_action chameleon_action.Grant(user) log_game("[key_name(user)] has removed the disguise lock on the chameleon gloves ([name]) with [W]") - return + return TRUE else chameleon_action.hidden = TRUE actions -= chameleon_action chameleon_action.Remove(user) log_game("[key_name(user)] has locked the disguise of the chameleon gloves ([name]) with [W]") - return + return TRUE . = ..() /obj/item/clothing/gloves/chameleon/combat @@ -611,20 +611,20 @@ . = ..() chameleon_action.emp_randomise(INFINITY) -/obj/item/clothing/head/chameleon/attackby(obj/item/W, mob/user, params) +/obj/item/clothing/head/chameleon/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_MULTITOOL) if(chameleon_action.hidden) chameleon_action.hidden = FALSE actions += chameleon_action chameleon_action.Grant(user) log_game("[key_name(user)] has removed the disguise lock on the chameleon hat ([name]) with [W]") - return + return TRUE else chameleon_action.hidden = TRUE actions -= chameleon_action chameleon_action.Remove(user) log_game("[key_name(user)] has locked the disguise of the chameleon hat ([name]) with [W]") - return + return TRUE . = ..() /obj/item/clothing/head/chameleon/envirohelm @@ -756,7 +756,7 @@ return idcard.registered_name return default_name -/obj/item/clothing/mask/chameleon/attackby(obj/item/W, mob/user, params) +/obj/item/clothing/mask/chameleon/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_MULTITOOL) if(chameleon_action.hidden) chameleon_action.hidden = FALSE @@ -765,14 +765,14 @@ actions += tongue_action tongue_action.Grant(user) log_game("[key_name(user)] has removed the disguise lock on the chameleon mask ([name]) with [W]") - return + return TRUE else chameleon_action.hidden = TRUE actions -= chameleon_action chameleon_action.Remove(user) log_game("[key_name(user)] has locked the disguise of the chameleon mask ([name]) with [W]") tongue_action.Remove(user) - return + return TRUE . = ..() /obj/item/clothing/mask/chameleon/drone @@ -821,20 +821,20 @@ return chameleon_action.emp_randomise() -/obj/item/clothing/shoes/chameleon/attackby(obj/item/W, mob/user, params) +/obj/item/clothing/shoes/chameleon/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_MULTITOOL) if(chameleon_action.hidden) chameleon_action.hidden = FALSE actions += chameleon_action chameleon_action.Grant(user) log_game("[key_name(user)] has removed the disguise lock on the chameleon shoes ([name]) with [W]") - return + return TRUE else chameleon_action.hidden = TRUE actions -= chameleon_action chameleon_action.Remove(user) log_game("[key_name(user)] has locked the disguise of the chameleon shoes ([name]) with [W]") - return + return TRUE . = ..() /obj/item/clothing/shoes/chameleon/noslip @@ -866,20 +866,20 @@ . = ..() chameleon_action.emp_randomise(INFINITY) -/obj/item/storage/backpack/chameleon/attackby(obj/item/W, mob/user, params) +/obj/item/storage/backpack/chameleon/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_MULTITOOL) if(chameleon_action.hidden) chameleon_action.hidden = FALSE actions += chameleon_action chameleon_action.Grant(user) log_game("[key_name(user)] has removed the disguise lock on the chameleon backpack ([name]) with [W]") - return + return TRUE else chameleon_action.hidden = TRUE actions -= chameleon_action chameleon_action.Remove(user) log_game("[key_name(user)] has locked the disguise of the chameleon backpack ([name]) with [W]") - return + return TRUE . = ..() /obj/item/storage/belt/chameleon @@ -910,20 +910,20 @@ . = ..() chameleon_action.emp_randomise(INFINITY) -/obj/item/storage/belt/chameleon/attackby(obj/item/W, mob/user, params) +/obj/item/storage/belt/chameleon/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_MULTITOOL) if(chameleon_action.hidden) chameleon_action.hidden = FALSE actions += chameleon_action chameleon_action.Grant(user) log_game("[key_name(user)] has removed the disguise lock on the chameleon belt ([name]) with [W]") - return + return TRUE else chameleon_action.hidden = TRUE actions -= chameleon_action chameleon_action.Remove(user) log_game("[key_name(user)] has locked the disguise of the chameleon belt ([name]) with [W]") - return + return TRUE . = ..() /obj/item/radio/headset/chameleon @@ -947,20 +947,20 @@ . = ..() chameleon_action.emp_randomise(INFINITY) -/obj/item/radio/headset/chameleon/attackby(obj/item/W, mob/user, params) +/obj/item/radio/headset/chameleon/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_MULTITOOL) if(chameleon_action.hidden) chameleon_action.hidden = FALSE actions += chameleon_action chameleon_action.Grant(user) log_game("[key_name(user)] has removed the disguise lock on the chameleon headset ([name]) with [W]") - return + return TRUE else chameleon_action.hidden = TRUE actions -= chameleon_action chameleon_action.Remove(user) log_game("[key_name(user)] has locked the disguise of the chameleon headset ([name]) with [W]") - return + return TRUE . = ..() /obj/item/radio/headset/chameleon/bowman @@ -991,20 +991,20 @@ . = ..() chameleon_action.emp_randomise(INFINITY) -/obj/item/modular_computer/tablet/pda/chameleon/attackby(obj/item/W, mob/user, params) +/obj/item/modular_computer/tablet/pda/chameleon/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_MULTITOOL) if(chameleon_action.hidden) chameleon_action.hidden = FALSE actions += chameleon_action chameleon_action.Grant(user) log_game("[key_name(user)] has removed the disguise lock on the chameleon PDA ([name]) with [W]") - return + return TRUE else chameleon_action.hidden = TRUE actions -= chameleon_action chameleon_action.Remove(user) log_game("[key_name(user)] has locked the disguise of the chameleon PDA ([name]) with [W]") - return + return TRUE . = ..() /obj/item/stamp/chameleon @@ -1021,20 +1021,20 @@ . = ..() chameleon_action.emp_randomise(INFINITY) -/obj/item/stamp/chameleon/attackby(obj/item/W, mob/user, params) +/obj/item/stamp/chameleon/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_MULTITOOL) if(chameleon_action.hidden) chameleon_action.hidden = FALSE actions += chameleon_action chameleon_action.Grant(user) log_game("[key_name(user)] has removed the disguise lock on the chameleon stamp ([name]) with [W]") - return + return TRUE else chameleon_action.hidden = TRUE actions -= chameleon_action chameleon_action.Remove(user) log_game("[key_name(user)] has locked the disguise of the chameleon stamp ([name]) with [W]") - return + return TRUE . = ..() /obj/item/clothing/neck/chameleon @@ -1060,18 +1060,18 @@ return chameleon_action.emp_randomise() -/obj/item/clothing/neck/chameleon/attackby(obj/item/W, mob/user, params) +/obj/item/clothing/neck/chameleon/item_interact(obj/item/W, mob/user, params) if(W.tool_behaviour == TOOL_MULTITOOL) if(chameleon_action.hidden) chameleon_action.hidden = FALSE actions += chameleon_action chameleon_action.Grant(user) log_game("[key_name(user)] has removed the disguise lock on the chameleon necktie ([name]) with [W]") - return + return TRUE else chameleon_action.hidden = TRUE actions -= chameleon_action chameleon_action.Remove(user) log_game("[key_name(user)] has locked the disguise of the chameleon necktie ([name]) with [W]") - return + return TRUE . = ..() diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 8b02a7f01e6e4..8f8c78f5a4d73 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -76,17 +76,17 @@ tastes = list("dust" = 1, "lint" = 1) foodtype = CLOTH -/obj/item/clothing/attack(mob/M, mob/user, def_zone) +/obj/item/clothing/attack_mob_target(mob/M, mob/user, def_zone) if(user.a_intent != INTENT_HARM && ismoth(M) && !(clothing_flags & NOTCONSUMABLE) && !(resistance_flags & INDESTRUCTIBLE) && (armor.getRating(MELEE) == 0)) var/obj/item/reagent_containers/food/snacks/clothing/clothing_as_food = new clothing_as_food.name = name - if(clothing_as_food.attack(M, user, def_zone)) + if(clothing_as_food.attack_mob_target(M, user, def_zone)) take_damage(15, sound_effect=FALSE) qdel(clothing_as_food) else return ..() -/obj/item/clothing/attackby(obj/item/W, mob/user, params) +/obj/item/clothing/item_interact(obj/item/W, mob/user, params) if(damaged_clothes && istype(W, /obj/item/stack/sheet/cotton/cloth)) var/obj/item/stack/sheet/cotton/cloth/C = W C.use(1) diff --git a/code/modules/clothing/glasses/_glasses.dm b/code/modules/clothing/glasses/_glasses.dm index 1b5c6bc66cb16..007a690303822 100644 --- a/code/modules/clothing/glasses/_glasses.dm +++ b/code/modules/clothing/glasses/_glasses.dm @@ -504,7 +504,7 @@ . = ..() ADD_TRAIT(src, TRAIT_NODROP, EYE_OF_GOD_TRAIT) -/obj/item/clothing/glasses/godeye/attackby(obj/item/W as obj, mob/user as mob, params) +/obj/item/clothing/glasses/godeye/item_interact(obj/item/W as obj, mob/user as mob, params) if(istype(W, src) && W != src && W.loc == user) if(W.icon_state == "godeye") W.icon_state = "doublegodeye" @@ -516,6 +516,7 @@ else to_chat(user, "The eye winks at you and vanishes into the abyss, you feel really unlucky.") qdel(src) + return TRUE ..() /obj/item/clothing/glasses/AltClick(mob/user) diff --git a/code/modules/clothing/gloves/_gloves.dm b/code/modules/clothing/gloves/_gloves.dm index 8500522ffbcf4..ee70b89f005c6 100644 --- a/code/modules/clothing/gloves/_gloves.dm +++ b/code/modules/clothing/gloves/_gloves.dm @@ -45,7 +45,7 @@ var/mob/M = loc M.update_inv_gloves() -// Called just before an attack_hand(), in mob/UnarmedAttack() +// Called just before an attack_hand(), in mob/primary_interact() /obj/item/clothing/gloves/proc/Touch(atom/A, proximity) return FALSE // return 1 to cancel attack_hand() diff --git a/code/modules/clothing/gloves/miscellaneous.dm b/code/modules/clothing/gloves/miscellaneous.dm index acd01cd5bb2fe..ca8ec074df010 100644 --- a/code/modules/clothing/gloves/miscellaneous.dm +++ b/code/modules/clothing/gloves/miscellaneous.dm @@ -102,7 +102,7 @@ item_state = "wgloves" var/range = 3 -/obj/item/clothing/gloves/color/white/magic/attackby(obj/item/W, mob/user, params) +/obj/item/clothing/gloves/color/white/magic/item_interact(obj/item/W, mob/user, params) . = ..() if(istype(W, /obj/item/upgradewand)) var/obj/item/upgradewand/wand = W @@ -111,6 +111,7 @@ range = 6 to_chat(user, "You upgrade the [src] with the [wand].") playsound(user, 'sound/weapons/emitter2.ogg', 25, 1, -1) + return TRUE /obj/item/clothing/gloves/color/white/magic/Touch(atom/A, proximity) var/mob/living/user = loc diff --git a/code/modules/clothing/head/_head.dm b/code/modules/clothing/head/_head.dm index 6135012e477cb..ff8edcc90c809 100644 --- a/code/modules/clothing/head/_head.dm +++ b/code/modules/clothing/head/_head.dm @@ -31,15 +31,15 @@ H.update_inv_head() attached_wig?.dropped(user) -/obj/item/clothing/head/attackby(obj/item/W, mob/user, params) +/obj/item/clothing/head/item_interact(obj/item/W, mob/user, params) . = ..() if(istype(W, /obj/item/clothing/head/wig)) if(flags_inv && HIDEHAIR) to_chat(user, "You can't attach a wig to [src]!") - return + return TRUE if(attached_wig) to_chat(user,"[src] already has a wig attached!") - return + return TRUE else attached_wig = W attached_wig.hat_attached_to = src @@ -48,6 +48,7 @@ update_icon() strip_delay = 10 //The fake hair makes it really easy to swipe the hat off the head attached_wig.equipped(user, ITEM_SLOT_HEAD) + return TRUE /obj/item/clothing/head/verb/unattach_wig() diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index 970d9d6cc047a..43d0861bb4c5a 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -71,15 +71,15 @@ A.UpdateButtonIcon() -/obj/item/clothing/head/helmet/attackby(obj/item/I, mob/user, params) +/obj/item/clothing/head/helmet/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/flashlight/seclite)) var/obj/item/flashlight/seclite/S = I if(can_flashlight && !attached_light) if(up) to_chat(user, "You need to pull the visor down before attaching \the [S].") - return + return TRUE if(!user.transferItemToLoc(S, src)) - return + return TRUE to_chat(user, "You click [S] into place on [src].") set_attached_light(S) @@ -87,7 +87,7 @@ alight = new(src) if(loc == user) alight.Grant(user) - return + return TRUE return ..() @@ -140,12 +140,12 @@ can_flashlight = TRUE dog_fashion = /datum/dog_fashion/head/helmet -/obj/item/clothing/head/helmet/sec/attackby(obj/item/I, mob/user, params) +/obj/item/clothing/head/helmet/sec/item_interact(obj/item/I, mob/user, params) if(issignaler(I)) var/obj/item/assembly/signaler/S = I if(attached_light) //Has a flashlight. Player must remove it, else it will be lost forever. to_chat(user, "The mounted flashlight is in the way, remove it first!") - return + return TRUE if(S.secured) qdel(S) @@ -153,7 +153,7 @@ user.put_in_hands(A) to_chat(user, "You add the signaler to the helmet.") qdel(src) - return + return TRUE return ..() /obj/item/clothing/head/helmet/alt diff --git a/code/modules/clothing/head/mind_monkey_helmet.dm b/code/modules/clothing/head/mind_monkey_helmet.dm index 346afc23862fe..1d74ee33da1c0 100644 --- a/code/modules/clothing/head/mind_monkey_helmet.dm +++ b/code/modules/clothing/head/mind_monkey_helmet.dm @@ -30,7 +30,7 @@ playsound(src, 'sound/machines/buzz-sigh.ogg', 30, TRUE) if(isliving(user)) //I don't know what normally would force us to check this, but it's worth checking var/mob/living/M = user - M.apply_damage(5,BRUTE,BODY_ZONE_HEAD,FALSE,FALSE,FALSE) //notably: no damage resist (it's in your helmet), no damage spread (it's in your helmet) + M.apply_damage(/datum/damage_source/mental_health, /datum/damage/brute, 5, BODY_ZONE_HEAD) //notably: no damage resist (it's in your helmet), no damage spread (it's in your helmet) return return INVOKE_ASYNC(src, PROC_REF(poll), user) diff --git a/code/modules/clothing/neck/_neck.dm b/code/modules/clothing/neck/_neck.dm index 2d19e51285d5d..a5ab19c989fdc 100644 --- a/code/modules/clothing/neck/_neck.dm +++ b/code/modules/clothing/neck/_neck.dm @@ -60,7 +60,7 @@ user.visible_message("[user] puts \the [src] to [user.p_their()] chest! It looks like [user.p_they()] wont hear much!") return OXYLOSS -/obj/item/clothing/neck/stethoscope/attack(mob/living/carbon/human/M, mob/living/user) +/obj/item/clothing/neck/stethoscope/attack_mob_target(mob/living/carbon/human/M, mob/living/user) if(ishuman(M) && isliving(user)) if(user.a_intent == INTENT_HELP) var/body_part = parse_zone(user.zone_selected) diff --git a/code/modules/clothing/shoes/color.dm b/code/modules/clothing/shoes/color.dm index 6fc4f00a6e3ef..0bf3679526339 100644 --- a/code/modules/clothing/shoes/color.dm +++ b/code/modules/clothing/shoes/color.dm @@ -70,15 +70,15 @@ src.icon_state = "" return -/obj/item/clothing/shoes/sneakers/orange/attackby(obj/H, loc, params) - ..() +/obj/item/clothing/shoes/sneakers/orange/item_interact(obj/H, loc, params) + . = ..() // Note: not using istype here because we want to ignore all subtypes if (!chained && H.type == /obj/item/restraints/handcuffs) qdel(H) src.chained = 1 src.slowdown = 15 src.icon_state = "sneakers_chained" - return + return TRUE /obj/item/clothing/shoes/sneakers/orange/allow_attack_hand_drop(mob/user) if(ishuman(user)) diff --git a/code/modules/clothing/shoes/magboots.dm b/code/modules/clothing/shoes/magboots.dm index 75913d615fa1d..5e890a02aae90 100644 --- a/code/modules/clothing/shoes/magboots.dm +++ b/code/modules/clothing/shoes/magboots.dm @@ -94,7 +94,8 @@ var/turf/T = user.loc for (var/mob/living/A in T) if (A != user && !(A.mobility_flags & MOBILITY_STAND)) - A.adjustBruteLoss(rand(10,13)) + var/datum/damage_source/crush/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(A, BRUTE, rand(10,13), null) to_chat(A,"[user]'s magboots press down on you, crushing you!") INVOKE_ASYNC(A, TYPE_PROC_REF(/mob, emote), "scream") diff --git a/code/modules/clothing/spacesuits/hardsuit.dm b/code/modules/clothing/spacesuits/hardsuit.dm index 20836c2716009..b521737f23bd6 100644 --- a/code/modules/clothing/spacesuits/hardsuit.dm +++ b/code/modules/clothing/spacesuits/hardsuit.dm @@ -150,32 +150,32 @@ user.changeNext_move(CLICK_CD_MELEE) ..() -/obj/item/clothing/suit/space/hardsuit/attackby(obj/item/I, mob/user, params) +/obj/item/clothing/suit/space/hardsuit/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/tank/jetpack/suit)) if(jetpack) to_chat(user, "[src] already has a jetpack installed.") - return + return TRUE if(src == user.get_item_by_slot(ITEM_SLOT_OCLOTHING)) //Make sure the player is not wearing the suit before applying the upgrade. to_chat(user, "You cannot install the upgrade to [src] while wearing it.") - return + return TRUE if(user.transferItemToLoc(I, src)) jetpack = I to_chat(user, "You successfully install the jetpack into [src].") - return + return TRUE else if(I.tool_behaviour == TOOL_SCREWDRIVER) if(!jetpack) to_chat(user, "[src] has no jetpack installed.") - return + return TRUE if(src == user.get_item_by_slot(ITEM_SLOT_OCLOTHING)) to_chat(user, "You cannot remove the jetpack from [src] while wearing it.") - return + return TRUE jetpack.turn_off(user) jetpack.forceMove(drop_location()) jetpack = null to_chat(user, "You successfully remove the jetpack from [src].") - return + return TRUE return ..() diff --git a/code/modules/clothing/spacesuits/miscellaneous.dm b/code/modules/clothing/spacesuits/miscellaneous.dm index 59be5d0d416d9..3a6d51f607aa8 100644 --- a/code/modules/clothing/spacesuits/miscellaneous.dm +++ b/code/modules/clothing/spacesuits/miscellaneous.dm @@ -534,8 +534,8 @@ Contains: max_heat_protection_temperature = 100 helmettype = /obj/item/clothing/head/helmet/space/hardsuit/skinsuit -/obj/item/clothing/suit/space/hardsuit/skinsuit/attackby(obj/item/I, mob/user, params) - return +/obj/item/clothing/suit/space/hardsuit/skinsuit/item_interact(obj/item/I, mob/user, params) + return FALSE /obj/item/clothing/head/helmet/space/hunter name = "bounty hunting helmet" diff --git a/code/modules/clothing/spacesuits/plasmamen.dm b/code/modules/clothing/spacesuits/plasmamen.dm index fe02a0db8ef40..431d5132891d3 100644 --- a/code/modules/clothing/spacesuits/plasmamen.dm +++ b/code/modules/clothing/spacesuits/plasmamen.dm @@ -106,12 +106,13 @@ var/mob/living/carbon/human/H = loc H.update_inv_head() -/obj/item/clothing/head/helmet/space/plasmaman/attackby(obj/item/item, mob/living/user) +/obj/item/clothing/head/helmet/space/plasmaman/item_interact(obj/item/item, mob/living/user) . = ..() if(istype(item, /obj/item/light/bulb) && !lamp_functional) lamp_functional = TRUE qdel(item) to_chat(user, "You repair the broken headlamp!") + return TRUE if(istype(item, /obj/item/toy/crayon)) if(smile) to_chat(user, "Seems like someone already drew something on the helmet's visor.") @@ -124,7 +125,7 @@ to_chat(user, "You draw a smiley on the helmet visor.") update_icon() update_button_icons(user) - return + return TRUE if(istype(item, /obj/item/clothing/head) \ // i know someone is gonna do it after i thought about it && !istype(item, /obj/item/clothing/head/helmet/space/plasmaman) \ @@ -133,7 +134,7 @@ var/obj/item/clothing/head/hat = item if(attached_hat) to_chat(user, "There's already a hat on the helmet!") - return + return TRUE attached_hat = hat hat.forceMove(src) if (user.get_item_by_slot(ITEM_SLOT_HEAD) == src) @@ -141,6 +142,7 @@ update_icon() update_button_icons(user) add_verb(/obj/item/clothing/head/helmet/space/plasmaman/verb/unattach_hat) + return TRUE /obj/item/clothing/head/helmet/space/plasmaman/equipped(mob/user, slot) . = ..() diff --git a/code/modules/clothing/suits/reactive_armour.dm b/code/modules/clothing/suits/reactive_armour.dm index 2586acfefa579..6108be532c1b9 100644 --- a/code/modules/clothing/suits/reactive_armour.dm +++ b/code/modules/clothing/suits/reactive_armour.dm @@ -5,8 +5,8 @@ icon = 'icons/obj/clothing/suits.dmi' w_class = WEIGHT_CLASS_BULKY -/obj/item/reactive_armour_shell/attackby(obj/item/weapon, mob/user, params) - ..() +/obj/item/reactive_armour_shell/item_interact(obj/item/weapon, mob/user, params) + . = ..() var/static/list/anomaly_armour_types = list( /obj/effect/anomaly/bluespace = /obj/item/clothing/suit/armor/reactive/teleport, /obj/effect/anomaly/bioscrambler = /obj/item/clothing/suit/armor/reactive/bioscrambling, @@ -24,6 +24,7 @@ new armour_path(get_turf(src)) qdel(src) qdel(anomaly) + return TRUE //Reactive armor /obj/item/clothing/suit/armor/reactive diff --git a/code/modules/clothing/under/_under.dm b/code/modules/clothing/under/_under.dm index f4c579c29b537..cb2a31e274c0f 100644 --- a/code/modules/clothing/under/_under.dm +++ b/code/modules/clothing/under/_under.dm @@ -28,7 +28,7 @@ if(accessory_overlay) . += accessory_overlay -/obj/item/clothing/under/attackby(obj/item/I, mob/user, params) +/obj/item/clothing/under/item_interact(obj/item/I, mob/user, params) if((has_sensor == BROKEN_SENSORS) && istype(I, /obj/item/stack/cable_coil)) var/obj/item/stack/cable_coil/C = I C.use(1) diff --git a/code/modules/clothing/under/accessories.dm b/code/modules/clothing/under/accessories.dm index cf47d13e89488..b10b0c6d03711 100755 --- a/code/modules/clothing/under/accessories.dm +++ b/code/modules/clothing/under/accessories.dm @@ -129,7 +129,7 @@ var/commended = FALSE //Pinning medals on people -/obj/item/clothing/accessory/medal/attack(mob/living/carbon/human/M, mob/living/user) +/obj/item/clothing/accessory/medal/attack_mob_target(mob/living/carbon/human/M, mob/living/user) if(ishuman(M) && (user.a_intent == INTENT_HELP)) if(M.wear_suit) diff --git a/code/modules/clothing/under/miscellaneous.dm b/code/modules/clothing/under/miscellaneous.dm index 472c07fa46947..d31c06267b104 100644 --- a/code/modules/clothing/under/miscellaneous.dm +++ b/code/modules/clothing/under/miscellaneous.dm @@ -101,17 +101,16 @@ new /obj/effect/particle_effect/water(get_turf(H)) return 0 -/obj/item/clothing/under/plasmaman/attackby(obj/item/E, mob/user, params) +/obj/item/clothing/under/plasmaman/item_interact(obj/item/E, mob/user, params) ..() if (istype(E, /obj/item/extinguisher_refill)) if (extinguishes_left == 5) to_chat(user, "The inbuilt extinguisher is full.") - return else extinguishes_left = 5 to_chat(user, "You refill the suit's built-in extinguisher, using up the cartridge.") qdel(E) - return + return TRUE /obj/item/extinguisher_refill name = "envirosuit extinguisher cartridge" diff --git a/code/modules/detectivework/evidence.dm b/code/modules/detectivework/evidence.dm index b19394bd01bbf..689a3b798775b 100644 --- a/code/modules/detectivework/evidence.dm +++ b/code/modules/detectivework/evidence.dm @@ -14,9 +14,10 @@ return evidencebagEquip(I, user) -/obj/item/evidencebag/attackby(obj/item/I, mob/user, params) +/obj/item/evidencebag/item_interact(obj/item/I, mob/user, params) if(evidencebagEquip(I, user)) return 1 + return ..() /obj/item/evidencebag/handle_atom_del(atom/A) cut_overlays() diff --git a/code/modules/detectivework/scanner.dm b/code/modules/detectivework/scanner.dm index 861bb5058f9c4..9a5fe9ea3362d 100644 --- a/code/modules/detectivework/scanner.dm +++ b/code/modules/detectivework/scanner.dm @@ -36,7 +36,7 @@ else to_chat(user, "The scanner has no logs or is in use.") -/obj/item/detective_scanner/attack(mob/living/M, mob/user) +/obj/item/detective_scanner/attack_mob_target(mob/living/M, mob/user) return /obj/item/detective_scanner/proc/PrintReport() diff --git a/code/modules/economy/pay_stand.dm b/code/modules/economy/pay_stand.dm index 5211be5ffb0f5..80257cf139f43 100644 --- a/code/modules/economy/pay_stand.dm +++ b/code/modules/economy/pay_stand.dm @@ -11,68 +11,68 @@ var/signaler_threshold = 0 //signaler threshold amount var/amount_deposited = 0 //keep track of the amount deposited over time so you can pay multiple times to reach the signaler threshold -/obj/machinery/paystand/attackby(obj/item/W, mob/user, params) +/obj/machinery/paystand/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/card/id)) if(W == my_card) locked = !locked to_chat(user, "You [src.locked ? "lock" : "unlock"] the bolts on the paystand.") - return + return TRUE if(!my_card) var/obj/item/card/id/assistant_mains_need_to_die = W if(assistant_mains_need_to_die.registered_account) var/msg = stripped_input(user, "Name of pay stand:", "Paystand Naming", "[user]'s Awesome Paystand") if(!msg) - return + return TRUE name = msg desc = "Owned by [assistant_mains_need_to_die.registered_account.account_holder], pays directly into [user.p_their()] account." my_card = assistant_mains_need_to_die to_chat(user, "You link the stand to your account.") - return + return TRUE var/obj/item/card/id/vbucks = W if(vbucks.registered_account) var/momsdebitcard = input(user, "How much would you like to deposit?", "Money Deposit") as null|num if(momsdebitcard < 1) to_chat(user, "ERROR: Invalid amount designated.") - return + return TRUE if(vbucks.registered_account.adjust_money(-momsdebitcard)) purchase(vbucks.registered_account.account_holder, momsdebitcard) to_chat(user, "Thanks for purchasing! The vendor has been informed.") - return + return TRUE else to_chat(user, "ERROR: Account has insufficient funds to make transaction.") - return + return TRUE else to_chat(user, "ERROR: No bank account assigned to identification card.") - return + return TRUE if(istype(W, /obj/item/holochip)) var/obj/item/holochip/H = W var/cashmoney = input(user, "How much would you like to deposit?", "Money Deposit") as null|num if(H.spend(cashmoney, FALSE)) purchase(user, cashmoney) to_chat(user, "Thanks for purchasing! The vendor has been informed.") - return + return TRUE else to_chat(user, "ERROR: Insufficient funds to make transaction.") - return + return TRUE if(istype(W, /obj/item/stack/spacecash)) to_chat(user, "What is this, the 2000s? We only take card here.") - return + return TRUE if(istype(W, /obj/item/coin)) to_chat(user, "What is this, the 1800s? We only take card here.") - return + return TRUE if(istype(W, /obj/item/assembly/signaler)) var/obj/item/assembly/signaler/S = W if(S.secured) to_chat(user, "The signaler needs to be in attachable mode to add it to the paystand!") - return + return TRUE if(!my_card) to_chat(user, "ERROR: No identification card has been assigned to this paystand yet!") - return + return TRUE if(!signaler) var/cash_limit = input(user, "Enter the minimum amount of cash needed to deposit before the signaler is activated.", "Signaler Activation Threshold") as null|num if(cash_limit < 1) to_chat(user, "ERROR: Invalid amount designated.") - return + return TRUE if(cash_limit) S.forceMove(src) signaler = S @@ -81,18 +81,19 @@ desc += " A signaler appears to be attached to the scanner." else to_chat(user, "A signaler is already attached to this unit!") + return TRUE if(default_deconstruction_screwdriver(user, "card_scanner", "card_scanner", W)) - return + return TRUE else if(default_pry_open(W)) - return + return TRUE else if(default_unfasten_wrench(user, W)) - return + return TRUE else if(default_deconstruction_crowbar(W)) - return + return TRUE else return ..() diff --git a/code/modules/elevator/elevator_segment.dm b/code/modules/elevator/elevator_segment.dm index f09fce3c3020c..8dda8eb45e90f 100644 --- a/code/modules/elevator/elevator_segment.dm +++ b/code/modules/elevator/elevator_segment.dm @@ -90,7 +90,8 @@ var/turf/trg = get_edge_target_turf(i, pick(NORTH, EAST, SOUTH, WEST)) i.throw_at(trg, 8, 8) i.Paralyze(8 SECONDS) - i.adjustBruteLoss(15) + var/datum/damage_source/crush/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(i, BRUTE, 150, null) i.AddElement(/datum/element/squish, 18 SECONDS) playsound(i, 'sound/effects/blobattack.ogg', 40, TRUE) playsound(i, 'sound/effects/splat.ogg', 50, TRUE) diff --git a/code/modules/events/holiday/xmas.dm b/code/modules/events/holiday/xmas.dm index 8e33645808d46..f5c6568bfb5a4 100644 --- a/code/modules/events/holiday/xmas.dm +++ b/code/modules/events/holiday/xmas.dm @@ -5,7 +5,7 @@ desc = "Directions for use: Requires two people, one to pull each end." var/cracked = 0 -/obj/item/toy/xmas_cracker/attack(mob/target, mob/user) +/obj/item/toy/xmas_cracker/attack_mob_target(mob/target, mob/user) if( !cracked && ishuman(target) && (target.stat == CONSCIOUS) && !target.get_active_held_item() ) target.visible_message("[user] and [target] pop \an [src]! *pop*", "You pull \an [src] with [target]! *pop*", "You hear a pop.") var/obj/item/paper/joke_paper = new /obj/item/paper(user.loc) diff --git a/code/modules/events/immovable_rod.dm b/code/modules/events/immovable_rod.dm index b00ee3f4c37ef..d513b52ed73d7 100644 --- a/code/modules/events/immovable_rod.dm +++ b/code/modules/events/immovable_rod.dm @@ -150,7 +150,8 @@ In my current plan for it, 'solid' will be defined as anything with density == 1 L.visible_message("[L] is penetrated by an immovable rod!" , "The rod penetrates you!" , "You hear a CLANG!") if(ishuman(L)) var/mob/living/carbon/human/H = L - H.adjustBruteLoss(160) + var/datum/damage_source/bullet/unstoppable/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(H, BRUTE, 160, null) if(L && (L.density || prob(10))) L.ex_act(EXPLODE_HEAVY) @@ -166,7 +167,7 @@ In my current plan for it, 'solid' will be defined as anything with density == 1 U.visible_message("[src] transforms into [wizard] as [U] suplexes them!", "As you grab [src], it suddenly turns into [wizard] as you suplex them!") to_chat(wizard, "You're suddenly jolted out of rod-form as [U] somehow manages to grab you, slamming you into the ground!") wizard.Stun(60) - wizard.apply_damage(25, BRUTE) + wizard.apply_damage(/datum/damage_source/impact, /datum/damage/brute, 25) qdel(src) else U.client.give_award(/datum/award/achievement/misc/feat_of_strength, U) //rod-form wizards would probably make this a lot easier to get so keep it to regular rods only diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm index 910755622dcaf..afdb8231c837a 100644 --- a/code/modules/events/spacevine.dm +++ b/code/modules/events/spacevine.dm @@ -158,11 +158,9 @@ /datum/spacevine_mutation/aggressive_spread/aggrospread_act(obj/structure/spacevine/S, mob/living/M) var/mob/living/carbon/C = M //If the mob is carbon then it now also exists as a "C", and not just an M. if(istype(C)) //If the mob (M) is a carbon subtype (C) we move on to pick a more complex damage proc, with damage zones, wounds and armor mitigation. - var/obj/item/bodypart/limb = pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG, BODY_ZONE_HEAD, BODY_ZONE_CHEST) //Picks a random bodypart. Does not runtime even if it's missing. - var/armor = C.run_armor_check(limb, MELEE, null, null) //armor = the armor value of that randomly chosen bodypart. Nulls to not print a message, because it would still print on pierce. var/datum/spacevine_mutation/thorns/T = locate() in S.mutations //Searches for the thorns mutation in the "mutations"-list inside obj/structure/spacevine, and defines T if it finds it. if(T && (prob(40))) //If we found the thorns mutation there is now a chance to get stung instead of lashed or smashed. - C.apply_damage(50, BRUTE, def_zone = limb) //This one gets a bit lower damage because it ignores armor. + C.apply_damage(/datum/damage_source/sharp/light, /datum/damage/brute, 60, pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG, BODY_ZONE_HEAD, BODY_ZONE_CHEST)) C.Stun(1 SECONDS) //Stopped in place for a moment. playsound(M, 'sound/weapons/pierce.ogg', 50, TRUE, -1) M.visible_message("[M] is nailed by a sharp thorn!", \ @@ -170,14 +168,14 @@ log_combat(S, M, "aggressively pierced") //"Aggressively" for easy ctrl+F'ing in the attack logs. else if(prob(80)) - C.apply_damage(60, BRUTE, def_zone = limb, blocked = armor) + C.apply_damage(/datum/damage_source/blunt/light, /datum/damage/brute, 60, pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG, BODY_ZONE_HEAD, BODY_ZONE_CHEST)) C.Knockdown(2 SECONDS) playsound(M, 'sound/weapons/whip.ogg', 50, TRUE, -1) M.visible_message("[M] is lacerated by an outburst of vines!", \ "You are lacerated by an outburst of vines!") log_combat(S, M, "aggressively lacerated") else - C.apply_damage(60, BRUTE, def_zone = limb, blocked = armor) + C.apply_damage(/datum/damage_source/blunt/light, /datum/damage/brute, 60, pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG, BODY_ZONE_HEAD, BODY_ZONE_CHEST)) C.Knockdown(3 SECONDS) var/atom/throw_target = get_edge_target_turf(C, get_dir(S, get_step_away(C, S))) C.throw_at(throw_target, 3, 6) @@ -186,7 +184,8 @@ "You are smashed by a large vine!") log_combat(S, M, "aggressively smashed") else //Living but not a carbon? Maybe a silicon? Can't be wounded so have a big chunk of simple bruteloss with no special effects. They can be entangled. - M.adjustBruteLoss(75) + var/datum/damage_source/sharp/light/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(M, BRUTE, 75, null) playsound(M, 'sound/weapons/whip.ogg', 50, TRUE, -1) M.visible_message("[M] is brutally threshed by [S]!", \ "You are brutally threshed by [S]!") @@ -258,13 +257,15 @@ /datum/spacevine_mutation/thorns/on_cross(obj/structure/spacevine/holder, mob/living/crosser) if(prob(severity) && istype(crosser) && !isvineimmune(holder)) var/mob/living/M = crosser - M.adjustBruteLoss(5) + var/datum/damage_source/sharp/light/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(M, BRUTE, 5, null) to_chat(M, "You cut yourself on the thorny vines.") /datum/spacevine_mutation/thorns/on_hit(obj/structure/spacevine/holder, mob/living/hitter, obj/item/I, expected_damage) if(prob(severity) && istype(hitter) && !isvineimmune(holder)) var/mob/living/M = hitter - M.adjustBruteLoss(5) + var/datum/damage_source/sharp/light/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(M, BRUTE, 5, null) to_chat(M, "You cut yourself on the thorny vines.") . = expected_damage @@ -362,7 +363,7 @@ if(!override) qdel(src) -/obj/structure/spacevine/attacked_by(obj/item/I, mob/living/user) +/obj/structure/spacevine/on_attacked(obj/item/I, mob/living/user) var/damage_dealt = I.force if(I.is_sharp()) damage_dealt *= 4 diff --git a/code/modules/exploration_crew/discovery_research/discovery_scanner.dm b/code/modules/exploration_crew/discovery_research/discovery_scanner.dm index d43b84f4db65c..3269c88869f06 100644 --- a/code/modules/exploration_crew/discovery_research/discovery_scanner.dm +++ b/code/modules/exploration_crew/discovery_research/discovery_scanner.dm @@ -24,13 +24,13 @@ . += "[src] has unlimited range." . += "Science goggles can help detect researchable items." -/obj/item/discovery_scanner/attack_obj(obj/O, mob/living/user) - if(istype(O, /obj/machinery/computer/rdconsole)) - to_chat(user, "You link [src] to [O].") - var/obj/machinery/computer/rdconsole/rdconsole = O +/obj/item/discovery_scanner/interact_with(atom/target, mob/user, params) + if(istype(target, /obj/machinery/computer/rdconsole)) + to_chat(user, "You link [src] to [target].") + var/obj/machinery/computer/rdconsole/rdconsole = target linked_techweb = rdconsole.stored_research - return - . = ..() + return TRUE + return ..() /obj/item/discovery_scanner/proc/begin_scanning(mob/user, datum/component/discoverable/discoverable) to_chat(user, "You begin scanning [discoverable.parent]...") diff --git a/code/modules/exploration_crew/exploration_explosives.dm b/code/modules/exploration_crew/exploration_explosives.dm index 377f267d7610c..bd5a2daab1d1d 100644 --- a/code/modules/exploration_crew/exploration_explosives.dm +++ b/code/modules/exploration_crew/exploration_explosives.dm @@ -25,13 +25,13 @@ attached_detonators = null . = ..() -/obj/item/grenade/exploration/attackby(obj/item/W, mob/user, params) +/obj/item/grenade/exploration/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/exploration_detonator)) var/obj/item/exploration_detonator/detonator = W detonator.linked_explosives |= src attached_detonators |= detonator to_chat(user, "You link [src] to [W].") - return + return TRUE . = ..() /obj/item/grenade/exploration/afterattack(atom/movable/AM, mob/user, flag) diff --git a/code/modules/food_and_drinks/drinks/drinks.dm b/code/modules/food_and_drinks/drinks/drinks.dm index 8c5c3a584cfcd..ef10a5f3dec46 100644 --- a/code/modules/food_and_drinks/drinks/drinks.dm +++ b/code/modules/food_and_drinks/drinks/drinks.dm @@ -20,7 +20,7 @@ . = ..() gulp_size = max(round(reagents.total_volume / 5), 5) -/obj/item/reagent_containers/food/drinks/attack(mob/living/M, mob/user, def_zone) +/obj/item/reagent_containers/food/drinks/attack_mob_target(mob/living/M, mob/user, def_zone) if(!reagents || !reagents.total_volume) to_chat(user, "[src] is empty!") @@ -109,11 +109,12 @@ var/trans = target.reagents.trans_to(src, amount_per_transfer_from_this, transfered_by = user) to_chat(user, "You fill [src] with [trans] units of the contents of [target].") -/obj/item/reagent_containers/food/drinks/attackby(obj/item/I, mob/user, params) +/obj/item/reagent_containers/food/drinks/item_interact(obj/item/I, mob/user, params) var/hotness = I.is_hot() if(hotness && reagents) reagents.expose_temperature(hotness) to_chat(user, "You heat [name] with [I]!") + return TRUE ..() /obj/item/reagent_containers/food/drinks/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum) @@ -487,7 +488,7 @@ sleep(20) //dramatic pause return TOXLOSS -/obj/item/reagent_containers/food/drinks/soda_cans/attack(mob/M, mob/user) +/obj/item/reagent_containers/food/drinks/soda_cans/attack_mob_target(mob/M, mob/user) if(M == user && !src.reagents.total_volume && user.a_intent == INTENT_HARM && user.zone_selected == BODY_ZONE_HEAD) user.visible_message("[user] crushes the can of [src] on [user.p_their()] forehead!", "You crush the can of [src] on your forehead.") playsound(user.loc,'sound/weapons/pierce.ogg', rand(10,50), 1) diff --git a/code/modules/food_and_drinks/drinks/drinks/bottle.dm b/code/modules/food_and_drinks/drinks/drinks/bottle.dm index ee7e4f3ee1c36..ab92ffa2faddb 100644 --- a/code/modules/food_and_drinks/drinks/drinks/bottle.dm +++ b/code/modules/food_and_drinks/drinks/drinks/bottle.dm @@ -46,7 +46,7 @@ qdel(src) target.Bumped(B) -/obj/item/reagent_containers/food/drinks/bottle/attack(mob/living/target, mob/living/user) +/obj/item/reagent_containers/food/drinks/bottle/attack_mob_target(mob/living/target, mob/living/user) if(!target) return @@ -62,7 +62,6 @@ var/obj/item/bodypart/affecting = user.zone_selected //Find what the player is aiming at - var/armor_block = 0 //Get the target's armor values for normal attack damage. var/armor_duration = 0 //The more force the bottle has, the longer the duration. //Calculating duration and calculating damage. @@ -70,7 +69,6 @@ var/mob/living/carbon/human/H = target var/headarmor = 0 // Target's head armor - armor_block = H.run_armor_check(affecting, MELEE,"","",armour_penetration) // For normal attack damage //If they have a hat/helmet and the user is targeting their head. if(istype(H.head, /obj/item/clothing/head) && affecting == BODY_ZONE_HEAD) @@ -82,14 +80,12 @@ armor_duration = (bottle_knockdown_duration - headarmor) + force else - //Only humans can have armor, right? - armor_block = target.run_armor_check(affecting, MELEE) if(affecting == BODY_ZONE_HEAD) armor_duration = bottle_knockdown_duration + force //Apply the damage! - armor_block = min(90,armor_block) - target.apply_damage(force, BRUTE, affecting, armor_block) + var/datum/damage_source/source = GET_DAMAGE_SOURCE(damage_source) + source.deal_attack(user, src, target, /datum/damage/brute, force, user.zone_selected) // You are going to knock someone down for longer if they are not wearing a helmet. var/head_attack_message = "" @@ -541,7 +537,7 @@ new /obj/effect/hotspot(get_turf(hit_atom)) ..() -/obj/item/reagent_containers/food/drinks/bottle/molotov/attackby(obj/item/I, mob/user, params) +/obj/item/reagent_containers/food/drinks/bottle/molotov/item_interact(obj/item/I, mob/user, params) if(I.is_hot() && !active) active = TRUE log_bomber(user, "has primed a", src, "for detonation") @@ -562,6 +558,8 @@ SplashReagents(A) A.fire_act() qdel(src) + return TRUE + return ..() /obj/item/reagent_containers/food/drinks/bottle/molotov/attack_self(mob/user) if(active) diff --git a/code/modules/food_and_drinks/drinks/drinks/drinkingglass.dm b/code/modules/food_and_drinks/drinks/drinks/drinkingglass.dm index 1ef594278ff59..775c9ff3d1b19 100644 --- a/code/modules/food_and_drinks/drinks/drinks/drinkingglass.dm +++ b/code/modules/food_and_drinks/drinks/drinks/drinkingglass.dm @@ -91,7 +91,7 @@ name = "Nuka Cola" list_reagents = list(/datum/reagent/consumable/nuka_cola = 50) -/obj/item/reagent_containers/food/drinks/drinkingglass/attackby(obj/item/I, mob/user, params) +/obj/item/reagent_containers/food/drinks/drinkingglass/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/reagent_containers/food/snacks/egg)) //breaking eggs var/obj/item/reagent_containers/food/snacks/egg/E = I if(reagents) @@ -101,11 +101,11 @@ to_chat(user, "You break [E] in [src].") reagents.add_reagent(/datum/reagent/consumable/eggyolk, 5) qdel(E) - return + return TRUE else - ..() + return ..() -/obj/item/reagent_containers/food/drinks/drinkingglass/attack(obj/target, mob/user) +/obj/item/reagent_containers/food/drinks/drinkingglass/attack_mob_target(obj/target, mob/user) if(user.a_intent == INTENT_HARM && ismob(target) && target.reagents && reagents.total_volume) target.visible_message("[user] splashes the contents of [src] onto [target]!", \ "[user] splashes the contents of [src] onto you!") diff --git a/code/modules/food_and_drinks/food/condiment.dm b/code/modules/food_and_drinks/food/condiment.dm index 169a1832828d2..e2f3a729e1cb4 100644 --- a/code/modules/food_and_drinks/food/condiment.dm +++ b/code/modules/food_and_drinks/food/condiment.dm @@ -69,7 +69,7 @@ user.visible_message("[user] is trying to eat the entire [src]! It looks like [user.p_they()] forgot how food works!") return OXYLOSS -/obj/item/reagent_containers/food/condiment/attack(mob/M, mob/user, def_zone) +/obj/item/reagent_containers/food/condiment/attack_mob_target(mob/M, mob/user, def_zone) if(!reagents || !reagents.total_volume) to_chat(user, "None of [src] left, oh no!") @@ -255,7 +255,7 @@ /obj/item/reagent_containers/food/condiment/pack/update_icon() return -/obj/item/reagent_containers/food/condiment/pack/attack(mob/M, mob/user, def_zone) //Can't feed these to people directly. +/obj/item/reagent_containers/food/condiment/pack/attack_mob_target(mob/M, mob/user, def_zone) //Can't feed these to people directly. return /obj/item/reagent_containers/food/condiment/pack/afterattack(obj/target, mob/user , proximity) diff --git a/code/modules/food_and_drinks/food/customizables.dm b/code/modules/food_and_drinks/food/customizables.dm index a6c0cd485fe0f..69fdef8c61646 100644 --- a/code/modules/food_and_drinks/food/customizables.dm +++ b/code/modules/food_and_drinks/food/customizables.dm @@ -35,18 +35,18 @@ size = "monster" . += "It contains [ingredients.len?"[ingredients_listed]":"no ingredient, "]making a [size]-sized [initial(name)]." -/obj/item/reagent_containers/food/snacks/customizable/attackby(obj/item/I, mob/user, params) - if(!istype(I, /obj/item/reagent_containers/food/snacks/customizable) && istype(I, /obj/item/reagent_containers/food/snacks)) - var/obj/item/reagent_containers/food/snacks/S = I - if(I.w_class > WEIGHT_CLASS_SMALL) +/obj/item/reagent_containers/food/snacks/customizable/item_interact(obj/item/item, mob/user, params) + if(!istype(item, /obj/item/reagent_containers/food/snacks/customizable) && istype(item, /obj/item/reagent_containers/food/snacks)) + var/obj/item/reagent_containers/food/snacks/S = item + if(item.w_class > WEIGHT_CLASS_SMALL) to_chat(user, "The ingredient is too big for [src]!") else if((ingredients.len >= ingMax) || (reagents.total_volume >= volume)) to_chat(user, "You can't add more ingredients to [src]!") - else if(istype(I, /obj/item/reagent_containers/food/snacks/pizzaslice/custom)) - to_chat(user, "Adding [I.name] to [src] would make a mess.") + else if(istype(item, /obj/item/reagent_containers/food/snacks/pizzaslice/custom)) + to_chat(user, "Adding [item.name] to [src] would make a mess.") else - if(!user.transferItemToLoc(I, src)) - return + if(!user.transferItemToLoc(item, src)) + return TRUE if(S.trash) S.generate_trash(get_turf(user)) ingredients += S @@ -54,10 +54,11 @@ S.reagents.trans_to(src,min(S.reagents.total_volume, 15), transfered_by = user) //limit of 15, we don't want our custom food to be completely filled by just one ingredient with large reagent volume. foodtype |= S.foodtype update_customizable_overlays(S) - to_chat(user, "You add the [I.name] to the [name].") + to_chat(user, "You add the [item.name] to the [name].") update_food_name(S) + return TRUE else - . = ..() + return ..() /obj/item/reagent_containers/food/snacks/customizable/proc/update_food_name(obj/item/reagent_containers/food/snacks/S) @@ -236,7 +237,7 @@ materials = list(/datum/material/glass = 500) w_class = WEIGHT_CLASS_NORMAL -/obj/item/reagent_containers/glass/bowl/attackby(obj/item/I,mob/user, params) +/obj/item/reagent_containers/glass/bowl/item_interact(obj/item/I,mob/user, params) if(istype(I, /obj/item/reagent_containers/food/snacks)) var/obj/item/reagent_containers/food/snacks/S = I if(I.w_class > WEIGHT_CLASS_SMALL) @@ -250,9 +251,8 @@ else var/obj/item/reagent_containers/food/snacks/customizable/A = new/obj/item/reagent_containers/food/snacks/customizable/salad(get_turf(src)) A.initialize_custom_food(src, S, user) - else - . = ..() - return + return TRUE + return ..() /obj/item/reagent_containers/glass/bowl/on_reagent_change(changetype) ..() diff --git a/code/modules/food_and_drinks/food/snacks.dm b/code/modules/food_and_drinks/food/snacks.dm index 2424f2cee741b..8e0e44675b385 100644 --- a/code/modules/food_and_drinks/food/snacks.dm +++ b/code/modules/food_and_drinks/food/snacks.dm @@ -91,7 +91,7 @@ All foods are distributed among various categories. Use common sense. return -/obj/item/reagent_containers/food/snacks/attack(mob/living/M, mob/living/user, def_zone) +/obj/item/reagent_containers/food/snacks/attack_mob_target(mob/living/M, mob/living/user, def_zone) if(user.a_intent == INTENT_HARM) return ..() if(!eatverb) @@ -173,31 +173,30 @@ All foods are distributed among various categories. Use common sense. else . += "[src] was bitten multiple times!" -/obj/item/reagent_containers/food/snacks/attackby(obj/item/W, mob/user, params) +/obj/item/reagent_containers/food/snacks/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/storage)) - ..() // -> item/attackby() - return 0 + return ..() // -> item/item_interact() if(istype(W, /obj/item/reagent_containers/food/snacks)) var/obj/item/reagent_containers/food/snacks/S = W if(custom_food_type && ispath(custom_food_type)) if(S.w_class > WEIGHT_CLASS_SMALL) to_chat(user, "[S] is too big for [src]!") - return 0 + return TRUE if(!S.customfoodfilling || istype(W, /obj/item/reagent_containers/food/snacks/customizable) || istype(W, /obj/item/reagent_containers/food/snacks/pizzaslice/custom)) to_chat(user, "[src] can't be filled with [S]!") - return 0 + return TRUE if(contents.len >= 20) to_chat(user, "You can't add more ingredients to [src]!") - return 0 + return TRUE var/obj/item/reagent_containers/food/snacks/customizable/C = new custom_food_type(get_turf(src)) C.initialize_custom_food(src, S, user) - return 0 + return TRUE var/sharp = W.is_sharp() if(sharp) - if(slice(sharp, W, user)) - return 1 + slice(sharp, W, user) + return 1 else - ..() + return ..() //Called when you finish tablecrafting a snack. /obj/item/reagent_containers/food/snacks/CheckParts(list/parts_list, datum/crafting_recipe/food/R) diff --git a/code/modules/food_and_drinks/food/snacks/dough.dm b/code/modules/food_and_drinks/food/snacks/dough.dm index 5a72edfd58378..2258cf3a70d81 100644 --- a/code/modules/food_and_drinks/food/snacks/dough.dm +++ b/code/modules/food_and_drinks/food/snacks/dough.dm @@ -15,7 +15,7 @@ // Dough + rolling pin = flat dough -/obj/item/reagent_containers/food/snacks/dough/attackby(obj/item/I, mob/user, params) +/obj/item/reagent_containers/food/snacks/dough/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/kitchen/rollingpin)) if(isturf(loc)) new /obj/item/reagent_containers/food/snacks/flatdough(loc) @@ -23,8 +23,9 @@ qdel(src) else to_chat(user, "You need to put [src] on a surface to roll it out!") + return TRUE else - ..() + return ..() // sliceable into 3xdoughslices @@ -87,7 +88,7 @@ foodtype = GRAIN | DAIRY // Cake batter + rolling pin = pie dough -/obj/item/reagent_containers/food/snacks/cakebatter/attackby(obj/item/I, mob/user, params) +/obj/item/reagent_containers/food/snacks/cakebatter/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/kitchen/rollingpin)) if(isturf(loc)) new /obj/item/reagent_containers/food/snacks/piedough(loc) @@ -95,8 +96,9 @@ qdel(src) else to_chat(user, "You need to put [src] on a surface to roll it out!") + return TRUE else - ..() + return ..() /obj/item/reagent_containers/food/snacks/piedough name = "pie dough" diff --git a/code/modules/food_and_drinks/food/snacks_egg.dm b/code/modules/food_and_drinks/food/snacks_egg.dm index 761d8afde1cd6..4b444fb384f46 100644 --- a/code/modules/food_and_drinks/food/snacks_egg.dm +++ b/code/modules/food_and_drinks/food/snacks_egg.dm @@ -41,19 +41,20 @@ reagents.reaction(hit_atom, TOUCH) qdel(src) -/obj/item/reagent_containers/food/snacks/egg/attackby(obj/item/W, mob/user, params) +/obj/item/reagent_containers/food/snacks/egg/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/toy/crayon)) var/obj/item/toy/crayon/C = W var/clr = C.crayon_color if(!(clr in list("blue", "green", "mime", "orange", "purple", "rainbow", "red", "yellow"))) to_chat(usr, "[src] refuses to take on this colour!") - return + return TRUE to_chat(usr, "You colour [src] with [W].") icon_state = "egg-[clr]" + return TRUE else - ..() + return ..() /obj/item/reagent_containers/food/snacks/egg/blue icon_state = "egg-blue" @@ -114,7 +115,7 @@ tastes = list("egg" = 1, "cheese" = 1) foodtype = MEAT | BREAKFAST -/obj/item/reagent_containers/food/snacks/omelette/attackby(obj/item/W, mob/user, params) +/obj/item/reagent_containers/food/snacks/omelette/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/kitchen/fork)) var/obj/item/kitchen/fork/F = W if(F.forkload) @@ -129,8 +130,8 @@ F.forkload = R if(reagents.total_volume <= 0) qdel(src) - return - ..() + return TRUE + return ..() /obj/item/reagent_containers/food/snacks/benedict name = "eggs benedict" diff --git a/code/modules/food_and_drinks/food/snacks_other.dm b/code/modules/food_and_drinks/food/snacks_other.dm index 0e60f5bb1927c..1ecbbf564cfc9 100644 --- a/code/modules/food_and_drinks/food/snacks_other.dm +++ b/code/modules/food_and_drinks/food/snacks_other.dm @@ -532,7 +532,8 @@ /obj/item/reagent_containers/food/snacks/lollipop/long/proc/on_trip(mob/living/carbon/user) visible_message("[user] is impailed by the [src]!", "You are impaled by the [src]!") - user.adjustBruteLoss(50) + var/datum/damage_source/consumption/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(user, BRUTE, 50, null) user.adjustOxyLoss(50) /obj/item/reagent_containers/food/snacks/lollipop/cyborg @@ -620,7 +621,7 @@ . = ..() . += "If you had a rod you could make butter on a stick." -/obj/item/reagent_containers/food/snacks/butter/attackby(obj/item/W, mob/user, params) +/obj/item/reagent_containers/food/snacks/butter/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/stack/rods)) var/obj/item/stack/rods/R = W if(!R.use(1))//borgs can still fail this if they have no metal @@ -633,7 +634,7 @@ user.put_in_hands(new_item) qdel(src) return TRUE - ..() + return ..() /obj/item/reagent_containers/food/snacks/butter/on_a_stick //there's something so special about putting it on a stick. name = "butter on a stick" @@ -695,7 +696,7 @@ icon_state = "[icon_state]_open" return ..() -/obj/item/reagent_containers/food/snacks/canned/attack(mob/living/M, mob/user, def_zone) +/obj/item/reagent_containers/food/snacks/canned/attack_mob_target(mob/living/M, mob/user, def_zone) if (!is_drainable()) to_chat(user, "[src]'s lid hasn't been opened!") return 0 diff --git a/code/modules/food_and_drinks/food/snacks_pastry.dm b/code/modules/food_and_drinks/food/snacks_pastry.dm index 949d0e52d551a..66454070a9ef0 100644 --- a/code/modules/food_and_drinks/food/snacks_pastry.dm +++ b/code/modules/food_and_drinks/food/snacks_pastry.dm @@ -858,14 +858,14 @@ . += "It contains [contents.len?"[ingredients_listed]":"no ingredient, "]on top of a [initial(name)]." bitecount = originalBites -/obj/item/reagent_containers/food/snacks/pancakes/attackby(obj/item/I, mob/living/user, params) +/obj/item/reagent_containers/food/snacks/pancakes/item_interact(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/reagent_containers/food/snacks/pancakes/)) var/obj/item/reagent_containers/food/snacks/pancakes/P = I if((contents.len >= PANCAKE_MAX_STACK) || ((P.contents.len + contents.len) > PANCAKE_MAX_STACK) || (reagents.total_volume >= volume)) to_chat(user, "You can't add that many pancakes to [src]!") else if(!user.transferItemToLoc(I, src)) - return + return TRUE to_chat(user, "You add the [I] to the [name].") P.name = initial(P.name) contents += P @@ -878,11 +878,11 @@ update_customizable_overlays(P) P = I P.contents.Cut() - return + return TRUE else if(contents.len) var/obj/O = contents[contents.len] - return O.attackby(I, user, params) - ..() + return O.item_interact(I, user, params) + return ..() /obj/item/reagent_containers/food/snacks/pancakes/update_customizable_overlays(obj/item/reagent_containers/food/snacks/P) var/mutable_appearance/pancake = mutable_appearance(icon, "[P.item_state]_[rand(1,3)]") @@ -891,11 +891,11 @@ add_overlay(pancake) update_icon() -/obj/item/reagent_containers/food/snacks/pancakes/attack(mob/M, mob/user, def_zone, stacked = TRUE) +/obj/item/reagent_containers/food/snacks/pancakes/attack_mob_target(mob/M, mob/user, def_zone, stacked = TRUE) if(user.a_intent == INTENT_HARM || !contents.len || !stacked) return ..() var/obj/item/O = contents[contents.len] - . = O.attack(M, user, def_zone, FALSE) + . = O.attack_mob_target(M, user, def_zone, FALSE) update_icon() /obj/item/reagent_containers/food/snacks/ravtart diff --git a/code/modules/food_and_drinks/food/snacks_pie.dm b/code/modules/food_and_drinks/food/snacks_pie.dm index 6428079e6e377..f19e6223f6262 100644 --- a/code/modules/food_and_drinks/food/snacks_pie.dm +++ b/code/modules/food_and_drinks/food/snacks_pie.dm @@ -74,7 +74,8 @@ M.visible_message("[src] bursts out of [M]!
") M.emote("scream") M.Knockdown(40) - M.adjustBruteLoss(60) + var/datum/damage_source/consumption/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(M, BRUTE, 60, null) return ..() /obj/item/reagent_containers/food/snacks/pie/berryclafoutis diff --git a/code/modules/food_and_drinks/food/snacks_pizza.dm b/code/modules/food_and_drinks/food/snacks_pizza.dm index 5e75c898eeaaa..37c9538875f1c 100644 --- a/code/modules/food_and_drinks/food/snacks_pizza.dm +++ b/code/modules/food_and_drinks/food/snacks_pizza.dm @@ -184,17 +184,20 @@ if(istype(I, /obj/item/reagent_containers/food/snacks/pineappleslice)) to_chat(user, "If you want something crazy like pineapple, I'll kill you.") //this is in bigger text because it's hard to spam something that gibs you, and so that you're perfectly aware of the reason why you died user.gib() //if you want something crazy like pineapple, i'll kill you + return TRUE else if(istype(I, /obj/item/reagent_containers/food/snacks/grown/mushroom) && iscarbon(user)) to_chat(user, "So, if you want mushroom, shut up.") //not as large as the pineapple text, because you could in theory spam it var/mob/living/carbon/shutup = user shutup.gain_trauma(/datum/brain_trauma/severe/mute) + return TRUE -/obj/item/reagent_containers/food/snacks/pizza/arnold/attack(mob/living/M, mob/living/user) +/obj/item/reagent_containers/food/snacks/pizza/arnold/attack_mob_target(mob/living/M, mob/living/user) . = ..() try_break_off(M, user) -/obj/item/reagent_containers/food/snacks/pizza/arnold/attackby(obj/item/I, mob/user) - i_kill_you(I, user) +/obj/item/reagent_containers/food/snacks/pizza/arnold/item_interact(obj/item/I, mob/user) + if (i_kill_you(I, user)) + return TRUE . = ..() @@ -206,12 +209,13 @@ tastes = list("crust" = 1, "tomato" = 1, "cheese" = 1, "pepperoni" = 2, "9 millimeter bullets" = 2) foodtype = GRAIN | VEGETABLES | DAIRY | MEAT -/obj/item/reagent_containers/food/snacks/pizzaslice/arnold/attack(mob/living/M, mob/living/user) +/obj/item/reagent_containers/food/snacks/pizzaslice/arnold/attack_mob_target(mob/living/M, mob/living/user) . =..() try_break_off(M, user) -/obj/item/reagent_containers/food/snacks/pizzaslice/arnold/attackby(obj/item/I, mob/user) - i_kill_you(I, user) +/obj/item/reagent_containers/food/snacks/pizzaslice/arnold/item_interact(obj/item/I, mob/user) + if (i_kill_you(I, user)) + return TRUE . = ..() diff --git a/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm b/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm index 6f275fc30bd10..bbfb509c4ce5b 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm @@ -82,31 +82,31 @@ God bless America. if(in_range(user, src) || isobserver(user)) . += "The status display reads: Frying at [fry_speed*100]% speed.
Using [oil_use] units of oil per second.
" -/obj/machinery/deepfryer/attackby(obj/item/I, mob/user) +/obj/machinery/deepfryer/item_interact(obj/item/I, mob/user) if(istype(I, /obj/item/reagent_containers/pill)) if(!reagents.total_volume) to_chat(user, "There's nothing to dissolve [I] in!") - return + return TRUE user.visible_message("[user] drops [I] into [src].", "You dissolve [I] in [src].") I.reagents.trans_to(src, I.reagents.total_volume, transfered_by = user) qdel(I) - return + return TRUE if(!reagents.has_reagent(/datum/reagent/consumable/cooking_oil)) to_chat(user, "[src] has no cooking oil to fry with!") - return + return TRUE if(I.resistance_flags & INDESTRUCTIBLE) to_chat(user, "You don't feel it would be wise to fry [I]...") - return + return TRUE if(istype(I, /obj/item/food/deepfryholder)) to_chat(user, "Your cooking skills are not up to the legendary Doublefry technique.") - return + return TRUE if(istype(I, /obj/item/clothing/head/mob_holder)) var/obj/item/clothing/head/mob_holder/P = I QDEL_NULL(P.held_mob) //just so the pet doesn't escape his incoming death if(default_unfasten_wrench(user, I)) - return + return TRUE else if(default_deconstruction_screwdriver(user, "fryer_off", "fryer_off" ,I)) //where's the open maint panel icon?! - return + return TRUE else if(is_type_in_typecache(I, deepfry_blacklisted_items) || HAS_TRAIT(I, TRAIT_NODROP) || (I.item_flags & (ABSTRACT | DROPDEL))) return ..() @@ -117,6 +117,7 @@ God bless America. frying = new/obj/item/food/deepfryholder(src, I) icon_state = "fryer_on" fry_loop.start() + return TRUE /obj/machinery/deepfryer/process(delta_time) ..() @@ -162,7 +163,7 @@ God bless America. user.visible_message("[user] dunks [C]'s face in [src]!") reagents.reaction(C, TOUCH) log_combat(user, C, "fryer slammed") - C.apply_damage(min(30, reagents.total_volume), BURN, BODY_ZONE_HEAD) + C.apply_damage(/datum/damage_source/temperature, /datum/damage/burn, min(30, reagents.total_volume), BODY_ZONE_HEAD) reagents.remove_any((reagents.total_volume/2)) C.Paralyze(60) user.changeNext_move(CLICK_CD_MELEE) diff --git a/code/modules/food_and_drinks/kitchen_machinery/food_cart.dm b/code/modules/food_and_drinks/kitchen_machinery/food_cart.dm index 4bad80b5a4537..bed1b47498a4f 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/food_cart.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/food_cart.dm @@ -30,7 +30,7 @@ /obj/machinery/food_cart/proc/isFull() return food_stored >= STORAGE_CAPACITY -/obj/machinery/food_cart/attackby(obj/item/O, mob/user, params) +/obj/machinery/food_cart/item_interact(obj/item/O, mob/user, params) if(O.tool_behaviour == TOOL_WRENCH) default_unfasten_wrench(user, O, 0) return TRUE @@ -40,23 +40,29 @@ qdel(DG) glasses++ to_chat(user, "[src] accepts the drinking glass, sterilizing it.") + updateDialog() + return TRUE else if(istype(O, /obj/item/reagent_containers/food/snacks)) if(isFull()) to_chat(user, "[src] is at full capacity.") else var/obj/item/reagent_containers/food/snacks/S = O if(!user.transferItemToLoc(S, src)) - return + return TRUE if(stored_food[sanitize(S.name)]) stored_food[sanitize(S.name)]++ else stored_food[sanitize(S.name)] = 1 + updateDialog() + return TRUE else if(istype(O, /obj/item/stack/sheet/glass)) var/obj/item/stack/sheet/glass/G = O if(G.get_amount() >= 1) G.use(1) glasses += 4 to_chat(user, "[src] accepts a sheet of glass.") + updateDialog() + return TRUE else if(istype(O, /obj/item/storage/bag/tray)) var/obj/item/storage/bag/tray/T = O for(var/obj/item/reagent_containers/food/snacks/S in T.contents) @@ -69,11 +75,13 @@ stored_food[sanitize(S.name)]++ else stored_food[sanitize(S.name)] = 1 + updateDialog() + return TRUE else if(O.is_drainable()) - return + updateDialog() + return TRUE else - . = ..() - updateDialog() + return ..() /obj/machinery/food_cart/ui_interact(mob/user) . = ..() diff --git a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm index 4ac915e0d52c1..2e849fa1afe46 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm @@ -103,18 +103,18 @@ else startgibbing(user) -/obj/machinery/gibber/attackby(obj/item/P, mob/user, params) +/obj/machinery/gibber/item_interact(obj/item/P, mob/user, params) if(default_deconstruction_screwdriver(user, "grinder_open", "grinder", P)) - return + return TRUE else if(default_pry_open(P)) - return + return TRUE else if(default_unfasten_wrench(user, P)) - return + return TRUE else if(default_deconstruction_crowbar(P)) - return + return TRUE else return ..() diff --git a/code/modules/food_and_drinks/kitchen_machinery/grill.dm b/code/modules/food_and_drinks/kitchen_machinery/grill.dm index 426cd431cd1ff..34e465ddf43a5 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/grill.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/grill.dm @@ -28,7 +28,7 @@ else icon_state = "grill_open" -/obj/machinery/grill/attackby(obj/item/I, mob/user) +/obj/machinery/grill/item_interact(obj/item/I, mob/user) if(istype(I, /obj/item/stack/sheet/mineral/coal) || istype(I, /obj/item/stack/sheet/wood)) var/obj/item/stack/S = I var/stackamount = S.get_amount() @@ -39,31 +39,32 @@ grill_fuel += (50 * stackamount) S.use(stackamount) update_icon() - return + return TRUE if(I.resistance_flags & INDESTRUCTIBLE) to_chat(user, "You don't feel it would be wise to grill [I]...") - return ..() + return TRUE if(istype(I, /obj/item/reagent_containers)) if(istype(I, /obj/item/reagent_containers/food) && !istype(I, /obj/item/reagent_containers/food/drinks)) if(HAS_TRAIT(I, TRAIT_NODROP) || (I.item_flags & (ABSTRACT | DROPDEL))) - return ..() + to_chat(user, "[I] is stuck to your hand!") + return TRUE else if(!grill_fuel) to_chat(user, "There is not enough fuel.") - return + return TRUE else if(!grilled_item && user.transferItemToLoc(I, src)) grilled_item = I to_chat(user, "You put the [grilled_item] on [src].") update_icon() grill_loop.start() - return + return TRUE else if(I.reagents.has_reagent(/datum/reagent/consumable/monkey_energy)) grill_fuel += (20 * (I.reagents.get_reagent_amount(/datum/reagent/consumable/monkey_energy))) to_chat(user, "You pour the Monkey Energy in [src].") I.reagents.remove_reagent(/datum/reagent/consumable/monkey_energy, I.reagents.get_reagent_amount(/datum/reagent/consumable/monkey_energy)) update_icon() - return - ..() + return TRUE + return ..() /obj/machinery/grill/process(delta_time) ..() diff --git a/code/modules/food_and_drinks/kitchen_machinery/icecream_vat.dm b/code/modules/food_and_drinks/kitchen_machinery/icecream_vat.dm index fc3cb85f90fe4..3628da625340c 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/icecream_vat.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/icecream_vat.dm @@ -91,7 +91,7 @@ popup.set_content(dat) popup.open() -/obj/machinery/icecream_vat/attackby(obj/item/O, mob/user, params) +/obj/machinery/icecream_vat/item_interact(obj/item/O, mob/user, params) if(istype(O, /obj/item/reagent_containers/food/snacks/icecream)) var/obj/item/reagent_containers/food/snacks/icecream/I = O if(!I.ice_creamed) @@ -105,9 +105,9 @@ to_chat(user, "There is not enough ice cream left!") else to_chat(user, "[O] already has ice cream in it.") - return 1 + return TRUE else if(O.is_drainable()) - return + return TRUE else return ..() diff --git a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm index 06b94e2fe9941..0e521eacde149 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm @@ -102,28 +102,36 @@ else icon_state = "mw" -/obj/machinery/microwave/attackby(obj/item/O, mob/user, params) - if(operating) - return +/obj/machinery/microwave/item_interact(obj/item/O, mob/user, params) if(default_deconstruction_crowbar(O)) - return + if(operating) + return TRUE + return TRUE if(dirty < 100) if(default_deconstruction_screwdriver(user, icon_state, icon_state, O) || default_unfasten_wrench(user, O)) + if(operating) + return TRUE update_icon() - return + return TRUE if(panel_open && is_wire_tool(O)) + if(operating) + return TRUE wires.interact(user) return TRUE if(broken > 0) if(broken == 2 && O.tool_behaviour == TOOL_WIRECUTTER) // If it's broken and they're using a screwdriver + if(operating) + return TRUE user.visible_message("[user] starts to fix part of \the [src].", "You start to fix part of \the [src]...") if(O.use_tool(src, user, 20)) user.visible_message("[user] fixes part of \the [src].", "You fix part of \the [src].") broken = 1 // Fix it a bit else if(broken == 1 && O.tool_behaviour == TOOL_WELDER) // If it's broken and they're doing the wrench + if(operating) + return TRUE user.visible_message("[user] starts to fix part of \the [src].", "You start to fix part of \the [src]...") if(O.use_tool(src, user, 20)) user.visible_message("[user] fixes \the [src].", "You fix \the [src].") @@ -131,11 +139,15 @@ update_icon() return FALSE //to use some fuel else + if(operating) + return TRUE to_chat(user, "It's broken!") return TRUE - return + return TRUE if(istype(O, /obj/item/reagent_containers/spray)) + if(operating) + return TRUE var/obj/item/reagent_containers/spray/clean_spray = O if(clean_spray.reagents.has_reagent(/datum/reagent/space_cleaner, clean_spray.amount_per_transfer_from_this)) clean_spray.reagents.remove_reagent(/datum/reagent/space_cleaner, clean_spray.amount_per_transfer_from_this,1) @@ -148,6 +160,8 @@ return TRUE if(istype(O, /obj/item/soap) || istype(O, /obj/item/reagent_containers/glass/rag)) + if(operating) + return TRUE var/cleanspeed = 50 if(istype(O, /obj/item/soap)) var/obj/item/soap/used_soap = O @@ -160,10 +174,14 @@ return TRUE if(dirty == 100) // The microwave is all dirty so can't be used! + if(operating) + return TRUE to_chat(user, "\The [src] is dirty!") return TRUE if(istype(O, /obj/item/storage/bag/tray)) + if(operating) + return TRUE var/obj/item/storage/T = O var/loaded = 0 for(var/obj/item/reagent_containers/food/snacks/S in T.contents) @@ -175,21 +193,23 @@ ingredients += S if(loaded) to_chat(user, "You insert [loaded] items into \the [src].") - return + return TRUE if(O.w_class <= WEIGHT_CLASS_NORMAL && !istype(O, /obj/item/storage) && user.a_intent == INTENT_HELP) + if(operating) + return TRUE if(ingredients.len >= max_n_of_items) to_chat(user, "\The [src] is full, you can't put anything in!") return TRUE if(!user.transferItemToLoc(O, src)) to_chat(user, "\The [O] is stuck to your hand!") - return FALSE + return TRUE ingredients += O user.visible_message("[user] has added \a [O] to \the [src].", "You add [O] to \the [src].") - return + return TRUE - ..() + return ..() /obj/machinery/microwave/AltClick(mob/user) if(user.canUseTopic(src, !issilicon(usr))) diff --git a/code/modules/food_and_drinks/kitchen_machinery/monkeyrecycler.dm b/code/modules/food_and_drinks/kitchen_machinery/monkeyrecycler.dm index be2474997aad8..c08046d97cfca 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/monkeyrecycler.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/monkeyrecycler.dm @@ -39,22 +39,22 @@ GLOBAL_LIST_EMPTY(monkey_recyclers) if(in_range(user, src) || isobserver(user)) . += "The status display reads: Producing [cube_production] cubes for every monkey inserted." -/obj/machinery/monkey_recycler/attackby(obj/item/O, mob/user, params) +/obj/machinery/monkey_recycler/item_interact(obj/item/O, mob/user, params) if(default_deconstruction_screwdriver(user, "grinder_open", "grinder", O)) - return + return TRUE if(default_pry_open(O)) - return + return TRUE if(default_unfasten_wrench(user, O)) power_change() - return + return TRUE if(default_deconstruction_crowbar(O)) - return + return TRUE if(machine_stat) //NOPOWER etc - return + return FALSE else return ..() diff --git a/code/modules/food_and_drinks/kitchen_machinery/processor.dm b/code/modules/food_and_drinks/kitchen_machinery/processor.dm index 7d4456178bf34..43b04f03b0e4a 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/processor.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/processor.dm @@ -44,21 +44,21 @@ continue return recipe -/obj/machinery/processor/attackby(obj/item/O, mob/user, params) +/obj/machinery/processor/item_interact(obj/item/O, mob/user, params) if(processing) to_chat(user, "[src] is in the process of processing!") return TRUE if(default_deconstruction_screwdriver(user, "processor", "processor1", O)) - return + return TRUE if(default_pry_open(O)) - return + return TRUE if(default_unfasten_wrench(user, O)) - return + return TRUE if(default_deconstruction_crowbar(O)) - return + return TRUE if(istype(O, /obj/item/storage/bag/tray)) var/obj/item/storage/T = O @@ -71,21 +71,17 @@ if(loaded) to_chat(user, "You insert [loaded] items into [src].") - return + return TRUE var/datum/food_processor_process/P = select_recipe(O) if(P) user.visible_message("[user] put [O] into [src].", \ "You put [O] into [src].") user.transferItemToLoc(O, src, TRUE) - return 1 + return TRUE else - if(user.a_intent != INTENT_HARM) - to_chat(user, "That probably won't blend!") - return 1 - else - return ..() - + to_chat(user, "That probably won't blend!") + return TRUE /obj/machinery/processor/interact(mob/user) if(processing) to_chat(user, "[src] is in the process of processing!") diff --git a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm index 8f0cb83ae3351..e640f13e2a4c2 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm @@ -68,29 +68,29 @@ * Item Adding ********************/ -/obj/machinery/smartfridge/attackby(obj/item/O, mob/user, params) +/obj/machinery/smartfridge/item_interact(obj/item/O, mob/user, params) if(default_deconstruction_screwdriver(user, icon_state, icon_state, O)) cut_overlays() if(panel_open) add_overlay("[initial(icon_state)]-panel") ui_update() - return + return TRUE if(default_pry_open(O)) - return + return TRUE if(default_unfasten_wrench(user, O)) power_change() - return + return TRUE if(default_deconstruction_crowbar(O)) - return + return TRUE if(!machine_stat) if(contents.len >= max_n_of_items) to_chat(user, "\The [src] is full!") - return FALSE + return TRUE if(accept_check(O)) load(O) @@ -123,7 +123,7 @@ return TRUE else to_chat(user, "There is nothing in [O] to put in [src]!") - return FALSE + return TRUE if(istype(O, /obj/item/organ_storage)) var/obj/item/organ_storage/S = O @@ -141,17 +141,13 @@ return TRUE else to_chat(user, "[src] does not accept [I]!") - return FALSE + return TRUE else to_chat(user, "There is nothing in [O] to put into [src]!") - return FALSE - - if(user.a_intent != INTENT_HARM) - to_chat(user, "\The [src] smartly refuses [O].") - return FALSE - else - return ..() + return TRUE + to_chat(user, "\The [src] smartly refuses [O].") + return TRUE /obj/machinery/smartfridge/hitby(atom/movable/AM, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum) if(!machine_stat) diff --git a/code/modules/food_and_drinks/pizzabox.dm b/code/modules/food_and_drinks/pizzabox.dm index 175bbc6b6a60c..e38da7ca86380 100644 --- a/code/modules/food_and_drinks/pizzabox.dm +++ b/code/modules/food_and_drinks/pizzabox.dm @@ -151,7 +151,7 @@ update_icon() user.regenerate_icons() -/obj/item/pizzabox/attackby(obj/item/I, mob/user, params) +/obj/item/pizzabox/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/pizzabox)) var/obj/item/pizzabox/newbox = I if(!open && !newbox.open) @@ -159,7 +159,7 @@ add += newbox add += newbox.boxes if(!user.transferItemToLoc(newbox, src)) - return + return TRUE boxes += add newbox.boxes.Cut() to_chat(user, "You put [newbox] on top of [src]!") @@ -172,50 +172,53 @@ disperse_pizzas() else to_chat(user, "The stack is getting a little high...") - return else to_chat(user, "Close [open ? src : newbox] first!") + return TRUE else if(istype(I, /obj/item/reagent_containers/food/snacks/pizza) || istype(I, /obj/item/reagent_containers/food/snacks/customizable/pizza)) if(open) if(pizza) to_chat(user, "[src] already has \a [pizza.name]!") - return + return TRUE if(!user.transferItemToLoc(I, src)) - return + return TRUE pizza = I to_chat(user, "You put [I] in [src].") update_icon() - return + return TRUE else if(istype(I, /obj/item/bombcore/miniature/pizza)) if(open && !bomb) if(!user.transferItemToLoc(I, src)) - return + return TRUE wires = new /datum/wires/explosive/pizza(src) bomb = I bomb.installed = TRUE to_chat(user, "You put [I] in [src]. Sneeki breeki...") update_icon() - return + return TRUE else if(bomb) to_chat(user, "[src] already has a bomb in it!") + return TRUE else if(istype(I, /obj/item/pen)) if(!open) if(!user.is_literate()) to_chat(user, "You scribble illegibly on [src]!") - return + return TRUE var/obj/item/pizzabox/box = boxes.len ? boxes[boxes.len] : src box.boxtag += stripped_input(user, "Write on [box]'s tag:", box, "", 30) if(!user.canUseTopic(src, BE_CLOSE)) - return + return TRUE to_chat(user, "You write with [I] on [src].") update_icon() - return + return TRUE else if(is_wire_tool(I)) if(wires && bomb) wires.interact(user) + return TRUE else if(istype(I, /obj/item/reagent_containers/food)) to_chat(user, "That's not a pizza!") - ..() + return TRUE + return ..() /obj/item/pizzabox/process(delta_time) if(bomb_active && !bomb_defused && (bomb_timer > 0)) @@ -234,7 +237,7 @@ unprocess() return -/obj/item/pizzabox/attack(mob/living/target, mob/living/user, def_zone) +/obj/item/pizzabox/attack_mob_target(mob/living/target, mob/living/user, def_zone) . = ..() if(boxes.len >= 3 && prob(25 * boxes.len)) disperse_pizzas() diff --git a/code/modules/games/cas.dm b/code/modules/games/cas.dm index f4836b40bd66c..8788c432f3a0d 100644 --- a/code/modules/games/cas.dm +++ b/code/modules/games/cas.dm @@ -79,7 +79,7 @@ user.visible_message("[user] draws a card from the deck.", "You draw a card from the deck.") update_icon() -/obj/item/toy/cards/deck/cas/attackby(obj/item/I, mob/living/user, params) +/obj/item/toy/cards/deck/cas/item_interact(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/toy/cards/singlecard/cas)) var/obj/item/toy/cards/singlecard/cas/SC = I if(!user.temporarilyRemoveItemFromInventory(SC)) @@ -92,7 +92,9 @@ cards += RC user.visible_message("[user] adds a card to the bottom of the deck.","You add the card to the bottom of the deck.") qdel(SC) - update_icon() + update_icon() + return TRUE + return ..() /obj/item/toy/cards/deck/cas/update_icon() if(cards.len < 26) @@ -141,17 +143,19 @@ else icon_state = "[card_face]" -/obj/item/toy/cards/singlecard/cas/attackby(obj/item/I, mob/living/user, params) +/obj/item/toy/cards/singlecard/cas/item_interact(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/pen)) if(!user.is_literate()) to_chat(user, "You scribble illegibly on [src]!") - return + return TRUE if(!blank) to_chat(user, "You cannot write on that card.") - return + return TRUE var/cardtext = stripped_input(user, "What do you wish to write on the card?", "Card Writing", "", 50) if(!cardtext || !user.canUseTopic(src, BE_CLOSE)) - return + return TRUE name = cardtext buffertext = cardtext blank = 0 + return TRUE + return FALSE diff --git a/code/modules/guardian/abilities/major/explosive.dm b/code/modules/guardian/abilities/major/explosive.dm index 9917d5319897b..1febad6fac2b1 100644 --- a/code/modules/guardian/abilities/major/explosive.dm +++ b/code/modules/guardian/abilities/major/explosive.dm @@ -30,7 +30,7 @@ if(guardian.hasmatchingsummoner(L)) //if the summoner matches don't hurt them continue if(L != guardian && L != guardian.summoner?.current) - L.apply_damage(15, BRUTE) + L.apply_damage(/datum/damage_source/explosion, /datum/damage/brute, 15) new /obj/effect/temp_visual/explosion(get_turf(M)) /datum/guardian_ability/major/explosive/AltClickOn(atom/A) diff --git a/code/modules/guardian/abilities/major/hand.dm b/code/modules/guardian/abilities/major/hand.dm index 2173d6408a763..6858b0f8a2fba 100644 --- a/code/modules/guardian/abilities/major/hand.dm +++ b/code/modules/guardian/abilities/major/hand.dm @@ -5,7 +5,7 @@ cost = 5 var/next_hand = 0 -/datum/guardian_ability/major/hand/RangedAttack(atom/target) +/datum/guardian_ability/major/hand/primary_ranged_attack(atom/target) if(world.time < next_hand || guardian.Adjacent(target) || !isturf(guardian.loc) || !guardian.is_deployed()) return ..() playsound(guardian, 'sound/magic/blink.ogg', 100, TRUE) // blink lol diff --git a/code/modules/guardian/abilities/major/healing.dm b/code/modules/guardian/abilities/major/healing.dm index aad2242ef9543..ae348fd8a1155 100644 --- a/code/modules/guardian/abilities/major/healing.dm +++ b/code/modules/guardian/abilities/major/healing.dm @@ -27,7 +27,7 @@ var/heals = -(master_stats.potential * 0.8 + 3) if(!guardian.is_deployed()) heals = min(heals * 0.5, -2) - L.adjustBruteLoss(heals) + L.adjustBruteLossAbstract(heals) L.adjustFireLoss(heals) L.adjustOxyLoss(heals) L.adjustToxLoss(heals, forced = TRUE) diff --git a/code/modules/guardian/guardian.dm b/code/modules/guardian/guardian.dm index ee1aa01551b97..dfe7023a759ba 100644 --- a/code/modules/guardian/guardian.dm +++ b/code/modules/guardian/guardian.dm @@ -36,7 +36,7 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians maxHealth = INFINITY //The spirit itself is invincible health = INFINITY healable = FALSE //don't brusepack the guardian - damage_coeff = list(BRUTE = 0.5, BURN = 0.5, TOX = 0.5, CLONE = 0.5, STAMINA = 0, OXY = 0.5) //how much damage from each damage type we transfer to the owner + damage_coeff = list(BRUTE = 0.5, BURN = 0.5, TOX = 0.5, CLONE = 0.5, STAMINA_DAMTYPE = 0, OXY = 0.5) //how much damage from each damage type we transfer to the owner environment_smash = ENVIRONMENT_SMASH_STRUCTURES obj_damage = 40 melee_damage = 15 @@ -368,11 +368,11 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians P.fire() return P -/mob/living/simple_animal/hostile/guardian/RangedAttack(atom/A, params) +/mob/living/simple_animal/hostile/guardian/primary_ranged_attack(atom/A, params) if(transforming) to_chat(src, "No... no... you can't!") return - if(stats.ability && stats.ability.RangedAttack(A)) + if(stats.ability && stats.ability.primary_ranged_attack(A)) return return ..() @@ -420,21 +420,22 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians resulthealth = round((summoner.current.health / summoner.current.maxHealth) * 100, 0.5) hud_used.healths.maptext = MAPTEXT("
[resulthealth]%
") -/mob/living/simple_animal/hostile/guardian/adjustHealth(amount, updating_health = TRUE, forced = FALSE) //The spirit is invincible, but passes on damage to the summoner +/mob/living/simple_animal/hostile/guardian/adjustHealth(amount, forced = FALSE) //The spirit is invincible, but passes on damage to the summoner if(berserk) return ..() . = amount if(summoner?.current) if(!is_deployed()) return FALSE - summoner.current.adjustBruteLoss(amount) + summoner.current.apply_damage(/datum/damage_source/abstract, BRUTE, amount, null) if(amount > 0) to_chat(summoner.current, "Your [name] is under attack! You take damage!") if(summoner_visible) summoner.current.visible_message("Blood sprays from [summoner] as [src] takes damage!") if(summoner.current.stat == UNCONSCIOUS) to_chat(summoner.current, "Your body can't take the strain of sustaining [src] in this condition, it begins to fall apart!") - summoner.current.adjustCloneLoss(amount * 0.5) //dying hosts take 50% bonus damage as cloneloss + var/datum/damage_source/abstract/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(summoner.current, CLONE, amount * 0.5) //dying hosts take 50% bonus damage as cloneloss update_health_hud() if(stats.ability) stats.ability.Health(amount) @@ -445,9 +446,9 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians gib() return if(2) - adjustBruteLoss(60) + apply_damage(/datum/damage_source/explosion, BRUTE, 60, null) if(3) - adjustBruteLoss(30) + apply_damage(/datum/damage_source/explosion, BRUTE, 30, null) /mob/living/simple_animal/hostile/guardian/examine(mob/user) . = ..() diff --git a/code/modules/guardian/guardianability.dm b/code/modules/guardian/guardianability.dm index 571e3d336cb70..c263ca68cffdb 100644 --- a/code/modules/guardian/guardianability.dm +++ b/code/modules/guardian/guardianability.dm @@ -35,7 +35,7 @@ /datum/guardian_ability/major/proc/Attack(atom/target) -/datum/guardian_ability/major/proc/RangedAttack(atom/target) +/datum/guardian_ability/major/proc/primary_ranged_attack(atom/target) /datum/guardian_ability/major/proc/AfterAttack(atom/target) diff --git a/code/modules/guardian/guardianstats.dm b/code/modules/guardian/guardianstats.dm index c47b823964fdc..d6dc37f39c801 100644 --- a/code/modules/guardian/guardianstats.dm +++ b/code/modules/guardian/guardianstats.dm @@ -19,7 +19,7 @@ guardian.melee_damage = damage * 5 guardian.obj_damage = damage * 16 var/armor = CLAMP((max(6 - defense, 1)/2.5)/2, 0.25, 1) - guardian.damage_coeff = list(BRUTE = armor, BURN = armor, TOX = armor, CLONE = armor, STAMINA = 0, OXY = armor) + guardian.damage_coeff = list(BRUTE = armor, BURN = armor, TOX = armor, CLONE = armor, STAMINA_DAMTYPE = 0, OXY = armor) if(damage == 5) guardian.environment_smash = ENVIRONMENT_SMASH_WALLS guardian.atk_cooldown = (15 / speed) * 1.5 diff --git a/code/modules/guardian/standarrow.dm b/code/modules/guardian/standarrow.dm index d83cd2144f7d7..15b6d95bfe629 100644 --- a/code/modules/guardian/standarrow.dm +++ b/code/modules/guardian/standarrow.dm @@ -18,7 +18,7 @@ . = ..() AddElement(/datum/element/point_of_interest) -/obj/item/stand_arrow/attack(mob/living/M, mob/living/user) +/obj/item/stand_arrow/attack_mob_target(mob/living/M, mob/living/user) if(in_use) return if(!M.client) @@ -57,7 +57,8 @@ log_game("[key_name(H)] was killed by a stand arrow.") forceMove(H.drop_location()) H.mind.no_cloning_at_all = TRUE - H.adjustCloneLoss(500) + var/datum/damage_source/abstract/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(H, CLONE, 500) //dying hosts take 50% bonus damage as cloneloss H.dust(TRUE) else INVOKE_ASYNC(src, PROC_REF(generate_stand), H) diff --git a/code/modules/health/damage/damage_sources/chemical.dm b/code/modules/health/damage/damage_sources/chemical.dm new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/code/modules/health/damage/damage_sources/damage_source.dm b/code/modules/health/damage/damage_sources/damage_source.dm new file mode 100644 index 0000000000000..05906d8c913e8 --- /dev/null +++ b/code/modules/health/damage/damage_sources/damage_source.dm @@ -0,0 +1,274 @@ +#define INITIAL_SETUP \ + src.transformed_damage_source = src;\ + src.damage_amount = _damage_amount;\ + src.armour_penetration = 0;\ + src.target = _target;\ + src.target_zone = _target_zone;\ + src.weapon = null;\ + src.damage_type = _damage_type;\ + src.attacker = null; + +#define CLEAR_REFERENCES do {\ + src.target = null;\ + src.weapon = null;\ +} while(0) + +/datum/damage_source + // =========================== + // Initial Variables + // =========================== + + /// The armour flag to use when calculating armour + /// and armour penetration. If null then armour will + /// be entirely bypassed. + var/armour_flag = null + + // NOTE: For maximum performance of a potentially hot path, we store our data here to be passed around the damage_sources and to be + // manipulated later on. + // !!! This means that our damage application procs that use this must NEVER sleep. !!! + + /// The damage source instance that we should be using when applying damage. This + /// allows things like armour to transform our damage type from sharp to blunt. + var/datum/damage_source/transformed_damage_source + /// The amount of damage that we are attempting to apply. Can be mutated by armour + var/damage_amount + /// The armour penetration value of this attack + var/armour_penetration + /// The target of these attacks + var/atom/target + /// The target zone of the attack + var/target_zone + /// The weapon used for the attack + var/obj/item/weapon + /// The type of damage being given to the victim + var/damage_type + /// Who is attacking with this? + var/mob/living/attacker + +/datum/damage_source/proc/apply_direct(atom/_target, _damage_type, _damage_amount, _target_zone = null, forced = FALSE) + SHOULD_NOT_SLEEP(TRUE) + SHOULD_NOT_OVERRIDE(TRUE) + + // Set the state + INITIAL_SETUP + + // Pre attack hooks + pre_attack() + if (damage_amount <= 0) + return 0 + + // Get the thing we are actually targetting + target.damage_get_target(src) + + // Run the armour calculation + target.damage_run_armour(src) + + // Not enough damage + if (damage_amount <= 0) + CLEAR_REFERENCES + return 0 + + if (QDELETED(target)) + CLEAR_REFERENCES + return 0 + + // Apply the damage at this point + target.damage_apply_damage(src) + + // Called when the target is damaged + target.on_damaged() + CLEAR_REFERENCES + return damage_amount + +/// Attacker may be null +/datum/damage_source/proc/deal_attack(mob/living/_attacker, obj/item/_attacking_item, atom/_target, _damage_type, _damage_amount, _target_zone = null, forced = FALSE) + SHOULD_NOT_SLEEP(TRUE) + SHOULD_NOT_OVERRIDE(TRUE) + + // Set the state + INITIAL_SETUP + src.weapon = _attacking_item + src.attacker = _attacker + + // Pre attack hooks + pre_attack() + if (damage_amount <= 0) + return 0 + + // Determine the target_zone + if (!target_zone) + target_zone = ran_zone(attacker?.zone_selected || BODY_ZONE_CHEST) + + // Get the thing we are actually targetting + target.damage_get_target(src) + + // Determine armour penetration + if (weapon) + weapon.damage_get_armour_penetration(src) + else + attacker.damage_get_armour_penetration(src) + + // Run the armour calculations + target.damage_run_armour(src) + + // Pacifism check + if (attacker && HAS_TRAIT(attacker, TRAIT_PACIFISM) && !ispath(damage_type, /datum/damage/stamina)) + to_chat(attacker, "You don't want to hurt anyone!") + CLEAR_REFERENCES + return 0 + + // Play the animation + if (weapon) + if (attacker) + attacker.do_attack_animation(target, used_item = weapon) + else + weapon.do_attack_animation(target, used_item = weapon) + else + if (attacker) + attacker.do_attack_animation(target, isanimal(attacker) ? pick(ATTACK_EFFECT_BITE, ATTACK_EFFECT_CLAW) : pick(ATTACK_EFFECT_KICK, ATTACK_EFFECT_PUNCH)) + + if (damage_amount <= 0) + CLEAR_REFERENCES + return 0 + + // Apply the damage at this point + target.damage_apply_damage(src) + + // Display the attack message + if (weapon) + weapon.display_attack_message(src) + else if(attacker) + attacker.display_attack_message(src) + + if (attacker && weapon) + target.on_attacked(weapon, attacker) + + after_attack(attacker, weapon, target, GET_DAMAGE(transformed_damage_source), damage_amount, target_zone) + if (istype(target, /obj/item/bodypart)) + var/obj/item/bodypart/part = target + if (part.owner) + after_attack_limb(attacker, weapon, part.owner, target, GET_DAMAGE(transformed_damage_source), damage_amount, target_zone) + + // Call when the target takes damage + target.on_damaged() + CLEAR_REFERENCES + return damage_amount + +/datum/damage_source/proc/pre_attack() + return + +/// Called after a successful attack +/datum/damage_source/proc/after_attack() + return + +/// Called after a specific limb was attacked +/datum/damage_source/proc/after_attack_limb( + mob/living/attacker, + obj/item/attacking_item, + mob/living/target, + obj/item/bodypart/limb, + datum/damage/damage, + damage_amount, + target_zone + ) + return + +/// Run dismemberment checks after a specific limb was attacked +/datum/damage_source/proc/run_dismemberment( + mob/living/attacker, + obj/item/attacking_item, + mob/living/target, + obj/item/bodypart/limb, + datum/damage/damage, + damage_amount, + target_zone, + multipler = 1 + ) + SHOULD_NOT_OVERRIDE(TRUE) + if (!attacking_item || !damage_amount) + return + var/dismemberthreshold = limb.max_damage * 2 - (limb.get_damage() + ((attacking_item.w_class - 3) * 10) + ((attacking_item.attack_weight - 1) * 15)) + if(HAS_TRAIT(target, TRAIT_EASYDISMEMBER)) + dismemberthreshold -= 50 + dismemberthreshold = min(((limb.max_damage * 2) - limb.get_damage()), dismemberthreshold) //makes it so limbs wont become immune to being dismembered if the item is sharp + if(target.stat == DEAD) + dismemberthreshold = dismemberthreshold / 3 + if(multipler * damage_amount >= dismemberthreshold && damage_amount >= 10) + if(limb.dismember(damage)) + attacking_item.add_mob_blood(target) + playsound(get_turf(target), attacking_item.get_dismember_sound(), 80, 1) + +/// Causes bleeding on the target +/datum/damage_source/proc/run_bleeding( + atom/target, + damage_amount, + intensity_multiplier = 1 + ) + SHOULD_NOT_OVERRIDE(TRUE) + if (!damage_amount) + return + target.apply_bleeding((damage_amount * intensity_multiplier) * rand(2, 4) / 10, damage_amount * intensity_multiplier) + +/// Deepends any pre-existing wounds and causes blood to splatter +/// if they are already bleeding. +/// Doesn't cause bleeding itself. +/datum/damage_source/proc/run_deepen_wounds( + mob/living/attacker, + obj/item/attacking_item, + mob/living/carbon/human/target, + datum/damage/damage, + damage_amount, + target_zone, + force = FALSE + ) + SHOULD_NOT_OVERRIDE(TRUE) + // Check if we are bleeding already + if (!istype(target) || (target.bleed_rate < damage_amount && !force)) + return + // Get blood on themselves + target.add_mob_blood(target) + run_apply_blood(target, target, BODY_ZONE_CHEST) + // Get our location + var/turf/location = get_turf(target) + if (!location) + return + // Add blood to the surrounding location + target.add_splatter_floor(location) + // Check if we are in range + if (attacker && get_dist(attacker, target) <= 1) + attacker.add_mob_blood(target) + if (ishuman(attacker)) + var/mob/living/carbon/human/human_attacker = attacker + run_apply_blood(target, human_attacker, target_zone) + +/// Apply blood from a source to a target +/datum/damage_source/proc/run_apply_blood(mob/living/blood_source, mob/living/carbon/human/blood_target, def_zone) + SHOULD_NOT_OVERRIDE(TRUE) + if (!istype(blood_target)) + return + switch (def_zone) + if (BODY_ZONE_HEAD) + if(blood_target.wear_mask) + blood_target.wear_mask.add_mob_blood(blood_source) + blood_target.update_inv_wear_mask() + if(blood_target.wear_neck) + blood_target.wear_neck.add_mob_blood(blood_source) + blood_target.update_inv_neck() + if(blood_target.head) + blood_target.head.add_mob_blood(blood_source) + blood_target.update_inv_head() + if (BODY_ZONE_CHEST) + if(blood_target.wear_suit) + blood_target.wear_suit.add_mob_blood(blood_source) + blood_target.update_inv_wear_suit() + if(blood_target.w_uniform) + blood_target.w_uniform.add_mob_blood(blood_source) + blood_target.update_inv_w_uniform() + +/// Force the target to say their message +/datum/damage_source/proc/run_force_say(mob/living/carbon/human/target, damage_amount) + SHOULD_NOT_OVERRIDE(TRUE) + if (!istype(target)) + return + if (damage_amount > 10 || damage_amount > 10 && prob(33)) + target.force_say() diff --git a/code/modules/health/damage/damage_sources/living_damage_extensions.dm b/code/modules/health/damage/damage_sources/living_damage_extensions.dm new file mode 100644 index 0000000000000..f67020455c8a4 --- /dev/null +++ b/code/modules/health/damage/damage_sources/living_damage_extensions.dm @@ -0,0 +1,35 @@ +/// Damage source will decide if this should respect armour or not +/// If you want an object to be the attacker, do not use this as it does not use the items +/// armour penetration value. +/// Target zone may be a def_zone or bodypart +/mob/living/proc/apply_damage(damage_source, damage_type, damage, target_zone = null, forced = FALSE) + // Get the damage source + var/datum/damage_source/source = damage_source + if (!istype(source)) + source = GET_DAMAGE_SOURCE(damage_source) + return source.apply_direct(src, damage_type, damage, target_zone) + +/// Perform the mobs default attack protocols (punching/biting/whatever) +/// Returns the amount of damage dealt +/// TODO: Add on the punch message somewhere in this attack chain +/mob/living/proc/deal_generic_attack(atom/target) + var/datum/damage_source/source = GET_DAMAGE_SOURCE(/datum/damage_source/blunt/light) + return source.deal_attack(src, null, target, BRUTE, 3, ran_zone(zone_selected)) + +/mob/living/carbon/alien/humanoid/deal_generic_attack(atom/target) + var/datum/damage_source/source = GET_DAMAGE_SOURCE(/datum/damage_source/sharp/light) + return source.deal_attack(src, null, target, BRUTE, 20, ran_zone(zone_selected)) + +/mob/living/simple_animal/deal_generic_attack(atom/target) + var/datum/damage_source/source = GET_DAMAGE_SOURCE(/datum/damage_source/blunt/light) + return source.deal_attack(src, null, target, melee_damage_type, isobj(target) ? obj_damage : melee_damage, ran_zone(zone_selected)) + +/mob/living/simple_animal/slime/deal_generic_attack(atom/target) + var/datum/damage_source/slime_damage_source = GET_DAMAGE_SOURCE(/datum/damage_source/slime) + var/damage = 20 + if (is_adult) + damage = 30 + if (transformeffects & SLIME_EFFECT_RED) + damage *= 1.1 + slime_damage_source.deal_attack(src, null, target, melee_damage_type, damage, ran_zone(zone_selected)) + target.after_attacked_by_slime(src) diff --git a/code/modules/health/damage/damage_sources/object_damage_extensions.dm b/code/modules/health/damage/damage_sources/object_damage_extensions.dm new file mode 100644 index 0000000000000..6b422cbe6d616 --- /dev/null +++ b/code/modules/health/damage/damage_sources/object_damage_extensions.dm @@ -0,0 +1,27 @@ +/** + * Perform the generic attack function which will use this object's damage + * profile to attack the target. + * This will handle + * - Attack animations + * - Attack sounds + * - Armour penetration (damage source handles this) + * - Bleeding (damage source handles this) + */ +/obj/proc/deal_attack(mob/living/user, atom/target, target_zone = null, forced = FALSE, override_damage = null) + SHOULD_NOT_OVERRIDE(TRUE) + // Get the damage source that we want to use + var/datum/damage_source/damage_provider = GET_DAMAGE_SOURCE(damage_source) + if (!damage_provider) + CRASH("[type] has not provided a valid damage source. Value provided: [damage_source], expected path of type /datum/damage_source") + // Deal the actaul damage + damage_provider.deal_attack(user, src, target, damtype, override_damage || force, target_zone, forced) + +/// If user is null, no animation will be played and there will be no attack message. +/obj/proc/damage_direct(mob/living/user, atom/target, target_zone = null, forced = FALSE, override_damage = null) + SHOULD_NOT_OVERRIDE(TRUE) + // Get the damage source that we want to use + var/datum/damage_source/damage_provider = GET_DAMAGE_SOURCE(damage_source) + if (!damage_provider) + CRASH("[type] has not provided a valid damage source. Value provided: [damage_source], expected path of type /datum/damage_source") + // Deal the actaul damage + damage_provider.apply_direct(target, damtype, override_damage || force, target_zone, forced) diff --git a/code/modules/health/damage/damage_sources/sharp.dm b/code/modules/health/damage/damage_sources/sharp.dm new file mode 100644 index 0000000000000..fecfb98875017 --- /dev/null +++ b/code/modules/health/damage/damage_sources/sharp.dm @@ -0,0 +1,285 @@ +/datum/damage_source/sharp + armour_flag = MELEE + var/dismemberment_multiplier = 0 + var/bleed_multiplier = 1 + +/datum/damage_source/sharp/after_attack_limb( + mob/living/attacker, + obj/item/attacking_item, + mob/living/target, + obj/item/bodypart/limb, + datum/damage/damage, + damage_amount, + target_zone + ) + run_bleeding(target, damage_amount, bleed_multiplier) + run_deepen_wounds(attacker, attacking_item, target, limb, damage, damage_amount, target_zone) + run_dismemberment(attacker, attacking_item, target, limb, damage, damage_amount, target_zone, dismemberment_multiplier) + +/// Small and light but sharp weapons like knives +/datum/damage_source/sharp/light + dismemberment_multiplier = 0.6 + bleed_multiplier = 0.8 + +/datum/damage_source/sharp/light/after_attack_limb(mob/living/attacker, obj/item/attacking_item, mob/living/target, obj/item/bodypart/limb, datum/damage/damage, damage_amount, target_zone) + . = ..() + if (attacking_item && target_zone == BODY_ZONE_PRECISE_EYES) + attacking_item.eyestab(target, attacker) + +/// Heavy and sharp weapons like large swords +/// Either by slicing or stabbing, without armour this will be likely to +/// penetrate the skin and cause internal damage and bleeding. +/datum/damage_source/sharp/heavy + dismemberment_multiplier = 1.2 + bleed_multiplier = 1.4 + +/// Surgical incisions. Causes bleeding but won't deal massive amounts +/// of unpredictable internal damage. +/// Should cause extreme amounts of pain compared to other damage types +/// to enforce surgery painkilling/sleeping. +/datum/damage_source/sharp/incision + bleed_multiplier = 1.8 + +/datum/damage_source/blunt + armour_flag = MELEE + +/datum/damage_source/blunt/after_attack_limb(mob/living/attacker, obj/item/attacking_item, mob/living/target, obj/item/bodypart/limb, datum/damage/damage, damage_amount, target_zone) + run_deepen_wounds(attacker, attacking_item, target, limb, damage, damage_amount, target_zone) + // Revolutionary remove + var/mob/living/carbon/human/H = target + if (attacking_item && target_zone == BODY_ZONE_HEAD && istype(H)) + if(H.mind && H.stat == CONSCIOUS && H != attacker && (H.health - (attacking_item.force * attacking_item.attack_weight)) <= 0) // rev deconversion through blunt trauma. + var/datum/antagonist/rev/rev = H.mind.has_antag_datum(/datum/antagonist/rev) + if(rev) + rev.remove_revolutionary(FALSE, attacker) + +/// Light and blunt weaker weapons like toolboxes +/datum/damage_source/blunt/light + +/// Heavy but blunt weapons like battle hammers +/datum/damage_source/blunt/heavy + +/// A constant source of damage drilling into the skin. +/// Pretty bad but respects melee armour. +/datum/damage_source/drill + armour_flag = MELEE + +/datum/damage_source/drill/after_attack_limb( + mob/living/attacker, + obj/item/attacking_item, + mob/living/target, + obj/item/bodypart/limb, + datum/damage/damage, + damage_amount, + target_zone + ) + run_bleeding(target, damage_amount, 1.8) + run_deepen_wounds(attacker, attacking_item, target, limb, damage, damage_amount, target_zone) + run_dismemberment(attacker, attacking_item, target, limb, damage, damage_amount, target_zone, 1.4) + +/// Something pricked directly in the skin, bypasses armour +/// Ignored if the mob has TRAIT_PIERCEIMMUNE +/datum/damage_source/skin_prick + +/// For when you rip a bodypart (un)cleanly off with sheer force. +/// Will force screaming +/datum/damage_source/forceful_laceration + +/// Caused by impact of objects colliding with each other +/// May cause head trauma if hit on the head +/// Affected by armour +/datum/damage_source/impact + armour_flag = MELEE + +/datum/damage_source/impact/after_attack_limb(mob/living/attacker, obj/item/attacking_item, mob/living/target, obj/item/bodypart/limb, datum/damage/damage, damage_amount, target_zone) + run_deepen_wounds(attacker, attacking_item, target, limb, damage, damage_amount, target_zone) + +/// Caused by being crushed +/// Might break some bones +/datum/damage_source/crush + armour_flag = MELEE + +/datum/damage_source/crush/after_attack_limb(mob/living/attacker, obj/item/attacking_item, mob/living/target, obj/item/bodypart/limb, datum/damage/damage, damage_amount, target_zone) + run_deepen_wounds(attacker, attacking_item, target, limb, damage, damage_amount, target_zone) + +/// Caused by an object inside of a mob bursting out through their skin +/// Causes intense bleeding and internal damage +/datum/damage_source/internal_rupture + +/datum/damage_source/internal_rupture/after_attack_limb(mob/living/attacker, obj/item/attacking_item, mob/living/target, obj/item/bodypart/limb, datum/damage/damage, damage_amount, target_zone) + run_bleeding(target, damage_amount, 2) + run_deepen_wounds(attacker, attacking_item, target, limb, damage, damage_amount, target_zone) + +/// Caused by an explosion, obviously +/datum/damage_source/explosion + armour_flag = BOMB + +/// Electrical damage to a mechanical source +/datum/damage_source/electrical_damage + +/// Caused by fatigue from doing an action over and over. +/// Bypasses all armour. +/datum/damage_source/fatigue + +/// Damage caused by consuming something you shouldn't have. Highly likely to cause +/// internal damage and bypasses armour. +/datum/damage_source/consumption + +/// Caused by accidentally burning yourself on something. +/// Will account for armour or gloves if you are wearing any and the target is a precise hand +/datum/damage_source/accidental_burn + armour_flag = FIRE + +/// Caused by external pressure +/datum/damage_source/pressure + +/// Damage caused by exposure to various temperatures. +/datum/damage_source/temperature + +/// Damaged caused by internal exosure to high temperatures from breathing +/// in cold/hot air. +/datum/damage_source/temperature/internal + +/// Electrical damage. +/// Applies the stutter effect. +/datum/damage_source/shock + +/// Damage caused by a religious source. Damage is reduced by a null rod +/// or magic protection. +/datum/damage_source/magic + armour_flag = MAGIC + +/// Abstract magic damage not blocked by a null rod +/datum/damage_source/magic/abstract + armour_flag = null + +/datum/damage_source/magic/religion + +//SEND_SIGNAL(target, COMSIG_LIVING_MINOR_SHOCK) //Only used for nanites +//target.stuttering = 20 +//target.do_jitter_animation(20) +/// Damaged caused by stun shock weapons. +/// Blocked by the stamina damage flag. +/// Applies the stutter effect. +/datum/damage_source/stun + armour_flag = STAMINA + +/// Caused by chemicals injested inside the body. Bypasses armour and causes +/// internal damage. +/// Only causes damage to organic limbs +/datum/damage_source/chemical + +/// Damage caused by external acid burns. Respects acid armour +/datum/damage_source/acid_burns + armour_flag = ACID + +/// Damage caused by mental trauma +/datum/damage_source/mental_health + +/// Damage caused by a bullet. If not blocked by armour, will be penetrating +/// and may cause internal damage. +/datum/damage_source/bullet + armour_flag = BULLET + +/// Rubber bullets and beanbag bullets. +/datum/damage_source/bullet/beanbag + +/// Unstoppable things like the immovable rod +/// This will entirely penetrate literally all armour and will rip a giant +/// hole through your body. +/datum/damage_source/bullet/unstoppable + armour_flag = NONE + +/// Laser projectiles +/datum/damage_source/laser + armour_flag = LASER + +/// Energy based projectiles +/datum/damage_source/energy + armour_flag = ENERGY + +/// Ion damage, causes empulses +/datum/damage_source/ion + armour_flag = ENERGY + +/// Caused by a mob punching another mob. Similar to blunt but with no force +/// multiplier at all (you are just using a fist). +/datum/damage_source/punch + armour_flag = MELEE + +/datum/damage_source/punch/after_attack_limb(mob/living/attacker, obj/item/attacking_item, mob/living/target, obj/item/bodypart/limb, datum/damage/damage, damage_amount, target_zone) + run_deepen_wounds(attacker, attacking_item, target, limb, damage, damage_amount, target_zone) + +/// Checks for radiation armour +/// Might cause some secondary bad effect like mutations if bad enough +/datum/damage_source/radiation_burn + armour_flag = RAD + +/// Caused by a slime attacking something. Might have digestive enzymes +/// or something. +/datum/damage_source/slime + +/datum/damage_source/slime/pre_attack() + // Slime cannot damage AI units + if (isAI(target)) + damage_amount = 0 + return + // Spark carbons + if (iscarbon(target)) + do_sparks(5, TRUE, target) + // Stop feeding if we attacked the thing we are on + if (isslime(attacker) && isliving(target)) + var/mob/living/living_target = target + var/mob/living/simple_animal/slime/slime = attacker + if (slime in living_target.buckled_mobs) + slime.Feedstop() + return + +/datum/damage_source/slime/after_attack() + // Slimes stun if they have a power level + if (isslime(attacker)) + var/mob/living/simple_animal/slime/slime = attacker + if (slime.powerlevel) + return + +/* +/datum/damage_source/slime/calculate_damage(mob/living/target, input_damage, target_zone, armour_penetration = 0) + // Determine armour + var/blocked = 0 + if (armour_flag) + var/bio_flag = target.run_armor_check(target_zone || BODY_ZONE_CHEST, BIO, armour_penetration = armour_penetration, silent = TRUE) + var/melee_flag = target.run_armor_check(target_zone || BODY_ZONE_CHEST, MELEE, armour_penetration = armour_penetration) + blocked = (bio_flag + melee_flag) / 2 + if (blocked >= 100) + return 0 + return input_damage * (1 - (blocked / 100)) +*/ + +/// Similar to above, but specific to blobs +/datum/damage_source/blob + +/* +/datum/damage_source/blob/calculate_damage(mob/living/target, input_damage, target_zone, armour_penetration = 0) + // Determine armour + var/blocked = 0 + if (armour_flag) + var/bio_flag = target.run_armor_check(target_zone || BODY_ZONE_CHEST, BIO, armour_penetration = armour_penetration, silent = TRUE) + var/melee_flag = target.run_armor_check(target_zone || BODY_ZONE_CHEST, MELEE, armour_penetration = armour_penetration) + blocked = (bio_flag + melee_flag) / 2 + if (blocked >= 100) + return 0 + return input_damage * (1 - (blocked / 100)) +*/ + +/// Biohazard damage. +/datum/damage_source/biohazard + armour_flag = BIO + +/// Abstract damage. Unavoidable +/datum/damage_source/abstract + +/// Damage caused from bodilly processes +/datum/damage_source/body + +/// Disolving in a swimming pool +/datum/damage_source/dissolving diff --git a/code/modules/health/damage/damage_types/brute.dm b/code/modules/health/damage/damage_types/brute.dm new file mode 100644 index 0000000000000..ee96e0e244efc --- /dev/null +++ b/code/modules/health/damage/damage_types/brute.dm @@ -0,0 +1,15 @@ + +/datum/damage/brute + display_name = "brute" + +/datum/damage/brute/apply_living(mob/living/target, damage, forced = FALSE) + target.adjustBruteLossAbstract(damage, forced) + +/datum/damage/brute/apply_bodypart(obj/item/bodypart/bodypart, damage, forced = FALSE) + bodypart.receive_damage(damage) + +/datum/damage/brute/apply_organ(obj/item/organ/organ, damage, forced = FALSE) + organ.applyOrganDamage(damage) + +/datum/damage/brute/apply_object(obj/target, damage) + target.take_damage(damage, BRUTE) diff --git a/code/modules/health/damage/damage_types/burn.dm b/code/modules/health/damage/damage_types/burn.dm new file mode 100644 index 0000000000000..f7c2f4381ba42 --- /dev/null +++ b/code/modules/health/damage/damage_types/burn.dm @@ -0,0 +1,16 @@ + +/datum/damage/burn + display_name = "burn" + +/datum/damage/burn/apply_living(mob/living/target, damage, forced = FALSE) + target.adjustFireLoss(damage, forced) + +/datum/damage/burn/apply_bodypart(obj/item/bodypart/bodypart, damage, forced = FALSE) + bodypart.receive_damage(burn = damage) + +/datum/damage/burn/apply_organ(obj/item/organ/organ, damage, forced = FALSE) + organ.applyOrganDamage(damage) + +/datum/damage/burn/apply_object(obj/target, damage) + target.take_damage(damage, BURN) + diff --git a/code/modules/health/damage/damage_types/clone.dm b/code/modules/health/damage/damage_types/clone.dm new file mode 100644 index 0000000000000..aaa8efcff63e1 --- /dev/null +++ b/code/modules/health/damage/damage_types/clone.dm @@ -0,0 +1,16 @@ + +/datum/damage/clone + display_name = "cellular" + +/datum/damage/clone/apply_living(mob/living/target, damage, forced = FALSE) + target.adjustCloneLossAbstract(damage, forced) + +/datum/damage/clone/apply_bodypart(obj/item/bodypart/bodypart, damage, forced = FALSE) + bodypart.owner?.adjustCloneLossAbstract(damage, forced) + +/datum/damage/clone/apply_organ(obj/item/organ/organ, damage, forced = FALSE) + organ.owner?.adjustCloneLossAbstract(damage, forced) + +/datum/damage/clone/apply_object(obj/target, damage) + target.take_damage(damage, CLONE) + diff --git a/code/modules/health/damage/damage_types/damage_source.dm b/code/modules/health/damage/damage_types/damage_source.dm new file mode 100644 index 0000000000000..0cb7cba9a53e5 --- /dev/null +++ b/code/modules/health/damage/damage_types/damage_source.dm @@ -0,0 +1,11 @@ + +/datum/damage + var/display_name = "" + +/datum/damage/proc/apply_living(mob/living/target, damage, forced = FALSE) + +/datum/damage/proc/apply_bodypart(obj/item/bodypart/bodypart, damage, forced = FALSE) + +/datum/damage/proc/apply_organ(obj/item/organ/organ, damage, forced = FALSE) + +/datum/damage/proc/apply_object(obj/target, damage) diff --git a/code/modules/health/damage/damage_types/stamina.dm b/code/modules/health/damage/damage_types/stamina.dm new file mode 100644 index 0000000000000..8b25325249d06 --- /dev/null +++ b/code/modules/health/damage/damage_types/stamina.dm @@ -0,0 +1,16 @@ + +/datum/damage/stamina + display_name = "stamina" + +/datum/damage/stamina/apply_living(mob/living/target, damage, forced = FALSE) + target.adjustStaminaLoss(damage, forced) + +/datum/damage/stamina/apply_bodypart(obj/item/bodypart/bodypart, damage, forced = FALSE) + bodypart.receive_damage(stamina = damage) + +/datum/damage/stamina/apply_organ(obj/item/organ/organ, damage, forced = FALSE) + return + +/datum/damage/stamina/apply_object(obj/target, damage) + target.take_damage(damage, STAMINA_DAMTYPE) + diff --git a/code/modules/health/damage/damage_types/suffocation.dm b/code/modules/health/damage/damage_types/suffocation.dm new file mode 100644 index 0000000000000..4b69a80419c00 --- /dev/null +++ b/code/modules/health/damage/damage_types/suffocation.dm @@ -0,0 +1,16 @@ + +/datum/damage/suffocation + display_name = "suffocation" + +/datum/damage/suffocation/apply_living(mob/living/target, damage, forced = FALSE) + target.adjustOxyLoss(damage, forced) + +/datum/damage/suffocation/apply_bodypart(obj/item/bodypart/bodypart, damage, forced = FALSE) + CRASH("Cannot apply oxyloss damage to bodyparts.") + +/datum/damage/suffocation/apply_organ(obj/item/organ/organ, damage, forced = FALSE) + CRASH("Cannot apply oxyloss damage to internal organs.") + +/datum/damage/suffocation/apply_object(obj/target, damage) + target.take_damage(damage, OXY) + diff --git a/code/modules/health/damage/damage_types/toxin.dm b/code/modules/health/damage/damage_types/toxin.dm new file mode 100644 index 0000000000000..a599a7fe449a1 --- /dev/null +++ b/code/modules/health/damage/damage_types/toxin.dm @@ -0,0 +1,16 @@ + +/datum/damage/toxin + display_name = "toxic" + +/datum/damage/toxin/apply_living(mob/living/target, damage, forced = FALSE) + target.adjustToxLoss(damage, forced) + +/datum/damage/toxin/apply_bodypart(obj/item/bodypart/bodypart, damage, forced = FALSE) + CRASH("Cannot apply toxin damage to bodyparts.") + +/datum/damage/toxin/apply_organ(obj/item/organ/organ, damage, forced = FALSE) + organ.applyOrganDamage(damage) + +/datum/damage/toxin/apply_object(obj/target, damage) + target.take_damage(damage, TOX) + diff --git a/code/modules/health/damage/systemic_damage/apply_bleeding.dm b/code/modules/health/damage/systemic_damage/apply_bleeding.dm new file mode 100644 index 0000000000000..6b1c9c6a26a3a --- /dev/null +++ b/code/modules/health/damage/systemic_damage/apply_bleeding.dm @@ -0,0 +1,9 @@ + +/** + * Causes the atom to start bleeding + */ +/atom/proc/apply_bleeding(bleed_amount, max_intensity) + return + +/mob/living/carbon/human/apply_bleeding(bleed_amount, max_intensity) + bleed_rate = max(bleed_rate + bleed_amount, max_intensity) diff --git a/code/modules/health/damage/systemic_damage/apply_damage.dm b/code/modules/health/damage/systemic_damage/apply_damage.dm new file mode 100644 index 0000000000000..991ac93764a93 --- /dev/null +++ b/code/modules/health/damage/systemic_damage/apply_damage.dm @@ -0,0 +1,25 @@ +/** + * Apply the damage to whatever we are targetting. + */ +/atom/proc/damage_apply_damage(datum/damage_source/source) + return + +/mob/living/damage_apply_damage(datum/damage_source/source) + // Apply the damage + var/datum/damage/damage = GET_DAMAGE(source.damage_type) + damage.apply_living(src, source.damage_amount) + +/obj/damage_apply_damage(datum/damage_source/source) + // Apply the damage + var/datum/damage/damage = GET_DAMAGE(source.damage_type) + damage.apply_object(src, source.damage_amount) + +/obj/item/bodypart/damage_apply_damage(datum/damage_source/source) + // Apply the damage + var/datum/damage/damage = GET_DAMAGE(source.damage_type) + damage.apply_bodypart(src, source.damage_amount) + +/obj/item/organ/damage_apply_damage(datum/damage_source/source) + // Apply the damage + var/datum/damage/damage = GET_DAMAGE(source.damage_type) + damage.apply_organ(src, source.damage_amount) diff --git a/code/modules/health/damage/systemic_damage/apply_dismemberment.dm b/code/modules/health/damage/systemic_damage/apply_dismemberment.dm new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/code/modules/health/damage/systemic_damage/armour_penetration.dm b/code/modules/health/damage/systemic_damage/armour_penetration.dm new file mode 100644 index 0000000000000..9ad2f8fea4fa8 --- /dev/null +++ b/code/modules/health/damage/systemic_damage/armour_penetration.dm @@ -0,0 +1,13 @@ + +/** + * Get the armour penetration value of this item as the attacker + * and mutate source with that. + */ +/atom/proc/damage_get_armour_penetration(datum/damage_source/source) + return + +/obj/item/damage_get_armour_penetration(datum/damage_source/source) + source.armour_penetration = armour_penetration + +/mob/living/simple_animal/damage_get_armour_penetration(datum/damage_source/source) + source.armour_penetration = armour_penetration diff --git a/code/modules/health/damage/systemic_damage/calculate_armour.dm b/code/modules/health/damage/systemic_damage/calculate_armour.dm new file mode 100644 index 0000000000000..47ce64ac98d2c --- /dev/null +++ b/code/modules/health/damage/systemic_damage/calculate_armour.dm @@ -0,0 +1,42 @@ + +/** + * Runs the damage armour subroutine and mutates the state + * to account for any modifications that come as a result of + * armour. + */ +/atom/proc/damage_run_armour(datum/damage_source/source) + return + +/** + * Mobs: + * Reduce damage according to armour. + * Mutate the damage source if required. + */ +/mob/living/damage_run_armour(datum/damage_source/source) + var/armour_value = run_armor_check(source.target_zone || BODY_ZONE_CHEST, source.armour_flag, armour_penetration = source.armour_penetration) + // The armour was fully effective + if (armour_value >= 100) + source.damage_amount = 0 + return + source.damage_amount = source.damage_amount * (1 - (armour_value / 100)) * (source.weapon ? check_weakness(source.weapon, src) : 1) + +/mob/living/simple_animal/damage_run_armour(datum/damage_source/source) + . = ..() + // Convert damage coeff + source.damage_amount = source.damage_amount * damage_coeff[source.damage_type] + // Simple animals can entirely deflect damage + if (is_damage_deflected(source.damage_amount)) + source.damage_amount = 0 + return + +/** + * Mobs: + * Mutate damage to reduce it according to armour block. + */ +/obj/damage_run_armour(datum/damage_source/source) + var/armour_value = run_obj_armor(source.damage_type, source.armour_flag, armour_penetration = source.armour_penetration) + // The armour was fully effective + if (armour_value >= 100) + source.damage_amount = 0 + return + source.damage_amount = source.damage_amount * (1 - (armour_value / 100)) diff --git a/code/modules/health/damage/systemic_damage/display_attack_message.dm b/code/modules/health/damage/systemic_damage/display_attack_message.dm new file mode 100644 index 0000000000000..319b081fd163b --- /dev/null +++ b/code/modules/health/damage/systemic_damage/display_attack_message.dm @@ -0,0 +1,15 @@ +/** + * Display the attack message from the item used + */ +/atom/proc/display_attack_message(datum/damage_source/source) + return + +/obj/item/display_attack_message(datum/damage_source/source) + if (isliving(source.target)) + var/mob/living/target = source.target + target.send_item_attack_message(src, source.attacker, parse_zone(source.target_zone)) + +/mob/living/carbon/alien/humanoid/display_attack_message(datum/damage_source/source) + playsound(loc, 'sound/weapons/slash.ogg', 25, 1, -1) + source.target.visible_message("[src] slashes at [source.target]!", \ + "[src] slashes at you!") diff --git a/code/modules/health/damage/systemic_damage/locate_target.dm b/code/modules/health/damage/systemic_damage/locate_target.dm new file mode 100644 index 0000000000000..52627b93937df --- /dev/null +++ b/code/modules/health/damage/systemic_damage/locate_target.dm @@ -0,0 +1,21 @@ + +/** + * Identify the target of our attack. For most things, we are just going + * to attack ourselves however for certain objects we may want to relay the + * damage to another source, such as mobs relaying the damage to limbs. + */ +/atom/proc/damage_get_target(datum/damage_source/source) + return + +/mob/living/carbon/damage_get_target(datum/damage_source/source) + // Attack the mob as a whole + if (!source.target_zone) + return + var/obj/item/bodypart/targetted_bodypart = get_bodypart(check_zone(source.target_zone)) + if (targetted_bodypart) + source.target = targetted_bodypart + return + targetted_bodypart = pick(bodyparts) + if (istype(targetted_bodypart)) + source.target = targetted_bodypart + return diff --git a/code/modules/health/damage/systemic_damage/on_damage.dm b/code/modules/health/damage/systemic_damage/on_damage.dm new file mode 100644 index 0000000000000..856ee9a1db390 --- /dev/null +++ b/code/modules/health/damage/systemic_damage/on_damage.dm @@ -0,0 +1,6 @@ +/** + * Called whenever the atom takes any form of damage from any + * source, abstract source or item souorce. + * Called from damage_source.apply_direct or damage_source.deal_attack + */ +/atom/proc/on_damaged() diff --git a/code/modules/holiday/halloween.dm b/code/modules/holiday/halloween.dm index 820f41b057cf3..89b012cb2e198 100644 --- a/code/modules/holiday/halloween.dm +++ b/code/modules/holiday/halloween.dm @@ -168,7 +168,7 @@ step(I,direction) return -/mob/living/simple_animal/shade/howling_ghost/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/shade/howling_ghost/adjustHealth(amount, forced = FALSE) . = 0 /////////////////////////// @@ -225,12 +225,13 @@ /mob/living/simple_animal/hostile/retaliate/clown/insane/AttackingTarget() return -/mob/living/simple_animal/hostile/retaliate/clown/insane/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/retaliate/clown/insane/adjustHealth(amount, forced = FALSE) . = 0 if(prob(5)) playsound(loc, 'sound/spookoween/insane_low_laugh.ogg', 300, 1) -/mob/living/simple_animal/hostile/retaliate/clown/insane/attackby(obj/item/O, mob/user) +///TODO: Convert to on_damage +/mob/living/simple_animal/hostile/retaliate/clown/insane/item_interact(obj/item/O, mob/user) if(istype(O, /obj/item/nullrod)) if(prob(5)) visible_message("[src] finally found the peace it deserves. You hear honks echoing off into the distance.") @@ -238,8 +239,9 @@ qdel(src) else visible_message("[src] seems to be resisting the effect!") + return TRUE else - ..() + return ..() /mob/living/simple_animal/hostile/retaliate/clown/insane/handle_temperature_damage() return diff --git a/code/modules/holodeck/area_copy.dm b/code/modules/holodeck/area_copy.dm index a80e470ddd88b..0f5e58e6fb4fd 100644 --- a/code/modules/holodeck/area_copy.dm +++ b/code/modules/holodeck/area_copy.dm @@ -35,7 +35,7 @@ GLOBAL_LIST_INIT(duplicate_forbidden_vars,list( if(nerf && isitem(O)) var/obj/item/I = O - I.damtype = STAMINA // thou shalt not + I.damtype = STAMINA_DAMTYPE // thou shalt not N.update_icon() if(ismachinery(O)) diff --git a/code/modules/holodeck/computer.dm b/code/modules/holodeck/computer.dm index fa7f8e55e15b0..46262e05f319b 100644 --- a/code/modules/holodeck/computer.dm +++ b/code/modules/holodeck/computer.dm @@ -368,7 +368,7 @@ and clear when youre done! if you dont i will use :newspaper2: on you if (!nerf_this && is_loading) return for(var/obj/item/to_be_nerfed in spawned) - to_be_nerfed.damtype = nerf_this ? STAMINA : initial(to_be_nerfed.damtype) + to_be_nerfed.damtype = nerf_this ? STAMINA_DAMTYPE : initial(to_be_nerfed.damtype) for(var/obj/effect/holodeck_effect/holo_effect as anything in effects) holo_effect.safety(nerf_this) diff --git a/code/modules/holodeck/items.dm b/code/modules/holodeck/items.dm index 3510e090af54d..673dc3a217172 100644 --- a/code/modules/holodeck/items.dm +++ b/code/modules/holodeck/items.dm @@ -8,7 +8,7 @@ // /obj/item/holo - damtype = STAMINA + damtype = /datum/damage/stamina /obj/item/holo/esword name = "holographic energy sword" @@ -41,7 +41,7 @@ return ..() return 0 -/obj/item/holo/esword/attack(target as mob, mob/user as mob) +/obj/item/holo/esword/attack_mob_target(target as mob, mob/user as mob) ..() /obj/item/holo/esword/Initialize(mapload) @@ -87,7 +87,7 @@ if((ishuman(hit_atom))) var/mob/living/carbon/M = hit_atom playsound(src, 'sound/items/dodgeball.ogg', 50, 1) - M.apply_damage(10, STAMINA) + M.apply_damage(/datum/damage_source/impact, /datum/damage/stamina, 10) if(prob(5)) M.Paralyze(60) visible_message("[M] is knocked right off [M.p_their()] feet!") @@ -104,10 +104,12 @@ anchored = TRUE density = TRUE -/obj/structure/holohoop/attackby(obj/item/W as obj, mob/user as mob, params) +/obj/structure/holohoop/item_interact(obj/item/W as obj, mob/user as mob, params) if(get_dist(src,user)<2) if(user.transferItemToLoc(W, drop_location())) visible_message(" [user] dunks [W] into \the [src]!") + return TRUE + return FALSE /obj/structure/holohoop/attack_hand(mob/user) . = ..() @@ -165,8 +167,8 @@ to_chat(user, "You are too primitive to use this device!") return -/obj/machinery/readybutton/attackby(obj/item/W as obj, mob/user as mob, params) - to_chat(user, "The device is a solid button, there's nothing you can do with it!") +/obj/machinery/readybutton/item_interact(obj/item/W as obj, mob/user as mob, params) + return FALSE /obj/machinery/readybutton/attack_hand(mob/user as mob) . = ..() @@ -217,9 +219,10 @@ /obj/machinery/conveyor/holodeck -/obj/machinery/conveyor/holodeck/attackby(obj/item/I, mob/user, params) +/obj/machinery/conveyor/holodeck/item_interact(obj/item/I, mob/user, params) if(!user.transferItemToLoc(I, drop_location())) return ..() + return TRUE /obj/item/paper/fluff/holodeck/trek_diploma name = "paper - Starfleet Academy Diploma" @@ -240,8 +243,8 @@ /obj/vehicle/ridden/scooter/skateboard/pro/holodeck/pick_up_board() //picking up normal skateboards spawned in the holodeck gets rid of the holo flag, now you cant pick them up. return -/obj/vehicle/ridden/scooter/skateboard/pro/holodeck/attackby(obj/item/I, mob/user, params) +/obj/vehicle/ridden/scooter/skateboard/pro/holodeck/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/stack/rods)) - return + return TRUE else return ..() diff --git a/code/modules/holodeck/turfs.dm b/code/modules/holodeck/turfs.dm index 8b86c2b343f5a..0920f7dfd31f8 100644 --- a/code/modules/holodeck/turfs.dm +++ b/code/modules/holodeck/turfs.dm @@ -5,8 +5,8 @@ flags_1 = NONE var/direction = SOUTH -/turf/open/floor/holofloor/attackby(obj/item/I, mob/living/user) - return // HOLOFLOOR DOES NOT GIVE A FUCK +/turf/open/floor/holofloor/item_interact(obj/item/I, mob/living/user) + return FALSE // HOLOFLOOR DOES NOT GIVE A FUCK /turf/open/floor/holofloor/tool_act(mob/living/user, obj/item/I, tool_type) return diff --git a/code/modules/holoparasite/holoparasite_damage.dm b/code/modules/holoparasite/holoparasite_damage.dm new file mode 100644 index 0000000000000..c28b698ae8ec5 --- /dev/null +++ b/code/modules/holoparasite/holoparasite_damage.dm @@ -0,0 +1,198 @@ +/mob/living/simple_animal/hostile/holoparasite + /// The cooldown for whenever to do the visible 'recoil' to the summoner from a holoparasite taking damage. + COOLDOWN_DECLARE(recoil_cooldown) + +/** + * Handles brute damage for the holoparasite, transferring it to the summoner. + */ +/mob/living/simple_animal/hostile/holoparasite/adjustBruteLossAbstract(amount, forced) + // No, you can't heal the holopara. + if(!forced && amount <= 0) + return + if(!summoner.current) + return + // Spread damage across different bodyparts. + summoner.current.take_overall_damage(brute = amount) + extra_host_damage(amount * 0.5) + if(COOLDOWN_FINISHED(src, recoil_cooldown) && prob(70)) + var/holoparasite_visible = isturf(summoner.current.loc) && isturf(loc) && (src in viewers(world.view, summoner.current)) + if(iscarbon(summoner.current)) + var/mob/living/carbon/carbon_summoner = summoner.current + carbon_summoner.vomit(lost_nutrition = 0, blood = TRUE, stun = FALSE, distance = HOLOPARA_CALC_BLOOD_RECOIL_DISTANCE(amount), message = FALSE) + else + summoner.current.add_splatter_floor() + recoil_scream() + to_chat(summoner.current, "You painfully cough up blood as [color_name] takes damage!") + summoner.current.visible_message("[summoner.current] painfully coughs up blood[holoparasite_visible ? " as [color_name] takes damage" : ""]!", vision_distance = HOLOPARA_SUMMONER_DAMAGE_VISION_RANGE) + COOLDOWN_START(src, recoil_cooldown, HOLOPARA_VISIBLE_RECOIL_COOLDOWN) + +/** + * Handles burn damage for the holoparasite, transferring it to the summoner. + */ +/mob/living/simple_animal/hostile/holoparasite/adjustFireLoss(amount, forced) + // No, you can't heal the holopara. + if(!forced && amount <= 0) + return + if(!summoner.current) + return + summoner.current.take_overall_damage(burn = amount) + extra_host_damage(amount * 0.5) + if(COOLDOWN_FINISHED(src, recoil_cooldown) && prob(70)) + var/holoparasite_visible = isturf(summoner.current.loc) && isturf(loc) && (src in viewers(world.view, summoner.current)) + recoil_scream() + to_chat(summoner.current, "Your body burns [color_name] takes damage!") + summoner.current.visible_message("[summoner.current] cringes with pain, burns and blisters taking form on [summoner.current.p_their()] skin[holoparasite_visible ? " as [color_name] takes damage" : ""]!", vision_distance = HOLOPARA_SUMMONER_DAMAGE_VISION_RANGE) + COOLDOWN_START(src, recoil_cooldown, HOLOPARA_VISIBLE_RECOIL_COOLDOWN) + + +/mob/living/simple_animal/hostile/holoparasite/updatehealth() + . = ..() + update_health_hud() + +/** + * Negates oxygen damage for the holoparasite - it's a bluespace crystallization, it does not breathe. + */ +/mob/living/simple_animal/hostile/holoparasite/adjustOxyLoss(amount, forced) + return FALSE + +/** + * Negates toxin damage for the holoparasite - it's a bluespace crystallization, it can't be poisoned. + */ +/mob/living/simple_animal/hostile/holoparasite/adjustToxLoss(amount, forced) + return FALSE + +/** + * Negates stamina damage for the holoparasite - it's a bluespace crystallization, it has no stamina. + */ +/mob/living/simple_animal/hostile/holoparasite/adjustStaminaLoss(amount, forced) + return FALSE + +/** + * Negates cellular damage for the holoparasite - it's a bluespace crystallization, it has no cells. + */ +/mob/living/simple_animal/hostile/holoparasite/adjustCloneLossAbstract(amount, forced) + return FALSE + +/** + * Handles the random chance for the summoner to scream when taking recoil damage. + */ +/mob/living/simple_animal/hostile/holoparasite/proc/recoil_scream() + if(summoner.current.stat == CONSCIOUS && prob(HOLOPARA_RECOIL_SCREAM_PROB)) + summoner.current.emote("scream") + +/** + * Deal extra brain damage to the host (or clone damage, if they don't have a real brain), whenever they're in crit or unconscious. + * + * Arguments + * * amount: How much damage to deal (in either brain damage, or clone damage if they lack a brain). + */ +/mob/living/simple_animal/hostile/holoparasite/proc/extra_host_damage(amount) + // NOTE: checking unconscious and not sleeping here is intentional! ~Lucy + if(!summoner.current || !(summoner.current.IsUnconscious() || summoner.current.InCritical())) + return + // No brain? Ah whatever, just deal clone damage. + var/obj/item/organ/brain/brain = summoner.current.getorganslot(ORGAN_SLOT_BRAIN) + if(!brain || brain.decoy_override) + to_chat(summoner.current, "You feel your body strain as [color_name] takes damage!") + var/datum/damage_source/abstract/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(summoner.current, CLONE, amount) + return + to_chat(summoner.current, "You feel your mind strain as [color_name] takes damage!") + brain.applyOrganDamage(amount, HOLOPARA_MAX_BRAIN_DAMAGE) + +/** + * A holoparasite does not sense through traditional methods, therefore it is immune to being flashed. + */ +/mob/living/simple_animal/hostile/holoparasite/flash_act(intensity = 1, override_blindness_check = FALSE, affect_silicon = FALSE, visual = FALSE, type = /atom/movable/screen/fullscreen/flash) + return FALSE + +/** + * A holoparasite does not sense through traditional methods, therefore it is immune to being banged. + */ +/mob/living/simple_animal/hostile/holoparasite/soundbang_act() + return FALSE + +/** + * A holoparasite's crystalline structure is unaffected by fire. + */ +/mob/living/simple_animal/hostile/holoparasite/fire_act() + return FALSE + +/** + * A holoparasite's crystalline structure is unaffected by radiation. + */ +/mob/living/simple_animal/hostile/holoparasite/rad_act(amount) + return FALSE + +/** + * An un-manifested holoparasite will be immune to EMPs, i.e in the case of a dextrous holoparasite. + */ +/mob/living/simple_animal/hostile/holoparasite/emp_act(severity) + if(incorporeal_move || !is_manifested()) + return EMP_PROTECT_SELF | EMP_PROTECT_CONTENTS + return ..() + +/** + * Nar'Sie is the summoner's problem to deal with. Not the holoparasite's. + */ +/mob/living/simple_animal/hostile/holoparasite/narsie_act() + return FALSE + +/** + * Ratvar is the summoner's problem to deal with. Not the holoparasite's. + */ +/mob/living/simple_animal/hostile/holoparasite/ratvar_act() + return FALSE + +/** + * Holoparasites are NOT physically soft like flesh. + */ +/mob/living/simple_animal/hostile/holoparasite/can_inject(mob/user, error_msg, target_zone, penetrate_thick = FALSE) + return FALSE + +/mob/living/simple_animal/hostile/holoparasite/ex_act(severity, target) + if(incorporeal_move || !is_manifested()) + return + switch(severity) + if(EXPLODE_DEVASTATE) + if(stats.defense >= 5) + // With max defense, you can BARELY survive this around full health, but it will hurt HORRIBLY. + if(iscarbon(summoner.current)) + var/mob/living/carbon/carbon_summoner = summoner.current + carbon_summoner.vomit(lost_nutrition = 0, blood = TRUE, stun = FALSE, distance = 5, message = FALSE) + carbon_summoner.take_overall_damage(brute = carbon_summoner.maxHealth * 1.1, stamina = summoner.current.maxHealth * 1.5) + else + summoner.current.add_splatter_floor() + summoner.current.take_overall_damage(brute = summoner.current.maxHealth * 0.9, stamina = summoner.current.maxHealth * 1.5) + to_chat(summoner.current, "You violently cough up blood, barely surviving as an explosion nearly tears apart [color_name], causing you to collapse in incredible, agonizing pain!") + summoner.current.visible_message("[summoner.current] violently coughs up blood, collapsing to the ground in incredible pain!") + summoner.current.AdjustParalyzed(45 SECONDS, ignore_canstun = TRUE) + summoner.current.jitteriness = min(summoner.current.jitteriness + 180, 180) + SSblackbox.record_feedback("tally", "holoparasite_exploded", 1, "devastate (survived)") + else + // RIP. + var/list/possible_splatter_tiles = list() + for(var/turf/open/open_turf in view(1, summoner.current)) + possible_splatter_tiles += open_turf + for(var/i = 1 to rand(3, 5)) + if(length(possible_splatter_tiles)) + summoner.current.add_splatter_floor(pick(possible_splatter_tiles)) + if(iscarbon(summoner.current)) + var/mob/living/carbon/carbon_summoner = summoner.current + carbon_summoner.vomit(lost_nutrition = 0, blood = TRUE, stun = FALSE, distance = 5, message = FALSE) + summoner.current.visible_message("[summoner.current] violently coughs up an incredible amount of blood, collapsing to the ground, seemingly dead.") + SSblackbox.record_feedback("tally", "holoparasite_exploded", 1, "devastate (gibbed)") + gib() + if(EXPLODE_HEAVY) + summoner.current.take_overall_damage(brute = summoner.current.maxHealth * 0.6, stamina = summoner.current.maxHealth * 0.6) + summoner.current.jitteriness = min(summoner.current.jitteriness + 90, 90) + SSblackbox.record_feedback("tally", "holoparasite_exploded", 1, "heavy") + if(EXPLODE_LIGHT) + summoner.current.take_overall_damage(brute = summoner.current.maxHealth * 0.3, stamina = summoner.current.maxHealth * 0.45) + summoner.current.jitteriness = min(summoner.current.jitteriness + 45, 45) + SSblackbox.record_feedback("tally", "holoparasite_exploded", 1, "light") + +/mob/living/simple_animal/hostile/holoparasite/gib() + if(summoner.current) + to_chat(summoner.current, "Your [color_name] was blown up!") + parent_holder.death_of_the_author(summoner.current) diff --git a/code/modules/hydroponics/beekeeping/beebox.dm b/code/modules/hydroponics/beekeeping/beebox.dm index 2876c7c2935ac..cb91ab2cfd4ee 100644 --- a/code/modules/hydroponics/beekeeping/beebox.dm +++ b/code/modules/hydroponics/beekeeping/beebox.dm @@ -144,26 +144,26 @@ . += "There's no room for more honeycomb!" -/obj/structure/beebox/attackby(obj/item/I, mob/user, params) +/obj/structure/beebox/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/honey_frame)) var/obj/item/honey_frame/HF = I if(honey_frames.len < BEEBOX_MAX_FRAMES) visible_message("[user] adds a frame to the apiary.") if(!user.transferItemToLoc(HF, src)) - return + return TRUE honey_frames += HF else to_chat(user, "There's no room for any more frames in the apiary!") - return + return TRUE if(I.tool_behaviour == TOOL_WRENCH) if(default_unfasten_wrench(user, I, time = 20)) - return + return TRUE if(istype(I, /obj/item/queen_bee)) if(queen_bee) to_chat(user, "This hive already has a queen!") - return + return TRUE var/obj/item/queen_bee/qb = I user.temporarilyRemoveItemFromInventory(qb) @@ -191,9 +191,9 @@ to_chat(user, "The queen bee disappeared! Disappearing bees have been in the news lately...") qdel(qb) - return + return TRUE - ..() + return ..() /obj/structure/beebox/interact(mob/user) . = ..() diff --git a/code/modules/hydroponics/biogenerator.dm b/code/modules/hydroponics/biogenerator.dm index 193cd5237fe70..5f6cdac451141 100644 --- a/code/modules/hydroponics/biogenerator.dm +++ b/code/modules/hydroponics/biogenerator.dm @@ -81,13 +81,10 @@ icon_state = "biogen-work" return -/obj/machinery/biogenerator/attackby(obj/item/O, mob/user, params) - if(user.a_intent == INTENT_HARM) - return ..() - +/obj/machinery/biogenerator/item_interact(obj/item/O, mob/user, params) if(processing) to_chat(user, "The biogenerator is currently processing.") - return + return TRUE if(default_deconstruction_screwdriver(user, "biogen-empty-o", "biogen-empty", O)) if(beaker) @@ -96,10 +93,10 @@ beaker = null ui_update() update_icon() - return + return TRUE if(default_deconstruction_crowbar(O)) - return + return TRUE if(istype(O, /obj/item/reagent_containers/glass)) . = 1 //no afterattack @@ -108,14 +105,14 @@ to_chat(user, "A container is already loaded into the machine.") else if(!user.transferItemToLoc(O, src)) - return + return TRUE beaker = O to_chat(user, "You add the container to the machine.") update_icon() ui_update() else to_chat(user, "Close the maintenance panel first.") - return + return TRUE else if(istype(O, /obj/item/storage/bag/plants)) var/obj/item/storage/bag/plants/PB = O @@ -166,6 +163,7 @@ return TRUE else to_chat(user, "You cannot put this in [src.name]!") + return TRUE /obj/machinery/biogenerator/AltClick(mob/living/user) if(user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK) && can_interact(user)) diff --git a/code/modules/hydroponics/fermenting_barrel.dm b/code/modules/hydroponics/fermenting_barrel.dm index c94dc308d974c..859a128b79c84 100644 --- a/code/modules/hydroponics/fermenting_barrel.dm +++ b/code/modules/hydroponics/fermenting_barrel.dm @@ -38,7 +38,7 @@ qdel(fruit) playsound(src, 'sound/effects/bubbles.ogg', 50, TRUE) -/obj/structure/fermenting_barrel/attackby(obj/item/I, mob/user, params) +/obj/structure/fermenting_barrel/item_interact(obj/item/I, mob/user, params) var/obj/item/reagent_containers/food/snacks/grown/fruit = I if(istype(fruit)) if(!fruit.can_distill) diff --git a/code/modules/hydroponics/gene_modder.dm b/code/modules/hydroponics/gene_modder.dm index af2ed908346ef..bf104516cc01a 100644 --- a/code/modules/hydroponics/gene_modder.dm +++ b/code/modules/hydroponics/gene_modder.dm @@ -68,37 +68,39 @@ if(panel_open) add_overlay("dnamod-open") -/obj/machinery/plantgenes/attackby(obj/item/I, mob/user, params) +/obj/machinery/plantgenes/item_interact(obj/item/I, mob/user, params) if(default_deconstruction_screwdriver(user, "dnamod", "dnamod", I)) update_icon() - return + return TRUE if(default_deconstruction_crowbar(I)) - return + return TRUE if(iscyborg(user)) - return + return FALSE if(istype(I, /obj/item/seeds)) if (operation) to_chat(user, "Please complete current operation.") - return + return TRUE if(!user.transferItemToLoc(I, src)) - return + return TRUE eject_seed() insert_seed(I) to_chat(user, "You add [I] to the machine.") interact(user) + return TRUE else if(istype(I, /obj/item/disk/plantgene)) if (operation) to_chat(user, "Please complete current operation.") - return + return TRUE if(!user.transferItemToLoc(I, src)) - return + return TRUE eject_disk() disk = I to_chat(user, "You add [I] to the machine.") interact(user) + return TRUE else - ..() + return ..() /obj/machinery/plantgenes/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm index d27af0811c81c..ac1c16559cdd5 100644 --- a/code/modules/hydroponics/grown.dm +++ b/code/modules/hydroponics/grown.dm @@ -67,8 +67,7 @@ if(T.examine_line) . += T.examine_line -/obj/item/reagent_containers/food/snacks/grown/attackby(obj/item/O, mob/user, params) - ..() +/obj/item/reagent_containers/food/snacks/grown/item_interact(obj/item/O, mob/user, params) if (istype(O, /obj/item/plant_analyzer)) var/msg = "This is \a [src].\n" if(seed) @@ -83,10 +82,13 @@ if(reag_txt) msg += reag_txt to_chat(user, EXAMINE_BLOCK(msg)) + return TRUE else if(seed) for(var/datum/plant_gene/trait/T in seed.genes) T.on_attackby(src, O, user) + return TRUE + return ..() // Various gene procs diff --git a/code/modules/hydroponics/grown/corn.dm b/code/modules/hydroponics/grown/corn.dm index 66abbc97b057e..ec00f1cd304df 100644 --- a/code/modules/hydroponics/grown/corn.dm +++ b/code/modules/hydroponics/grown/corn.dm @@ -40,11 +40,12 @@ throw_speed = 3 throw_range = 7 -/obj/item/grown/corncob/attackby(obj/item/W, mob/user, params) +/obj/item/grown/corncob/item_interact(obj/item/W, mob/user, params) if(W.is_sharp()) to_chat(user, "You use [W] to fashion a pipe out of the corn cob!") new /obj/item/clothing/mask/cigarette/pipe/cobpipe (user.loc) qdel(src) + return TRUE else return ..() diff --git a/code/modules/hydroponics/grown/flowers.dm b/code/modules/hydroponics/grown/flowers.dm index e3cb0b0c8797e..d6633cd078901 100644 --- a/code/modules/hydroponics/grown/flowers.dm +++ b/code/modules/hydroponics/grown/flowers.dm @@ -202,7 +202,7 @@ icon_state = "sunflower" lefthand_file = 'icons/mob/inhands/weapons/plants_lefthand.dmi' righthand_file = 'icons/mob/inhands/weapons/plants_righthand.dmi' - damtype = BURN + damtype = /datum/damage/burn force = 0 slot_flags = ITEM_SLOT_HEAD throwforce = 0 @@ -223,7 +223,7 @@ SEND_SIGNAL(user, COMSIG_CLEAR_MOOD_EVENT, "flower_worn") -/obj/item/grown/sunflower/attack(mob/M, mob/user) +/obj/item/grown/sunflower/attack_mob_target(mob/M, mob/user) to_chat(M, " [user] smacks you with a sunflower! FLOWER POWER") to_chat(user, "Your sunflower's FLOWER POWER strikes [M]") @@ -276,7 +276,7 @@ icon_state = "novaflower" lefthand_file = 'icons/mob/inhands/weapons/plants_lefthand.dmi' righthand_file = 'icons/mob/inhands/weapons/plants_righthand.dmi' - damtype = BURN + damtype = /datum/damage/burn force = 0 slot_flags = ITEM_SLOT_HEAD throwforce = 0 @@ -291,7 +291,7 @@ ..() force = round((5 + seed.potency / 5), 1) -/obj/item/grown/novaflower/attack(mob/living/carbon/M, mob/user) +/obj/item/grown/novaflower/attack_mob_target(mob/living/carbon/M, mob/user) if(!..()) return if(isliving(M)) diff --git a/code/modules/hydroponics/grown/nettle.dm b/code/modules/hydroponics/grown/nettle.dm index 154a3cdbcda33..3c17585249371 100644 --- a/code/modules/hydroponics/grown/nettle.dm +++ b/code/modules/hydroponics/grown/nettle.dm @@ -36,7 +36,7 @@ icon_state = "nettle" lefthand_file = 'icons/mob/inhands/weapons/plants_lefthand.dmi' righthand_file = 'icons/mob/inhands/weapons/plants_righthand.dmi' - damtype = BURN + damtype = /datum/damage/burn force = 15 hitsound = 'sound/weapons/bladeslice.ogg' throwforce = 5 @@ -103,7 +103,7 @@ user.Paralyze(100) to_chat(user, "You are stunned by [src] as you try picking it up!") -/obj/item/reagent_containers/food/snacks/grown/nettle/death/attack(mob/living/M, mob/user) +/obj/item/reagent_containers/food/snacks/grown/nettle/death/attack_mob_target(mob/living/M, mob/user) if(!M.can_inject(user) && user.a_intent == INTENT_HARM) to_chat(user, "The [src] harmlessly bounces off of [M]! They're protected from its needles!") return FALSE diff --git a/code/modules/hydroponics/grown/potato.dm b/code/modules/hydroponics/grown/potato.dm index 3e4817e792bc0..85b6a8b83d471 100644 --- a/code/modules/hydroponics/grown/potato.dm +++ b/code/modules/hydroponics/grown/potato.dm @@ -37,13 +37,14 @@ bitesize = 100 -/obj/item/reagent_containers/food/snacks/grown/potato/attackby(obj/item/W, mob/user, params) +/obj/item/reagent_containers/food/snacks/grown/potato/item_interact(obj/item/W, mob/user, params) if(W.is_sharp()) to_chat(user, "You cut the potato into wedges with [W].") var/obj/item/reagent_containers/food/snacks/grown/potato/wedges/Wedges = new /obj/item/reagent_containers/food/snacks/grown/potato/wedges remove_item_from_storage(user) qdel(src) user.put_in_hands(Wedges) + return TRUE else return ..() diff --git a/code/modules/hydroponics/grown/pumpkin.dm b/code/modules/hydroponics/grown/pumpkin.dm index e893797835ae4..91b8aa94cda70 100644 --- a/code/modules/hydroponics/grown/pumpkin.dm +++ b/code/modules/hydroponics/grown/pumpkin.dm @@ -27,12 +27,12 @@ juice_results = list(/datum/reagent/consumable/pumpkinjuice = 0) wine_power = 20 -/obj/item/reagent_containers/food/snacks/grown/pumpkin/attackby(obj/item/W as obj, mob/user as mob, params) +/obj/item/reagent_containers/food/snacks/grown/pumpkin/item_interact(obj/item/W as obj, mob/user as mob, params) if(W.is_sharp()) user.show_message("You carve a face into [src]!", MSG_VISUAL) new /obj/item/clothing/head/hardhat/pumpkinhead(user.loc) qdel(src) - return + return TRUE else return ..() diff --git a/code/modules/hydroponics/grown/root.dm b/code/modules/hydroponics/grown/root.dm index faf8ce4cef259..10ab4e2cd06fc 100644 --- a/code/modules/hydroponics/grown/root.dm +++ b/code/modules/hydroponics/grown/root.dm @@ -25,13 +25,14 @@ juice_results = list(/datum/reagent/consumable/carrotjuice = 0) wine_power = 30 -/obj/item/reagent_containers/food/snacks/grown/carrot/attackby(obj/item/I, mob/user, params) +/obj/item/reagent_containers/food/snacks/grown/carrot/item_interact(obj/item/I, mob/user, params) if(I.is_sharp()) to_chat(user, "You sharpen the carrot into a shiv with [I].") var/obj/item/kitchen/knife/carrotshiv/Shiv = new /obj/item/kitchen/knife/carrotshiv remove_item_from_storage(user) qdel(src) user.put_in_hands(Shiv) + return TRUE else return ..() diff --git a/code/modules/hydroponics/grown/tomato.dm b/code/modules/hydroponics/grown/tomato.dm index 26c8d79d60c36..a4c2415615869 100644 --- a/code/modules/hydroponics/grown/tomato.dm +++ b/code/modules/hydroponics/grown/tomato.dm @@ -131,7 +131,7 @@ distill_reagent = /datum/reagent/consumable/ethanol/demonsblood discovery_points = 300 -/obj/item/reagent_containers/food/snacks/grown/tomato/killer/attack(mob/M, mob/user, def_zone) +/obj/item/reagent_containers/food/snacks/grown/tomato/killer/attack_mob_target(mob/M, mob/user, def_zone) if(awakening) to_chat(user, "The tomato is twitching and shaking, preventing you from eating it.") return @@ -145,7 +145,7 @@ awakening = TRUE log_game("[key_name(user)] awakened a killer tomato at [AREACOORD(user)].") addtimer(CALLBACK(src, PROC_REF(make_killer_tomato)), 30) - + /obj/item/reagent_containers/food/snacks/grown/tomato/killer/proc/make_killer_tomato() if(!QDELETED(src)) var/mob/living/simple_animal/hostile/killertomato/K = new /mob/living/simple_animal/hostile/killertomato(get_turf(src.loc)) diff --git a/code/modules/hydroponics/grown/towercap.dm b/code/modules/hydroponics/grown/towercap.dm index 617046ee8b31c..17370c97514e1 100644 --- a/code/modules/hydroponics/grown/towercap.dm +++ b/code/modules/hydroponics/grown/towercap.dm @@ -50,7 +50,7 @@ /obj/item/reagent_containers/food/snacks/grown/ambrosia, /obj/item/reagent_containers/food/snacks/grown/wheat)) -/obj/item/grown/log/attackby(obj/item/W, mob/user, params) +/obj/item/grown/log/item_interact(obj/item/W, mob/user, params) if(W.is_sharp()) user.show_message("You make [plank_name] out of \the [src]!", MSG_VISUAL) var/seed_modifier = 0 @@ -64,6 +64,7 @@ if(plank.amount > old_plank_amount) to_chat(user, "You add the newly-formed [plank_name] to the stack. It now contains [plank.amount] [plank_name].") qdel(src) + return TRUE if(CheckAccepted(W)) var/obj/item/reagent_containers/food/snacks/grown/leaf = W @@ -74,9 +75,9 @@ usr.put_in_active_hand(T) qdel(leaf) qdel(src) - return else to_chat(usr, "You must dry this first!") + return TRUE else return ..() @@ -187,7 +188,7 @@ ) AddComponent(/datum/element/connect_loc, loc_connections) -/obj/structure/bonfire/attackby(obj/item/W, mob/user, params) +/obj/structure/bonfire/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/stack/rods) && !can_buckle && !grill) var/obj/item/stack/rods/R = W var/choice = input(user, "What would you like to construct?", "Bonfire") as null|anything in list("Stake","Grill") @@ -206,11 +207,11 @@ to_chat(user, "You add a grill to \the [src].") add_overlay("bonfire_grill") else - return ..() + return TRUE if(W.is_hot()) StartBurning() if(grill) - if(user.a_intent != INTENT_HARM && !(W.item_flags & ABSTRACT)) + if(!(W.item_flags & ABSTRACT)) if(user.temporarilyRemoveItemFromInventory(W)) W.forceMove(get_turf(src)) var/list/modifiers = params2list(params) @@ -222,6 +223,7 @@ W.pixel_y = W.base_pixel_y + clamp(text2num(LAZYACCESS(modifiers, ICON_Y)) - 16, -(world.icon_size/2), world.icon_size/2) else return ..() + return TRUE /obj/structure/bonfire/attack_hand(mob/user) diff --git a/code/modules/hydroponics/growninedible.dm b/code/modules/hydroponics/growninedible.dm index 8c65dd1f14e90..4465acb3a3df3 100644 --- a/code/modules/hydroponics/growninedible.dm +++ b/code/modules/hydroponics/growninedible.dm @@ -35,15 +35,15 @@ if(discovery_points) AddComponent(/datum/component/discoverable, discovery_points) -/obj/item/grown/attackby(obj/item/O, mob/user, params) - ..() +/obj/item/grown/item_interact(obj/item/O, mob/user, params) if (istype(O, /obj/item/plant_analyzer)) var/msg = "This is \a [src]\n" if(seed) msg += seed.get_analyzer_text() msg += "" to_chat(usr, EXAMINE_BLOCK(msg)) - return + return TRUE + return ..() /obj/item/grown/proc/add_juice() if(reagents) diff --git a/code/modules/hydroponics/hydroitemdefines.dm b/code/modules/hydroponics/hydroitemdefines.dm index 98ae2bc0a3533..4c2cef0c16c86 100644 --- a/code/modules/hydroponics/hydroitemdefines.dm +++ b/code/modules/hydroponics/hydroitemdefines.dm @@ -140,7 +140,7 @@ var/turf/T = get_step(user_turf, turn(dir_to_target, i)) for(var/obj/structure/spacevine/V in T) if(user.Adjacent(V)) - melee_attack_chain(user, V) + use_on(user, V) swiping = FALSE // ************************************* diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 5307c1cc652d5..7579d949a3bcf 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -58,18 +58,17 @@ myseed = null return ..() -/obj/machinery/hydroponics/constructable/attackby(obj/item/I, mob/user, params) - if (user.a_intent != INTENT_HARM) - // handle opening the panel - if(default_deconstruction_screwdriver(user, icon_state, icon_state, I)) - return - - // handle deconstructing the machine, if permissible - if(I.tool_behaviour == TOOL_CROWBAR && using_irrigation) - to_chat(user, "Disconnect the hoses first!") - return - else if(default_deconstruction_crowbar(I)) - return +/obj/machinery/hydroponics/constructable/item_interact(obj/item/I, mob/user, params) + // handle opening the panel + if(default_deconstruction_screwdriver(user, icon_state, icon_state, I)) + return TRUE + + // handle deconstructing the machine, if permissible + if(I.tool_behaviour == TOOL_CROWBAR && using_irrigation) + to_chat(user, "Disconnect the hoses first!") + return TRUE + else if(default_deconstruction_crowbar(I)) + return TRUE return ..() @@ -710,12 +709,12 @@ else to_chat(user, "Nothing happens...") -/obj/machinery/hydroponics/attackby(obj/item/O, mob/user, params) +/obj/machinery/hydroponics/item_interact(obj/item/O, mob/user, params) //Called when mob user "attacks" it with object O if(istype(O, /obj/item/reagent_containers) || IS_EDIBLE(O)) // Syringe stuff (and other reagent containers now too). Edibles also have reagents. if(SEND_SIGNAL(O, COMSIG_EDIBLE_ON_COMPOST) & COMPONENT_EDIBLE_BLOCK_COMPOST) to_chat(user, "You can't compost that!") - return ..() + return TRUE var/obj/item/reagent_containers/reagent_source = O @@ -723,11 +722,11 @@ var/obj/item/reagent_containers/syringe/syr = reagent_source if(syr.mode != 1) to_chat(user, "You can't get any extract out of this plant.") - return + return TRUE if(!reagent_source.reagents.total_volume) to_chat(user, "[reagent_source] is empty.") - return 1 + return TRUE var/list/trays = list(src)//makes the list just this in cases of syringes and compost etc var/target = myseed ? myseed.plantname : src @@ -787,14 +786,14 @@ H.update_icon() if(reagent_source) // If the source wasn't composted and destroyed reagent_source.update_icon() - return 1 + return TRUE else if(istype(O, /obj/item/seeds) && !istype(O, /obj/item/seeds/sample)) if(!myseed) if(istype(O, /obj/item/seeds/kudzu)) investigate_log("had Kudzu planted in it by [key_name(user)] at [AREACOORD(src)]","kudzu") if(!user.transferItemToLoc(O, src)) - return + return TRUE to_chat(user, "You plant [O].") dead = 0 myseed = O @@ -805,6 +804,7 @@ update_icon() else to_chat(user, "[src] already has seeds in it!") + return TRUE else if(istype(O, /obj/item/plant_analyzer)) var/list/message = list() @@ -822,6 +822,7 @@ message += "- Water level: [waterlevel] / [maxwater]" message += "- Nutrition level: [nutrilevel] / [maxnutri]" to_chat(user, EXAMINE_BLOCK(jointext(message, "\n"))) + return TRUE else if(istype(O, /obj/item/cultivator)) if(weedlevel > 0) @@ -830,30 +831,33 @@ update_icon() else to_chat(user, "This plot is completely devoid of weeds! It doesn't need uprooting.") + return TRUE else if(istype(O, /obj/item/storage/bag/plants)) harvest_plant(user) for(var/obj/item/reagent_containers/food/snacks/grown/G in locate(user.x,user.y,user.z)) SEND_SIGNAL(O, COMSIG_TRY_STORAGE_INSERT, G, user, TRUE) + return TRUE else if(default_unfasten_wrench(user, O)) - return + return TRUE else if((O.tool_behaviour == TOOL_WIRECUTTER) && unwrenchable) if (!anchored) to_chat(user, "Anchor the tray first!") - return + return TRUE using_irrigation = !using_irrigation O.play_tool_sound(src) user.visible_message("[user] [using_irrigation ? "" : "dis"]connects [src]'s irrigation hoses.", \ "You [using_irrigation ? "" : "dis"]connect [src]'s irrigation hoses.") for(var/obj/machinery/hydroponics/h in range(1,src)) h.update_icon() + return TRUE else if(istype(O, /obj/item/shovel/spade)) if(!myseed && !weedlevel) to_chat(user, "[src] doesn't have any plants or weeds!") - return + return TRUE user.visible_message("[user] starts digging out [src]'s plants...", "You start digging out [src]'s plants...") if(O.use_tool(src, user, 50, volume=50) || (!myseed && !weedlevel)) @@ -868,9 +872,8 @@ myseed = null weedlevel = 0 //Has a side effect of cleaning up those nasty weeds update_icon() - - else - return ..() + return TRUE + return ..() /obj/machinery/hydroponics/can_be_unfasten_wrench(mob/user, silent) if (!unwrenchable) // case also covered by NODECONSTRUCT checks in default_unfasten_wrench @@ -983,9 +986,10 @@ /obj/machinery/hydroponics/soil/update_icon_lights() return // Has no lights -/obj/machinery/hydroponics/soil/attackby(obj/item/O, mob/user, params) +/obj/machinery/hydroponics/soil/item_interact(obj/item/O, mob/user, params) if(O.tool_behaviour == TOOL_SHOVEL && !istype(O, /obj/item/shovel/spade)) //Doesn't include spades because of uprooting plants to_chat(user, "You clear up [src]!") qdel(src) + return TRUE else return ..() diff --git a/code/modules/hydroponics/seed_extractor.dm b/code/modules/hydroponics/seed_extractor.dm index 58b45a008551c..07d7339a39840 100644 --- a/code/modules/hydroponics/seed_extractor.dm +++ b/code/modules/hydroponics/seed_extractor.dm @@ -78,19 +78,19 @@ if(in_range(user, src) || isobserver(user)) . += "The status display reads: Extracting [seed_multiplier] seed(s) per piece of produce.
Machine can store up to [max_seeds]% seeds.
" -/obj/machinery/seed_extractor/attackby(obj/item/O, mob/user, params) +/obj/machinery/seed_extractor/item_interact(obj/item/O, mob/user, params) if(default_deconstruction_screwdriver(user, "sextractor_open", "sextractor", O)) - return + return TRUE if(default_pry_open(O)) - return + return TRUE if(default_unfasten_wrench(user, O)) - return + return TRUE if(default_deconstruction_crowbar(O)) - return + return TRUE if(istype(O, /obj/item/storage/bag/plants)) var/obj/item/storage/P = O @@ -104,20 +104,17 @@ to_chat(user, "You put as many seeds from \the [O.name] into [src] as you can.") else to_chat(user, "There are no seeds in \the [O.name].") - return + return TRUE else if(seedify(O,-1, src, user)) to_chat(user, "You extract some seeds.") - return + return TRUE else if (istype(O, /obj/item/seeds)) if(add_seed(O)) to_chat(user, "You add [O] to [src.name].") updateUsrDialog() - return - else if(user.a_intent != INTENT_HARM) - to_chat(user, "You can't extract any seeds from \the [O.name]!") - else - return ..() + return TRUE + to_chat(user, "You can't extract any seeds from \the [O.name]!") /** * Generate seed string diff --git a/code/modules/hydroponics/seeds.dm b/code/modules/hydroponics/seeds.dm index 5987fc61442c9..1d89211d29eb6 100644 --- a/code/modules/hydroponics/seeds.dm +++ b/code/modules/hydroponics/seeds.dm @@ -387,24 +387,24 @@ /obj/item/seeds/proc/on_chem_reaction(datum/reagents/S) //in case seeds have some special interaction with special chems return -/obj/item/seeds/attackby(obj/item/O, mob/user, params) +/obj/item/seeds/item_interact(obj/item/O, mob/user, params) if (istype(O, /obj/item/plant_analyzer)) to_chat(user, "*---------*\n This is \a [src].") var/text = get_analyzer_text() if(text) to_chat(user, EXAMINE_BLOCK("[text]")) - return + return TRUE if (istype(O, /obj/item/pen)) var/penchoice = input(user, "What would you like to edit?") as null|anything in list("Plant Name","Plant Description","Seed Description") if(QDELETED(src) || !user.canUseTopic(src, BE_CLOSE)) - return + return TRUE if(penchoice == "Plant Name") var/input = stripped_input(user,"What do you want to name the plant?", default=plantname, max_length=MAX_NAME_LEN) if(QDELETED(src) || !user.canUseTopic(src, BE_CLOSE)) - return + return TRUE name = "pack of [input] seeds" plantname = input renamedByPlayer = TRUE @@ -412,15 +412,16 @@ if(penchoice == "Plant Description") var/input = stripped_input(user,"What do you want to change the description of the plant to?", default=plantdesc, max_length=MAX_NAME_LEN) if(QDELETED(src) || !user.canUseTopic(src, BE_CLOSE)) - return + return TRUE plantdesc = input if(penchoice == "Seed Description") var/input = stripped_input(user,"What do you want to change the description of the seeds to?", default=desc, max_length=MAX_NAME_LEN) if(QDELETED(src) || !user.canUseTopic(src, BE_CLOSE)) - return + return TRUE desc = input - ..() // Fallthrough to item/attackby() so that bags can pick seeds up + return TRUE + return ..() // Fallthrough to item/item_interact() so that bags can pick seeds up /obj/item/seeds/proc/randomize_stats() set_lifespan(rand(25, 60)) diff --git a/code/modules/instruments/items.dm b/code/modules/instruments/items.dm index 8f8e716f63cce..5ccbfd7fa097b 100644 --- a/code/modules/instruments/items.dm +++ b/code/modules/instruments/items.dm @@ -134,7 +134,7 @@ . = ..() AddComponent(/datum/component/spooky) -/obj/item/instrument/trumpet/spectral/attack(mob/living/carbon/C, mob/user) +/obj/item/instrument/trumpet/spectral/attack_mob_target(mob/living/carbon/C, mob/user) playsound (loc, 'sound/instruments/trombone/En4.mid', 100,1,-1) ..() @@ -158,7 +158,7 @@ . = ..() AddComponent(/datum/component/spooky) -/obj/item/instrument/saxophone/spectral/attack(mob/living/carbon/C, mob/user) +/obj/item/instrument/saxophone/spectral/attack_mob_target(mob/living/carbon/C, mob/user) playsound (loc, 'sound/instruments/saxophone/En4.mid', 100,1,-1) ..() @@ -181,7 +181,7 @@ . = ..() AddComponent(/datum/component/spooky) -/obj/item/instrument/trombone/spectral/attack(mob/living/carbon/C, mob/user) +/obj/item/instrument/trombone/spectral/attack_mob_target(mob/living/carbon/C, mob/user) playsound (loc, 'sound/instruments/trombone/Cn4.mid', 100,1,-1) ..() diff --git a/code/modules/language/codespeak.dm b/code/modules/language/codespeak.dm index 0f1bd035a3a25..353025f974669 100644 --- a/code/modules/language/codespeak.dm +++ b/code/modules/language/codespeak.dm @@ -51,7 +51,7 @@ use_charge(user) -/obj/item/codespeak_manual/attack(mob/living/M, mob/living/user) +/obj/item/codespeak_manual/attack_mob_target(mob/living/M, mob/living/user) if(!istype(M) || !istype(user)) return if(M == user) diff --git a/code/modules/library/lib_items.dm b/code/modules/library/lib_items.dm index b852de189d455..8dbad72176018 100644 --- a/code/modules/library/lib_items.dm +++ b/code/modules/library/lib_items.dm @@ -56,7 +56,7 @@ I.forceMove(src) update_icon() -/obj/structure/bookcase/attackby(obj/item/I, mob/user, params) +/obj/structure/bookcase/item_interact(obj/item/I, mob/user, params) switch(state) if(0) if(I.tool_behaviour == TOOL_WRENCH) @@ -64,10 +64,12 @@ to_chat(user, "You wrench the frame into place.") anchored = TRUE state = 1 + return TRUE if(I.tool_behaviour == TOOL_CROWBAR) if(I.use_tool(src, user, 20, volume=50)) to_chat(user, "You pry the frame apart.") deconstruct(TRUE) + return TRUE if(1) if(istype(I, /obj/item/stack/sheet/wood)) @@ -77,17 +79,19 @@ to_chat(user, "You add a shelf.") state = 2 icon_state = "book-0" + return TRUE if(I.tool_behaviour == TOOL_WRENCH) I.play_tool_sound(src, 100) to_chat(user, "You unwrench the frame.") anchored = FALSE state = 0 + return TRUE if(2) var/datum/component/storage/STR = I.GetComponent(/datum/component/storage) if(is_type_in_list(I, allowed_books)) if(!user.transferItemToLoc(I, src)) - return + return TRUE update_icon() else if(STR) for(var/obj/item/T in I.contents) @@ -95,17 +99,19 @@ STR.remove_from_storage(T, src) to_chat(user, "You empty \the [I] into \the [src].") update_icon() + return TRUE else if(istype(I, /obj/item/pen)) if(!user.is_literate()) to_chat(user, "You scribble illegibly on the side of [src]!") - return + return TRUE var/newname = stripped_input(user, "What would you like to title this bookshelf?") if(!user.canUseTopic(src, BE_CLOSE)) - return + return TRUE if(!newname) - return + return TRUE else name = "bookcase ([sanitize(newname)])" + return TRUE else if(I.tool_behaviour == TOOL_CROWBAR) if(contents.len) to_chat(user, "You need to remove the books first!") @@ -115,8 +121,8 @@ new /obj/item/stack/sheet/wood(drop_location(), 2) state = 1 icon_state = "bookempty" - else - return ..() + return TRUE + return ..() /obj/structure/bookcase/attack_hand(mob/living/user) @@ -225,57 +231,61 @@ to_chat(user, "This book is completely blank!") -/obj/item/book/attackby(obj/item/I, mob/user, params) +/obj/item/book/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/pen)) if(user.is_blind()) to_chat(user, " As you are trying to write on the book, you suddenly feel very stupid!") - return + return TRUE if(unique) to_chat(user, "These pages don't seem to take the ink well! Looks like you can't modify it.") - return + return TRUE var/literate = user.is_literate() if(!literate) to_chat(user, "You scribble illegibly on the cover of [src]!") - return + return TRUE var/choice = input("What would you like to change?") in list("Title", "Contents", "Author", "Cancel") if(!user.canUseTopic(src, BE_CLOSE, literate)) - return + return TRUE switch(choice) if("Title") var/newtitle = reject_bad_text(stripped_input(user, "Write a new title:")) if(!user.canUseTopic(src, BE_CLOSE, literate)) - return + return TRUE if (length(newtitle) > 50) to_chat(user, "That title won't fit on the cover!") - return + return TRUE if(!newtitle) to_chat(user, "That title is invalid.") - return + return TRUE else name = newtitle title = newtitle + return TRUE if("Contents") var/content = stripped_input(user, "Write your book's contents (HTML NOT allowed):","","",8192) if(!user.canUseTopic(src, BE_CLOSE, literate)) - return + return TRUE if(!content) to_chat(user, "The content is invalid.") - return + return TRUE else dat += content + return TRUE if("Author") var/newauthor = stripped_input(user, "Write the author's name:") if(!user.canUseTopic(src, BE_CLOSE, literate)) - return + return TRUE if(!newauthor) to_chat(user, "The name is invalid.") - return + return TRUE else if(length(newauthor) > 45) to_chat(user, "That name is too long!") + return TRUE else author = newauthor + return TRUE else - return + return TRUE else if(istype(I, /obj/item/barcodescanner)) var/obj/item/barcodescanner/scanner = I @@ -296,16 +306,17 @@ if(b.bookname == name) scanner.computer.checkouts.Remove(b) to_chat(user, "[I]'s screen flashes: 'Book stored in buffer. Book has been checked in.'") - return + return TRUE to_chat(user, "[I]'s screen flashes: 'Book stored in buffer. No active check-out record found for current title.'") if(3) scanner.book = src for(var/obj/item/book in scanner.computer.inventory) if(book == src) to_chat(user, "[I]'s screen flashes: 'Book stored in buffer. Title already present in inventory, aborting to avoid duplicate entry.'") - return + return TRUE scanner.computer.inventory.Add(src) to_chat(user, "[I]'s screen flashes: 'Book stored in buffer. Title added to general inventory.'") + return TRUE else if((istype(I, /obj/item/kitchen/knife) || I.tool_behaviour == TOOL_WIRECUTTER) && !(flags_1 & HOLOGRAM_1)) to_chat(user, "You begin to carve out [title]...") @@ -318,14 +329,14 @@ if(user.is_holding(src)) qdel(src) user.put_in_hands(B) - return + return TRUE else B.forceMove(drop_location()) qdel(src) - return - return + return TRUE + return TRUE else - ..() + return ..() /* diff --git a/code/modules/library/lib_machines.dm b/code/modules/library/lib_machines.dm index c6fd689d57a2c..d53c37006e377 100644 --- a/code/modules/library/lib_machines.dm +++ b/code/modules/library/lib_machines.dm @@ -363,12 +363,13 @@ GLOBAL_LIST(cachedbooks) // List of our cached book datums to_chat(user, "Your sanity barely endures the seconds spent in the vault's browsing window. The only thing to remind you of this when you stop browsing is an ominous book, bound by a chain, sitting on the desk. You don't even remember where it came from...") user.visible_message("[user] stares at the blank screen for a few moments, [user.p_their()] expression frozen in fear. When [user.p_they()] finally awaken[user.p_s()] from it, [user.p_they()] look[user.p_s()] a lot older.", 2) -/obj/machinery/computer/libraryconsole/bookmanagement/attackby(obj/item/W, mob/user, params) +/obj/machinery/computer/libraryconsole/bookmanagement/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/barcodescanner)) var/obj/item/barcodescanner/scanner = W scanner.computer = src to_chat(user, "[scanner]'s associated machine has been set to [src].") audible_message("[src] lets out a low, short blip.") + return TRUE else return ..() @@ -554,10 +555,10 @@ GLOBAL_LIST(cachedbooks) // List of our cached book datums density = TRUE var/obj/item/book/cache // Last scanned book -/obj/machinery/libraryscanner/attackby(obj/O, mob/user, params) +/obj/machinery/libraryscanner/item_interact(obj/O, mob/user, params) if(istype(O, /obj/item/book)) - if(!user.transferItemToLoc(O, src)) - return + user.transferItemToLoc(O, src) + return TRUE else return ..() @@ -611,11 +612,12 @@ GLOBAL_LIST(cachedbooks) // List of our cached book datums density = TRUE var/busy = FALSE -/obj/machinery/bookbinder/attackby(obj/O, mob/user, params) +/obj/machinery/bookbinder/item_interact(obj/O, mob/user, params) if(istype(O, /obj/item/paper)) bind_book(user, O) + return TRUE else if(default_unfasten_wrench(user, O)) - return 1 + return TRUE else return ..() diff --git a/code/modules/mining/abandoned_crates.dm b/code/modules/mining/abandoned_crates.dm index bc341a9879311..f1575cb5b2d72 100644 --- a/code/modules/mining/abandoned_crates.dm +++ b/code/modules/mining/abandoned_crates.dm @@ -62,7 +62,7 @@ return return attack_hand(user) //this helps you not blow up so easily by overriding unlocking which results in an immediate boom. -/obj/structure/closet/crate/secure/loot/attackby(obj/item/W, mob/user) +/obj/structure/closet/crate/secure/loot/item_interact(obj/item/W, mob/user) if(locked) if(W.tool_behaviour == TOOL_MULTITOOL) to_chat(user, "DECA-CODE LOCK REPORT:") @@ -94,7 +94,7 @@ code_it += length(code_char) to_chat(user, "Last code attempt, [lastattempt], had [bulls] correct digits at correct positions and [cows] correct digits at incorrect positions.") - return + return TRUE return ..() /obj/structure/closet/secure/loot/dive_into(mob/living/user) diff --git a/code/modules/mining/aux_base_camera.dm b/code/modules/mining/aux_base_camera.dm index c5de462d03f9c..e57d7415a60dc 100644 --- a/code/modules/mining/aux_base_camera.dm +++ b/code/modules/mining/aux_base_camera.dm @@ -78,9 +78,10 @@ eyeobj.origin = src -/obj/machinery/computer/camera_advanced/base_construction/attackby(obj/item/W, mob/user, params) +/obj/machinery/computer/camera_advanced/base_construction/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/rcd_ammo) || istype(W, /obj/item/stack/sheet)) RCD.attackby(W, user, params) //If trying to feed the console more materials, pass it along to the RCD. + return TRUE else return ..() diff --git a/code/modules/mining/coins.dm b/code/modules/mining/coins.dm index 233280f12cad9..2126778aa72d2 100644 --- a/code/modules/mining/coins.dm +++ b/code/modules/mining/coins.dm @@ -103,11 +103,10 @@ plasma_ignition(0, Proj?.firer) . = ..() -/obj/item/coin/plasma/attackby(obj/item/W, mob/user, params) +/obj/item/coin/plasma/item_interact(obj/item/W, mob/user, params) if(W.is_hot() > 300)//If the temperature of the object is over 300, then ignite plasma_ignition(0, user) - else - return ..() + return ..() /obj/item/coin/uranium name = "uranium coin" @@ -162,12 +161,12 @@ desc = "A coin that allows you to redeem a prize from an arcade machine." value = 0 -/obj/item/coin/attackby(obj/item/W, mob/user, params) +/obj/item/coin/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/stack/cable_coil)) var/obj/item/stack/cable_coil/CC = W if(string_attached) to_chat(user, "There already is a string attached to this coin!") - return + return TRUE if (CC.use(1)) add_overlay("coin_string_overlay") @@ -175,9 +174,9 @@ to_chat(user, "You attach a string to the coin.") else to_chat(user, "You need one length of cable to attach a string to the coin!") - return + return TRUE else - ..() + return ..() /obj/item/coin/wirecutter_act(mob/living/user, obj/item/I) if(!string_attached) diff --git a/code/modules/mining/equipment/kinetic_crusher.dm b/code/modules/mining/equipment/kinetic_crusher.dm index 166043fd2f4e4..97c6c7bcb3412 100644 --- a/code/modules/mining/equipment/kinetic_crusher.dm +++ b/code/modules/mining/equipment/kinetic_crusher.dm @@ -46,7 +46,7 @@ var/obj/item/crusher_trophy/T = t . += "[icon2html(T, user)]It has \a [T] attached, which causes [T.effect_desc()]." -/obj/item/kinetic_crusher/attackby(obj/item/I, mob/living/user) +/obj/item/kinetic_crusher/item_interact(obj/item/I, mob/living/user) if(I.tool_behaviour == TOOL_CROWBAR) if(LAZYLEN(trophies)) to_chat(user, "You remove [src]'s trophies.") @@ -56,13 +56,15 @@ T.remove_from(src, user) else to_chat(user, "There are no trophies on [src].") + return TRUE else if(istype(I, /obj/item/crusher_trophy)) var/obj/item/crusher_trophy/T = I T.add_to(src, user) + return TRUE else return ..() -/obj/item/kinetic_crusher/attack(mob/living/target, mob/living/carbon/user) +/obj/item/kinetic_crusher/attack_mob_target(mob/living/target, mob/living/carbon/user) if(!ISWIELDED(src)) to_chat(user, "[src] is too heavy to use with one hand. You fumble and drop everything.") user.drop_all_held_items() @@ -117,16 +119,15 @@ C.total_damage += target_health - L.health //we did some damage, but let's not assume how much we did new /obj/effect/temp_visual/kinetic_blast(get_turf(L)) var/backstab_dir = get_dir(user, L) - var/def_check = L.getarmor(type = BOMB) if((user.dir & backstab_dir) && (L.dir & backstab_dir)) if(!QDELETED(C)) C.total_damage += detonation_damage + backstab_bonus //cheat a little and add the total before killing it, so certain mobs don't have much lower chances of giving an item - L.apply_damage(detonation_damage + backstab_bonus, BRUTE, blocked = def_check) + L.apply_damage(/datum/damage_source/explosion, /datum/damage/brute, detonation_damage + backstab_bonus, ) playsound(user, 'sound/weapons/kenetic_accel.ogg', 100, 1) //Seriously who spelled it wrong else if(!QDELETED(C)) C.total_damage += detonation_damage - L.apply_damage(detonation_damage, BRUTE, blocked = def_check) + L.apply_damage(/datum/damage_source/explosion, /datum/damage/brute, detonation_damage, ) /obj/item/kinetic_crusher/proc/Recharge() if(!charged) @@ -160,7 +161,7 @@ nodamage = TRUE damage = 0 //We're just here to mark people. This is still a melee weapon. damage_type = BRUTE - armor_flag = BOMB + damage_source = /datum/damage_source/explosion range = 6 log_override = TRUE var/obj/item/kinetic_crusher/hammer_synced @@ -201,11 +202,12 @@ /obj/item/crusher_trophy/proc/effect_desc() return "errors" -/obj/item/crusher_trophy/attackby(obj/item/A, mob/living/user) +/obj/item/crusher_trophy/item_interact(obj/item/A, mob/living/user) if(istype(A, /obj/item/kinetic_crusher)) add_to(A, user) + return TRUE else - ..() + return ..() /obj/item/crusher_trophy/proc/add_to(obj/item/kinetic_crusher/H, mob/living/user) for(var/t in H.trophies) @@ -247,7 +249,8 @@ missing_health *= missing_health_ratio //bonus is active at all times, even if you're above 90 health missing_health *= bonus_value //multiply the remaining amount by bonus_value if(missing_health > 0) - target.adjustBruteLoss(missing_health) //and do that much damage + var/datum/damage_source/explosion/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(target, BRUTE, missing_health, null) //and do that much damage //watcher /obj/item/crusher_trophy/watcher_wing diff --git a/code/modules/mining/equipment/marker_beacons.dm b/code/modules/mining/equipment/marker_beacons.dm index 27e31ef0f290b..89cbeb84f06a4 100644 --- a/code/modules/mining/equipment/marker_beacons.dm +++ b/code/modules/mining/equipment/marker_beacons.dm @@ -120,7 +120,7 @@ GLOBAL_LIST_INIT(marker_beacon_colors, sort_list(list( playsound(src, 'sound/items/deconstruct.ogg', 50, 1) qdel(src) //otherwise delete us -/obj/structure/marker_beacon/attackby(obj/item/I, mob/user, params) +/obj/structure/marker_beacon/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/stack/marker_beacon)) var/obj/item/stack/marker_beacon/M = I to_chat(user, "You start picking [src] up...") @@ -128,14 +128,14 @@ GLOBAL_LIST_INIT(marker_beacon_colors, sort_list(list( M.add(1) playsound(src, 'sound/items/deconstruct.ogg', 50, 1) qdel(src) - return + return TRUE if(istype(I, /obj/item/light_eater)) var/obj/effect/decal/cleanable/ash/A = new /obj/effect/decal/cleanable/ash(drop_location()) A.desc += "\nLooks like this used to be \a [src] some time ago." visible_message("[src] is disintegrated by [I]!") playsound(src, 'sound/items/welder.ogg', 50, 1) qdel(src) - return + return TRUE return ..() /obj/structure/marker_beacon/AltClick(mob/living/user) diff --git a/code/modules/mining/equipment/resonator.dm b/code/modules/mining/equipment/resonator.dm index b5588e772ba9d..b2aa047b90e1c 100644 --- a/code/modules/mining/equipment/resonator.dm +++ b/code/modules/mining/equipment/resonator.dm @@ -113,7 +113,7 @@ if(creator) log_combat(creator, L, "used a resonator field on", "resonator") to_chat(L, "[src] ruptured with you in it!") - L.apply_damage(resonance_damage, BRUTE) + L.apply_damage(/datum/damage_source/explosion, /datum/damage/brute, resonance_damage) qdel(src) /obj/effect/temp_visual/resonance_crush diff --git a/code/modules/mining/gibtonite.dm b/code/modules/mining/gibtonite.dm index 2635f00857d0a..576f3fa9afa73 100644 --- a/code/modules/mining/gibtonite.dm +++ b/code/modules/mining/gibtonite.dm @@ -25,23 +25,23 @@ wires = null return ..() -/obj/item/gibtonite/attackby(obj/item/I, mob/user, params) +/obj/item/gibtonite/item_interact(obj/item/I, mob/user, params) if(!wires && istype(I, /obj/item/assembly/igniter)) user.visible_message("[user] attaches [I] to [src].", "You attach [I] to [src].") wires = new /datum/wires/explosive/gibtonite(src) attacher = key_name(user) qdel(I) add_overlay("Gibtonite_igniter") - return + return TRUE if(wires && !primed) if(is_wire_tool(I)) wires.interact(user) - return + return TRUE if(I.tool_behaviour == TOOL_MINING || istype(I, /obj/item/resonator) || I.force >= 10) GibtoniteReaction(user) - return + return TRUE if(primed) if(istype(I, /obj/item/mining_scanner) || istype(I, /obj/item/t_scanner/adv_mining_scanner) || I.tool_behaviour == TOOL_MULTITOOL) primed = FALSE @@ -50,8 +50,8 @@ user.visible_message("The chain reaction was stopped! ...The ore's quality looks diminished.", "You stopped the chain reaction. ...The ore's quality looks diminished.") icon_state = "Gibtonite ore" quality = GIBTONITE_QUALITY_LOW - return - ..() + return TRUE + return ..() /obj/item/gibtonite/attack_self(user) if(wires) diff --git a/code/modules/mining/laborcamp/laborstacker.dm b/code/modules/mining/laborcamp/laborstacker.dm index aa088e1a124b2..c0a6d0b28540b 100644 --- a/code/modules/mining/laborcamp/laborstacker.dm +++ b/code/modules/mining/laborcamp/laborstacker.dm @@ -141,10 +141,11 @@ GLOBAL_LIST(labor_sheet_values) points += inp.point_value * inp.amount ..() -/obj/machinery/mineral/stacking_machine/laborstacker/attackby(obj/item/I, mob/living/user) +/obj/machinery/mineral/stacking_machine/laborstacker/item_interact(obj/item/I, mob/living/user) if(istype(I, /obj/item/stack/sheet) && user.canUnEquip(I) && user.a_intent == INTENT_HELP) var/obj/item/stack/sheet/inp = I points += inp.point_value * inp.amount + return TRUE return ..() /**********************Point Lookup Console**************************/ @@ -161,7 +162,7 @@ GLOBAL_LIST(labor_sheet_values) return user.examinate(src) -/obj/machinery/mineral/labor_points_checker/attackby(obj/item/I, mob/user, params) +/obj/machinery/mineral/labor_points_checker/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/card/id)) if(istype(I, /obj/item/card/id/prisoner)) var/obj/item/card/id/prisoner/prisoner_id = I @@ -171,5 +172,6 @@ GLOBAL_LIST(labor_sheet_values) to_chat(user, "Collect points by bringing smelted minerals to the Labor Shuttle stacking machine. Reach your quota to earn your release.") else to_chat(user, "Error: Invalid ID") + return TRUE else return ..() diff --git a/code/modules/mining/lavaland/ash_flora.dm b/code/modules/mining/lavaland/ash_flora.dm index 041389a26c9f2..337171021ccb9 100644 --- a/code/modules/mining/lavaland/ash_flora.dm +++ b/code/modules/mining/lavaland/ash_flora.dm @@ -60,11 +60,12 @@ desc = initial(desc) harvested = FALSE -/obj/structure/flora/ash/attackby(obj/item/W, mob/user, params) +/obj/structure/flora/ash/item_interact(obj/item/W, mob/user, params) if(!harvested && needs_sharp_harvest && W.is_sharp()) user.visible_message("[user] starts to harvest from [src] with [W].","You begin to harvest from [src] with [W].") if(do_after(user, harvest_time, target = src)) harvest(user) + return TRUE else return ..() @@ -321,7 +322,7 @@ else icon_state = "mushroom_bowl" -/obj/item/reagent_containers/glass/bowl/mushroom_bowl/attackby(obj/item/I,mob/user, params) +/obj/item/reagent_containers/glass/bowl/mushroom_bowl/item_interact(obj/item/I,mob/user, params) if(istype(I, /obj/item/reagent_containers/food/snacks)) var/obj/item/reagent_containers/food/snacks/S = I if(I.w_class > WEIGHT_CLASS_SMALL) @@ -335,5 +336,6 @@ else var/obj/item/reagent_containers/food/snacks/customizable/A = new/obj/item/reagent_containers/food/snacks/customizable/salad/ashsalad(get_turf(src)) A.initialize_custom_food(src, S, user) + return TRUE else . = ..() diff --git a/code/modules/mining/lavaland/necropolis_chests.dm b/code/modules/mining/lavaland/necropolis_chests.dm index 0c1f07b4577f7..5895f4d5beca6 100644 --- a/code/modules/mining/lavaland/necropolis_chests.dm +++ b/code/modules/mining/lavaland/necropolis_chests.dm @@ -529,8 +529,8 @@ can_destroy = TRUE qdel(src) -/obj/effect/immortality_talisman/attackby() - return +/obj/effect/immortality_talisman/item_interact() + return FALSE /obj/effect/immortality_talisman/ex_act() return @@ -647,8 +647,8 @@ newwings.Insert(H) to_chat(C, "A terrible pain travels down your back as wings burst out!") playsound(C.loc, 'sound/items/poster_ripped.ogg', 50, TRUE, -1) - C.adjustBruteLoss(20) - C.emote("scream") + var/datum/damage_source/forceful_laceration/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(C, BRUTE, 20, null) if(holycheck) to_chat(C, "You feel blessed!") ADD_TRAIT(C, TRAIT_HOLY, SPECIES_TRAIT) @@ -761,8 +761,8 @@ to_chat(user, "You accidentally cut yourself with [src], like a doofus!") user.take_bodypart_damage(10) -/obj/item/melee/transforming/cleaving_saw/melee_attack_chain(mob/user, atom/target, params) - ..() +/obj/item/melee/transforming/cleaving_saw/afterattack(atom/target, mob/user, proximity_flag, click_parameters) + . = ..() if(!active) user.changeNext_move(CLICK_CD_MELEE * 0.5) //when closed, it attacks very rapidly @@ -774,7 +774,7 @@ else B.add_bleed(B.bleed_buildup) -/obj/item/melee/transforming/cleaving_saw/attack(mob/living/target, mob/living/carbon/human/user) +/obj/item/melee/transforming/cleaving_saw/attack_mob_target(mob/living/target, mob/living/carbon/human/user) if(!active || swiping || !target.density || get_turf(target) == get_turf(user)) if(!active) faction_bonus_force = 0 @@ -790,7 +790,7 @@ var/turf/T = get_step(user_turf, turn(dir_to_target, i)) for(var/mob/living/L in T) if(user.Adjacent(L) && L.density) - melee_attack_chain(user, L) + use_on(user, L) swiping = FALSE //Dragon @@ -887,7 +887,7 @@ return ghost_counter -/obj/item/melee/ghost_sword/attack(mob/living/target, mob/living/carbon/human/user) +/obj/item/melee/ghost_sword/attack_mob_target(mob/living/target, mob/living/carbon/human/user) force = 0 var/ghost_counter = ghost_check() @@ -962,7 +962,7 @@ slot_flags = ITEM_SLOT_BACK w_class = WEIGHT_CLASS_BULKY force = 15 - damtype = BURN + damtype = /datum/damage/burn resistance_flags = LAVA_PROOF | FIRE_PROOF | ACID_PROOF hitsound = 'sound/weapons/sear.ogg' item_flags = ISWEAPON diff --git a/code/modules/mining/machine_processing.dm b/code/modules/mining/machine_processing.dm index 9fd05c70674ee..f6b6890f7cf89 100644 --- a/code/modules/mining/machine_processing.dm +++ b/code/modules/mining/machine_processing.dm @@ -175,15 +175,15 @@ DEFINE_BUFFER_HANDLER(/obj/machinery/mineral/processing_unit_console) to_chat(user, "-% Successfully stored [REF(src)] [name] in buffer %-") return COMPONENT_BUFFER_RECIEVED -/obj/machinery/mineral/processing_unit_console/attackby(obj/item/W, mob/user, params) +/obj/machinery/mineral/processing_unit_console/item_interact(obj/item/W, mob/user, params) if(default_deconstruction_screwdriver(user, icon_state, icon_state, W)) - return + return TRUE if(default_unfasten_wrench(user, W)) - return + return TRUE if(default_deconstruction_crowbar(W)) - return + return TRUE return ..() @@ -250,15 +250,15 @@ DEFINE_BUFFER_HANDLER(/obj/machinery/mineral/processing_unit_console) register_input_turf() // register the new one return TRUE -/obj/machinery/mineral/processing_unit/attackby(obj/item/W, mob/user, params) +/obj/machinery/mineral/processing_unit/item_interact(obj/item/W, mob/user, params) if(default_deconstruction_screwdriver(user, icon_state, icon_state, W)) - return + return TRUE if(default_unfasten_wrench(user, W)) - return + return TRUE if(default_deconstruction_crowbar(W)) - return + return TRUE return ..() diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm index 649aab08a3920..8a53026870352 100644 --- a/code/modules/mining/machine_redemption.dm +++ b/code/modules/mining/machine_redemption.dm @@ -168,17 +168,17 @@ else unregister_input_turf() // someone just un-wrenched us, unregister the turf -/obj/machinery/mineral/ore_redemption/attackby(obj/item/W, mob/user, params) +/obj/machinery/mineral/ore_redemption/item_interact(obj/item/W, mob/user, params) if(default_unfasten_wrench(user, W)) - return + return TRUE if(default_deconstruction_screwdriver(user, "ore_redemption-open", "ore_redemption", W)) updateUsrDialog() - return + return TRUE if(default_deconstruction_crowbar(W)) - return + return TRUE if(!powered()) - return ..() + return TRUE if(istype(W, /obj/item/disk/design_disk)) if(user.transferItemToLoc(W, src)) @@ -189,7 +189,7 @@ if(istype(O)) if(O.refined_type == null) to_chat(user, "[O] has already been refined!") - return + return TRUE return ..() diff --git a/code/modules/mining/machine_silo.dm b/code/modules/mining/machine_silo.dm index 9c5326fb4fc57..0a8e6ef88f6ac 100644 --- a/code/modules/mining/machine_silo.dm +++ b/code/modules/mining/machine_silo.dm @@ -70,16 +70,16 @@ GLOBAL_LIST_EMPTY(silo_access_logs) silo_log(M, "deposited", amount, "sheets", item_mats) return TRUE -/obj/machinery/ore_silo/attackby(obj/item/W, mob/user, params) +/obj/machinery/ore_silo/item_interact(obj/item/W, mob/user, params) if(default_deconstruction_screwdriver(user, icon_state, icon_state, W)) updateUsrDialog() - return + return TRUE if(default_deconstruction_crowbar(W)) - return + return TRUE if(!powered()) - return ..() + return TRUE if(istype(W, /obj/item/stack)) return remote_attackby(src, user, W) diff --git a/code/modules/mining/machine_vending.dm b/code/modules/mining/machine_vending.dm index 58a40cb68e050..4d5c881e070db 100644 --- a/code/modules/mining/machine_vending.dm +++ b/code/modules/mining/machine_vending.dm @@ -138,11 +138,11 @@ SSblackbox.record_feedback("nested tally", "mining_equipment_bought", 1, list("[type]", "[prize.equipment_path]")) . = TRUE -/obj/machinery/vendor/attackby(obj/item/I, mob/user, params) +/obj/machinery/vendor/item_interact(obj/item/I, mob/user, params) if(default_deconstruction_screwdriver(user, "mining-open", "mining", I)) - return + return TRUE if(default_deconstruction_crowbar(I)) - return + return TRUE return ..() /obj/machinery/vendor/ex_act(severity, target) @@ -233,10 +233,10 @@ src.equipment_path = path src.cost = cost -/obj/machinery/vendor/mining/attackby(obj/item/I, mob/user, params) +/obj/machinery/vendor/mining/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/mining_voucher)) RedeemVoucher(I, user) - return + return TRUE return ..() /obj/machinery/vendor/mining/proc/RedeemVoucher(obj/item/mining_voucher/voucher, mob/redeemer) @@ -309,18 +309,19 @@ icon_state = "data_1" var/points = 500 -/obj/item/card/mining_point_card/attackby(obj/item/I, mob/user, params) +/obj/item/card/mining_point_card/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/card/id)) if(points) var/obj/item/card/id/C = I if(!C.registered_account) to_chat(user, "[C] has no registered account!") - return ..() + return TRUE C.registered_account.adjust_currency(ACCOUNT_CURRENCY_MINING, points) to_chat(user, "You transfer [points] points to [C.registered_account.account_holder]'s bank account.") points = 0 else to_chat(user, "There's no points left on [src].") + return TRUE ..() /obj/item/card/mining_point_card/examine(mob/user) diff --git a/code/modules/mining/minebot.dm b/code/modules/mining/minebot.dm index 28f8b39cbf6d0..abed932953d0f 100644 --- a/code/modules/mining/minebot.dm +++ b/code/modules/mining/minebot.dm @@ -177,7 +177,7 @@ to_chat(user, "You restart [src].") revive() return TRUE - adjustBruteLoss(-15) + adjustBruteLossAbstract(-15) to_chat(user, "You repair some of the armor on [src].") return TRUE @@ -187,11 +187,9 @@ check_friendly_fire = FALSE /// Handles installing new tools/upgrades and interacting with the minebot -/mob/living/simple_animal/hostile/mining_drone/attackby(obj/item/item, mob/user, params) +/mob/living/simple_animal/hostile/mining_drone/item_interact(obj/item/item, mob/user, params) if(user == src) return TRUE // Returning true in most cases prevents afterattacks from going off and whacking/shooting the minebot - if(user.a_intent != INTENT_HELP) - return ..() // For smacking if(istype(item, /obj/item/minebot_upgrade)) if(!do_after(user, 20, src)) return TRUE @@ -211,7 +209,7 @@ if(istype(item, /obj/item/borg/upgrade/modkit)) if(!do_after(user, 20, src)) return TRUE - item.melee_attack_chain(user, stored_pka, params) // This handles any install messages + item.use_on(user, stored_pka, params) // This handles any install messages return TRUE if(item.tool_behaviour == TOOL_CROWBAR) uninstall_upgrades() @@ -219,7 +217,7 @@ return TRUE if(istype(item, /obj/item/gun/energy/plasmacutter)) if(health != maxHealth) - return // For repairs + return TRUE // For repairs if(!do_after(user, 20, src)) return TRUE if(stored_cutter) @@ -243,8 +241,8 @@ RegisterSignal(stored_drill, COMSIG_PARENT_QDELETING, PROC_REF(on_drill_qdel)) to_chat(user, "You install [item].") return TRUE - ..() check_friendly_fire = FALSE + return ..() // Procs handling deletion of items /mob/living/simple_animal/hostile/mining_drone/proc/on_scanner_qdel() @@ -347,7 +345,7 @@ if(!client && isliving(target)) // Switching to offense mode if we've got a target set_offense_behavior() if(stored_drill) - stored_drill.melee_attack_chain(src, target) // Use the drill if the target's adjacent + stored_drill.use_on(src, target) // Use the drill if the target's adjacent /// Ranged attack handling (PKA/plasma cutter) /mob/living/simple_animal/hostile/mining_drone/OpenFire(atom/target) @@ -362,12 +360,15 @@ stored_cutter.afterattack(target, src) /// Handles reacting to attacks, getting the minebot in combat mode if it was mining. -/mob/living/simple_animal/hostile/mining_drone/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/mining_drone/adjustHealth(amount, forced = FALSE) if(!client && mode != MODE_COMBAT && amount > 0) // We don't want to automatically switch it if a player's in control set_offense_behavior() - update_health_hud() . = ..() +/mob/living/simple_animal/hostile/mining_drone/updatehealth() + . = ..() + update_health_hud() + /**********************Minebot AI Handling**********************/ /// Allows the minebot to find ore through rocks, limited by the installed scanner's maximum range. @@ -673,7 +674,7 @@ return list("Stored Medipen", "None") // Handles manually loading/unloading medipens. -/obj/item/minebot_upgrade/medical/attackby(obj/item/item, mob/living/user, params) +/obj/item/minebot_upgrade/medical/item_interact(obj/item/item, mob/living/user, params) if(istype(item, /obj/item/reagent_containers/hypospray/medipen)) if(stored_medipen) to_chat(user, "You replace [stored_medipen] with [item].") @@ -696,7 +697,7 @@ return if(istype(target, /mob/living/carbon)) if(stored_medipen) - stored_medipen.attack(target, linked_bot) + stored_medipen.attack_mob_target(target, linked_bot) return if(istype(target, /obj/item/reagent_containers/hypospray/medipen)) var/obj/item/reagent_containers/hypospray/medipen/new_medipen = target @@ -735,7 +736,7 @@ var/cooldown_time = 600 var/timer -/obj/item/slimepotion/slime/sentience/mining/attack(mob/living/M, mob/user) +/obj/item/slimepotion/slime/sentience/mining/attack_mob_target(mob/living/M, mob/user) if(timer > world.time) to_chat(user, "Please wait [(timer - world.time)/10] seconds before trying again.") return diff --git a/code/modules/mining/satchel_ore_box.dm b/code/modules/mining/satchel_ore_box.dm index 9d3636c7ce74d..b01ac0b2c14e1 100644 --- a/code/modules/mining/satchel_ore_box.dm +++ b/code/modules/mining/satchel_ore_box.dm @@ -15,14 +15,16 @@ if(!typecache_to_take) typecache_to_take = typecacheof(/obj/item/stack/ore) -/obj/structure/ore_box/attackby(obj/item/W, mob/user, params) +/obj/structure/ore_box/item_interact(obj/item/W, mob/user, params) if (istype(W, /obj/item/stack/ore)) user.transferItemToLoc(W, src) ui_update() + return TRUE else if(SEND_SIGNAL(W, COMSIG_CONTAINS_STORAGE)) SEND_SIGNAL(W, COMSIG_TRY_STORAGE_TAKE_TYPE, typecache_to_take, src) to_chat(user, "You empty the ore in [W] into \the [src].") ui_update() + return TRUE else return ..() diff --git a/code/modules/mob/living/bloodcrawl.dm b/code/modules/mob/living/bloodcrawl.dm index c0577c6a6dfb3..8e95beb2ce88f 100644 --- a/code/modules/mob/living/bloodcrawl.dm +++ b/code/modules/mob/living/bloodcrawl.dm @@ -107,7 +107,7 @@ if(victim.reagents && victim.reagents.has_reagent(/datum/reagent/consumable/ethanol/devilskiss, needs_metabolizing = TRUE)) to_chat(src, "AAH! THEIR FLESH! IT BURNS!") - adjustBruteLoss(25) //I can't use adjustHealth() here because bloodcrawl affects /mob/living and adjustHealth() only affects simple mobs + apply_damage(/datum/damage_source/chemical, BRUTE, 25, null) var/found_bloodpool = FALSE for(var/obj/effect/decal/cleanable/target in range(1,get_turf(victim))) if(target.can_bloodcrawl_in()) @@ -127,7 +127,8 @@ src.revive(full_heal = 1) // No defib possible after laughter - victim.adjustBruteLoss(1000) + var/datum/damage_source/abstract/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(victim, BRUTE, 1000, null) victim.death() bloodcrawl_swallow(victim) return TRUE diff --git a/code/modules/mob/living/brain/MMI.dm b/code/modules/mob/living/brain/MMI.dm index 4714edc6ee7a9..819b32ab4efde 100644 --- a/code/modules/mob/living/brain/MMI.dm +++ b/code/modules/mob/living/brain/MMI.dm @@ -46,19 +46,19 @@ else add_overlay("mmi_dead") -/obj/item/mmi/attackby(obj/item/O, mob/user, params) +/obj/item/mmi/item_interact(obj/item/O, mob/user, params) user.changeNext_move(CLICK_CD_MELEE) if(istype(O, /obj/item/organ/brain)) //Time to stick a brain in it --NEO var/obj/item/organ/brain/newbrain = O if(brain) to_chat(user, "There's already a brain in the MMI!") - return + return TRUE if(!newbrain.brainmob) to_chat(user, "You aren't sure where this brain came from, but you're pretty sure it's a useless brain!") - return + return TRUE if(!user.transferItemToLoc(O, src)) - return + return TRUE var/mob/living/brain/B = newbrain.brainmob if(!B.key) B.notify_ghost_cloning("Someone has put your brain in a MMI!", source = src) @@ -90,9 +90,11 @@ update_icon() SSblackbox.record_feedback("amount", "mmis_filled", 1) + return TRUE else if(brainmob) - O.attack(brainmob, user) //Oh noooeeeee + O.attack_mob_target(brainmob, user) //Oh noooeeeee + return TRUE else return ..() diff --git a/code/modules/mob/living/brain/brain_item.dm b/code/modules/mob/living/brain/brain_item.dm index e9be3a75242ab..dd161f2caa508 100644 --- a/code/modules/mob/living/brain/brain_item.dm +++ b/code/modules/mob/living/brain/brain_item.dm @@ -101,34 +101,35 @@ L.mind.transfer_to(brainmob) to_chat(brainmob, "You feel slightly disoriented. That's normal when you're just a brain.") -/obj/item/organ/brain/attackby(obj/item/O, mob/user, params) +/obj/item/organ/brain/item_interact(obj/item/O, mob/user, params) user.changeNext_move(CLICK_CD_MELEE) if(istype(O, /obj/item/organ_storage)) - return //Borg organ bags shouldn't be killing brains + return TRUE //Borg organ bags shouldn't be killing brains if((organ_flags & ORGAN_FAILING) && O.is_drainable() && O.reagents.has_reagent(/datum/reagent/medicine/mannitol)) //attempt to heal the brain . = TRUE //don't do attack animation. if(!O.reagents.has_reagent(/datum/reagent/medicine/mannitol, 10)) to_chat(user, "There's not enough mannitol in [O] to restore [src]!") - return + return TRUE user.visible_message("[user] starts to pour the contents of [O] onto [src].", "You start to slowly pour the contents of [O] onto [src].") if(!do_after(user, 60, src)) to_chat(user, "You failed to pour [O] onto [src]!") - return + return TRUE user.visible_message("[user] pours the contents of [O] onto [src], causing it to reform its original shape and turn a slightly brighter shade of pink.", "You pour the contents of [O] onto [src], causing it to reform its original shape and turn a slightly brighter shade of pink.") setOrganDamage(damage - (0.05 * maxHealth)) //heals a small amount, and by using "setorgandamage", we clear the failing variable if that was up O.reagents.clear_reagents() - return + return TRUE if(brainmob) //if we aren't trying to heal the brain, pass the attack onto the brainmob. - O.attack(brainmob, user) //Oh noooeeeee + O.attack_mob_target(brainmob, user) //Oh noooeeeee - if(O.force != 0 && !(O.item_flags & NOBLUDGEON)) - setOrganDamage(maxHealth) //fails the brain as the brain was attacked, they're pretty fragile. + if(O.force != 0 && !(O.item_flags & NOBLUDGEON)) + setOrganDamage(maxHealth) //fails the brain as the brain was attacked, they're pretty fragile. + return TRUE /obj/item/organ/brain/examine(mob/user) . = ..() diff --git a/code/modules/mob/living/brain/posibrain.dm b/code/modules/mob/living/brain/posibrain.dm index 352a37cf114dc..88c8ffac1c3e1 100644 --- a/code/modules/mob/living/brain/posibrain.dm +++ b/code/modules/mob/living/brain/posibrain.dm @@ -184,9 +184,8 @@ GLOBAL_VAR(posibrain_notify_cooldown) if(autoping) ping_ghosts("created", TRUE) -/obj/item/mmi/posibrain/attackby(obj/item/O, mob/user) - return - +/obj/item/mmi/posibrain/item_interact(obj/item/O, mob/user) + return FALSE /obj/item/mmi/posibrain/update_icon() if(searching) diff --git a/code/modules/mob/living/carbon/alien/alien.dm b/code/modules/mob/living/carbon/alien/alien.dm index bdb4739c3b29f..4ab07a7cf06d7 100644 --- a/code/modules/mob/living/carbon/alien/alien.dm +++ b/code/modules/mob/living/carbon/alien/alien.dm @@ -64,14 +64,14 @@ throw_alert("alien_fire", /atom/movable/screen/alert/alien_fire) switch(bodytemperature) if(360 to 400) - apply_damage(HEAT_DAMAGE_LEVEL_1, BURN) + apply_damage(/datum/damage_source/temperature, /datum/damage/burn, HEAT_DAMAGE_LEVEL_1) if(400 to 460) - apply_damage(HEAT_DAMAGE_LEVEL_2, BURN) + apply_damage(/datum/damage_source/temperature, /datum/damage/burn, HEAT_DAMAGE_LEVEL_2) if(460 to INFINITY) if(on_fire) - apply_damage(HEAT_DAMAGE_LEVEL_3, BURN) + apply_damage(/datum/damage_source/temperature, /datum/damage/burn, HEAT_DAMAGE_LEVEL_3) else - apply_damage(HEAT_DAMAGE_LEVEL_2, BURN) + apply_damage(/datum/damage_source/temperature, /datum/damage/burn, HEAT_DAMAGE_LEVEL_2) else clear_alert("alien_fire") diff --git a/code/modules/mob/living/carbon/alien/alien_defense.dm b/code/modules/mob/living/carbon/alien/alien_defense.dm index a8c0b3f87cbe4..fa34cfa0cdf6d 100644 --- a/code/modules/mob/living/carbon/alien/alien_defense.dm +++ b/code/modules/mob/living/carbon/alien/alien_defense.dm @@ -39,22 +39,20 @@ In all, this is a lot like the monkey code. /N playsound(loc, 'sound/weapons/bite.ogg', 50, 1, -1) visible_message("[M.name] playfully bites [src]!", \ "[M.name] playfully bites you!", null, COMBAT_MESSAGE_RANGE) - adjustBruteLoss(1) + apply_damage(/datum/damage_source/blunt/light, BRUTE, 1) log_combat(M, src, "attacked") - updatehealth() else to_chat(M, "[name] is too injured for that.") -/mob/living/carbon/alien/attack_larva(mob/living/carbon/alien/larva/L) +/mob/living/carbon/alien/larva_attack_intercept(mob/living/carbon/alien/larva/L) return attack_alien(L) /mob/living/carbon/alien/attack_paw(mob/living/carbon/monkey/M) if(!..()) return if(stat != DEAD) - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) - apply_damage(rand(3), BRUTE, affecting) + M.deal_generic_attack(src) /mob/living/carbon/alien/attack_hand(mob/living/carbon/human/M) if(..()) //to allow surgery to return properly. @@ -68,8 +66,7 @@ In all, this is a lot like the monkey code. /N playsound(loc, "punch", 25, 1, -1) visible_message("[M] punches [src]!", \ "[M] punches you!", null, COMBAT_MESSAGE_RANGE) - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) - apply_damage(M.dna.species.punchdamage, BRUTE, affecting) + apply_damage(M.dna.species.damage_source_type, M.dna.species.damage_type, M.dna.species.punchdamage, ran_zone(M.zone_selected)) log_combat(M, src, "attacked") M.do_attack_animation(src, ATTACK_EFFECT_PUNCH) @@ -81,36 +78,6 @@ In all, this is a lot like the monkey code. /N if("grab") grabbedby(M) -/mob/living/carbon/alien/attack_animal(mob/living/simple_animal/M) - if(!..()) - return - var/damage = M.melee_damage - switch(M.melee_damage_type) - if(BRUTE) - adjustBruteLoss(damage) - if(BURN) - adjustFireLoss(damage) - if(TOX) - adjustToxLoss(damage) - if(OXY) - adjustOxyLoss(damage) - if(CLONE) - adjustCloneLoss(damage) - if(STAMINA) - adjustStaminaLoss(damage) - -/mob/living/carbon/alien/attack_slime(mob/living/simple_animal/slime/M) - if(!..()) - return //gotta be a successful slime attack - var/damage = rand(20) - if(M.is_adult) - damage = rand(30) - if(M.transformeffects & SLIME_EFFECT_RED) - damage *= 1.1 - adjustBruteLoss(damage) - log_combat(M, src, "attacked") - updatehealth() - /mob/living/carbon/alien/ex_act(severity, target, origin) if(origin && istype(origin, /datum/spacevine_mutation) && isvineimmune(src)) return diff --git a/code/modules/mob/living/carbon/alien/damage_procs.dm b/code/modules/mob/living/carbon/alien/damage_procs.dm index d5f324de53aa2..76b2957f6b17a 100644 --- a/code/modules/mob/living/carbon/alien/damage_procs.dm +++ b/code/modules/mob/living/carbon/alien/damage_procs.dm @@ -2,12 +2,12 @@ /mob/living/carbon/alien/getToxLoss() return FALSE -/mob/living/carbon/alien/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE) //alien immune to tox damage +/mob/living/carbon/alien/adjustToxLoss(amount, forced = FALSE) //alien immune to tox damage return FALSE //aliens are immune to stamina damage. -/mob/living/carbon/alien/adjustStaminaLoss(amount, updating_health = 1, forced = FALSE) +/mob/living/carbon/alien/adjustStaminaLoss(amount, forced = FALSE) return FALSE -/mob/living/carbon/alien/setStaminaLoss(amount, updating_health = 1) +/mob/living/carbon/alien/setStaminaLoss(amount) return FALSE diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm index 187fe81bf6665..53341bdfab791 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm @@ -1,7 +1,7 @@ /mob/living/carbon/alien/humanoid/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) if(user.a_intent == INTENT_HARM) ..(user, 1) - adjustBruteLoss(15) + apply_damage(/datum/damage_source/blunt/light, BRUTE, 15, null) var/hitverb = "punches" if(mob_size < MOB_SIZE_LARGE) step_away(src,user,15) diff --git a/code/modules/mob/living/carbon/alien/humanoid/queen.dm b/code/modules/mob/living/carbon/alien/humanoid/queen.dm index 399295cf8a860..a122214a1b62c 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/queen.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/queen.dm @@ -157,7 +157,7 @@ . = ..() ADD_TRAIT(src, TRAIT_NODROP, ABSTRACT_ITEM_TRAIT) -/obj/item/queenpromote/attack(mob/living/M, mob/living/carbon/alien/humanoid/user) +/obj/item/queenpromote/attack_mob_target(mob/living/M, mob/living/carbon/alien/humanoid/user) if(!isalienadult(M) || isalienroyal(M)) to_chat(user, "You may only use this with your adult, non-royal children!") return diff --git a/code/modules/mob/living/carbon/alien/larva/larva_defense.dm b/code/modules/mob/living/carbon/alien/larva/larva_defense.dm index 425501773550f..4869ac5b0fcb7 100644 --- a/code/modules/mob/living/carbon/alien/larva/larva_defense.dm +++ b/code/modules/mob/living/carbon/alien/larva/larva_defense.dm @@ -6,13 +6,12 @@ log_combat(M, src, "attacked") visible_message("[M] kicks [src]!", \ "[M] kicks you!", null, COMBAT_MESSAGE_RANGE) - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) - apply_damage(M.dna.species.punchdamage, BRUTE, affecting) + apply_damage(M.dna.species.damage_source_type, M.dna.species.damage_type, M.dna.species.punchdamage, ran_zone(M.zone_selected)) /mob/living/carbon/alien/larva/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) if(user.a_intent == INTENT_HARM) ..(user, 1) - adjustBruteLoss(5 + rand(1,9)) + apply_damage(/datum/damage_source/blunt/light, BRUTE, 5 + rand(1, 9), null) user.AddComponent(/datum/component/force_move, get_step_away(user,src, 30)) return 1 diff --git a/code/modules/mob/living/carbon/alien/organs.dm b/code/modules/mob/living/carbon/alien/organs.dm index 12d13bd80e821..8c438409cdffb 100644 --- a/code/modules/mob/living/carbon/alien/organs.dm +++ b/code/modules/mob/living/carbon/alien/organs.dm @@ -75,10 +75,10 @@ if(!isalien(owner)) heal_amt *= 0.2 owner.adjustPlasma(plasma_rate*0.5) - owner.adjustBruteLoss(-heal_amt) + owner.adjustBruteLossAbstract(-heal_amt) owner.adjustFireLoss(-heal_amt) owner.adjustOxyLoss(-heal_amt) - owner.adjustCloneLoss(-heal_amt) + owner.adjustCloneLossAbstract(-heal_amt) else owner.adjustPlasma(plasma_rate * 0.1) diff --git a/code/modules/mob/living/carbon/alien/special/alien_embryo.dm b/code/modules/mob/living/carbon/alien/special/alien_embryo.dm index 8500172811799..9dc1cd6cc50b9 100644 --- a/code/modules/mob/living/carbon/alien/special/alien_embryo.dm +++ b/code/modules/mob/living/carbon/alien/special/alien_embryo.dm @@ -122,15 +122,10 @@ var/mob/living/carbon/host = owner if(kill_on_success) new_xeno.visible_message("[new_xeno] bursts out of [owner] in a shower of gore!", "You exit [owner], your previous host.", "You hear organic matter ripping and tearing!") - var/obj/item/bodypart/BP = owner.get_bodypart(BODY_ZONE_CHEST) - if(BP) - BP.receive_damage(brute = 200) // Kill them dead - BP.dismember() - else - owner.apply_damage(200) + owner.apply_damage(/datum/damage_source/internal_rupture, /datum/damage/brute, 200, BODY_ZONE_CHEST) else new_xeno.visible_message("[new_xeno] wriggles out of [owner]!", "You exit [owner], your previous host.") - owner.adjustBruteLoss(40) + owner.apply_damage(/datum/damage_source/internal_rupture, /datum/damage/brute, 40, BODY_ZONE_CHEST) host.cut_overlay(overlay) qdel(src) diff --git a/code/modules/mob/living/carbon/alien/special/facehugger.dm b/code/modules/mob/living/carbon/alien/special/facehugger.dm index fba3b5b2d374a..4890a45dab443 100644 --- a/code/modules/mob/living/carbon/alien/special/facehugger.dm +++ b/code/modules/mob/living/carbon/alien/special/facehugger.dm @@ -21,6 +21,7 @@ flags_cover = MASKCOVERSEYES | MASKCOVERSMOUTH layer = MOB_LAYER max_integrity = 100 + obj_flags = CAN_BE_HIT var/stat = CONSCIOUS //UNCONSCIOUS is the idle state in this case var/sterile = FALSE @@ -62,9 +63,6 @@ if(obj_integrity < 90) Die() -/obj/item/clothing/mask/facehugger/attackby(obj/item/O, mob/user, params) - return O.attack_obj(src, user) - /obj/item/clothing/mask/facehugger/attack_alien(mob/user) //can be picked up by aliens return attack_hand(user) @@ -75,7 +73,7 @@ return return ..() -/obj/item/clothing/mask/facehugger/attack(mob/living/M, mob/user) +/obj/item/clothing/mask/facehugger/attack_mob_target(mob/living/M, mob/user) . = ..() if(user.transferItemToLoc(src, get_turf(M))) Leap(M) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index a32f71af12a83..0479291d44ade 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -62,10 +62,10 @@ else mode() // Activate held item -/mob/living/carbon/attackby(obj/item/I, mob/user, params) +/mob/living/carbon/item_interact(obj/item/I, mob/user, params) for(var/datum/surgery/S in surgeries) if(!(mobility_flags & MOBILITY_STAND) || !S.lying_required) - if((S.self_operable || user != src) && (user.a_intent == INTENT_HELP || user.a_intent == INTENT_DISARM)) + if(S.self_operable || user != src) if(S.next_step(user,user.a_intent)) return TRUE return ..() @@ -370,7 +370,7 @@ switch(rand(1,100)+modifier) //91-100=Nothing special happens if(-INFINITY to 0) //attack yourself - I.attack(src,src) + I.attack_mob_target(src,src) if(1 to 30) //throw it at yourself I.throw_impact(src) if(31 to 60) //Throw object in facing direction @@ -449,7 +449,7 @@ if(T) add_splatter_floor(T) if(stun) - adjustBruteLoss(3) + apply_damage(/datum/damage_source/chemical, BRUTE, 3, null) else if(src.reagents.has_reagent(/datum/reagent/consumable/ethanol/blazaam, needs_metabolizing = TRUE)) if(T) T.add_vomit_floor(src, VOMIT_PURPLE) @@ -516,7 +516,7 @@ enter_stamcrit() else if(stam_paralyzed) stam_paralyzed = FALSE - REMOVE_TRAIT(src,TRAIT_INCAPACITATED, STAMINA) + REMOVE_TRAIT(src,TRAIT_INCAPACITATED, STAMINA_DAMTYPE) else return update_health_hud() diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index 939c17e615e57..ef6e08b41e343 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -70,47 +70,14 @@ ..(AM, skipcatch, hitpush, blocked, throwingdatum) -/mob/living/carbon/attacked_by(obj/item/I, mob/living/user) +/mob/living/carbon/on_attacked(obj/item/I, mob/living/user) var/obj/item/bodypart/affecting + var/target_zone = check_zone(user.zone_selected) affecting = get_bodypart(check_zone(user.zone_selected)) if(!affecting) //missing limb? we select the first bodypart (you can never have zero, because of chest) affecting = bodyparts[1] SEND_SIGNAL(I, COMSIG_ITEM_ATTACK_ZONE, src, user, affecting) - send_item_attack_message(I, user, parse_zone(affecting.body_zone)) - if(I.force) - var/armour_block = run_armor_check(affecting, MELEE, armour_penetration = I.armour_penetration) - apply_damage(I.force, I.damtype, affecting, armour_block) - if(I.damtype == BRUTE && (IS_ORGANIC_LIMB(affecting))) - if(I.is_sharp() || I.force >= 10) - I.add_mob_blood(src) - var/turf/location = get_turf(src) - add_splatter_floor(location) - if(get_dist(user, src) <= 1) //people with TK won't get smeared with blood - user.add_mob_blood(src) - if(affecting.body_zone == BODY_ZONE_HEAD) - if(wear_mask) - wear_mask.add_mob_blood(src) - update_inv_wear_mask() - if(wear_neck) - wear_neck.add_mob_blood(src) - update_inv_neck() - if(head) - head.add_mob_blood(src) - update_inv_head() - - //dismemberment - var/dismemberthreshold = (((affecting.max_damage * 2) / max(I.is_sharp(), 0.5)) - (affecting.get_damage() + ((I.w_class - 3) * 10) + ((I.attack_weight - 1) * 15))) - if(HAS_TRAIT(src, TRAIT_EASYDISMEMBER)) - dismemberthreshold -= 50 - if(I.is_sharp()) - dismemberthreshold = min(((affecting.max_damage * 2) - affecting.get_damage()), dismemberthreshold) //makes it so limbs wont become immune to being dismembered if the item is sharp - if(stat == DEAD) - dismemberthreshold = dismemberthreshold / 3 - if(I.force >= dismemberthreshold && I.force >= 10) - if(affecting.dismember(I.damtype)) - I.add_mob_blood(src) - playsound(get_turf(src), I.get_dismember_sound(), 80, 1) - return TRUE //successful attack + return I.deal_attack(user, src, target_zone) //successful attack /mob/living/carbon/attack_drone(mob/living/simple_animal/drone/user) return //so we don't call the carbon's attack_hand(). @@ -163,22 +130,19 @@ return 1 -/mob/living/carbon/attack_slime(mob/living/simple_animal/slime/M) - if(..()) //successful slime attack - if(M.powerlevel > 0) - M.powerlevel-- - visible_message("The [M.name] has shocked [src]!", \ - "The [M.name] has shocked you!") - do_sparks(5, TRUE, src) - Knockdown(M.powerlevel*5) - if(stuttering < M.powerlevel) - stuttering = M.powerlevel - if(M.transformeffects & SLIME_EFFECT_ORANGE) - adjust_fire_stacks(2) - IgniteMob() - adjustFireLoss(M.powerlevel * 3) - updatehealth() - return TRUE +/mob/living/carbon/after_attacked_by_slime(mob/living/simple_animal/slime/M) + if(M.powerlevel > 0) + M.powerlevel-- + visible_message("The [M.name] has shocked [src]!", \ + "The [M.name] has shocked you!") + do_sparks(5, TRUE, src) + Knockdown(M.powerlevel*5) + if(stuttering < M.powerlevel) + stuttering = M.powerlevel + if(M.transformeffects & SLIME_EFFECT_ORANGE) + adjust_fire_stacks(2) + IgniteMob() + adjustFireLoss(M.powerlevel * 3) /mob/living/carbon/proc/dismembering_strike(mob/living/attacker, dam_zone) if(!attacker.limb_destroyer) @@ -208,7 +172,7 @@ return else show_message("The blob attacks!") - adjustBruteLoss(10) + apply_damage(/datum/damage_source/blob, BRUTE, 10, null) /mob/living/carbon/emp_act(severity) . = ..() diff --git a/code/modules/mob/living/carbon/damage_procs.dm b/code/modules/mob/living/carbon/damage_procs.dm index c8aad1d8bb568..88ba237e2c863 100644 --- a/code/modules/mob/living/carbon/damage_procs.dm +++ b/code/modules/mob/living/carbon/damage_procs.dm @@ -1,6 +1,6 @@ -/mob/living/carbon/apply_damage(damage, damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE) +/mob/living/carbon/apply_damage_old(damage, damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE) SEND_SIGNAL(src, COMSIG_MOB_APPLY_DAMGE, damage, damagetype, def_zone) var/hit_percent = (100-blocked)/100 if(!damage || (!forced && hit_percent <= 0)) @@ -23,7 +23,7 @@ if(BP.receive_damage(damage_amount, 0)) update_damage_overlays() else //no bodypart, we deal damage with a more general method. - adjustBruteLoss(damage_amount, forced = forced) + adjustBruteLossAbstract(damage_amount, forced = forced) if(BURN) if(BP) if(BP.receive_damage(0, damage_amount)) @@ -35,8 +35,8 @@ if(OXY) adjustOxyLoss(damage_amount, forced = forced) if(CLONE) - adjustCloneLoss(damage_amount, forced = forced) - if(STAMINA) + adjustCloneLossAbstract(damage_amount, forced = forced) + if(STAMINA_DAMTYPE) if(BP) if(BP.receive_damage(0, 0, damage_amount)) update_damage_overlays() @@ -59,29 +59,29 @@ return amount -/mob/living/carbon/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE, required_status) +/mob/living/carbon/adjustBruteLossAbstract(amount, forced = FALSE, required_status) if(!forced && (status_flags & GODMODE)) return FALSE if(amount > 0) - take_overall_damage(amount, 0, 0, updating_health, required_status) + take_overall_damage(amount, 0, 0, required_status) else if(!required_status) required_status = forced ? null : BODYTYPE_ORGANIC - heal_overall_damage(abs(amount), 0, 0, required_status, updating_health) + heal_overall_damage(abs(amount), 0, 0, required_status) return amount -/mob/living/carbon/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE, required_status) +/mob/living/carbon/adjustFireLoss(amount, forced = FALSE, required_status) if(!forced && (status_flags & GODMODE)) return FALSE if(amount > 0) - take_overall_damage(0, amount, 0, updating_health, required_status) + take_overall_damage(0, amount, 0, required_status) else if(!required_status) required_status = forced ? null : BODYTYPE_ORGANIC - heal_overall_damage(0, abs(amount), 0, required_status, updating_health) + heal_overall_damage(0, abs(amount), 0, required_status) return amount -/mob/living/carbon/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/carbon/adjustToxLoss(amount, forced = FALSE) if(!forced && HAS_TRAIT(src, TRAIT_TOXINLOVER)) //damage becomes healing and healing becomes damage amount = -amount if(amount > 0) @@ -97,21 +97,21 @@ for(var/obj/item/bodypart/BP as() in bodyparts) . += round(BP.stamina_dam * BP.stam_damage_coeff, DAMAGE_PRECISION) -/mob/living/carbon/adjustStaminaLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/carbon/adjustStaminaLoss(amount, forced = FALSE) if(!forced && (status_flags & GODMODE)) return FALSE if(amount > 0) - take_overall_damage(0, 0, amount, updating_health) + take_overall_damage(0, 0, amount) else - heal_overall_damage(0, 0, abs(amount), null, updating_health) + heal_overall_damage(0, 0, abs(amount), null) return amount -/mob/living/carbon/setStaminaLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/carbon/setStaminaLoss(amount, forced = FALSE) var/current = getStaminaLoss() var/diff = amount - current if(!diff) return - adjustStaminaLoss(diff, updating_health, forced) + adjustStaminaLoss(diff, forced) /** adjustOrganLoss * inputs: slot (organ slot, like ORGAN_SLOT_HEART), amount (damage to be done), and maximum (currently an arbitrarily large number, can be set so as to limit damage) @@ -124,6 +124,7 @@ if(required_status && O.status != required_status) return FALSE O.applyOrganDamage(amount, maximum) + UPDATE_HEALTH(src) /** setOrganLoss * inputs: slot (organ slot, like ORGAN_SLOT_HEART), amount(damage to be set to) @@ -135,6 +136,7 @@ var/obj/item/organ/O = getorganslot(slot) if(O && !(status_flags & GODMODE)) O.setOrganDamage(amount) + UPDATE_HEALTH(src) /** getOrganLoss * inputs: slot (organ slot, like ORGAN_SLOT_HEART) @@ -171,7 +173,7 @@ //Heals ONE bodypart randomly selected from damaged ones. //It automatically updates damage overlays if necessary //It automatically updates health status -/mob/living/carbon/heal_bodypart_damage(brute = 0, burn = 0, stamina = 0, updating_health = TRUE, required_status) +/mob/living/carbon/heal_bodypart_damage(brute = 0, burn = 0, stamina = 0, required_status) var/list/obj/item/bodypart/parts = get_damaged_bodyparts(brute,burn,stamina,required_status) if(!parts.len) return @@ -182,16 +184,16 @@ //Damages ONE bodypart randomly selected from damagable ones. //It automatically updates damage overlays if necessary //It automatically updates health status -/mob/living/carbon/take_bodypart_damage(brute = 0, burn = 0, stamina = 0, updating_health = TRUE, required_status, check_armor = FALSE) +/mob/living/carbon/take_bodypart_damage(brute = 0, burn = 0, stamina = 0, required_status, check_armor = FALSE) var/list/obj/item/bodypart/parts = get_damageable_bodyparts(required_status) if(!parts.len) return var/obj/item/bodypart/picked = pick(parts) - if(picked.receive_damage(brute, burn, stamina,check_armor ? run_armor_check(picked, (brute ? MELEE : burn ? FIRE : stamina ? STAMINA : null)) : FALSE)) + if(picked.receive_damage(brute, burn, stamina,check_armor ? run_armor_check(picked, (brute ? MELEE : burn ? FIRE : stamina ? STAMINA_DAMTYPE : null)) : FALSE)) update_damage_overlays() //Heal MANY bodyparts, in random order -/mob/living/carbon/heal_overall_damage(brute = 0, burn = 0, stamina = 0, required_status, updating_health = TRUE) +/mob/living/carbon/heal_overall_damage(brute = 0, burn = 0, stamina = 0, required_status) var/list/obj/item/bodypart/parts = get_damaged_bodyparts(brute, burn, stamina, required_status) var/update = NONE @@ -209,14 +211,14 @@ stamina = round(stamina - (stamina_was - picked.stamina_dam), DAMAGE_PRECISION) parts -= picked - if(updating_health) - updatehealth() + UPDATE_HEALTH(src) + if(stamina != 0) update_stamina(stamina >= DAMAGE_PRECISION) if(update) update_damage_overlays() // damage MANY bodyparts, in random order -/mob/living/carbon/take_overall_damage(brute = 0, burn = 0, stamina = 0, updating_health = TRUE, required_status) +/mob/living/carbon/take_overall_damage(brute = 0, burn = 0, stamina = 0, required_status) if(status_flags & GODMODE) return //godmode @@ -240,8 +242,7 @@ stamina = round(stamina - (picked.stamina_dam - stamina_was), DAMAGE_PRECISION) parts -= picked - if(updating_health) - updatehealth() + UPDATE_HEALTH(src) if(update) update_damage_overlays() update_stamina(stamina >= DAMAGE_PRECISION) diff --git a/code/modules/mob/living/carbon/human/damage_procs.dm b/code/modules/mob/living/carbon/human/damage_procs.dm index 1d6bfef41988e..f3f826a187a21 100644 --- a/code/modules/mob/living/carbon/human/damage_procs.dm +++ b/code/modules/mob/living/carbon/human/damage_procs.dm @@ -1,10 +1,10 @@ -/mob/living/carbon/human/apply_damage(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE) - // depending on the species, it will run the corresponding apply_damage code there +/mob/living/carbon/human/apply_damage_old(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE) + // depending on the species, it will run the corresponding apply_damage_old code there if(stat != DEAD && (damagetype==BRUTE || damagetype==BURN) && damage>10 && prob(10+damage/2)) INVOKE_ASYNC(src, PROC_REF(emote), "scream") - return dna.species.apply_damage(damage, damagetype, def_zone, blocked, src, forced) + return ..() /mob/living/carbon/human/revive(full_heal = 0, admin_revive = 0) if(..()) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index cd38b66f7b526..66a251a69d363 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -584,7 +584,6 @@ if(they_breathe && they_lung) var/suff = min(C.getOxyLoss(), 7) C.adjustOxyLoss(-suff) - C.updatehealth() to_chat(C, "You feel a breath of fresh air enter your lungs. It feels good.") else if(they_breathe && !they_lung) to_chat(C, "You feel a breath of fresh air, but you don't feel any better.") @@ -1093,13 +1092,15 @@ return ..() /mob/living/carbon/human/proc/stub_toe(var/power) + // If you are super heavilly armoured, the damage might be deflected + if (!apply_damage(/datum/damage_source/impact, /datum/damage/brute, power, pick(BODY_ZONE_PRECISE_R_FOOT, BODY_ZONE_PRECISE_L_FOOT))) + return if(HAS_TRAIT(src, TRAIT_LIGHT_STEP)) power *= 0.5 - src.emote("gasp") + emote("gasp") else - src.emote("scream") - src.apply_damage(power, BRUTE, def_zone = pick(BODY_ZONE_PRECISE_R_FOOT, BODY_ZONE_PRECISE_L_FOOT)) - src.Paralyze(10 * power) + emote("scream") + Paralyze(10 * power) /mob/living/carbon/human/monkeybrain ai_controller = /datum/ai_controller/monkey diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 638da6cbfec76..4bad17f228c04 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -170,7 +170,7 @@ ..() -/mob/living/carbon/human/attacked_by(obj/item/I, mob/living/user) +/mob/living/carbon/human/on_attacked(obj/item/I, mob/living/user) if(!I || !user) return 0 @@ -181,7 +181,7 @@ affecting = get_bodypart(ran_zone(user.zone_selected)) var/target_area = parse_zone(check_zone(user.zone_selected)) //our intended target if(affecting) - if(I.force && I.damtype != STAMINA && (!IS_ORGANIC_LIMB(affecting))) // Bodpart_robotic sparks when hit, but only when it does real damage + if(I.force && I.damtype != STAMINA_DAMTYPE && (!IS_ORGANIC_LIMB(affecting))) // Bodpart_robotic sparks when hit, but only when it does real damage if(I.force >= 5) do_sparks(1, FALSE, loc) if(prob(25)) @@ -193,7 +193,7 @@ SSblackbox.record_feedback("tally", "zone_targeted", 1, target_area) // the attacked_by code varies among species - return dna.species.spec_attacked_by(I, user, affecting, a_intent, src) + return dna.species.spec_on_attacked(I, user, affecting, a_intent, src) /mob/living/carbon/human/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) @@ -206,11 +206,7 @@ var/message = "[user] has [hulk_verb]ed [src]!" visible_message("[message]", \ "[message]") - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(user.zone_selected)) - if(!affecting) - affecting = get_bodypart(BODY_ZONE_CHEST) - var/armor_block = run_armor_check(affecting, MELEE,"","",10) - apply_damage(20, BRUTE, affecting, armor_block) + apply_damage(user.dna?.species.damage_source_type || /datum/damage_source/punch, user.dna?.species.damage_type || /datum/damage/brute, 20, ran_zone(user.zone_selected)) return 1 /mob/living/carbon/human/attack_hand(mob/user) @@ -244,7 +240,7 @@ if(..()) //successful monkey bite, this handles disease contraction. var/damage = rand(1, 3) if(stat != DEAD) - apply_damage(damage, BRUTE, affecting, run_armor_check(affecting, MELEE)) + apply_damage(/datum/damage_source/sharp/light, /datum/damage/brute, damage, affecting) return 1 /mob/living/carbon/human/attack_alien(mob/living/carbon/alien/humanoid/M) @@ -260,7 +256,6 @@ var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) if(!affecting) affecting = get_bodypart(BODY_ZONE_CHEST) - var/armor_block = run_armor_check(affecting, MELEE,"","",10) playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1) visible_message("[M] slashes at [src]!", \ @@ -268,7 +263,7 @@ log_combat(M, src, "attacked") if(!dismembering_strike(M, M.zone_selected)) //Dismemberment successful return 1 - apply_damage(20, BRUTE, affecting, armor_block) + apply_damage(/datum/damage_source/sharp/light, /datum/damage/brute, 20, affecting) if(M.a_intent == INTENT_DISARM) playsound(loc, 'sound/weapons/pierce.ogg', 25, 1, -1) @@ -277,13 +272,12 @@ var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) if(!affecting) affecting = get_bodypart(BODY_ZONE_CHEST) - var/armor_block = run_armor_check(affecting, MELEE,"","",10) - apply_damage(30, STAMINA, affecting, armor_block) + apply_damage(/datum/damage_source/blunt/light, /datum/damage/stamina, 30, affecting) visible_message("[M] tackles [src] down!", \ "[M] tackles you down!") -/mob/living/carbon/human/attack_larva(mob/living/carbon/alien/larva/L) +/mob/living/carbon/human/larva_attack_intercept(mob/living/carbon/alien/larva/L) if(..()) //successful larva bite. var/damage = rand(1, 3) @@ -291,11 +285,7 @@ return 0 if(stat != DEAD) L.amount_grown = min(L.amount_grown + damage, L.max_grown) - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(L.zone_selected)) - if(!affecting) - affecting = get_bodypart(BODY_ZONE_CHEST) - var/armor_block = run_armor_check(affecting, MELEE) - apply_damage(damage, BRUTE, affecting, armor_block) + apply_damage(/datum/damage_source/sharp/light, /datum/damage/brute, damage, ran_zone(L.zone_selected)) /mob/living/carbon/human/attack_animal(mob/living/simple_animal/M) @@ -307,34 +297,7 @@ var/dam_zone = dismembering_strike(M, pick(BODY_ZONE_CHEST, BODY_ZONE_PRECISE_L_HAND, BODY_ZONE_PRECISE_R_HAND, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)) if(!dam_zone) //Dismemberment successful return TRUE - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(dam_zone)) - if(!affecting) - affecting = get_bodypart(BODY_ZONE_CHEST) - var/armor = run_armor_check(affecting, MELEE, armour_penetration = M.armour_penetration) - apply_damage(damage, M.melee_damage_type, affecting, armor) - - -/mob/living/carbon/human/attack_slime(mob/living/simple_animal/slime/M) - if(..()) //successful slime attack - var/damage = 20 - if(M.is_adult) - damage = 30 - - if(M.transformeffects & SLIME_EFFECT_RED) - damage *= 1.1 - - if(check_shields(M, damage, "the [M.name]")) - return 0 - - var/dam_zone = dismembering_strike(M, pick(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)) - if(!dam_zone) //Dismemberment successful - return 1 - - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(dam_zone)) - if(!affecting) - affecting = get_bodypart(BODY_ZONE_CHEST) - var/armor_block = run_armor_check(affecting, MELEE) - apply_damage(damage, BRUTE, affecting, armor_block) + apply_damage(M.melee_damage_source, M.melee_damage_type, damage, ran_zone(dam_zone)) /mob/living/carbon/human/mech_melee_attack(obj/mecha/M) @@ -363,7 +326,6 @@ return if(update) update_damage_overlays() - updatehealth() visible_message("[M.name] hits [src]!", \ "[M.name] hits you!", null, COMBAT_MESSAGE_RANGE) @@ -423,8 +385,8 @@ adjustEarDamage(15,60) Knockdown(160 - (bomb_armor * 1.6)) //100 bomb armor will prevent knockdown altogether - apply_damage(brute_loss, BRUTE, blocked = (bomb_armor * 0.6)) - apply_damage(burn_loss, BURN, blocked = (bomb_armor * 0.6)) + apply_damage(/datum/damage_source/explosion, /datum/damage/brute, brute_loss) + apply_damage(/datum/damage_source/explosion, /datum/damage/burn, burn_loss) //attempt to dismember bodyparts if(severity >= EXPLODE_HEAVY || !bomb_armor) @@ -451,9 +413,7 @@ return show_message("The blob attacks you!") var/dam_zone = pick(BODY_ZONE_CHEST, BODY_ZONE_PRECISE_L_HAND, BODY_ZONE_PRECISE_R_HAND, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG) - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(dam_zone)) - apply_damage(5, BRUTE, affecting, run_armor_check(affecting, MELEE)) - + apply_damage(/datum/damage_source/blob, /datum/damage/brute, 5, ran_zone(dam_zone)) //Added a safety check in case you want to shock a human mob directly through electrocute_act. /mob/living/carbon/human/electrocute_act(shock_damage, source, siemens_coeff = 1, safety = 0, override = 0, tesla_shock = 0, illusion = 0, stun = TRUE) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index a301d31df1433..3b584629aeacc 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -37,7 +37,7 @@ adjustOxyLoss(8) Unconscious(80) // Tissues die without blood circulation - adjustBruteLoss(2) + apply_damage(/datum/damage_source/body, BRUTE, 2, null) dna.species.spec_life(src) // for mutantraces diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index 8bb0349378919..fc8fa8543042e 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -48,7 +48,8 @@ GLOBAL_LIST_EMPTY(features_by_species) var/clonemod = 1 var/toxmod = 1 var/staminamod = 1 // multiplier for stun duration - var/attack_type = BRUTE //Type of damage attack does + var/damage_source_type = /datum/damage_source/punch + var/damage_type = /datum/damage/brute //Type of damage attack does var/punchdamage = 7 //highest possible punch damage var/siemens_coeff = 1 //base electrocution coefficient var/damage_overlay_type = "human" //what kind of damage overlays (if any) appear on our species when wounded? @@ -1044,7 +1045,8 @@ GLOBAL_LIST_EMPTY(features_by_species) var/takes_crit_damage = (!HAS_TRAIT(H, TRAIT_NOCRITDAMAGE)) if((H.health <= H.crit_threshold) && takes_crit_damage) - H.adjustBruteLoss(1) + var/datum/damage_source/body/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(H, BRUTE, 1, null) if(H.getorgan(/obj/item/organ/wings)) handle_flight(H) @@ -1544,17 +1546,13 @@ GLOBAL_LIST_EMPTY(features_by_species) var/damage = user.dna.species.punchdamage - var/obj/item/bodypart/affecting = target.get_bodypart(ran_zone(user.zone_selected)) - - if(!damage || !affecting)//future-proofing for species that have 0 damage/weird cases where no zone is targeted + if(!damage)//future-proofing for species that have 0 damage/weird cases where no zone is targeted playsound(target.loc, user.dna.species.miss_sound, 25, 1, -1) target.visible_message("[user]'s [atk_verb] misses [target]!",\ "[user]'s [atk_verb] misses you!", null, COMBAT_MESSAGE_RANGE) log_combat(user, target, "attempted to punch") return FALSE - var/armor_block = target.run_armor_check(affecting, MELEE) - playsound(target.loc, user.dna.species.attack_sound, 25, 1, -1) target.visible_message("[user] [atk_verb]ed [target]!", \ @@ -1562,24 +1560,25 @@ GLOBAL_LIST_EMPTY(features_by_species) target.lastattacker = user.real_name target.lastattackerckey = user.ckey - user.dna.species.spec_unarmedattacked(user, target) + user.dna.species.spec_primary_interacted(user, target) + var/target_zone = ran_zone(user.zone_selected) if(user.limb_destroyer) - target.dismembering_strike(user, affecting.body_zone) + target.dismembering_strike(user,target_zone) if(atk_verb == ATTACK_EFFECT_KICK)//kicks deal 1.5x raw damage - target.apply_damage(damage*1.5, attack_type, affecting, armor_block) + target.apply_damage(damage_source_type, damage_type, damage * 1.5, target_zone) if((damage * 1.5) >= 9) target.force_say() log_combat(user, target, "kicked") else//other attacks deal full raw damage + 1.5x in stamina damage - target.apply_damage(damage, attack_type, affecting, armor_block) - target.apply_damage(damage*1.5, STAMINA, affecting, armor_block) + target.apply_damage(damage_source_type, damage_type, damage, target_zone) + target.apply_damage(damage_source_type, /datum/damage/stamina, damage * 1.5, target_zone) if(damage >= 9) target.force_say() log_combat(user, target, "punched") -/datum/species/proc/spec_unarmedattacked(mob/living/carbon/human/user, mob/living/carbon/human/target) +/datum/species/proc/spec_primary_interacted(mob/living/carbon/human/user, mob/living/carbon/human/target) return /datum/species/proc/disarm(mob/living/carbon/user, mob/living/carbon/human/target, datum/martial_art/attacker_style) @@ -1737,7 +1736,7 @@ GLOBAL_LIST_EMPTY(features_by_species) if("disarm") disarm(M, H, attacker_style) -/datum/species/proc/spec_attacked_by(obj/item/I, mob/living/user, obj/item/bodypart/affecting, intent, mob/living/carbon/human/H) +/datum/species/proc/spec_on_attacked(obj/item/I, mob/living/user, obj/item/bodypart/affecting, intent, mob/living/carbon/human/H) // Allows you to put in item-specific reactions based on species if(user != H) if(H.check_shields(I, I.force, "the [I.name]", MELEE_ATTACK, I.armour_penetration)) @@ -1746,136 +1745,8 @@ GLOBAL_LIST_EMPTY(features_by_species) H.visible_message("[H] blocks [I]!", \ "You block [I]!") return 0 - - var/hit_area - if(!affecting) //Something went wrong. Maybe the limb is missing? - affecting = H.bodyparts[1] - - hit_area = parse_zone(affecting.body_zone) - var/def_zone = affecting.body_zone - - var/armor_block = H.run_armor_check(affecting, MELEE, "Your armor has protected your [hit_area]!", "Your armor has softened a hit to your [hit_area]!",I.armour_penetration) - var/Iforce = I.force //to avoid runtimes on the forcesay checks at the bottom. Some items might delete themselves if you drop them. (stunning yourself, ninja swords) - - var/weakness = H.check_weakness(I, user) - apply_damage(I.force * weakness, I.damtype, def_zone, armor_block, H) - - H.send_item_attack_message(I, user, hit_area) - - if(!I.force) - return 0 //item force is zero - - //dismemberment - var/dismemberthreshold = ((affecting.max_damage * 2) - affecting.get_damage()) //don't take the current hit into account. - var/attackforce = (((I.w_class - 3) * 5) + ((I.attack_weight - 1) * 14) + ((I.is_sharp()-1) * 20)) //all the variables that go into ripping off a limb in one handy package. Force is absent because it's already been taken into account by the limb being damaged - if(HAS_TRAIT(src, TRAIT_EASYDISMEMBER)) - dismemberthreshold -= 30 - if(I.is_sharp()) - attackforce = max(attackforce, I.force) - if(attackforce >= dismemberthreshold && I.force >= 10) - if(affecting.dismember(I.damtype)) - I.add_mob_blood(H) - playsound(get_turf(H), I.get_dismember_sound(), 80, 1) - - var/bloody = 0 - if((I.damtype == BRUTE) && (I.force >= max(10, armor_block) || I.is_sharp())) - if(IS_ORGANIC_LIMB(affecting)) - I.add_mob_blood(H) //Make the weapon bloody, not the person. - if(prob(I.force * 2)) //blood spatter! - bloody = 1 - var/turf/location = H.loc - if(istype(location)) - H.add_splatter_floor(location) - if(get_dist(user, H) <= 1) //people with TK won't get smeared with blood - user.add_mob_blood(H) - - switch(hit_area) - if(BODY_ZONE_HEAD) - if(!I.is_sharp()) - if(H.mind && H.stat == CONSCIOUS && H != user && (H.health - (I.force * I.attack_weight)) <= 0) // rev deconversion through blunt trauma. - var/datum/antagonist/rev/rev = H.mind.has_antag_datum(/datum/antagonist/rev) - if(rev) - rev.remove_revolutionary(FALSE, user) - - if(bloody) //Apply blood - if(H.wear_mask) - H.wear_mask.add_mob_blood(H) - H.update_inv_wear_mask() - if(H.head) - H.head.add_mob_blood(H) - H.update_inv_head() - if(H.glasses && prob(33)) - H.glasses.add_mob_blood(H) - H.update_inv_glasses() - - if(BODY_ZONE_CHEST) - if(bloody) - if(H.wear_suit) - H.wear_suit.add_mob_blood(H) - H.update_inv_wear_suit() - if(H.w_uniform) - H.w_uniform.add_mob_blood(H) - H.update_inv_w_uniform() - - if(Iforce > 10 || Iforce >= 5 && prob(33)) - H.force_say(user) return TRUE -/datum/species/proc/apply_damage(damage, damagetype = BRUTE, def_zone = null, blocked, mob/living/carbon/human/H, forced = FALSE) - SEND_SIGNAL(H, COMSIG_MOB_APPLY_DAMGE, damage, damagetype, def_zone) - var/hit_percent = (100-(blocked+armor))/100 - hit_percent = (hit_percent * (100-H.physiology.damage_resistance))/100 - if(!damage || (!forced && hit_percent <= 0)) - return 0 - - var/obj/item/bodypart/BP = null - if(isbodypart(def_zone)) - BP = def_zone - else - if(!def_zone) - def_zone = check_zone(def_zone) - BP = H.get_bodypart(check_zone(def_zone)) - if(!BP) - BP = H.bodyparts[1] - - switch(damagetype) - if(BRUTE) - H.damageoverlaytemp = 20 - var/damage_amount = forced ? damage : damage * hit_percent * brutemod * H.physiology.brute_mod - if(BP) - if(BP.receive_damage(damage_amount, 0)) - H.update_damage_overlays() - else//no bodypart, we deal damage with a more general method. - H.adjustBruteLoss(damage_amount) - if(BURN) - H.damageoverlaytemp = 20 - var/damage_amount = forced ? damage : damage * hit_percent * burnmod * H.physiology.burn_mod - if(BP) - if(BP.receive_damage(0, damage_amount)) - H.update_damage_overlays() - else - H.adjustFireLoss(damage_amount) - if(TOX) - var/damage_amount = forced ? damage : damage * hit_percent * toxmod * H.physiology.tox_mod - H.adjustToxLoss(damage_amount) - if(OXY) - var/damage_amount = forced ? damage : damage * oxymod * hit_percent * H.physiology.oxy_mod - H.adjustOxyLoss(damage_amount) - if(CLONE) - var/damage_amount = forced ? damage : damage * hit_percent * clonemod * H.physiology.clone_mod - H.adjustCloneLoss(damage_amount) - if(STAMINA) - var/damage_amount = forced ? damage : damage * hit_percent * staminamod * H.physiology.stamina_mod - if(BP) - if(BP.receive_damage(0, 0, damage_amount)) - H.update_stamina(TRUE) - else - H.adjustStaminaLoss(damage_amount) - if(BRAIN) - var/damage_amount = forced ? damage : damage * hit_percent * H.physiology.brain_mod - H.adjustOrganLoss(ORGAN_SLOT_BRAIN, damage_amount) - return 1 - /datum/species/proc/on_hit(obj/projectile/P, mob/living/carbon/human/H) // called when hit by a projectile switch(P.type) @@ -1956,7 +1827,7 @@ GLOBAL_LIST_EMPTY(features_by_species) burn_damage = burn_damage * heatmod * H.physiology.heat_mod if (H.stat < UNCONSCIOUS && (prob(burn_damage) * 10) / 4) //40% for level 3 damage on humans H.emote("scream") - H.apply_damage(burn_damage, BURN) + H.apply_damage(/datum/damage_source/temperature, /datum/damage/burn, burn_damage) else if(H.bodytemperature < BODYTEMP_COLD_DAMAGE_LIMIT && !HAS_TRAIT(H, TRAIT_RESISTCOLD)) SEND_SIGNAL(H, COMSIG_CLEAR_MOOD_EVENT, "hot") @@ -1966,13 +1837,13 @@ GLOBAL_LIST_EMPTY(features_by_species) switch(H.bodytemperature) if(200 to BODYTEMP_COLD_DAMAGE_LIMIT) H.throw_alert("temp", /atom/movable/screen/alert/cold, 1) - H.apply_damage(COLD_DAMAGE_LEVEL_1*coldmod*H.physiology.cold_mod, BURN) + H.apply_damage(/datum/damage_source/temperature, /datum/damage/burn, COLD_DAMAGE_LEVEL_1*coldmod*H.physiology.cold_mod) if(120 to 200) H.throw_alert("temp", /atom/movable/screen/alert/cold, 2) - H.apply_damage(COLD_DAMAGE_LEVEL_2*coldmod*H.physiology.cold_mod, BURN) + H.apply_damage(/datum/damage_source/temperature, /datum/damage/burn, COLD_DAMAGE_LEVEL_2*coldmod*H.physiology.cold_mod) else H.throw_alert("temp", /atom/movable/screen/alert/cold, 3) - H.apply_damage(COLD_DAMAGE_LEVEL_3*coldmod*H.physiology.cold_mod, BURN) + H.apply_damage(/datum/damage_source/temperature, /datum/damage/burn, COLD_DAMAGE_LEVEL_3*coldmod*H.physiology.cold_mod) else H.clear_alert("temp") @@ -1985,7 +1856,7 @@ GLOBAL_LIST_EMPTY(features_by_species) switch(adjusted_pressure) if(HAZARD_HIGH_PRESSURE to INFINITY) if(!HAS_TRAIT(H, TRAIT_RESISTHIGHPRESSURE)) - H.adjustBruteLoss(min(((adjusted_pressure / HAZARD_HIGH_PRESSURE) -1 ) * PRESSURE_DAMAGE_COEFFICIENT, MAX_HIGH_PRESSURE_DAMAGE) * H.physiology.pressure_mod) + H.apply_damage(/datum/damage_source/pressure, BRUTE, min(((adjusted_pressure / HAZARD_HIGH_PRESSURE) -1 ) * PRESSURE_DAMAGE_COEFFICIENT, MAX_HIGH_PRESSURE_DAMAGE), null) H.throw_alert("pressure", /atom/movable/screen/alert/highpressure, 2) else H.clear_alert("pressure") @@ -1999,7 +1870,7 @@ GLOBAL_LIST_EMPTY(features_by_species) if(HAS_TRAIT(H, TRAIT_RESISTLOWPRESSURE)) H.clear_alert("pressure") else - H.adjustBruteLoss(LOW_PRESSURE_DAMAGE * H.physiology.pressure_mod) + H.apply_damage(/datum/damage_source/pressure, BRUTE, LOW_PRESSURE_DAMAGE, null) H.throw_alert("pressure", /atom/movable/screen/alert/lowpressure, 2) ////////// @@ -2427,12 +2298,13 @@ GLOBAL_LIST_EMPTY(features_by_species) /datum/species/proc/create_pref_combat_perks() var/list/to_add = list() - if(attack_type != BRUTE) + if(damage_type != /datum/damage/brute) + var/datum/damage/dealt_damage = GET_DAMAGE(damage_type) to_add += list(list( SPECIES_PERK_TYPE = SPECIES_NEUTRAL_PERK, SPECIES_PERK_ICON = "fist-raised", SPECIES_PERK_NAME = "Elemental Attacker", - SPECIES_PERK_DESC = "[plural_form] deal [attack_type] damage with their punches instead of brute.", + SPECIES_PERK_DESC = "[plural_form] deal [dealt_damage.display_name] damage with their punches instead of brute.", )) return to_add diff --git a/code/modules/mob/living/carbon/human/species_types/ethereal.dm b/code/modules/mob/living/carbon/human/species_types/ethereal.dm index a261fab61f0e9..9788feefad971 100644 --- a/code/modules/mob/living/carbon/human/species_types/ethereal.dm +++ b/code/modules/mob/living/carbon/human/species_types/ethereal.dm @@ -11,7 +11,8 @@ exotic_blood = /datum/reagent/consumable/liquidelectricity //Liquid Electricity. fuck you think of something better gamer siemens_coeff = 0.5 //They thrive on energy brutemod = 1.25 //They're weak to punches - attack_type = BURN //burn bish + damage_type = /datum/damage/burn + damage_source_type = /datum/damage_source/stun damage_overlay_type = "" //We are too cool for regular damage overlays species_traits = list(DYNCOLORS, AGENDER, HAIR) changesource_flags = MIRROR_BADMIN | WABBAJACK | MIRROR_PRIDE | MIRROR_MAGIC | RACE_SWAP | ERT_SPAWN | SLIME_EXTRACT @@ -162,12 +163,12 @@ if(1 to NUTRITION_LEVEL_STARVING) H.throw_alert("nutrition", /atom/movable/screen/alert/etherealcharge, 2) if(H.health > 10.5) - apply_damage(0.65, TOX, null, null, H) + H.apply_damage(/datum/damage_source/body, /datum/damage/toxin, 0.65, forced = TRUE) brutemod = 1.75 else H.throw_alert("nutrition", /atom/movable/screen/alert/etherealcharge, 3) if(H.health > 10.5) - apply_damage(1, TOX, null, null, H) + H.apply_damage(/datum/damage_source/body, /datum/damage/toxin, 1, forced = TRUE) brutemod = 2 /datum/species/ethereal/get_cough_sound(mob/living/carbon/user) diff --git a/code/modules/mob/living/carbon/human/species_types/felinid.dm b/code/modules/mob/living/carbon/human/species_types/felinid.dm index 5b0dcf55c7453..c0d17af34483b 100644 --- a/code/modules/mob/living/carbon/human/species_types/felinid.dm +++ b/code/modules/mob/living/carbon/human/species_types/felinid.dm @@ -107,9 +107,10 @@ else H.visible_message("[H] falls [levels] level\s into [T], barely landing on [H.p_their()] feet, with a sickening crunch!") var/amount_total = H.get_distributed_zimpact_damage(levels) * 0.5 - H.apply_damage(amount_total * 0.45, BRUTE, BODY_ZONE_L_LEG) - H.apply_damage(amount_total * 0.45, BRUTE, BODY_ZONE_R_LEG) - H.adjustBruteLoss(amount_total * 0.1) + H.apply_damage(/datum/damage_source/impact, /datum/damage/brute, amount_total * 0.45, BODY_ZONE_L_LEG) + H.apply_damage(/datum/damage_source/impact, /datum/damage/brute, amount_total * 0.45, BODY_ZONE_R_LEG) + // Finally, deal overall damage + H.apply_damage(/datum/damage_source/impact, /datum/damage/brute, amount_total * 0.45) H.Stun(levels * 50) // SPLAT! // 5: 25%, 4: 16%, 3: 9% diff --git a/code/modules/mob/living/carbon/human/species_types/golems.dm b/code/modules/mob/living/carbon/human/species_types/golems.dm index 3ea22e48eeab2..de5f361e052d9 100644 --- a/code/modules/mob/living/carbon/human/species_types/golems.dm +++ b/code/modules/mob/living/carbon/human/species_types/golems.dm @@ -397,7 +397,7 @@ /datum/species/golem/sand/bullet_act(obj/projectile/P, mob/living/carbon/human/H) if(!(P.original == H && P.firer == H)) - if(P.armor_flag == BULLET || P.armor_flag == BOMB) + if(ispath(P.damage_source, /datum/damage_source/bullet) || ispath(P.damage_source, /datum/damage_source/explosion)) playsound(H, 'sound/effects/shovel_dig.ogg', 70, 1) H.visible_message("The [P.name] sinks harmlessly in [H]'s sandy body!", \ "The [P.name] sinks harmlessly in [H]'s sandy body!") @@ -429,7 +429,7 @@ /datum/species/golem/glass/bullet_act(obj/projectile/P, mob/living/carbon/human/H) if(!(P.original == H && P.firer == H)) //self-shots don't reflect - if(P.armor_flag == LASER || P.armor_flag == ENERGY) + if(ispath(P.damage_source, /datum/damage_source/laser) || ispath(P.damage_source, /datum/damage_source/energy)) H.visible_message("The [P.name] gets reflected by [H]'s glass skin!", \ "The [P.name] gets reflected by [H]'s glass skin!") if(P.starting) @@ -479,7 +479,7 @@ if(world.time > last_teleport + teleport_cooldown && M != H && M.a_intent != INTENT_HELP) reactive_teleport(H) -/datum/species/golem/bluespace/spec_attacked_by(obj/item/I, mob/living/user, obj/item/bodypart/affecting, intent, mob/living/carbon/human/H) +/datum/species/golem/bluespace/spec_on_attacked(obj/item/I, mob/living/user, obj/item/bodypart/affecting, intent, mob/living/carbon/human/H) ..() if(world.time > last_teleport + teleport_cooldown && user != H) reactive_teleport(H) @@ -582,7 +582,7 @@ new/obj/item/grown/bananapeel/specialpeel(get_turf(H)) last_banana = world.time -/datum/species/golem/bananium/spec_attacked_by(obj/item/I, mob/living/user, obj/item/bodypart/affecting, intent, mob/living/carbon/human/H) +/datum/species/golem/bananium/spec_on_attacked(obj/item/I, mob/living/user, obj/item/bodypart/affecting, intent, mob/living/carbon/human/H) ..() if(world.time > last_banana + banana_cooldown && user != H) new/obj/item/grown/bananapeel/specialpeel(get_turf(H)) @@ -682,7 +682,7 @@ return TRUE if(chem.type == /datum/reagent/fuel/unholywater) - H.adjustBruteLoss(-4) + H.adjustBruteLossAbstract(-4) H.adjustFireLoss(-4) H.reagents.remove_reagent(chem.type, chem.metabolization_rate) return TRUE @@ -897,7 +897,7 @@ cloth_golem = null qdel(src) -/obj/structure/cloth_pile/attackby(obj/item/P, mob/living/carbon/human/user, params) +/obj/structure/cloth_pile/item_interact(obj/item/item, mob/user, params) . = ..() if(resistance_flags & ON_FIRE) @@ -906,6 +906,7 @@ if(P.is_hot()) visible_message("[src] bursts into flames!") fire_act() + return TRUE /datum/species/golem/plastic name = "Plastic Golem" @@ -938,7 +939,7 @@ /datum/species/golem/bronze/bullet_act(obj/projectile/P, mob/living/carbon/human/H) if(!(world.time > last_gong_time + gong_cooldown)) return ..() - if(P.armor_flag == BULLET || P.armor_flag == BOMB) + if (ispath(P.damage_source, /datum/damage_source/bullet) || ispath(P.damage_source, /datum/damage_source/explosion)) gong(H) return ..() @@ -952,7 +953,7 @@ if(world.time > last_gong_time + gong_cooldown && M.a_intent != INTENT_HELP) gong(H) -/datum/species/golem/bronze/spec_attacked_by(obj/item/I, mob/living/user, obj/item/bodypart/affecting, intent, mob/living/carbon/human/H) +/datum/species/golem/bronze/spec_on_attacked(obj/item/I, mob/living/user, obj/item/bodypart/affecting, intent, mob/living/carbon/human/H) ..() if(world.time > last_gong_time + gong_cooldown) gong(H) @@ -1019,7 +1020,7 @@ species_l_leg = /obj/item/bodypart/l_leg/golem/cardboard species_r_leg = /obj/item/bodypart/r_leg/golem/cardboard -/datum/species/golem/cardboard/spec_attacked_by(obj/item/I, mob/living/user, obj/item/bodypart/affecting, intent, mob/living/carbon/human/H) +/datum/species/golem/cardboard/spec_on_attacked(obj/item/I, mob/living/user, obj/item/bodypart/affecting, intent, mob/living/carbon/human/H) . = ..() if(user != H) return FALSE //forced reproduction is rape. @@ -1072,7 +1073,7 @@ species_l_leg = /obj/item/bodypart/l_leg/golem/durathread species_r_leg = /obj/item/bodypart/r_leg/golem/durathread -/datum/species/golem/durathread/spec_unarmedattacked(mob/living/carbon/human/user, mob/living/carbon/human/target) +/datum/species/golem/durathread/spec_primary_interacted(mob/living/carbon/human/user, mob/living/carbon/human/target) . = ..() target.apply_status_effect(STATUS_EFFECT_CHOKINGSTRAND) @@ -1119,7 +1120,7 @@ return TRUE if(chem.type == /datum/reagent/toxin/bonehurtingjuice) - H.adjustBruteLoss(0.5, 0) + H.apply_damage(/datum/damage_source/chemical, BRUTE, 0.5, null, FALSE) H.reagents.remove_reagent(chem.type, REAGENTS_METABOLISM) return TRUE return ..() @@ -1249,7 +1250,7 @@ for(var/obj/effect/proc_holder/spell/aoe_turf/knock/spell in C.mob_spell_list) C.RemoveSpell(spell) -/datum/species/golem/capitalist/spec_unarmedattacked(mob/living/carbon/human/user, mob/living/carbon/human/target) +/datum/species/golem/capitalist/spec_primary_interacted(mob/living/carbon/human/user, mob/living/carbon/human/target) ..() if(isgolem(target)) return @@ -1292,7 +1293,7 @@ C.RemoveSpell(spell) UnregisterSignal(C, COMSIG_MOB_SAY, PROC_REF(handle_speech)) -/datum/species/golem/soviet/spec_unarmedattacked(mob/living/carbon/human/user, mob/living/carbon/human/target) +/datum/species/golem/soviet/spec_primary_interacted(mob/living/carbon/human/user, mob/living/carbon/human/target) ..() if(isgolem(target)) return diff --git a/code/modules/mob/living/carbon/human/species_types/mothmen.dm b/code/modules/mob/living/carbon/human/species_types/mothmen.dm index c436da3e406ad..ad6a065cde711 100644 --- a/code/modules/mob/living/carbon/human/species_types/mothmen.dm +++ b/code/modules/mob/living/carbon/human/species_types/mothmen.dm @@ -170,7 +170,7 @@ visible_message("[src] is torn open, harming the Mothperson within!") for(var/mob/living/carbon/human/H in contents) if(H.has_status_effect(STATUS_EFFECT_COCOONED) && !done_regenerating) - H.adjustBruteLoss(COCOON_HARM_AMOUNT, FALSE) + H.apply_damage(/datum/damage_source/forceful_laceration, BRUTE, COCOON_HARM_AMOUNT, null, FALSE) H.SetSleeping(0, FALSE) H.remove_status_effect(STATUS_EFFECT_COCOONED) H.dna.species.handle_mutant_bodyparts(H) @@ -188,7 +188,7 @@ /datum/status_effect/cocooned/tick() owner.SetSleeping(10, TRUE) - owner.adjustBruteLoss(-(COCOON_HEAL_AMOUNT / (COCOON_EMERGE_DELAY)), FALSE) + owner.adjustBruteLossAbstract(-(COCOON_HEAL_AMOUNT / COCOON_EMERGE_DELAY), FALSE) owner.adjustFireLoss(-(COCOON_HEAL_AMOUNT / (COCOON_EMERGE_DELAY)), FALSE) owner.adjust_nutrition(-((COCOON_NUTRITION_AMOUNT * 10 ) / (COCOON_EMERGE_DELAY))) diff --git a/code/modules/mob/living/carbon/human/species_types/oozelings.dm b/code/modules/mob/living/carbon/human/species_types/oozelings.dm index 99eb6a57d49e0..55c4276e3acea 100644 --- a/code/modules/mob/living/carbon/human/species_types/oozelings.dm +++ b/code/modules/mob/living/carbon/human/species_types/oozelings.dm @@ -56,7 +56,7 @@ return if(!H.blood_volume) H.blood_volume += 5 - H.adjustBruteLoss(5) + H.apply_damage(/datum/damage_source/body, BRUTE, 5, null) to_chat(H, "You feel empty!") if(H.nutrition >= NUTRITION_LEVEL_WELL_FED && H.blood_volume <= 672) if(H.nutrition >= NUTRITION_LEVEL_ALMOST_FULL) @@ -173,7 +173,7 @@ "You fall [levels] level\s into [T]. Your body flattens upon landing!") H.Paralyze(levels * 8 SECONDS) var/amount_total = H.get_distributed_zimpact_damage(levels) * 0.45 - H.adjustBruteLoss(amount_total) + H.apply_damage(/datum/damage_source/impact, BRUTE, amount_total, null) playsound(H, 'sound/effects/blobattack.ogg', 40, TRUE) playsound(H, 'sound/effects/splat.ogg', 50, TRUE) H.AddElement(/datum/element/squish, levels * 15 SECONDS) diff --git a/code/modules/mob/living/carbon/human/species_types/plasmamen.dm b/code/modules/mob/living/carbon/human/species_types/plasmamen.dm index f99b7833128b0..1a59cc2f37ec7 100644 --- a/code/modules/mob/living/carbon/human/species_types/plasmamen.dm +++ b/code/modules/mob/living/carbon/human/species_types/plasmamen.dm @@ -107,7 +107,7 @@ return TRUE if(chem.type == /datum/reagent/toxin/bonehurtingjuice) H.adjustStaminaLoss(7.5, 0) - H.adjustBruteLoss(0.5, 0) + H.apply_damage(/datum/damage_source/chemical, BRUTE, 0.5, null, 0) if(prob(20)) switch(rand(1, 3)) if(1) diff --git a/code/modules/mob/living/carbon/human/species_types/shadowpeople.dm b/code/modules/mob/living/carbon/human/species_types/shadowpeople.dm index 06fe781f3ffca..3c5c2ed83f5ba 100644 --- a/code/modules/mob/living/carbon/human/species_types/shadowpeople.dm +++ b/code/modules/mob/living/carbon/human/species_types/shadowpeople.dm @@ -155,7 +155,7 @@ decay_factor = 0 -/obj/item/organ/heart/nightmare/attack(mob/M, mob/living/carbon/user, obj/target) +/obj/item/organ/heart/nightmare/attack_mob_target(mob/M, mob/living/carbon/user, obj/target) if(M != user) return ..() user.visible_message("[user] raises [src] to [user.p_their()] mouth and tears into it with [user.p_their()] teeth!", \ diff --git a/code/modules/mob/living/carbon/human/species_types/skeletons.dm b/code/modules/mob/living/carbon/human/species_types/skeletons.dm index ad3a3284bc672..216c93d587d3d 100644 --- a/code/modules/mob/living/carbon/human/species_types/skeletons.dm +++ b/code/modules/mob/living/carbon/human/species_types/skeletons.dm @@ -38,7 +38,7 @@ return TRUE if(chem.type == /datum/reagent/toxin/bonehurtingjuice) H.adjustStaminaLoss(7.5, 0) - H.adjustBruteLoss(0.5, 0) + H.apply_damage(/datum/damage_source/chemical, BRUTE, 0.5, null, 0) if(prob(20)) switch(rand(1, 3)) if(1) diff --git a/code/modules/mob/living/carbon/human/species_types/vampire.dm b/code/modules/mob/living/carbon/human/species_types/vampire.dm index 987bb28e2e0f5..39794b81578b6 100644 --- a/code/modules/mob/living/carbon/human/species_types/vampire.dm +++ b/code/modules/mob/living/carbon/human/species_types/vampire.dm @@ -42,7 +42,7 @@ C.heal_overall_damage(4,4,0, BODYTYPE_ORGANIC) C.adjustToxLoss(-4) C.adjustOxyLoss(-4) - C.adjustCloneLoss(-4) + C.adjustCloneLossAbstract(-4) return C.blood_volume -= 0.75 if(C.blood_volume <= BLOOD_VOLUME_SURVIVE) diff --git a/code/modules/mob/living/carbon/human/species_types/zombies.dm b/code/modules/mob/living/carbon/human/species_types/zombies.dm index aaeca112ee2f9..6fc3b01280002 100644 --- a/code/modules/mob/living/carbon/human/species_types/zombies.dm +++ b/code/modules/mob/living/carbon/human/species_types/zombies.dm @@ -44,18 +44,23 @@ var/regen_cooldown = 0 changesource_flags = MIRROR_BADMIN | WABBAJACK | ERT_SPAWN +/datum/species/zombie/infectious/on_species_gain(mob/living/carbon/C, datum/species/old_species) + . = ..() + RegisterSignal(C, COMSIG_MOB_APPLY_DAMGE, PROC_REF(on_taken_damage)) + +/datum/species/zombie/infectious/on_species_loss(mob/living/carbon/human/C, datum/species/new_species, pref_load) + . = ..() + UnregisterSignal(C, COMSIG_MOB_APPLY_DAMGE) + +/datum/species/zombie/infectious/proc/on_taken_damage(datum/source, damage, damagetype, def_zone) + regen_cooldown = world.time + REGENERATION_DELAY + /datum/species/zombie/infectious/check_roundstart_eligible() return FALSE - /datum/species/zombie/infectious/spec_stun(mob/living/carbon/human/H,amount) . = min(20, amount) -/datum/species/zombie/infectious/apply_damage(damage, damagetype = BRUTE, def_zone = null, blocked, mob/living/carbon/human/H, forced = FALSE) - . = ..() - if(.) - regen_cooldown = world.time + REGENERATION_DELAY - /datum/species/zombie/infectious/spec_life(mob/living/carbon/C) . = ..() C.a_intent = INTENT_HARM // THE SUFFERING MUST FLOW diff --git a/code/modules/mob/living/carbon/human/suicides.dm b/code/modules/mob/living/carbon/human/suicides.dm index 2670149965bc7..47c4091af6d7a 100644 --- a/code/modules/mob/living/carbon/human/suicides.dm +++ b/code/modules/mob/living/carbon/human/suicides.dm @@ -1,6 +1,6 @@ /mob/living/carbon/human/proc/delayed_suicide() suicide_log() - adjustBruteLoss(max(200 - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0)) + apply_damage(/datum/damage_source/abstract, BRUTE, max(200 - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0), null) death(FALSE) ghostize(FALSE,SENTIENCE_ERASE) // Disallows reentering body and disassociates mind diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index a2697f42d0585..63394aa9ec1d0 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -482,7 +482,7 @@ GLOBAL_LIST_INIT(ballmer_windows_me_msg, list("Yo man, what if, we like, uh, put slurring += 2 * delta_time jitteriness = max(jitteriness - (3 * delta_time), 0) if(HAS_TRAIT(src, TRAIT_DRUNK_HEALING)) - adjustBruteLoss(-0.12 * delta_time, FALSE) + adjustBruteLossAbstract(-0.12 * delta_time) adjustFireLoss(-0.06 * delta_time, FALSE) else SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "drunk") @@ -513,7 +513,7 @@ GLOBAL_LIST_INIT(ballmer_windows_me_msg, list("Yo man, what if, we like, uh, put confused += 2 * delta_time Dizzy(10) if(HAS_TRAIT(src, TRAIT_DRUNK_HEALING)) // effects stack with lower tiers - adjustBruteLoss(-0.3 * delta_time, FALSE) + adjustBruteLossAbstract(-0.3 * delta_time) adjustFireLoss(-0.15 * delta_time, FALSE) if(drunkenness >= 51) @@ -526,7 +526,7 @@ GLOBAL_LIST_INIT(ballmer_windows_me_msg, list("Yo man, what if, we like, uh, put if(DT_PROB(50, delta_time)) blur_eyes(5 * delta_time) if(HAS_TRAIT(src, TRAIT_DRUNK_HEALING)) - adjustBruteLoss(-0.4 * delta_time, FALSE) + adjustBruteLossAbstract(-0.4 * delta_time) adjustFireLoss(-0.2 * delta_time, FALSE) if(drunkenness >= 71) diff --git a/code/modules/mob/living/carbon/monkey/life.dm b/code/modules/mob/living/carbon/monkey/life.dm index 2a01b2bd3a01b..938b566717427 100644 --- a/code/modules/mob/living/carbon/monkey/life.dm +++ b/code/modules/mob/living/carbon/monkey/life.dm @@ -68,16 +68,16 @@ switch(bodytemperature) if(360 to 400) throw_alert("temp", /atom/movable/screen/alert/hot, 1) - apply_damage(HEAT_DAMAGE_LEVEL_1, BURN) + apply_damage(/datum/damage_source/temperature, /datum/damage/burn, HEAT_DAMAGE_LEVEL_1) if(400 to 460) throw_alert("temp", /atom/movable/screen/alert/hot, 2) - apply_damage(HEAT_DAMAGE_LEVEL_2, BURN) + apply_damage(/datum/damage_source/temperature, /datum/damage/burn, HEAT_DAMAGE_LEVEL_2) if(460 to INFINITY) throw_alert("temp", /atom/movable/screen/alert/hot, 3) if(on_fire) - apply_damage(HEAT_DAMAGE_LEVEL_3, BURN) + apply_damage(/datum/damage_source/temperature, /datum/damage/burn, HEAT_DAMAGE_LEVEL_3) else - apply_damage(HEAT_DAMAGE_LEVEL_2, BURN) + apply_damage(/datum/damage_source/temperature, /datum/damage/burn, HEAT_DAMAGE_LEVEL_2) else if(bodytemperature < BODYTEMP_COLD_DAMAGE_LIMIT && !HAS_TRAIT(src, TRAIT_RESISTCOLD)) if(!istype(loc, /obj/machinery/atmospherics/components/unary/cryo_cell)) @@ -85,13 +85,13 @@ switch(bodytemperature) if(200 to BODYTEMP_COLD_DAMAGE_LIMIT) throw_alert("temp", /atom/movable/screen/alert/cold, 1) - apply_damage(COLD_DAMAGE_LEVEL_1, BURN) + apply_damage(/datum/damage_source/temperature, /datum/damage/burn, HEAT_DAMAGE_LEVEL_1) if(120 to 200) throw_alert("temp", /atom/movable/screen/alert/cold, 2) - apply_damage(COLD_DAMAGE_LEVEL_2, BURN) + apply_damage(/datum/damage_source/temperature, /datum/damage/burn, HEAT_DAMAGE_LEVEL_2) if(-INFINITY to 120) throw_alert("temp", /atom/movable/screen/alert/cold, 3) - apply_damage(COLD_DAMAGE_LEVEL_3, BURN) + apply_damage(/datum/damage_source/temperature, /datum/damage/burn, COLD_DAMAGE_LEVEL_3) else clear_alert("temp") @@ -105,7 +105,7 @@ var/adjusted_pressure = calculate_affecting_pressure(pressure) //Returns how much pressure actually affects the mob. switch(adjusted_pressure) if(HAZARD_HIGH_PRESSURE to INFINITY) - adjustBruteLoss( min( ( (adjusted_pressure / HAZARD_HIGH_PRESSURE) -1 )*PRESSURE_DAMAGE_COEFFICIENT , MAX_HIGH_PRESSURE_DAMAGE) ) + apply_damage(/datum/damage_source/pressure, BRUTE, min( ( (adjusted_pressure / HAZARD_HIGH_PRESSURE) -1 )*PRESSURE_DAMAGE_COEFFICIENT , MAX_HIGH_PRESSURE_DAMAGE)) throw_alert("pressure", /atom/movable/screen/alert/highpressure, 2) if(WARNING_HIGH_PRESSURE to HAZARD_HIGH_PRESSURE) throw_alert("pressure", /atom/movable/screen/alert/highpressure, 1) @@ -117,7 +117,7 @@ if(HAS_TRAIT(src, TRAIT_RESISTLOWPRESSURE)) clear_alert("pressure") else - adjustBruteLoss( LOW_PRESSURE_DAMAGE ) + apply_damage(/datum/damage_source/pressure, BRUTE, LOW_PRESSURE_DAMAGE) throw_alert("pressure", /atom/movable/screen/alert/lowpressure, 2) return diff --git a/code/modules/mob/living/carbon/monkey/monkey_defense.dm b/code/modules/mob/living/carbon/monkey/monkey_defense.dm index c72bc3dcd6547..dc48edaaafc27 100644 --- a/code/modules/mob/living/carbon/monkey/monkey_defense.dm +++ b/code/modules/mob/living/carbon/monkey/monkey_defense.dm @@ -15,17 +15,7 @@ dismembering_strike(M, affecting.body_zone) if(stat != DEAD) var/dmg = rand(1, 5) - apply_damage(dmg, BRUTE, affecting) - -/mob/living/carbon/monkey/attack_larva(mob/living/carbon/alien/larva/L) - if(..()) //successful larva bite. - var/damage = rand(1, 3) - if(stat != DEAD) - L.amount_grown = min(L.amount_grown + damage, L.max_grown) - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(L.zone_selected)) - if(!affecting) - affecting = get_bodypart(BODY_ZONE_CHEST) - apply_damage(damage, BRUTE, affecting) + apply_damage(/datum/damage_source/sharp/light, /datum/damage/brute, dmg, affecting) /mob/living/carbon/monkey/attack_hand(mob/living/carbon/human/M) if(..()) //To allow surgery to return properly. @@ -45,7 +35,7 @@ var/obj/item/bodypart/affecting = get_bodypart(check_zone(M.zone_selected)) if(!affecting) affecting = get_bodypart(BODY_ZONE_CHEST) - apply_damage(damage, BRUTE, affecting) + apply_damage(M.dna.species.damage_source_type, M.dna.species.damage_type, damage, affecting) log_combat(M, src, "attacked") if("disarm") if(!IsUnconscious()) @@ -79,7 +69,8 @@ affecting = get_bodypart(BODY_ZONE_CHEST) if(!dismembering_strike(M, affecting.body_zone)) //Dismemberment successful return 1 - apply_damage(damage, BRUTE, affecting) + apply_damage_old(damage, BRUTE, affecting) + else playsound(loc, 'sound/weapons/slashmiss.ogg', 25, 1, -1) @@ -114,22 +105,7 @@ var/obj/item/bodypart/affecting = get_bodypart(ran_zone(dam_zone)) if(!affecting) affecting = get_bodypart(BODY_ZONE_CHEST) - apply_damage(damage, M.melee_damage_type, affecting) - -/mob/living/carbon/monkey/attack_slime(mob/living/simple_animal/slime/M) - if(..()) //successful slime attack - var/damage = 20 - if(M.is_adult) - damage = 30 - if(M.transformeffects & SLIME_EFFECT_RED) - damage *= 1.1 - var/dam_zone = dismembering_strike(M, pick(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)) - if(!dam_zone) //Dismemberment successful - return 1 - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(dam_zone)) - if(!affecting) - affecting = get_bodypart(BODY_ZONE_CHEST) - apply_damage(damage, BRUTE, affecting) + apply_damage_old(damage, M.melee_damage_type, affecting) /mob/living/carbon/monkey/acid_act(acidpwr, acid_volume, bodyzone_hit) . = 1 diff --git a/code/modules/mob/living/carbon/status_procs.dm b/code/modules/mob/living/carbon/status_procs.dm index ed6f9e48d3f4f..775683a9420c5 100644 --- a/code/modules/mob/living/carbon/status_procs.dm +++ b/code/modules/mob/living/carbon/status_procs.dm @@ -15,7 +15,7 @@ to_chat(src, "You're too exhausted to keep going.") stam_regen_start_time = world.time + STAMINA_CRIT_TIME stam_paralyzed = TRUE - ADD_TRAIT(src, TRAIT_INCAPACITATED, STAMINA) + ADD_TRAIT(src, TRAIT_INCAPACITATED, STAMINA_DAMTYPE) update_mobility() /mob/living/carbon/adjust_drugginess(amount) diff --git a/code/modules/mob/living/damage_procs.dm b/code/modules/mob/living/damage_procs.dm index e1cfb5f5f5e4e..46b8560b218d8 100644 --- a/code/modules/mob/living/damage_procs.dm +++ b/code/modules/mob/living/damage_procs.dm @@ -1,6 +1,6 @@ /* - apply_damage(a,b,c) + apply_damage_old(a,b,c) args a:damage - How much damage to take b:damage_type - What type of damage to take, brute, burn @@ -8,7 +8,7 @@ Returns standard 0 if fail */ -/mob/living/proc/apply_damage(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE) +/mob/living/proc/apply_damage_old(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE) SEND_SIGNAL(src, COMSIG_MOB_APPLY_DAMGE, damage, damagetype, def_zone) var/hit_percent = (100-blocked)/100 if(!damage || (!forced && hit_percent <= 0)) @@ -16,7 +16,7 @@ var/damage_amount = forced ? damage : damage * hit_percent switch(damagetype) if(BRUTE) - adjustBruteLoss(damage_amount, forced = forced) + adjustBruteLossAbstract(damage_amount, forced = forced) if(BURN) adjustFireLoss(damage_amount, forced = forced) if(TOX) @@ -24,26 +24,11 @@ if(OXY) adjustOxyLoss(damage_amount, forced = forced) if(CLONE) - adjustCloneLoss(damage_amount, forced = forced) - if(STAMINA) + adjustCloneLossAbstract(damage_amount, forced = forced) + if(STAMINA_DAMTYPE) adjustStaminaLoss(damage_amount, forced = forced) return 1 -/mob/living/proc/apply_damage_type(damage = 0, damagetype = BRUTE) //like apply damage except it always uses the damage procs - switch(damagetype) - if(BRUTE) - return adjustBruteLoss(damage) - if(BURN) - return adjustFireLoss(damage) - if(TOX) - return adjustToxLoss(damage) - if(OXY) - return adjustOxyLoss(damage) - if(CLONE) - return adjustCloneLoss(damage) - if(STAMINA) - return adjustStaminaLoss(damage) - /mob/living/proc/get_damage_amount(damagetype = BRUTE) switch(damagetype) if(BRUTE) @@ -56,31 +41,9 @@ return getOxyLoss() if(CLONE) return getCloneLoss() - if(STAMINA) + if(STAMINA_DAMTYPE) return getStaminaLoss() - -/mob/living/proc/apply_damages(brute = 0, burn = 0, tox = 0, oxy = 0, clone = 0, def_zone = null, blocked = FALSE, stamina = 0, brain = 0) - if(blocked >= 100) - return 0 - if(brute) - apply_damage(brute, BRUTE, def_zone, blocked) - if(burn) - apply_damage(burn, BURN, def_zone, blocked) - if(tox) - apply_damage(tox, TOX, def_zone, blocked) - if(oxy) - apply_damage(oxy, OXY, def_zone, blocked) - if(clone) - apply_damage(clone, CLONE, def_zone, blocked) - if(stamina) - apply_damage(stamina, STAMINA, def_zone, blocked) - if(brain) - apply_damage(brain, BRAIN, def_zone, blocked) - return 1 - - - /mob/living/proc/apply_effect(effect = 0,effecttype = EFFECT_STUN, blocked = FALSE) var/hit_percent = (100-blocked)/100 if(!effect || (hit_percent <= 0)) @@ -137,7 +100,7 @@ if(drowsy) apply_effect(drowsy, EFFECT_DROWSY, blocked) if(stamina) - apply_damage(stamina, STAMINA, null, blocked) + apply_damage_old(stamina, STAMINA_DAMTYPE, null, blocked) if(jitter) apply_effect(jitter, EFFECT_JITTER, blocked) return BULLET_ACT_HIT @@ -146,80 +109,72 @@ /mob/living/proc/getBruteLoss() return bruteloss -/mob/living/proc/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE, required_status) +/mob/living/proc/adjustBruteLossAbstract(amount, forced = FALSE, required_status) if(!forced && (status_flags & GODMODE)) return FALSE bruteloss = CLAMP((bruteloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2) - if(updating_health) - updatehealth() + UPDATE_HEALTH(src) return amount /mob/living/proc/getOxyLoss() return oxyloss -/mob/living/proc/adjustOxyLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/proc/adjustOxyLoss(amount, forced = FALSE) if(!forced && (status_flags & GODMODE)) return FALSE oxyloss = CLAMP((oxyloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2) - if(updating_health) - updatehealth() + UPDATE_HEALTH(src) return amount -/mob/living/proc/setOxyLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/proc/setOxyLoss(amount, forced = FALSE) if(status_flags & GODMODE) return 0 oxyloss = amount - if(updating_health) - updatehealth() + UPDATE_HEALTH(src) return amount /mob/living/proc/getToxLoss() return toxloss -/mob/living/proc/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/proc/adjustToxLoss(amount, forced = FALSE) if(!forced && (status_flags & GODMODE)) return FALSE toxloss = CLAMP((toxloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2) - if(updating_health) - updatehealth() + UPDATE_HEALTH(src) return amount -/mob/living/proc/setToxLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/proc/setToxLoss(amount, forced = FALSE) if(!forced && (status_flags & GODMODE)) return FALSE toxloss = amount - if(updating_health) - updatehealth() + UPDATE_HEALTH(src) return amount /mob/living/proc/getFireLoss() return fireloss -/mob/living/proc/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/proc/adjustFireLoss(amount, forced = FALSE) if(!forced && (status_flags & GODMODE)) return FALSE fireloss = CLAMP((fireloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2) - if(updating_health) - updatehealth() + UPDATE_HEALTH(src) return amount /mob/living/proc/getCloneLoss() return cloneloss -/mob/living/proc/adjustCloneLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/proc/adjustCloneLossAbstract(amount, forced = FALSE) if(!forced && ((status_flags & GODMODE) || HAS_TRAIT(src, TRAIT_NOCLONELOSS))) return FALSE cloneloss = CLAMP((cloneloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2) - if(updating_health) - updatehealth() + UPDATE_HEALTH(src) return amount -/mob/living/proc/setCloneLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/proc/setCloneLoss(amount, forced = FALSE) if(!forced && ((status_flags & GODMODE) || HAS_TRAIT(src, TRAIT_NOCLONELOSS))) return FALSE cloneloss = amount - if(updating_health) - updatehealth() + UPDATE_HEALTH(src) return amount /mob/living/proc/adjustOrganLoss(slot, amount, maximum, required_status) @@ -234,46 +189,42 @@ /mob/living/proc/getStaminaLoss() return staminaloss -/mob/living/proc/adjustStaminaLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/proc/adjustStaminaLoss(amount, forced = FALSE) return -/mob/living/proc/setStaminaLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/proc/setStaminaLoss(amount, forced = FALSE) return // heal ONE external organ, organ gets randomly selected from damaged ones. -/mob/living/proc/heal_bodypart_damage(brute = 0, burn = 0, stamina = 0, updating_health = TRUE, required_status) - adjustBruteLoss(-brute, FALSE) //zero as argument for no instant health update +/mob/living/proc/heal_bodypart_damage(brute = 0, burn = 0, stamina = 0, required_status) + adjustBruteLossAbstract(-brute, FALSE) //zero as argument for no instant health update adjustFireLoss(-burn, FALSE) adjustStaminaLoss(-stamina, FALSE) - if(updating_health) - updatehealth() + if (stamina != 0) update_stamina() // damage ONE external organ, organ gets randomly selected from damaged ones. -/mob/living/proc/take_bodypart_damage(brute = 0, burn = 0, stamina = 0, updating_health = TRUE, required_status, check_armor = FALSE) - adjustBruteLoss(brute, FALSE) //zero as argument for no instant health update +/mob/living/proc/take_bodypart_damage(brute = 0, burn = 0, stamina = 0, required_status, check_armor = FALSE) + adjustBruteLossAbstract(brute, FALSE) //zero as argument for no instant health update adjustFireLoss(burn, FALSE) adjustStaminaLoss(stamina, FALSE) - if(updating_health) - updatehealth() + if (stamina != 0) update_stamina(stamina >= DAMAGE_PRECISION) // heal MANY bodyparts, in random order -/mob/living/proc/heal_overall_damage(brute = 0, burn = 0, stamina = 0, required_status, updating_health = TRUE) - adjustBruteLoss(-brute, FALSE) //zero as argument for no instant health update +/mob/living/proc/heal_overall_damage(brute = 0, burn = 0, stamina = 0, required_status) + adjustBruteLossAbstract(-brute, FALSE) //zero as argument for no instant health update adjustFireLoss(-burn, FALSE) adjustStaminaLoss(-stamina, FALSE) - if(updating_health) - updatehealth() + if (stamina != 0) update_stamina() // damage MANY bodyparts, in random order -/mob/living/proc/take_overall_damage(brute = 0, burn = 0, stamina = 0, updating_health = TRUE, required_status = null) - adjustBruteLoss(brute, FALSE) //zero as argument for no instant health update - adjustFireLoss(burn, FALSE) - adjustStaminaLoss(stamina, FALSE) - if(updating_health) - updatehealth() +/mob/living/proc/take_overall_damage(brute = 0, burn = 0, stamina = 0, required_status = null) + adjustBruteLossAbstract(brute) //zero as argument for no instant health update + adjustFireLoss(burn) + adjustStaminaLoss(stamina) + if (stamina != 0) update_stamina(stamina >= DAMAGE_PRECISION) //heal up to amount damage, in a given order @@ -282,7 +233,7 @@ for(var/i in damage_types) var/amount_to_heal = min(amount, get_damage_amount(i)) //heal only up to the amount of damage we have if(amount_to_heal) - apply_damage_type(-amount_to_heal, i) + //BACONTODO apply_damage_old_type(-amount_to_heal, i) amount -= amount_to_heal //remove what we healed from our current amount if(!amount) break diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index b2387d30bef8c..ec83465080453 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -111,4 +111,4 @@ /mob/living/proc/handle_high_gravity(gravity) if(gravity >= GRAVITY_DAMAGE_TRESHOLD) //Aka gravity values of 3 or more var/grav_stregth = gravity - GRAVITY_DAMAGE_TRESHOLD - adjustBruteLoss(min(grav_stregth,3)) + apply_damage(/datum/damage_source/crush, BRUTE, min(grav_stregth,3), null) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index ab984f6d4f071..56f829e155cf2 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -66,7 +66,7 @@ if(prob(10)) playsound(get_turf(src), "punch", 25, 1, -1) visible_message("[src] [pick("ran", "slammed")] into \the [A]!") - apply_damage(5, BRUTE) + apply_damage(/datum/damage_source/impact, /datum/damage/brute, 5) Paralyze(40) addtimer(CALLBACK(src, PROC_REF(can_bumpslam)), 200) else @@ -413,7 +413,6 @@ if (InCritical()) log_message("Has [whispered ? "whispered his final words" : "succumbed to death"] while in [InFullCritical() ? "hard":"soft"] critical with [round(health, 0.1)] points of health!", LOG_ATTACK) adjustOxyLoss(health - HEALTH_THRESHOLD_DEAD) - updatehealth() if(!whispered) to_chat(src, "You have given up life and succumbed to death.") @@ -544,6 +543,7 @@ update_stat() med_hud_set_health() med_hud_set_status() + health_dirty = HEALTH_DIRTY_NOT_DIRTY //proc used to ressuscitate a mob /mob/living/proc/revive(full_heal = 0, admin_revive = 0) @@ -587,7 +587,7 @@ var/oxy_to_heal = heal_to - getOxyLoss() var/tox_to_heal = heal_to - getToxLoss() if(brute_to_heal < 0) - adjustBruteLoss(brute_to_heal, FALSE) + adjustBruteLossAbstract(brute_to_heal) if(burn_to_heal < 0) adjustFireLoss(burn_to_heal, FALSE) if(oxy_to_heal < 0) @@ -595,9 +595,6 @@ if(tox_to_heal < 0) adjustToxLoss(tox_to_heal, FALSE, TRUE) - // Run updatehealth once to set health for the revival check - updatehealth() - // We've given them a decent heal. // If they happen to be dead too, try to revive them - if possible. if(stat == DEAD && can_be_revived()) @@ -605,9 +602,6 @@ if(revive(FALSE, FALSE, 10) && revive_message) visible_message(revive_message) - // Finally update health again after we're all done - updatehealth() - return stat != DEAD /mob/living/proc/remove_CC(should_update_mobility = TRUE) @@ -663,6 +657,7 @@ //proc called by revive(), to check if we can actually ressuscitate the mob (we don't want to revive him and have him instantly die again) /mob/living/proc/can_be_revived() . = 1 + RESOLVE_HEALTH(src) if(health <= HEALTH_THRESHOLD_DEAD) return 0 @@ -1078,7 +1073,7 @@ var/blocked = getarmor(null, RAD) if(amount > RAD_BURN_THRESHOLD) - apply_damage((amount-RAD_BURN_THRESHOLD)/RAD_BURN_THRESHOLD, BURN, null, blocked) + apply_damage(/datum/damage_source/radiation_burn, /datum/damage/burn, (amount-RAD_BURN_THRESHOLD)/RAD_BURN_THRESHOLD) apply_effect((amount*RAD_MOB_COEFFICIENT)/max(1, (radiation**2)*RAD_OVERDOSE_REDUCTION), EFFECT_IRRADIATE, blocked) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 99604c6cdf8c5..4ffcb2051fa30 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -61,9 +61,9 @@ /mob/living/bullet_act(obj/projectile/P, def_zone, piercing_hit = FALSE) SEND_SIGNAL(src, COMSIG_ATOM_BULLET_ACT, P, def_zone) - var/armor = run_armor_check(def_zone, P.armor_flag, "","",P.armour_penetration) + var/armor = run_armor_check(def_zone, P.damage_source, "","",P.armour_penetration) if(!P.nodamage) - apply_damage(P.damage, P.damage_type, def_zone, armor) + apply_damage(P.damage_source, P.damage_type, P.damage, def_zone) if(P.dismemberment) check_projectile_dismemberment(P, def_zone) return P.on_hit(src, armor, piercing_hit)? BULLET_ACT_HIT : BULLET_ACT_BLOCK @@ -83,7 +83,6 @@ if(istype(AM, /obj/item)) var/obj/item/I = AM var/zone = ran_zone(BODY_ZONE_CHEST, 65)//Hits a random part of the body, geared towards the chest - var/dtype = BRUTE var/volume = I.get_volume_by_throwforce_and_or_w_class() var/nosell_hit = SEND_SIGNAL(I, COMSIG_MOVABLE_IMPACT_ZONE, src, zone, throwingdatum) // TODO: find a better way to handle hitpush and skipcatch for humans if(nosell_hit) @@ -108,8 +107,7 @@ if(!blocked) visible_message("[src] is hit by [I]!", \ "You're hit by [I]!") - var/armor = run_armor_check(zone, MELEE, "Your armor has protected your [parse_zone(zone)].", "Your armor has softened hit to your [parse_zone(zone)].",I.armour_penetration) - apply_damage(I.throwforce, dtype, zone, armor) + I.deal_attack(null, src, zone, override_damage = I.throwforce) var/mob/thrown_by = I.thrownby?.resolve() if(thrown_by) @@ -140,7 +138,6 @@ M.mech_toxin_damage(src) else return - updatehealth() visible_message("[M.name] hits [src]!", \ "[M.name] hits you!", null, COMBAT_MESSAGE_RANGE) log_combat(M.occupant, src, "attacked", M, "(INTENT: [uppertext(M.occupant.a_intent)]) (DAMTYPE: [uppertext(M.damtype)])") @@ -228,28 +225,6 @@ user.set_pull_offsets(src, grab_state) return 1 - -/mob/living/attack_slime(mob/living/simple_animal/slime/M) - if(!SSticker.HasRoundStarted()) - to_chat(M, "You cannot attack people before the game has started.") - return - - if(M.buckled) - if(M in buckled_mobs) - M.Feedstop() - return // can't attack while eating! - - if(HAS_TRAIT(M, TRAIT_PACIFISM)) - to_chat(M, "You don't want to hurt anyone!") - return FALSE - - if(stat != DEAD) - log_combat(M, src, "attacked") - M.do_attack_animation(src) - visible_message("\The [M.name] glomps [src]!", \ - "\The [M.name] glomps you!", null, COMBAT_MESSAGE_RANGE) - return TRUE - /mob/living/attack_animal(mob/living/simple_animal/M) M.face_atom(src) if(M.melee_damage == 0) @@ -263,6 +238,7 @@ if(M.attack_sound) playsound(loc, M.attack_sound, 50, 1, 1) M.do_attack_animation(src) + M.deal_generic_attack(src) visible_message("\The [M] [M.attacktext] [src]!", \ "\The [M] [M.attacktext] you!", null, COMBAT_MESSAGE_RANGE) log_combat(M, src, "attacked") @@ -290,30 +266,6 @@ return TRUE return FALSE -/mob/living/attack_larva(mob/living/carbon/alien/larva/L) - switch(L.a_intent) - if("help") - visible_message("[L.name] rubs its head against [src].", \ - "[L.name] rubs its head against you.") - return FALSE - - else - if(HAS_TRAIT(L, TRAIT_PACIFISM)) - to_chat(L, "You don't want to hurt anyone!") - return - - L.do_attack_animation(src) - if(prob(90)) - log_combat(L, src, "attacked") - visible_message("[L.name] bites [src]!", \ - "[L.name] bites you!", null, COMBAT_MESSAGE_RANGE) - playsound(loc, 'sound/weapons/bite.ogg', 50, 1, -1) - return TRUE - else - visible_message("[L.name]'s bite misses [src]!", \ - "[L.name]'s bite misses you!", null, COMBAT_MESSAGE_RANGE) - return FALSE - /mob/living/attack_alien(mob/living/carbon/alien/humanoid/M) SEND_SIGNAL(src, COMSIG_MOB_ATTACK_ALIEN, M) switch(M.a_intent) @@ -328,7 +280,7 @@ if(HAS_TRAIT(M, TRAIT_PACIFISM)) to_chat(M, "You don't want to hurt anyone!") return FALSE - M.do_attack_animation(src) + M.deal_generic_attack(src) return TRUE if("disarm") M.do_attack_animation(src, ATTACK_EFFECT_DISARM) diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index dc4caba554f16..bc107411d227b 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -139,3 +139,6 @@ ///The x amount a mob's sprite should be offset due to the current position they're in var/body_position_pixel_y_offset = 0 + /// Do we need to call update_health? + var/health_dirty = HEALTH_DIRTY_NOT_DIRTY + diff --git a/code/modules/mob/living/silicon/ai/ai_defense.dm b/code/modules/mob/living/silicon/ai/ai_defense.dm index c5cbfb4d37c55..666c12b290969 100644 --- a/code/modules/mob/living/silicon/ai/ai_defense.dm +++ b/code/modules/mob/living/silicon/ai/ai_defense.dm @@ -1,6 +1,6 @@ -/mob/living/silicon/ai/attacked_by(obj/item/I, mob/living/user, def_zone) - if(I.force && I.damtype != STAMINA && stat != DEAD) //only sparks if real damage is dealt. +/mob/living/silicon/ai/on_attacked(obj/item/I, mob/living/user, def_zone) + if(I.force && I.damtype != STAMINA_DAMTYPE && stat != DEAD) //only sparks if real damage is dealt. spark_system.start() return ..() @@ -11,12 +11,9 @@ return ..() -/mob/living/silicon/ai/attack_slime(mob/living/simple_animal/slime/user) - return //immune to slimes - /mob/living/silicon/ai/blob_act(obj/structure/blob/B) if (stat != DEAD) - adjustBruteLoss(60) + apply_damage(/datum/damage_source/blob, BRUTE, 60) updatehealth() return 1 return 0 @@ -39,11 +36,11 @@ gib() if(2) if (stat != DEAD) - adjustBruteLoss(60) + apply_damage(/datum/damage_source/explosion, BRUTE, 60) adjustFireLoss(60) if(3) if (stat != DEAD) - adjustBruteLoss(30) + apply_damage(/datum/damage_source/explosion, BRUTE, 30) diff --git a/code/modules/mob/living/silicon/damage_procs.dm b/code/modules/mob/living/silicon/damage_procs.dm index 4ab92b5284d9d..f6916d250ad6e 100644 --- a/code/modules/mob/living/silicon/damage_procs.dm +++ b/code/modules/mob/living/silicon/damage_procs.dm @@ -1,12 +1,12 @@ -/mob/living/silicon/apply_damage(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE) +/mob/living/silicon/apply_damage_old(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE) var/hit_percent = (100-blocked)/100 if((!damage || (!forced && hit_percent <= 0))) return 0 var/damage_amount = forced ? damage : damage * hit_percent switch(damagetype) if(BRUTE) - adjustBruteLoss(damage_amount, forced = forced) + adjustBruteLossAbstract(damage_amount, forced = forced) if(BURN) adjustFireLoss(damage_amount, forced = forced) if(OXY) @@ -18,22 +18,22 @@ /mob/living/silicon/apply_effect(effect = 0,effecttype = EFFECT_STUN, blocked = FALSE) return FALSE //The only effect that can hit them atm is flashes and they still directly edit so this works for now -/mob/living/silicon/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE) //immune to tox damage +/mob/living/silicon/adjustToxLoss(amount, forced = FALSE) //immune to tox damage return FALSE -/mob/living/silicon/setToxLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/silicon/setToxLoss(amount, forced = FALSE) return FALSE -/mob/living/silicon/adjustCloneLoss(amount, updating_health = TRUE, forced = FALSE) //immune to clone damage +/mob/living/silicon/adjustCloneLossAbstract(amount, forced = FALSE) //immune to clone damage return FALSE -/mob/living/silicon/setCloneLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/silicon/setCloneLoss(amount, forced = FALSE) return FALSE -/mob/living/silicon/adjustStaminaLoss(amount, updating_health = TRUE, forced = FALSE)//immune to stamina damage. +/mob/living/silicon/adjustStaminaLoss(amount, forced = FALSE)//immune to stamina damage. return FALSE -/mob/living/silicon/setStaminaLoss(amount, updating_health = TRUE) +/mob/living/silicon/setStaminaLoss(amount) return FALSE /mob/living/silicon/adjustOrganLoss(slot, amount, maximum = 500, required_status) diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 2264558f17022..d09e8648ab6f1 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -353,15 +353,15 @@ return ..() -/obj/item/paicard/attackby(obj/item/used, mob/user, params) +/obj/item/paicard/item_interact(obj/item/used, mob/user, params) if(pai && (istype(used, /obj/item/encryptionkey) || used.tool_behaviour == TOOL_SCREWDRIVER)) if(!pai.encryptmod) to_chat(user, "Encryption Key ports not configured.") - return + return TRUE user.set_machine(src) pai.radio.attackby(used, user, params) to_chat(user, "You insert [used] into the [src].") - return + return TRUE return ..() diff --git a/code/modules/mob/living/silicon/pai/pai_defense.dm b/code/modules/mob/living/silicon/pai/pai_defense.dm index 67134d957c09c..2a51ed51333b2 100644 --- a/code/modules/mob/living/silicon/pai/pai_defense.dm +++ b/code/modules/mob/living/silicon/pai/pai_defense.dm @@ -68,22 +68,22 @@ to_chat(src, "The impact degrades your holochassis!") return amount -/mob/living/silicon/pai/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/silicon/pai/adjustBruteLossAbstract(amount, forced = FALSE) return take_holo_damage(amount) -/mob/living/silicon/pai/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/silicon/pai/adjustFireLoss(amount, forced = FALSE) return take_holo_damage(amount) -/mob/living/silicon/pai/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/silicon/pai/adjustToxLoss(amount, forced = FALSE) return FALSE -/mob/living/silicon/pai/adjustOxyLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/silicon/pai/adjustOxyLoss(amount, forced = FALSE) return FALSE -/mob/living/silicon/pai/adjustCloneLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/silicon/pai/adjustCloneLossAbstract(amount, forced = FALSE) return FALSE -/mob/living/silicon/pai/adjustStaminaLoss(amount, updating_health, forced = FALSE) +/mob/living/silicon/pai/adjustStaminaLoss(amount, forced = FALSE) if(forced) take_holo_damage(amount) else @@ -110,7 +110,7 @@ /mob/living/silicon/pai/setCloneLoss() return FALSE -/mob/living/silicon/pai/setStaminaLoss(amount, updating_health = TRUE) +/mob/living/silicon/pai/setStaminaLoss(amount) return FALSE /mob/living/silicon/pai/setToxLoss() diff --git a/code/modules/mob/living/silicon/pai/software.dm b/code/modules/mob/living/silicon/pai/software.dm index 7e4e3979bd3db..4a88570857b6d 100644 --- a/code/modules/mob/living/silicon/pai/software.dm +++ b/code/modules/mob/living/silicon/pai/software.dm @@ -235,7 +235,7 @@ var/mob/living/silicon/pai/pAI = usr var/mob/living/carbon/holder = get(pAI.card.loc, /mob/living/carbon) if(holder) - pAI.hostscan.attack(holder, pAI) + pAI.hostscan.attack_mob_target(holder, pAI) else to_chat(usr, "You are not being carried by anyone!") return FALSE diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index a95e9a8a7b0f9..166d2bc6fb372 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -376,24 +376,24 @@ return togglelock(user) -/mob/living/silicon/robot/attackby(obj/item/W, mob/user, params) +/mob/living/silicon/robot/item_interact(obj/item/I, mob/living/user) if(length(user.progressbars)) if(W.tool_behaviour == TOOL_WELDER || istype(W, /obj/item/stack/cable_coil)) user.changeNext_move(CLICK_CD_MELEE) to_chat(user, "You are already busy!") - return + return TRUE if(W.tool_behaviour == TOOL_WELDER && (user.a_intent != INTENT_HARM)) user.changeNext_move(CLICK_CD_MELEE) if(user == src) to_chat(user, "You are unable to maneuver [W] properly to repair yourself, seek assistance!") - return + return TRUE if (!getBruteLoss()) to_chat(user, "[src] is already in good condition!") - return + return TRUE //repeatedly repairs until the cyborg is fully repaired while(getBruteLoss() && W.tool_start_check(user, amount=0) && W.use_tool(src, user, 3 SECONDS)) W.use(1) //use one fuel for each repair step - adjustBruteLoss(-10) + adjustBruteLossAbstract(-10) updatehealth() add_fingerprint(user) user.visible_message("[user] has fixed some of the dents on [src].", "You fix some of the dents on [src].") @@ -403,7 +403,7 @@ user.changeNext_move(CLICK_CD_MELEE) if(!(getFireLoss() || getToxLoss())) to_chat(user, "The wires seem fine, there's no need to fix them.") - return + return TRUE var/obj/item/stack/cable_coil/coil = W while((getFireLoss() || getToxLoss()) && do_after(user, 30, target = src)) if(coil.use(1)) @@ -414,6 +414,7 @@ user.visible_message("[user] has fixed some of the burnt wires on [src].", "You fix some of the burnt wires on [src].") else to_chat(user, "You need more cable to repair [src]!") + return TRUE else if(W.tool_behaviour == TOOL_CROWBAR) // crowbar means open or close the cover if(opened) @@ -429,6 +430,7 @@ Paralyze(5 SECONDS) opened = 1 update_icons() + return TRUE else if(istype(W, /obj/item/stock_parts/cell) && opened) // trying to put a cell inside if(wiresexposed) to_chat(user, "Close the cover first!") @@ -441,17 +443,20 @@ to_chat(user, "You insert the power cell.") update_icons() diag_hud_set_borgcell() + return TRUE else if(is_wire_tool(W)) if (wiresexposed) wires.interact(user) else to_chat(user, "You can't reach the wiring!") + return TRUE else if(W.tool_behaviour == TOOL_SCREWDRIVER && opened && !cell) // haxing wiresexposed = !wiresexposed to_chat(user, "The wires have been [wiresexposed ? "exposed" : "unexposed"].") update_icons() + return TRUE else if(W.tool_behaviour == TOOL_SCREWDRIVER && opened && cell) // radio if(shell) @@ -461,50 +466,54 @@ else to_chat(user, "Unable to locate a radio!") update_icons() + return TRUE else if(W.tool_behaviour == TOOL_WRENCH && opened && !cell) //Deconstruction. The flashes break from the fall, to prevent this from being a ghetto reset module. if(!lockcharge) to_chat(user, "[src]'s bolts spark! Maybe you should lock them down first!") spark_system.start() - return + return TRUE else to_chat(user, "You start to unfasten [src]'s securing bolts.") if(W.use_tool(src, user, 50, volume=50) && !cell) user.visible_message("[user] deconstructs [src]!", "You unfasten the securing bolts, and [src] falls to pieces!") log_attack("[key_name(user)] deconstructed [name] at [AREACOORD(src)].") deconstruct() + return TRUE else if(istype(W, /obj/item/aiModule)) var/obj/item/aiModule/MOD = W if(!opened) to_chat(user, "You need access to the robot's insides to do that!") - return + return TRUE if(wiresexposed) to_chat(user, "You need to close the wire panel to do that!") - return + return TRUE if(!cell) to_chat(user, "You need to install a power cell to do that!") - return + return TRUE if(shell) //AI shells always have the laws of the AI to_chat(user, "[src] is controlled remotely! You cannot upload new laws this way!") - return + return TRUE if(emagged || (connected_ai && lawupdate)) //Can't be sure which, metagamers emote("buzz-[user.name]") - return + return TRUE if(!mind) //A player mind is required for law procs to run antag checks. to_chat(user, "[src] is entirely unresponsive!") - return + return TRUE MOD.install(laws, user) //Proc includes a success mesage so we don't need another one - return + return TRUE else if(istype(W, /obj/item/encryptionkey/) && opened) if(radio)//sanityyyyyy radio.attackby(W,user)//GTFO, you have your own procs else to_chat(user, "Unable to locate a radio!") + return TRUE else if (istype(W, /obj/item/card/id)||istype(W, /obj/item/modular_computer/tablet/pda)) // trying to unlock the interface with an ID card togglelock(user) + return TRUE else if(istype(W, /obj/item/borg/upgrade/)) var/obj/item/borg/upgrade/U = W @@ -516,7 +525,7 @@ to_chat(user, "The upgrade is locked and cannot be used yet!") else if(!user.temporarilyRemoveItemFromInventory(U)) - return + return TRUE if(U.action(src)) to_chat(user, "You apply the upgrade to [src].") to_chat(src, "----------------\nNew hardware detected...Identified as \"[U]\"...Setup complete.\n----------------") @@ -535,10 +544,11 @@ to_chat(user, "The toner level of [src] is at its highest level possible!") else if(!user.temporarilyRemoveItemFromInventory(W)) - return + return TRUE toner = tonermax qdel(W) to_chat(user, "You fill the toner level of [src] to its max capacity.") + return TRUE else if(istype(W, /obj/item/flashlight)) if(!opened) @@ -548,17 +558,19 @@ else if(!user.temporarilyRemoveItemFromInventory(W)) to_chat(user, "[W] seems to be stuck to your hand. You'll have to find a different light.") - return + return TRUE lamp_functional = TRUE qdel(W) to_chat(user, "You replace the headlamp bulbs.") + return TRUE else if(istype(W, /obj/item/computer_hardware/hard_drive/portable)) //Allows borgs to install new programs with human help if(!modularInterface) stack_trace("Cyborg [src] ( [type] ) was somehow missing their integrated tablet. Please make a bug report.") create_modularInterface() var/obj/item/computer_hardware/hard_drive/portable/floppy = W if(modularInterface.install_component(floppy, user)) - return + return TRUE + return TRUE else return ..() diff --git a/code/modules/mob/living/silicon/robot/robot_defense.dm b/code/modules/mob/living/silicon/robot/robot_defense.dm index f0bb46a69a080..976535b88dda7 100644 --- a/code/modules/mob/living/silicon/robot/robot_defense.dm +++ b/code/modules/mob/living/silicon/robot/robot_defense.dm @@ -1,12 +1,15 @@ -/mob/living/silicon/robot/attackby(obj/item/I, mob/living/user) - if(I.slot_flags & ITEM_SLOT_HEAD && hat_offset != INFINITY && user.a_intent == INTENT_HELP && !is_type_in_typecache(I, blacklisted_hats)) +/mob/living/silicon/robot/item_interact(obj/item/I, mob/living/user) + if(I.slot_flags & ITEM_SLOT_HEAD && hat_offset != INFINITY && !is_type_in_typecache(I, blacklisted_hats)) to_chat(user, "You begin to place [I] on [src]'s head...") to_chat(src, "[user] is placing [I] on your head...") if(do_after(user, 30, target = src)) if (user.temporarilyRemoveItemFromInventory(I, TRUE)) place_on_head(I) - return - if(I.force && I.damtype != STAMINA && stat != DEAD) //only sparks if real damage is dealt. + return TRUE + return ..() + +/mob/living/silicon/robot/on_attacked(obj/item/I, mob/living/user) + if(I.force && I.damtype != STAMINA_DAMTYPE && stat != DEAD) //only sparks if real damage is dealt. spark_system.start() return ..() @@ -31,27 +34,6 @@ ..() return -/mob/living/silicon/robot/attack_slime(mob/living/simple_animal/slime/M) - if(..()) //successful slime shock - flash_act() - if(M.powerlevel) - adjustBruteLoss(M.powerlevel * 4) - M.powerlevel -- - - var/damage = rand(3) - - if(M.is_adult) - damage = 30 - else - damage = 20 - if(M.transformeffects & SLIME_EFFECT_RED) - damage *= 1.1 - damage = round(damage / 2) // borgs receive half damage - adjustBruteLoss(damage) - updatehealth() - - return - //ATTACK HAND IGNORING PARENT RETURN VALUE /mob/living/silicon/robot/attack_hand(mob/living/carbon/human/user) add_fingerprint(user) @@ -164,7 +146,7 @@ /mob/living/silicon/robot/blob_act(obj/structure/blob/B) if(stat != DEAD) - adjustBruteLoss(30) + apply_damage(/datum/damage_source/blob, BRUTE, 30) else gib() return TRUE @@ -176,11 +158,11 @@ return if(2) if (stat != DEAD) - adjustBruteLoss(60) - adjustFireLoss(60) + apply_damage(/datum/damage_source/explosion, BRUTE, 60) + apply_damage(/datum/damage_source/explosion, BURN, 60) if(3) if (stat != DEAD) - adjustBruteLoss(30) + apply_damage(/datum/damage_source/explosion, BRUTE, 30) /mob/living/silicon/robot/bullet_act(var/obj/projectile/Proj, def_zone) . = ..() diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index 4df434aabd866..339ad8deef2e7 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -468,7 +468,7 @@ return /mob/living/silicon/rust_heretic_act() - adjustBruteLoss(500) + apply_damage(/datum/damage_source/magic, BRUTE, 500) return TRUE /mob/living/silicon/hears_radio() diff --git a/code/modules/mob/living/silicon/silicon_defense.dm b/code/modules/mob/living/silicon/silicon_defense.dm index 856f7e2eda40f..90d02439e6090 100644 --- a/code/modules/mob/living/silicon/silicon_defense.dm +++ b/code/modules/mob/living/silicon/silicon_defense.dm @@ -7,17 +7,10 @@ /mob/living/silicon/attack_alien(mob/living/carbon/alien/humanoid/M) if(..()) //if harm or disarm intent - var/damage = 20 if (prob(90)) log_combat(M, src, "attacked") - playsound(loc, 'sound/weapons/slash.ogg', 25, 1, -1) - visible_message("[M] slashes at [src]!", \ - "[M] slashes at you!") if(prob(8)) flash_act(affect_silicon = 1) - log_combat(M, src, "attacked") - adjustBruteLoss(damage) - updatehealth() else playsound(loc, 'sound/weapons/slashmiss.ogg', 25, 1, -1) visible_message("[M]'s swipe misses [src]!", \ @@ -33,31 +26,14 @@ unbuckle_mob(N) N.visible_message("[N] is knocked off of [src] by [M]!", \ "You're knocked off of [src] by [M]!") - switch(M.melee_damage_type) - if(BRUTE) - adjustBruteLoss(damage) - if(BURN) - adjustFireLoss(damage) - if(TOX) - adjustToxLoss(damage) - if(OXY) - adjustOxyLoss(damage) - if(CLONE) - adjustCloneLoss(damage) - if(STAMINA) - adjustStaminaLoss(damage) /mob/living/silicon/attack_paw(mob/living/user) return attack_hand(user) -/mob/living/silicon/attack_larva(mob/living/carbon/alien/larva/L) - if(L.a_intent == INTENT_HELP) - visible_message("[L.name] rubs its head against [src].") - /mob/living/silicon/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) if(user.a_intent == INTENT_HARM) ..(user, 1) - adjustBruteLoss(rand(10, 15)) + apply_damage(/datum/damage_source/blunt/light, BRUTE, rand(10, 15)) playsound(loc, "punch", 25, 1, -1) visible_message("[user] punches [src]!", \ "[user] punches you!", null, COMBAT_MESSAGE_RANGE) @@ -80,7 +56,7 @@ to_chat(M, "You don't want to hurt [src]!") return if(M.dna.species.punchdamage >= 10) - adjustBruteLoss(M.dna.species.punchdamage) + apply_damage(M.dna.species.damage_source_type, M.dna.species.damage_type, M.dna.species.punchdamage) playsound(loc, "punch", 25, 1, -1) visible_message("[M] punches [src]!", \ "[M] punches you!", null, COMBAT_MESSAGE_RANGE) @@ -125,7 +101,7 @@ /mob/living/silicon/bullet_act(obj/projectile/Proj, def_zone, piercing_hit = FALSE) SEND_SIGNAL(src, COMSIG_ATOM_BULLET_ACT, Proj, def_zone) if((Proj.damage_type == BRUTE || Proj.damage_type == BURN)) - adjustBruteLoss(Proj.damage) + apply_damage(Proj.damtype, BRUTE, Proj.damage, ran_zone(def_zone)) if(prob(Proj.damage*1.5)) for(var/mob/living/M in buckled_mobs) M.visible_message("[M] is knocked off of [src]!") diff --git a/code/modules/mob/living/simple_animal/animal_defense.dm b/code/modules/mob/living/simple_animal/animal_defense.dm index fe4a714e8e99a..7717903052b91 100644 --- a/code/modules/mob/living/simple_animal/animal_defense.dm +++ b/code/modules/mob/living/simple_animal/animal_defense.dm @@ -36,9 +36,12 @@ visible_message("[M] [response_harm] [src]!",\ "[M] [response_harm] you!", null, COMBAT_MESSAGE_RANGE) playsound(loc, attacked_sound, 25, 1, -1) - attack_threshold_check(M.dna.species.punchdamage) + if (is_damage_deflected(M.dna.species.punchdamage)) + log_combat(M, src, "attacked (entirely deflected)") + return + var/datum/damage_source/source = GET_DAMAGE_SOURCE(M.dna.species.damage_source_type) + source.deal_attack(M, null, src, M.dna.species.damage_type, M.dna.species.punchdamage) log_combat(M, src, "attacked") - updatehealth() return TRUE /mob/living/simple_animal/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) @@ -50,14 +53,17 @@ playsound(loc, "punch", 25, 1, -1) visible_message("[user] punches [src]!", \ "[user] punches you!", null, COMBAT_MESSAGE_RANGE) - adjustBruteLoss(15) + apply_damage(/datum/damage_source/blunt/light, BRUTE, 15) return TRUE /mob/living/simple_animal/attack_paw(mob/living/carbon/monkey/M) if(..()) //successful monkey bite. if(stat != DEAD) var/damage = rand(1, 3) - attack_threshold_check(damage) + if (is_damage_deflected(damage)) + log_combat(M, src, "attacked (entirely deflected)") + return + //BACONTODO attack_threshold_check(damage) return 1 if (M.a_intent == INTENT_HELP) if (health > 0) @@ -78,54 +84,46 @@ visible_message("[M] slashes at [src]!", \ "[M] slashes at you!", null, COMBAT_MESSAGE_RANGE) playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1) - attack_threshold_check(damage) + if (is_damage_deflected(damage)) + log_combat(M, src, "attacked (entirely deflected)") + return + //BACONTODO attack_threshold_check(damage) log_combat(M, src, "attacked") return 1 -/mob/living/simple_animal/attack_larva(mob/living/carbon/alien/larva/L) +/mob/living/simple_animal/larva_attack_intercept(mob/living/carbon/alien/larva/L) . = ..() if(. && stat != DEAD) //successful larva bite var/damage = rand(5, 10) - . = attack_threshold_check(damage) - if(.) - L.amount_grown = min(L.amount_grown + damage, L.max_grown) + if (is_damage_deflected(damage)) + log_combat(L, src, "attacked (entirely deflected)") + return + //BACONTODO . = attack_threshold_check(damage) + //if(.) + // L.amount_grown = min(L.amount_grown + damage, L.max_grown) /mob/living/simple_animal/attack_animal(mob/living/simple_animal/M) . = ..() if(.) var/damage = M.melee_damage - return attack_threshold_check(damage, M.melee_damage_type) - -/mob/living/simple_animal/attack_slime(mob/living/simple_animal/slime/M) - if(..()) //successful slime attack - var/damage = 20 - if(M.is_adult) - damage = 30 - if(M.transformeffects & SLIME_EFFECT_RED) - damage *= 1.1 - return attack_threshold_check(damage) + if (is_damage_deflected(damage)) + log_combat(M, src, "attacked (entirely deflected)") + return + //BACONTODO return attack_threshold_check(damage) /mob/living/simple_animal/attack_drone(mob/living/simple_animal/drone/M) if(M.a_intent == INTENT_HARM) //No kicking dogs even as a rogue drone. Use a weapon. return return ..() -/mob/living/simple_animal/proc/attack_threshold_check(damage, damagetype = BRUTE, armorcheck = MELEE) - var/temp_damage = damage - if(!damage_coeff[damagetype]) - temp_damage = 0 - else - temp_damage *= damage_coeff[damagetype] - - if(temp_damage >= 0 && temp_damage <= force_threshold) +/mob/living/simple_animal/proc/is_damage_deflected(damage) + if(damage >= 0 && damage <= force_threshold) visible_message("[src] looks unharmed.") - return FALSE - else - apply_damage(damage, damagetype, null, getarmor(null, armorcheck)) return TRUE + return FALSE /mob/living/simple_animal/bullet_act(obj/projectile/Proj, def_zone, piercing_hit = FALSE) - apply_damage(Proj.damage, Proj.damage_type) + Proj.deal_attack(null, src, Proj.def_zone, override_damage = Proj.damage) Proj.on_hit(src, 0, piercing_hit) return BULLET_ACT_HIT @@ -139,7 +137,7 @@ switch (severity) if (EXPLODE_DEVASTATE) if(prob(bomb_armor)) - adjustBruteLoss(500) + apply_damage(/datum/damage_source/explosion, BRUTE, 500) else gib() return @@ -147,16 +145,16 @@ var/bloss = 60 if(prob(bomb_armor)) bloss = bloss / 1.5 - adjustBruteLoss(bloss) + apply_damage(/datum/damage_source/explosion, BRUTE, bloss) if(EXPLODE_LIGHT) var/bloss = 30 if(prob(bomb_armor)) bloss = bloss / 1.5 - adjustBruteLoss(bloss) + apply_damage(/datum/damage_source/explosion, BRUTE, bloss) /mob/living/simple_animal/blob_act(obj/structure/blob/B) - adjustBruteLoss(20) + apply_damage(/datum/damage_source/blob, BRUTE, 20) return /mob/living/simple_animal/do_attack_animation(atom/A, visual_effect_icon, used_item, no_effect) diff --git a/code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm b/code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm index 33266d519e6df..4e0cf28d00768 100644 --- a/code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm +++ b/code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm @@ -60,7 +60,7 @@ return TRUE /mob/living/simple_animal/bot/secbot/grievous/stun_attack(mob/living/carbon/C) //Criminals don't deserve to live - weapon.attack(C, src) + weapon.attack_mob_target(C, src) playsound(src, 'sound/weapons/blade1.ogg', 50, TRUE, -1) if(C.stat == DEAD) addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, update_icon)), 2) diff --git a/code/modules/mob/living/simple_animal/bot/atmosbot.dm b/code/modules/mob/living/simple_animal/bot/atmosbot.dm index db8a35f75bee6..5dd7b934fba7a 100644 --- a/code/modules/mob/living/simple_animal/bot/atmosbot.dm +++ b/code/modules/mob/living/simple_animal/bot/atmosbot.dm @@ -329,7 +329,7 @@ return icon_state = "atmosbot[on][on?"_[action]":""]" -/mob/living/simple_animal/bot/atmosbot/UnarmedAttack(atom/A, proximity) +/mob/living/simple_animal/bot/atmosbot/primary_interact(atom/A, proximity) if(isturf(A) && A == get_turf(src)) return deploy_holobarrier() return ..() diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index 1fcc44792c8d7..56a91a1ba9696 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -6,7 +6,7 @@ mob_biotypes = list(MOB_ROBOTIC) wander = FALSE healable = 0 - damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0) + damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA_DAMTYPE = 0, OXY = 0) atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0) maxbodytemp = INFINITY minbodytemp = 0 @@ -257,7 +257,7 @@ else . += "[src] is in pristine condition." -/mob/living/simple_animal/bot/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/bot/adjustHealth(amount, forced = FALSE) if(amount>0 && prob(10)) new /obj/effect/decal/cleanable/oil(loc) . = ..() @@ -324,17 +324,25 @@ else to_chat(user, "Access denied.") -/mob/living/simple_animal/bot/attackby(obj/item/W, mob/user, params) +/mob/living/simple_animal/bot/on_attacked(obj/item/I, mob/living/user, nonharmfulhit) + if(I.force) //if force is non-zero + do_sparks(5, TRUE, src) + return ..() + +/mob/living/simple_animal/bot/item_interact(obj/item/item, mob/user, params) if(W.tool_behaviour == TOOL_SCREWDRIVER) if(!locked) open = !open to_chat(user, "The maintenance panel is now [open ? "opened" : "closed"].") else to_chat(user, "The maintenance panel is locked.") + return TRUE else if(istype(W, /obj/item/card/id) || istype(W, /obj/item/modular_computer/tablet/pda)) togglelock(user) + return TRUE else if(istype(W, /obj/item/paicard)) insertpai(user, W) + return TRUE else if((W.tool_behaviour == TOOL_HEMOSTAT) && paicard) if(open) to_chat(user, "Close the access panel before manipulating the personality slot!") @@ -344,6 +352,7 @@ if (paicard) user.visible_message("[user] uses [W] to pull [paicard] out of [bot_name]!","You pull [paicard] out of [bot_name] with [W].") ejectpai(user) + return TRUE else user.changeNext_move(CLICK_CD_MELEE) if(W.tool_behaviour == TOOL_WELDER && user.a_intent != INTENT_HARM) @@ -357,10 +366,9 @@ if(W.use_tool(src, user, 0, volume=40)) adjustHealth(-10) user.visible_message("[user] repairs [src]!","You repair [src].") + return TRUE else - if(W.force) //if force is non-zero - do_sparks(5, TRUE, src) - ..() + return ..() /mob/living/simple_animal/bot/AltClick(mob/user) ..() @@ -1172,7 +1180,7 @@ Pass a positive integer as an argument to override a bot's default speed. path.Cut(1, 2) /mob/living/simple_animal/bot/rust_heretic_act() - adjustBruteLoss(400) + apply_damage(/datum/damage_source/magic, BRUTE, 400) return TRUE diff --git a/code/modules/mob/living/simple_animal/bot/cleanbot.dm b/code/modules/mob/living/simple_animal/bot/cleanbot.dm index 9ce25751af005..3a57bcb9043e0 100644 --- a/code/modules/mob/living/simple_animal/bot/cleanbot.dm +++ b/code/modules/mob/living/simple_animal/bot/cleanbot.dm @@ -68,7 +68,7 @@ text_dehack = "[name]'s software has been reset!" text_dehack_fail = "[name] does not seem to respond to your repair code!" -/mob/living/simple_animal/bot/cleanbot/attackby(obj/item/W, mob/user, params) +/mob/living/simple_animal/bot/cleanbot/item_interact(obj/item/item, mob/user, params) if(istype(W, /obj/item/card/id)||istype(W, /obj/item/modular_computer/tablet/pda)) if(bot_core.allowed(user) && !open && !emagged) locked = !locked @@ -80,6 +80,7 @@ to_chat(user, "Please close the access panel before locking it.") else to_chat(user, "\The [src] doesn't seem to respect your authority.") + return TRUE else return ..() @@ -109,10 +110,10 @@ for(var/mob/living/carbon/victim in loc) if(victim != target) - UnarmedAttack(victim) // Acid spray + primary_interact(victim) // Acid spray if(prob(15)) // Wets floors and spawns foam randomly - UnarmedAttack(src) + primary_interact(src) else if(prob(5)) audible_message("[src] makes an excited beeping booping sound!") @@ -153,7 +154,7 @@ if(loc == get_turf(target)) if(!(check_bot(target) && prob(50))) //Target is not defined at the parent. 50% chance to still try and clean so we dont get stuck on the last blood drop. - UnarmedAttack(target) //Rather than check at every step of the way, let's check before we do an action, so we can rescan before the other bot. + primary_interact(target) //Rather than check at every step of the way, let's check before we do an action, so we can rescan before the other bot. if(QDELETED(target)) //We done here. target = null mode = BOT_IDLE @@ -209,7 +210,7 @@ target_types = typecacheof(target_types) -/mob/living/simple_animal/bot/cleanbot/UnarmedAttack(atom/A) +/mob/living/simple_animal/bot/cleanbot/primary_interact(atom/A) if(istype(A, /obj/effect/decal/cleanable)) anchored = TRUE icon_state = "cleanbot-c" @@ -287,14 +288,14 @@ icon = 'icons/obj/janitor.dmi' icon_state = "larryframe" -/obj/item/larryframe/attackby(obj/O, mob/user, params) +/obj/item/larryframe/item_interact(obj/item/item, mob/user, params) if(isprox(O)) to_chat(user, "You add [O] to [src].") qdel(O) qdel(src) user.put_in_hands(new /obj/item/bot_assembly/larry) - else - ..() + return TRUE + return ..() /mob/living/simple_animal/bot/cleanbot/medbay name = "Scrubs, MD" @@ -323,7 +324,7 @@ icon_state = "larry[on]" bot_core.updateUsrDialog() -/mob/living/simple_animal/bot/cleanbot/larry/UnarmedAttack(atom/A) +/mob/living/simple_animal/bot/cleanbot/larry/primary_interact(atom/A) if(istype(A, /obj/effect/decal/cleanable)) anchored = TRUE icon_state = "larry-c" @@ -381,7 +382,7 @@ target = null -/mob/living/simple_animal/bot/cleanbot/larry/attackby(obj/item/I, mob/living/user) +/mob/living/simple_animal/bot/cleanbot/larry/item_interact(obj/item/item, mob/user, params) if(user.a_intent == INTENT_HELP) if(istype(I, /obj/item/kitchen/knife) && !knife) //Is it a knife? var/obj/item/kitchen/knife/newknife = I @@ -390,6 +391,7 @@ message_admins("[user] attached a [newknife.name] to [src]") //This should definitely be a notified thing. AddComponent(/datum/component/knife_attached_to_movable, knife.force) update_icons() + return TRUE else return ..() else diff --git a/code/modules/mob/living/simple_animal/bot/construction.dm b/code/modules/mob/living/simple_animal/bot/construction.dm index effb609e29453..e69186de3d541 100644 --- a/code/modules/mob/living/simple_animal/bot/construction.dm +++ b/code/modules/mob/living/simple_animal/bot/construction.dm @@ -10,11 +10,11 @@ var/build_step = ASSEMBLY_FIRST_STEP var/robot_arm = /obj/item/bodypart/r_arm/robot -/obj/item/bot_assembly/attackby(obj/item/I, mob/user, params) - ..() +/obj/item/bot_assembly/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/pen)) rename_bot() - return + return TRUE + return ..() /obj/item/bot_assembly/proc/rename_bot() var/t = sanitize_name(stripped_input(usr, "Enter new robot name", name, created_name,MAX_NAME_LEN)) @@ -40,17 +40,18 @@ throwforce = 5 created_name = "Cleanbot" -/obj/item/bot_assembly/cleanbot/attackby(obj/item/W, mob/user, params) - ..() +/obj/item/bot_assembly/cleanbot/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/bodypart/l_arm/robot) || istype(W, /obj/item/bodypart/r_arm/robot)) if(!can_finish_build(W, user)) - return + return TRUE var/mob/living/simple_animal/bot/cleanbot/A = new(drop_location()) A.name = created_name A.robot_arm = W.type to_chat(user, "You add [W] to [src]. Beep boop!") qdel(W) qdel(src) + return TRUE + return ..() /obj/item/bot_assembly/larry name = "incomplete larry frame" @@ -59,17 +60,18 @@ throwforce = 5 created_name = "Larry" -/obj/item/bot_assembly/larry/attackby(obj/item/W, mob/user, params) - ..() +/obj/item/bot_assembly/larry/item_interact(obj/item/W, mob/user, params) if(istype(W, /obj/item/bodypart/l_arm/robot) || istype(W, /obj/item/bodypart/r_arm/robot)) if(!can_finish_build(W, user)) - return + return TRUE var/mob/living/simple_animal/bot/cleanbot/larry/A = new(drop_location()) A.name = created_name A.robot_arm = W.type to_chat(user, "You add [W] to [src]. Beep boop!") qdel(W) qdel(src) + return TRUE + return ..() //Edbot Assembly /obj/item/bot_assembly/ed209 @@ -81,13 +83,12 @@ var/lasercolor = "" var/vest_type = /obj/item/clothing/suit/armor/vest -/obj/item/bot_assembly/ed209/attackby(obj/item/W, mob/user, params) - ..() +/obj/item/bot_assembly/ed209/item_interact(obj/item/W, mob/user, params) switch(build_step) if(ASSEMBLY_FIRST_STEP, ASSEMBLY_SECOND_STEP) if(istype(W, /obj/item/bodypart/l_leg/robot) || istype(W, /obj/item/bodypart/r_leg/robot)) if(!user.temporarilyRemoveItemFromInventory(W)) - return + return TRUE to_chat(user, "You add [W] to [src].") qdel(W) name = "legs/frame assembly" @@ -98,16 +99,19 @@ item_state = "ed209_legs" icon_state = "ed209_legs" build_step++ + return TRUE if(ASSEMBLY_THIRD_STEP) var/newcolor = "" if(istype(W, /obj/item/clothing/suit/redtag)) newcolor = "r" + return TRUE else if(istype(W, /obj/item/clothing/suit/bluetag)) newcolor = "b" + return TRUE if(newcolor || istype(W, /obj/item/clothing/suit/armor/vest)) if(!user.temporarilyRemoveItemFromInventory(W)) - return + return TRUE lasercolor = newcolor vest_type = W.type to_chat(user, "You add [W] to [src].") @@ -116,6 +120,7 @@ item_state = "[lasercolor]ed209_shell" icon_state = "[lasercolor]ed209_shell" build_step++ + return TRUE if(ASSEMBLY_FOURTH_STEP) if(W.tool_behaviour == TOOL_WELDER) @@ -123,47 +128,50 @@ name = "shielded frame assembly" to_chat(user, "You weld the vest to [src].") build_step++ + return TRUE if(ASSEMBLY_FIFTH_STEP) switch(lasercolor) if("b") if(!istype(W, /obj/item/clothing/head/helmet/bluetaghelm)) - return + return TRUE if("r") if(!istype(W, /obj/item/clothing/head/helmet/redtaghelm)) - return + return TRUE if("") if(!istype(W, /obj/item/clothing/head/helmet)) - return + return TRUE if(!user.temporarilyRemoveItemFromInventory(W)) - return + return ..() to_chat(user, "You add [W] to [src].") qdel(W) name = "covered and shielded frame assembly" item_state = "[lasercolor]ed209_hat" icon_state = "[lasercolor]ed209_hat" build_step++ + return TRUE if(5) if(isprox(W)) if(!user.temporarilyRemoveItemFromInventory(W)) - return + return TRUE build_step++ to_chat(user, "You add [W] to [src].") qdel(W) name = "covered, shielded and sensored frame assembly" item_state = "[lasercolor]ed209_prox" icon_state = "[lasercolor]ed209_prox" + return TRUE if(6) if(istype(W, /obj/item/stack/cable_coil)) var/obj/item/stack/cable_coil/coil = W if(coil.get_amount() < 1) to_chat(user, "You need one length of cable to wire the ED-209!") - return + return TRUE to_chat(user, "You start to wire [src]...") if(do_after(user, 40, target = src)) if(coil.get_amount() >= 1 && build_step == 6) @@ -171,28 +179,30 @@ to_chat(user, "You wire [src].") name = "wired ED-209 assembly" build_step++ + return TRUE if(7) switch(lasercolor) if("b") if(!istype(W, /obj/item/gun/energy/laser/bluetag)) - return + return TRUE if("r") if(!istype(W, /obj/item/gun/energy/laser/redtag)) - return + return TRUE if("") if(!istype(W, /obj/item/gun/energy/disabler)) - return + return TRUE else - return + return ..() if(!user.temporarilyRemoveItemFromInventory(W)) - return + return ..() name = "[W.name] ED-209 assembly" to_chat(user, "You add [W] to [src].") item_state = "[lasercolor]ed209_taser" icon_state = "[lasercolor]ed209_taser" qdel(W) build_step++ + return TRUE if(8) if(W.tool_behaviour == TOOL_SCREWDRIVER) @@ -201,17 +211,20 @@ name = "armed [name]" to_chat(user, "The gun is now securely fastened to the frame.") build_step++ + return TRUE if(9) if(istype(W, /obj/item/stock_parts/cell)) if(!can_finish_build(W, user)) - return + return TRUE var/mob/living/simple_animal/bot/ed209/B = new(drop_location(),created_name,lasercolor) to_chat(user, "You complete the ED-209.") B.cell_type = W.type qdel(W) B.vest_type = vest_type qdel(src) + return TRUE + return ..() //Floorbot assemblies @@ -241,22 +254,22 @@ name = "incomplete floorbot assembly" icon_state = "[toolbox_color]toolbox_tiles_sensor" -/obj/item/bot_assembly/floorbot/attackby(obj/item/W, mob/user, params) - ..() +/obj/item/bot_assembly/floorbot/item_interact(obj/item/W, mob/user, params) switch(build_step) if(ASSEMBLY_FIRST_STEP) if(isprox(W)) if(!user.temporarilyRemoveItemFromInventory(W)) - return + return TRUE to_chat(user, "You add [W] to [src].") qdel(W) build_step++ update_icon() + return TRUE if(ASSEMBLY_SECOND_STEP) if(istype(W, /obj/item/bodypart/l_arm/robot) || istype(W, /obj/item/bodypart/r_arm/robot)) if(!can_finish_build(W, user)) - return + return TRUE var/mob/living/simple_animal/bot/floorbot/A = new(drop_location(), toolbox_color) A.name = created_name A.robot_arm = W.type @@ -264,6 +277,8 @@ to_chat(user, "You add [W] to [src]. Boop beep!") qdel(W) qdel(src) + return TRUE + return ..() //Medbot Assembly @@ -282,24 +297,24 @@ if(skin) add_overlay("kit_skin_[skin]") -/obj/item/bot_assembly/medbot/attackby(obj/item/W, mob/user, params) - ..() +/obj/item/bot_assembly/medbot/item_interact(obj/item/W, mob/user, params) switch(build_step) if(ASSEMBLY_FIRST_STEP) if(istype(W, /obj/item/healthanalyzer)) if(!user.temporarilyRemoveItemFromInventory(W)) - return + return TRUE healthanalyzer = W.type to_chat(user, "You add [W] to [src].") qdel(W) name = "first aid/robot arm/health analyzer assembly" add_overlay("na_scanner") build_step++ + return TRUE if(ASSEMBLY_SECOND_STEP) if(isprox(W)) if(!can_finish_build(W, user)) - return + return TRUE qdel(W) var/mob/living/simple_animal/bot/medbot/S = new(drop_location(), skin) to_chat(user, "You complete the Medbot. Beep boop!") @@ -308,6 +323,8 @@ S.robot_arm = robot_arm S.healthanalyzer = healthanalyzer qdel(src) + return TRUE + return ..() //Honkbot Assembly @@ -317,23 +334,23 @@ icon_state = "honkbot_arm" created_name = "Honkbot" -/obj/item/bot_assembly/honkbot/attackby(obj/item/I, mob/user, params) - ..() +/obj/item/bot_assembly/honkbot/item_interact(obj/item/I, mob/user, params) switch(build_step) if(ASSEMBLY_FIRST_STEP) if(isprox(I)) if(!user.temporarilyRemoveItemFromInventory(I)) - return + return TRUE to_chat(user, "You add the [I] to [src]!") icon_state = "honkbot_proxy" name = "incomplete Honkbot assembly" qdel(I) build_step++ + return TRUE if(ASSEMBLY_SECOND_STEP) if(istype(I, /obj/item/bikehorn)) if(!can_finish_build(I, user)) - return + return TRUE to_chat(user, "You add the [I] to [src]! Honk!") var/mob/living/simple_animal/bot/honkbot/S = new(drop_location()) S.name = created_name @@ -342,6 +359,8 @@ S.bikehorn = I.type qdel(I) qdel(src) + return TRUE + return ..() //Secbot Assembly @@ -354,7 +373,7 @@ var/swordamt = 0 //If you're converting it into a grievousbot, how many swords have you attached var/toyswordamt = 0 //honk -/obj/item/bot_assembly/secbot/attackby(obj/item/I, mob/user, params) +/obj/item/bot_assembly/secbot/item_interact(obj/item/I, mob/user, params) ..() var/atom/Tsec = drop_location() switch(build_step) @@ -364,50 +383,56 @@ add_overlay("hs_hole") to_chat(user, "You weld a hole in [src]!") build_step++ + return TRUE else if(I.tool_behaviour == TOOL_SCREWDRIVER) //deconstruct new /obj/item/assembly/signaler(Tsec) new /obj/item/clothing/head/helmet/sec(Tsec) to_chat(user, "You disconnect the signaler from the helmet.") qdel(src) + return TRUE if(ASSEMBLY_SECOND_STEP) if(isprox(I)) if(!user.temporarilyRemoveItemFromInventory(I)) - return + return TRUE to_chat(user, "You add [I] to [src]!") add_overlay("hs_eye") name = "helmet/signaler/prox sensor assembly" qdel(I) build_step++ + return TRUE else if(I.tool_behaviour == TOOL_WELDER) //deconstruct if(I.use_tool(src, user, 0, volume=40)) cut_overlay("hs_hole") to_chat(user, "You weld the hole in [src] shut!") build_step-- + return TRUE if(ASSEMBLY_THIRD_STEP) if((istype(I, /obj/item/bodypart/l_arm/robot)) || (istype(I, /obj/item/bodypart/r_arm/robot))) if(!user.temporarilyRemoveItemFromInventory(I)) - return + return TRUE to_chat(user, "You add [I] to [src]!") name = "helmet/signaler/prox sensor/robot arm assembly" add_overlay("hs_arm") robot_arm = I.type qdel(I) build_step++ + return TRUE else if(I.tool_behaviour == TOOL_SCREWDRIVER) //deconstruct cut_overlay("hs_eye") new /obj/item/assembly/prox_sensor(Tsec) to_chat(user, "You detach the proximity sensor from [src].") build_step-- + return TRUE if(ASSEMBLY_FOURTH_STEP) if(istype(I, /obj/item/melee/baton)) if(!can_finish_build(I, user)) - return + return TRUE to_chat(user, "You complete the Securitron! Beep boop.") var/mob/living/simple_animal/bot/secbot/S = new(Tsec) S.name = created_name @@ -415,14 +440,15 @@ S.robot_arm = robot_arm qdel(I) qdel(src) + return TRUE if(I.tool_behaviour == TOOL_WRENCH) to_chat(user, "You adjust [src]'s arm slots to mount extra weapons") build_step ++ - return + return TRUE if(istype(I, /obj/item/toy/sword)) if(toyswordamt < 3 && swordamt <= 0) if(!user.temporarilyRemoveItemFromInventory(I)) - return + return TRUE created_name = "General Beepsky" name = "helmet/signaler/prox sensor/robot arm/toy sword assembly" icon_state = "grievous_assembly" @@ -431,13 +457,14 @@ toyswordamt ++ else if(!can_finish_build(I, user)) - return + return TRUE to_chat(user, "You complete the Securitron!...Something seems a bit wrong with it..?") var/mob/living/simple_animal/bot/secbot/grievous/toy/S = new(Tsec) S.name = created_name S.robot_arm = robot_arm qdel(I) qdel(src) + return TRUE else if(I.tool_behaviour == TOOL_SCREWDRIVER) //deconstruct cut_overlay("hs_arm") @@ -450,12 +477,13 @@ to_chat(user, "The superglue binding [src]'s toy swords to its chassis snaps!") for(var/IS in 1 to toyswordamt) new /obj/item/toy/sword(Tsec) + return TRUE if(ASSEMBLY_FIFTH_STEP) if(istype(I, /obj/item/melee/transforming/energy/sword/saber)) if(swordamt < 3) if(!user.temporarilyRemoveItemFromInventory(I)) - return + return TRUE created_name = "General Beepsky" name = "helmet/signaler/prox sensor/robot arm/energy sword assembly" icon_state = "grievous_assembly" @@ -464,20 +492,22 @@ swordamt ++ else if(!can_finish_build(I, user)) - return + return TRUE to_chat(user, "You complete the Securitron!...Something seems a bit wrong with it..?") var/mob/living/simple_animal/bot/secbot/grievous/S = new(Tsec) S.name = created_name S.robot_arm = robot_arm qdel(I) qdel(src) + return TRUE else if(I.tool_behaviour == TOOL_SCREWDRIVER) //deconstruct build_step-- icon_state = initial(icon_state) to_chat(user, "You unbolt [src]'s energy swords.") for(var/IS in 1 to swordamt) new /obj/item/melee/transforming/energy/sword/saber(Tsec) - + return TRUE + return ..() //Firebot Assembly /obj/item/bot_assembly/firebot @@ -486,28 +516,30 @@ icon_state = "firebot_arm" created_name = "Firebot" -/obj/item/bot_assembly/firebot/attackby(obj/item/I, mob/user, params) - ..() +/obj/item/bot_assembly/firebot/item_interact(obj/item/I, mob/user, params) switch(build_step) if(ASSEMBLY_FIRST_STEP) if(istype(I, /obj/item/clothing/head/hardhat/red)) if(!user.temporarilyRemoveItemFromInventory(I)) - return + return TRUE to_chat(user,"You add the [I] to [src]!") icon_state = "firebot_helmet" desc = "An incomplete firebot assembly with a fire helmet." qdel(I) build_step++ + return TRUE if(ASSEMBLY_SECOND_STEP) if(isprox(I)) if(!can_finish_build(I, user)) - return + return TRUE to_chat(user, "You add the [I] to [src]! Beep Boop!") var/mob/living/simple_animal/bot/firebot/F = new(drop_location()) F.name = created_name qdel(I) qdel(src) + return TRUE + return ..() //Atmosbot Assembly /obj/item/bot_assembly/atmosbot @@ -516,25 +548,27 @@ icon_state = "atmosbot_assembly" created_name = "Atmosbot" -/obj/item/bot_assembly/atmosbot/attackby(obj/item/I, mob/user, params) - ..() +/obj/item/bot_assembly/atmosbot/item_interact(obj/item/I, mob/user, params) switch(build_step) if(ASSEMBLY_FIRST_STEP) if(istype(I, /obj/item/tank/internals)) if(!user.temporarilyRemoveItemFromInventory(I)) - return + return TRUE to_chat(user,"You add the [I] to [src]!") icon_state = "atmosbot_assembly_tank" desc = "An incomplete atmosbot assembly with a tank strapped to it." qdel(I) build_step++ + return TRUE if(ASSEMBLY_SECOND_STEP) if(isprox(I)) if(!can_finish_build(I, user)) - return + return TRUE to_chat(user, "You add the [I] to [src]! Beep Boop!") var/mob/living/simple_animal/bot/atmosbot/A = new(drop_location()) A.name = created_name qdel(I) qdel(src) + return TRUE + return ..() diff --git a/code/modules/mob/living/simple_animal/bot/ed209bot.dm b/code/modules/mob/living/simple_animal/bot/ed209bot.dm index 9ac10801ed956..18cf70b187f92 100644 --- a/code/modules/mob/living/simple_animal/bot/ed209bot.dm +++ b/code/modules/mob/living/simple_animal/bot/ed209bot.dm @@ -7,7 +7,7 @@ anchored = FALSE health = 100 maxHealth = 100 - damage_coeff = list(BRUTE = 0.5, BURN = 0.7, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0) + damage_coeff = list(BRUTE = 0.5, BURN = 0.7, TOX = 0, CLONE = 0, STAMINA_DAMTYPE = 0, OXY = 0) obj_damage = 60 environment_smash = ENVIRONMENT_SMASH_WALLS //Walls can't stop THE LAW mob_size = MOB_SIZE_LARGE @@ -174,15 +174,18 @@ retaliate(H) return ..() -/mob/living/simple_animal/bot/ed209/attackby(obj/item/W, mob/user, params) - ..() - if(W.tool_behaviour == TOOL_WELDER && user.a_intent != INTENT_HARM) // Any intent but harm will heal, so we shouldn't get angry. - return - if(W.tool_behaviour != TOOL_SCREWDRIVER && (!target)) // Added check for welding tool to fix #2432. Welding tool behavior is handled in superclass. - if(W.force && W.damtype != STAMINA)//If force is non-zero and damage type isn't stamina. +/mob/living/simple_animal/bot/ed209/item_interact(obj/item/W, mob/user, params) + if(W.tool_behaviour == TOOL_WELDER) // Any intent but harm will heal, so we shouldn't get angry. + return TRUE + +/mob/living/simple_animal/bot/ed209/item_interact(obj/item/W, mob/user, params) + if(I.tool_behaviour != TOOL_SCREWDRIVER && (!target)) // Added check for welding tool to fix #2432. Welding tool behavior is handled in superclass. + if(I.force && I.damtype != /datum/damage/stamina)//If force is non-zero and damage type isn't stamina. retaliate(user) if(lasercolor)//To make up for the fact that lasertag bots don't hunt shootAt(user) + return TRUE + return ..() /mob/living/simple_animal/bot/ed209/on_emag(atom/target, mob/user) ..() @@ -514,7 +517,7 @@ /mob/living/simple_animal/bot/ed209/redtag lasercolor = "r" -/mob/living/simple_animal/bot/ed209/UnarmedAttack(atom/A) +/mob/living/simple_animal/bot/ed209/primary_interact(atom/A) if(!on) return if(iscarbon(A)) @@ -534,7 +537,7 @@ retaliate(H) ..() -/mob/living/simple_animal/bot/ed209/RangedAttack(atom/A) +/mob/living/simple_animal/bot/ed209/primary_ranged_attack(atom/A) if(!on) return shootAt(A) diff --git a/code/modules/mob/living/simple_animal/bot/firebot.dm b/code/modules/mob/living/simple_animal/bot/firebot.dm index d3d56fbdb8ed8..a20f9e5015ea5 100644 --- a/code/modules/mob/living/simple_animal/bot/firebot.dm +++ b/code/modules/mob/living/simple_animal/bot/firebot.dm @@ -59,7 +59,7 @@ internal_ext.max_water = INFINITY internal_ext.refill() -/mob/living/simple_animal/bot/firebot/UnarmedAttack(atom/A) +/mob/living/simple_animal/bot/firebot/primary_interact(atom/A) if(!on) return if(internal_ext) @@ -67,7 +67,7 @@ else return ..() -/mob/living/simple_animal/bot/firebot/RangedAttack(atom/A) +/mob/living/simple_animal/bot/firebot/primary_ranged_attack(atom/A) if(!on) return if(internal_ext) diff --git a/code/modules/mob/living/simple_animal/bot/floorbot.dm b/code/modules/mob/living/simple_animal/bot/floorbot.dm index 54a1cd0b48476..9cc9e0b0b2f93 100644 --- a/code/modules/mob/living/simple_animal/bot/floorbot.dm +++ b/code/modules/mob/living/simple_animal/bot/floorbot.dm @@ -105,18 +105,18 @@ return dat -/mob/living/simple_animal/bot/floorbot/attackby(obj/item/W , mob/user, params) +/mob/living/simple_animal/bot/floorbot/item_interact(obj/item/W , mob/user, params) if(istype(W, /obj/item/stack/tile/plasteel)) to_chat(user, "The floorbot can produce normal tiles itself.") - return + return TRUE if(specialtiles && istype(W, /obj/item/stack/tile)) var/obj/item/stack/tile/usedtile = W if(usedtile.type != tiletype) to_chat(user, "Different custom tiles are already inside the floorbot.") - return + return TRUE if(istype(W, /obj/item/stack/tile)) if(specialtiles >= maxtiles) - return + return TRUE var/obj/item/stack/tile/tiles = W //used only to get the amount tiletype = W.type var/loaded = min(maxtiles-specialtiles, tiles.amount) @@ -126,8 +126,9 @@ to_chat(user, "You load [loaded] tiles into the floorbot. It now contains [specialtiles] tiles.") else to_chat(user, "You need at least one floor tile to put into [src]!") + return TRUE else - ..() + return ..() /mob/living/simple_animal/bot/floorbot/on_emag(atom/target, mob/user) ..() @@ -392,7 +393,7 @@ /obj/machinery/bot_core/floorbot req_one_access = list(ACCESS_CONSTRUCTION, ACCESS_ROBOTICS) -/mob/living/simple_animal/bot/floorbot/UnarmedAttack(atom/A) +/mob/living/simple_animal/bot/floorbot/primary_interact(atom/A) if(isturf(A)) repair(A) else diff --git a/code/modules/mob/living/simple_animal/bot/honkbot.dm b/code/modules/mob/living/simple_animal/bot/honkbot.dm index ba476701562af..c46faf8b6a98a 100644 --- a/code/modules/mob/living/simple_animal/bot/honkbot.dm +++ b/code/modules/mob/living/simple_animal/bot/honkbot.dm @@ -7,7 +7,7 @@ anchored = FALSE health = 25 maxHealth = 25 - damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0) + damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA_DAMTYPE = 0, OXY = 0) pass_flags = PASSMOB radio_key = /obj/item/encryptionkey/headset_service //doesn't have security key @@ -121,11 +121,12 @@ return ..() -/mob/living/simple_animal/bot/honkbot/attackby(obj/item/W, mob/user, params) - if(W.tool_behaviour != TOOL_SCREWDRIVER && (W.force) && (!target) && (W.damtype != STAMINA) ) +/mob/living/simple_animal/bot/honkbot/item_interact(obj/item/W, mob/user, params) + if(W.tool_behaviour != TOOL_SCREWDRIVER && (W.force) && (!target) && (W.damtype != STAMINA_DAMTYPE) ) retaliate(user) addtimer(CALLBACK(src, PROC_REF(react_buzz)), 5) - ..() + return TRUE + return ..() /mob/living/simple_animal/bot/honkbot/on_emag(atom/target, mob/user) ..() @@ -142,7 +143,7 @@ retaliate(Proj.firer) return ..() -/mob/living/simple_animal/bot/honkbot/UnarmedAttack(atom/A) +/mob/living/simple_animal/bot/honkbot/primary_interact(atom/A) if(!on) return if(iscarbon(A)) diff --git a/code/modules/mob/living/simple_animal/bot/medbot.dm b/code/modules/mob/living/simple_animal/bot/medbot.dm index 95ae8ca007059..da290c7606b6e 100644 --- a/code/modules/mob/living/simple_animal/bot/medbot.dm +++ b/code/modules/mob/living/simple_animal/bot/medbot.dm @@ -211,9 +211,9 @@ GLOBAL_VAR(medibot_unique_id_gen) update_controls() return -/mob/living/simple_animal/bot/medbot/attackby(obj/item/W as obj, mob/user as mob, params) +/mob/living/simple_animal/bot/medbot/on_attacked(obj/item/I, mob/living/user, nonharmfulhit) var/current_health = health - ..() + . = ..() if(health < current_health) //if medbot took some damage step_to(src, (get_step_away(src,user))) @@ -478,7 +478,7 @@ GLOBAL_VAR(medibot_unique_id_gen) else ..() -/mob/living/simple_animal/bot/medbot/UnarmedAttack(atom/A) +/mob/living/simple_animal/bot/medbot/primary_interact(atom/A) if(iscarbon(A)) var/mob/living/carbon/C = A set_patient(C) @@ -553,10 +553,10 @@ GLOBAL_VAR(medibot_unique_id_gen) healies *= -1.5 if(emagged == 2) patient.reagents.add_reagent(/datum/reagent/toxin/chloralhydrate, 5) - patient.apply_damage_type((healies*1),treatment_method) + //BACONTODO patient.apply_damage_old_type((healies*1),treatment_method) log_combat(src, patient, "pretended to tend wounds on", "internal tools", "([uppertext(treatment_method)]) (EMAGGED)") else - patient.apply_damage_type((healies*-1),treatment_method) //don't need to check treatment_method since we know by this point that they were actually damaged. + //BACONTODO patient.apply_damage_old_type((healies*-1),treatment_method) //don't need to check treatment_method since we know by this point that they were actually damaged. log_combat(src, patient, "tended the wounds of", "internal tools", "([uppertext(treatment_method)])") C.visible_message("[src] tends the wounds of [patient]!", \ "[src] tends your wounds!") diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index 55ba743dcd1cf..54fc8478e91ff 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -18,7 +18,7 @@ animate_movement = FORWARD_STEPS health = 50 maxHealth = 50 - damage_coeff = list(BRUTE = 0.5, BURN = 0.7, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0) + damage_coeff = list(BRUTE = 0.5, BURN = 0.7, TOX = 0, CLONE = 0, STAMINA_DAMTYPE = 0, OXY = 0) a_intent = INTENT_HARM //No swapping buckle_lying = 0 buckle_prevents_pull = TRUE // No pulling loaded shit @@ -138,7 +138,7 @@ reached_target = FALSE new_destination = null -/mob/living/simple_animal/bot/mulebot/attackby(obj/item/I, mob/user, params) +/mob/living/simple_animal/bot/mulebot/item_interact(obj/item/item, mob/user, params) if(I.tool_behaviour == TOOL_SCREWDRIVER) . = ..() if(open) @@ -148,16 +148,16 @@ else if(istype(I, /obj/item/stock_parts/cell) && open) if(cell) to_chat(user, "[src] already has a power cell!") - return + return TRUE if(!user.transferItemToLoc(I, src)) - return + return TRUE cell = I visible_message("[user] inserts \a [cell] into [src].", "You insert [cell] into [src].") else if(I.tool_behaviour == TOOL_CROWBAR && open && user.a_intent != INTENT_HARM) if(!cell) to_chat(user, "[src] doesn't have a power cell!") - return + return TRUE cell.add_fingerprint(user) if(Adjacent(user) && !issilicon(user)) user.put_in_hands(cell) @@ -178,6 +178,7 @@ return ..() else return ..() + return TRUE /mob/living/simple_animal/bot/mulebot/on_emag(atom/target, mob/user) if(!emagged) @@ -765,12 +766,12 @@ playsound(src, 'sound/effects/splat.ogg', 50, TRUE) var/damage = rand(5,15) - H.apply_damage(2*damage, BRUTE, BODY_ZONE_HEAD, run_armor_check(BODY_ZONE_HEAD, MELEE)) - H.apply_damage(2*damage, BRUTE, BODY_ZONE_CHEST, run_armor_check(BODY_ZONE_CHEST, MELEE)) - H.apply_damage(0.5*damage, BRUTE, BODY_ZONE_L_LEG, run_armor_check(BODY_ZONE_L_LEG, MELEE)) - H.apply_damage(0.5*damage, BRUTE, BODY_ZONE_R_LEG, run_armor_check(BODY_ZONE_R_LEG, MELEE)) - H.apply_damage(0.5*damage, BRUTE, BODY_ZONE_L_ARM, run_armor_check(BODY_ZONE_L_ARM, MELEE)) - H.apply_damage(0.5*damage, BRUTE, BODY_ZONE_R_ARM, run_armor_check(BODY_ZONE_R_ARM, MELEE)) + H.apply_damage(/datum/damage_source/crush, /datum/damage/brute, 2 * damage, BODY_ZONE_HEAD) + H.apply_damage(/datum/damage_source/crush, /datum/damage/brute, 2 * damage, BODY_ZONE_CHEST) + H.apply_damage(/datum/damage_source/crush, /datum/damage/brute, 0.5 * damage, BODY_ZONE_L_LEG) + H.apply_damage(/datum/damage_source/crush, /datum/damage/brute, 0.5 * damage, BODY_ZONE_R_LEG) + H.apply_damage(/datum/damage_source/crush, /datum/damage/brute, 0.5 * damage, BODY_ZONE_L_ARM) + H.apply_damage(/datum/damage_source/crush, /datum/damage/brute, 0.5 * damage, BODY_ZONE_R_ARM) var/turf/T = get_turf(src) T.add_mob_blood(H) @@ -845,7 +846,7 @@ if(load) unload() -/mob/living/simple_animal/bot/mulebot/UnarmedAttack(atom/A) +/mob/living/simple_animal/bot/mulebot/primary_interact(atom/A) if(isturf(A) && isturf(loc) && loc.Adjacent(A) && load) unload(get_dir(loc, A)) else diff --git a/code/modules/mob/living/simple_animal/bot/secbot.dm b/code/modules/mob/living/simple_animal/bot/secbot.dm index a53a04f99a3e2..76882275295f3 100644 --- a/code/modules/mob/living/simple_animal/bot/secbot.dm +++ b/code/modules/mob/living/simple_animal/bot/secbot.dm @@ -7,7 +7,7 @@ anchored = FALSE health = 25 maxHealth = 25 - damage_coeff = list(BRUTE = 0.5, BURN = 0.7, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0) + damage_coeff = list(BRUTE = 0.5, BURN = 0.7, TOX = 0, CLONE = 0, STAMINA_DAMTYPE = 0, OXY = 0) pass_flags = PASSMOB radio_key = /obj/item/encryptionkey/secbot //AI Priv + Security @@ -176,14 +176,13 @@ return ..() -/mob/living/simple_animal/bot/secbot/attackby(obj/item/W, mob/user, params) +/mob/living/simple_animal/bot/secbot/on_attacked(obj/item/I, mob/living/user, nonharmfulhit) ..() - if(W.tool_behaviour == TOOL_WELDER && user.a_intent != INTENT_HARM) // Any intent but harm will heal, so we shouldn't get angry. + if((I.force) && (!target) && (I.damtype != STAMINA_DAMTYPE) ) // Added check for welding tool to fix #2432. Welding tool behavior is handled in superclass. + return + retaliate(user) + if(special_retaliate_after_attack(user)) return - if(W.tool_behaviour != TOOL_SCREWDRIVER && (W.force) && (!target) && (W.damtype != STAMINA) ) // Added check for welding tool to fix #2432. Welding tool behavior is handled in superclass. - retaliate(user) - if(special_retaliate_after_attack(user)) - return /mob/living/simple_animal/bot/secbot/on_emag(atom/target, mob/user) ..() @@ -202,7 +201,7 @@ retaliate(Proj.firer) return ..() -/mob/living/simple_animal/bot/secbot/UnarmedAttack(atom/A) +/mob/living/simple_animal/bot/secbot/primary_interact(atom/A) if(!on) return if(iscarbon(A)) @@ -253,9 +252,7 @@ var/area/location = get_area(src) speak("[arrest_type ? "Detaining" : "Arresting"] level [threat] scumbag [C] in [location].", radio_channel) - var/armor_block = C.run_armor_check(BODY_ZONE_CHEST, "stamina") - C.apply_damage(85, STAMINA, BODY_ZONE_CHEST, armor_block) - C.apply_effect(EFFECT_STUTTER, 50) + C.apply_damage(/datum/damage_source/stun, /datum/damage/stamina, 85, BODY_ZONE_CHEST) C.visible_message( "[src] has stunned [C]!",\ "[src] has stunned you!" diff --git a/code/modules/mob/living/simple_animal/cluwne.dm b/code/modules/mob/living/simple_animal/cluwne.dm index 748203c2ebf34..d77644c0ee7de 100644 --- a/code/modules/mob/living/simple_animal/cluwne.dm +++ b/code/modules/mob/living/simple_animal/cluwne.dm @@ -35,11 +35,11 @@ act = "me" ..() -/mob/living/simple_animal/cluwne/UnarmedAttack(atom/A, proximity) +/mob/living/simple_animal/cluwne/primary_interact(atom/A, proximity) playsound(src, 'sound/items/bikehorn.ogg', 20, 2) ..() -/mob/living/simple_animal/cluwne/attacked_by(obj/item/I, mob/living/user) +/mob/living/simple_animal/cluwne/on_attacked(obj/item/I, mob/living/user) playsound(src, 'sound/items/bikehorn.ogg', 20, 2) ..() diff --git a/code/modules/mob/living/simple_animal/constructs.dm b/code/modules/mob/living/simple_animal/constructs.dm index d443605c17b71..452a5fb619758 100644 --- a/code/modules/mob/living/simple_animal/constructs.dm +++ b/code/modules/mob/living/simple_animal/constructs.dm @@ -18,7 +18,7 @@ attack_sound = 'sound/weapons/punch1.ogg' see_in_dark = 7 lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE - damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0) + damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA_DAMTYPE = 0, OXY = 0) atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0) minbodytemp = 0 maxbodytemp = INFINITY @@ -123,10 +123,9 @@ /mob/living/simple_animal/hostile/construct/electrocute_act(shock_damage, source, siemens_coeff = 1, safety = 0, tesla_shock = 0, illusion = 0, stun = TRUE) return 0 -/mob/living/simple_animal/hostile/construct/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/construct/updatehealth() . = ..() - if(updating_health) - update_health_hud() + update_health_hud() /////////////////Juggernaut/////////////// /mob/living/simple_animal/hostile/construct/armored @@ -163,7 +162,7 @@ if(istype(P, /obj/projectile/energy) || istype(P, /obj/projectile/beam)) var/reflectchance = 40 - round(P.damage/3) if(prob(reflectchance)) - apply_damage(P.damage * 0.5, P.damage_type) + apply_damage(P.damage_source, P.damage_type, P.damage * 0.5) visible_message("The [P.name] is reflected by [src]'s armored shell!", \ "The [P.name] is reflected by your armored shell!") diff --git a/code/modules/mob/living/simple_animal/damage_procs.dm b/code/modules/mob/living/simple_animal/damage_procs.dm index eda19be7af450..083b2327794b8 100644 --- a/code/modules/mob/living/simple_animal/damage_procs.dm +++ b/code/modules/mob/living/simple_animal/damage_procs.dm @@ -1,41 +1,40 @@ -/mob/living/simple_animal/proc/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/proc/adjustHealth(amount, forced = FALSE) if(!forced && (status_flags & GODMODE)) return FALSE bruteloss = round(CLAMP(bruteloss + amount, 0, maxHealth),DAMAGE_PRECISION) - if(updating_health) - updatehealth() + UPDATE_HEALTH(src) return amount -/mob/living/simple_animal/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/adjustBruteLossAbstract(amount, forced = FALSE) if(forced) - . = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced) + . = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), forced) else if(damage_coeff[BRUTE]) - . = adjustHealth(amount * damage_coeff[BRUTE] * CONFIG_GET(number/damage_multiplier), updating_health, forced) + . = adjustHealth(amount * damage_coeff[BRUTE] * CONFIG_GET(number/damage_multiplier), forced) -/mob/living/simple_animal/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/adjustFireLoss(amount, forced = FALSE) if(forced) - . = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced) + . = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), forced) else if(damage_coeff[BURN]) - . = adjustHealth(amount * damage_coeff[BURN] * CONFIG_GET(number/damage_multiplier), updating_health, forced) + . = adjustHealth(amount * damage_coeff[BURN] * CONFIG_GET(number/damage_multiplier), forced) -/mob/living/simple_animal/adjustOxyLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/adjustOxyLoss(amount, forced = FALSE) if(forced) - . = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced) + . = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), forced) else if(damage_coeff[OXY]) - . = adjustHealth(amount * damage_coeff[OXY] * CONFIG_GET(number/damage_multiplier), updating_health, forced) + . = adjustHealth(amount * damage_coeff[OXY] * CONFIG_GET(number/damage_multiplier), forced) -/mob/living/simple_animal/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/adjustToxLoss(amount, forced = FALSE) if(forced) - . = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced) + . = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), forced) else if(damage_coeff[TOX]) - . = adjustHealth(amount * damage_coeff[TOX] * CONFIG_GET(number/damage_multiplier), updating_health, forced) + . = adjustHealth(amount * damage_coeff[TOX] * CONFIG_GET(number/damage_multiplier), forced) -/mob/living/simple_animal/adjustCloneLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/adjustCloneLossAbstract(amount, forced = FALSE) if(forced) - . = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced) + . = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), forced) else if(damage_coeff[CLONE]) - . = adjustHealth(amount * damage_coeff[CLONE] * CONFIG_GET(number/damage_multiplier), updating_health, forced) + . = adjustHealth(amount * damage_coeff[CLONE] * CONFIG_GET(number/damage_multiplier), forced) -/mob/living/simple_animal/adjustStaminaLoss(amount, updating_health, forced = FALSE) +/mob/living/simple_animal/adjustStaminaLoss(amount, forced = FALSE) return diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index f22baa62f43f2..24d2fc788f879 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -288,7 +288,7 @@ if(stat) return if(health < maxHealth) - adjustBruteLoss(-8) //Fast life regen + adjustBruteLossAbstract(-8) //Fast life regen /mob/living/simple_animal/pet/cat/cak/Move() . = ..() diff --git a/code/modules/mob/living/simple_animal/friendly/cockroach.dm b/code/modules/mob/living/simple_animal/friendly/cockroach.dm index b7db4a6a5cbf2..6e058e04fb01c 100644 --- a/code/modules/mob/living/simple_animal/friendly/cockroach.dm +++ b/code/modules/mob/living/simple_animal/friendly/cockroach.dm @@ -49,14 +49,14 @@ if(A.mob_size > MOB_SIZE_SMALL && !(A.movement_type & FLYING)) if(prob(squish_chance)) A.visible_message("[A] squashed [src].", "You squashed [src].") - adjustBruteLoss(1) //kills a normal cockroach + apply_damage(/datum/damage_source/crush, BRUTE, 1) else visible_message("[src] avoids getting crushed.") else if(isstructure(AM)) if(prob(squish_chance)) AM.visible_message("[src] was crushed under [AM].") - adjustBruteLoss(1) + apply_damage(/datum/damage_source/crush, BRUTE, 1) else visible_message("[src] avoids getting crushed.") diff --git a/code/modules/mob/living/simple_animal/friendly/dog.dm b/code/modules/mob/living/simple_animal/friendly/dog.dm index 4d999b7a89254..335c4e1137f6c 100644 --- a/code/modules/mob/living/simple_animal/friendly/dog.dm +++ b/code/modules/mob/living/simple_animal/friendly/dog.dm @@ -268,14 +268,14 @@ GLOBAL_LIST_INIT(strippable_corgi_items, create_strippable_list(list( armorval *= 1 - min((inventory_back.get_armor_rating(type, src) / 100) * (1 - penetration / 100), 1) return (1 - armorval) * 100 -/mob/living/simple_animal/pet/dog/corgi/attackby(obj/item/O, mob/user, params) +/mob/living/simple_animal/pet/dog/corgi/item_interact(obj/item/item, mob/user, params) if (istype(O, /obj/item/razor)) if (shaved) to_chat(user, "You can't shave this corgi, it's already been shaved!") - return + return TRUE if (nofur) to_chat(user, " You can't shave this corgi, it doesn't have a fur coat!") - return + return TRUE user.visible_message("[user] starts to shave [src] using \the [O].", "You start to shave [src] using \the [O]...") if(do_after(user, 50, target = src)) user.visible_message("[user] shaves [src]'s hair using \the [O].") @@ -287,8 +287,9 @@ GLOBAL_LIST_INIT(strippable_corgi_items, create_strippable_list(list( icon_state = icon_living else icon_state = icon_dead - return - ..() + update_corgi_fluff() + return TRUE + . = ..() update_corgi_fluff() //Corgis are supposed to be simpler, so only a select few objects can actually be put @@ -550,7 +551,7 @@ GLOBAL_LIST_INIT(strippable_corgi_items, create_strippable_list(list( emote_see = list("communes with the unnameable.", "ponders devouring some souls.", "shakes.") /mob/living/simple_animal/pet/dog/corgi/narsie/narsie_act() - adjustBruteLoss(-maxHealth) + adjustBruteLossAbstract(-maxHealth) /mob/living/simple_animal/pet/dog/corgi/regenerate_icons() diff --git a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm index 9ab732c688f15..f98e3fb7a97ab 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm @@ -41,7 +41,7 @@ initial_language_holder = /datum/language_holder/drone mob_size = MOB_SIZE_SMALL has_unlimited_silicon_privilege = 1 - damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0) + damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA_DAMTYPE = 0, OXY = 0) hud_possible = list(DIAG_STAT_HUD, DIAG_HUD, ANTAG_HUD) unique_name = TRUE faction = list("neutral","silicon","turret") @@ -213,7 +213,7 @@ Stun(100) to_chat(src, "ER@%R: MME^RY CO#RU9T! R&$b@0tin)...") if(severity == 1) - adjustBruteLoss(heavy_emp_damage) + apply_damage(/datum/damage_source/electrical_damage, BRUTE, heavy_emp_damage) to_chat(src, "HeAV% DA%^MMA+G TO I/O CIR!%UUT!") /mob/living/simple_animal/drone/proc/alarm_triggered(datum/source, alarm_type, area/source_area) diff --git a/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm b/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm index 46fef614b5da9..81969b6ee2007 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm @@ -19,7 +19,7 @@ D.visible_message("[D] begins to cannibalize parts from [src].", "You begin to cannibalize parts from [src]...") if(do_after(D, 60, 0, target = src)) D.visible_message("[D] repairs itself using [src]'s remains!", "You repair yourself using [src]'s remains.") - D.adjustBruteLoss(-src.maxHealth) + D.adjustBruteLossAbstract(-src.maxHealth) new /obj/effect/decal/cleanable/oil/streak(get_turf(src)) qdel(src) else @@ -78,18 +78,18 @@ to_chat(user, "You need to remain still to reactivate [src]!") -/mob/living/simple_animal/drone/attackby(obj/item/I, mob/user) +/mob/living/simple_animal/drone/item_interact(obj/item/item, mob/user, params) if(I.tool_behaviour == TOOL_SCREWDRIVER && stat != DEAD) if(health < maxHealth) to_chat(user, "You start to tighten loose screws on [src]...") if(I.use_tool(src, user, 80)) - adjustBruteLoss(-getBruteLoss()) + adjustBruteLossAbstract(-getBruteLoss()) visible_message("[user] tightens [src == user ? "[user.p_their()]" : "[src]'s"] loose screws!", "You tighten [src == user ? "your" : "[src]'s"] loose screws.") else to_chat(user, "You need to remain still to tighten [src]'s screws!") else to_chat(user, "[src]'s screws can't get any tighter!") - return //This used to not exist and drones who repaired themselves also stabbed the shit out of themselves. + return TRUE //This used to not exist and drones who repaired themselves also stabbed the shit out of themselves. else if(I.tool_behaviour == TOOL_WRENCH && user != src) //They aren't required to be hacked, because laws can change in other ways (i.e. admins) user.visible_message("[user] starts resetting [src]...", \ "You press down on [src]'s factory reset control...") @@ -97,9 +97,9 @@ user.visible_message("[user] resets [src]!", \ "You reset [src]'s directives to factory defaults!") update_drone_hack(FALSE) - return + return TRUE else - ..() + return ..() /mob/living/simple_animal/drone/getarmor(def_zone, type, penetration) var/armorval = 0 diff --git a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm index 688ce1101dca8..10a9d2508ca3e 100644 --- a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm +++ b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm @@ -290,7 +290,7 @@ GLOB.total_chickens-- return ..() -/mob/living/simple_animal/chicken/attackby(obj/item/O, mob/user, params) +/mob/living/simple_animal/chicken/item_interact(obj/item/item, mob/user, params) if(istype(O, food_type)) //feedin' dem chickens if(!stat && eggsleft < 8) var/feedmsg = "[user] feeds [O] to [name]! [pick(feedMessages)]" @@ -299,8 +299,9 @@ eggsleft += rand(1, 4) else to_chat(user, "[name] doesn't seem hungry!") + return TRUE else - ..() + return ..() /mob/living/simple_animal/chicken/Life() . =..() diff --git a/code/modules/mob/living/simple_animal/friendly/lizard.dm b/code/modules/mob/living/simple_animal/friendly/lizard.dm index 7bc3de052c4dc..f3c7dca2feeeb 100644 --- a/code/modules/mob/living/simple_animal/friendly/lizard.dm +++ b/code/modules/mob/living/simple_animal/friendly/lizard.dm @@ -35,7 +35,7 @@ if(is_type_in_typecache(target,edibles)) //Makes sure player lizards only consume edibles. visible_message("[name] consumes [target] in a single gulp.", "You consume [target] in a single gulp.") QDEL_NULL(target) //Nom - adjustBruteLoss(-2) + adjustBruteLossAbstract(-2) return TRUE else return ..() diff --git a/code/modules/mob/living/simple_animal/friendly/mouse.dm b/code/modules/mob/living/simple_animal/friendly/mouse.dm index 64bdeb686638a..937b0030a542b 100644 --- a/code/modules/mob/living/simple_animal/friendly/mouse.dm +++ b/code/modules/mob/living/simple_animal/friendly/mouse.dm @@ -142,7 +142,7 @@ grind_results = list(/datum/reagent/blood = 20, /datum/reagent/liquidgibs = 5) -/obj/item/reagent_containers/food/snacks/deadmouse/attackby(obj/item/I, mob/user, params) +/obj/item/reagent_containers/food/snacks/deadmouse/item_interact(obj/item/W, mob/user, params) if(I.is_sharp() && user.a_intent == INTENT_HARM) if(isturf(loc)) new /obj/item/reagent_containers/food/snacks/meat/slab/mouse(loc) @@ -150,6 +150,7 @@ qdel(src) else to_chat(user, "You need to put [src] on a surface to butcher it!") + return TRUE else return ..() diff --git a/code/modules/mob/living/simple_animal/friendly/pet.dm b/code/modules/mob/living/simple_animal/friendly/pet.dm index 4560322656ab0..c65fd70cdabba 100644 --- a/code/modules/mob/living/simple_animal/friendly/pet.dm +++ b/code/modules/mob/living/simple_animal/friendly/pet.dm @@ -23,20 +23,23 @@ if(P.tagname && !unique_pet) fully_replace_character_name(null, "\proper [P.tagname]") -/mob/living/simple_animal/pet/attackby(obj/item/O, mob/user, params) +/mob/living/simple_animal/pet/item_interact(obj/item/item, mob/user, params) if(istype(O, /obj/item/clothing/neck/petcollar) && !pcollar && collar_type) add_collar(O, user) - return + return TRUE if(istype(O, /obj/item/newspaper)) + item.do_attack_animation(src) + add attack animation if(!stat) user.visible_message("[user] baps [name] on the nose with the rolled up [O].") spawn(0) for(var/i in list(1,2,4,8,4,2,1,2)) setDir(i) sleep(1) + return TRUE else - ..() + return ..() /mob/living/simple_animal/pet/Initialize(mapload) . = ..() diff --git a/code/modules/mob/living/simple_animal/friendly/snake.dm b/code/modules/mob/living/simple_animal/friendly/snake.dm index 5b070d075c25e..efc883d07050a 100644 --- a/code/modules/mob/living/simple_animal/friendly/snake.dm +++ b/code/modules/mob/living/simple_animal/friendly/snake.dm @@ -62,6 +62,6 @@ if(istype(target, /mob/living/simple_animal/mouse)) visible_message("[name] consumes [target] in a single gulp!", "You consume [target] in a single gulp!") QDEL_NULL(target) - adjustBruteLoss(-2) + adjustBruteLossAbstract(-2) else return ..() diff --git a/code/modules/mob/living/simple_animal/friendly/turtle.dm b/code/modules/mob/living/simple_animal/friendly/turtle.dm index 79ace932f85be..86b0674a979cb 100644 --- a/code/modules/mob/living/simple_animal/friendly/turtle.dm +++ b/code/modules/mob/living/simple_animal/friendly/turtle.dm @@ -52,7 +52,7 @@ return //Mobs with objects -/mob/living/simple_animal/turtle/attackby(obj/item/O, mob/living/user, params) +/mob/living/simple_animal/turtle/on_attacked(obj/item/I, mob/living/user, nonharmfulhit) if(!stat && !client && !istype(O, /obj/item/stack/medical)) if(O.force) if(icon_state == icon_hiding) diff --git a/code/modules/mob/living/simple_animal/guardian/guardian.dm b/code/modules/mob/living/simple_animal/guardian/guardian.dm index 75d86e1667aa7..632106bd790eb 100644 --- a/code/modules/mob/living/simple_animal/guardian/guardian.dm +++ b/code/modules/mob/living/simple_animal/guardian/guardian.dm @@ -31,7 +31,7 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians maxHealth = INFINITY //The spirit itself is invincible health = INFINITY healable = FALSE //don't brusepack the guardian - damage_coeff = list(BRUTE = 0.5, BURN = 0.5, TOX = 0.5, CLONE = 0.5, STAMINA = 0, OXY = 0.5) //how much damage from each damage type we transfer to the owner + damage_coeff = list(BRUTE = 0.5, BURN = 0.5, TOX = 0.5, CLONE = 0.5, STAMINA_DAMTYPE = 0, OXY = 0.5) //how much damage from each damage type we transfer to the owner environment_smash = ENVIRONMENT_SMASH_STRUCTURES obj_damage = 40 melee_damage = 15 @@ -252,19 +252,24 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians resulthealth = round((summoner.health / summoner.maxHealth) * 100, 0.5) hud_used.healths.maptext = MAPTEXT("
[resulthealth]%
") -/mob/living/simple_animal/hostile/guardian/adjustHealth(amount, updating_health = TRUE, forced = FALSE) //The spirit is invincible, but passes on damage to the summoner +/mob/living/simple_animal/hostile/guardian/adjustHealth(amount, forced = FALSE) //The spirit is invincible, but passes on damage to the summoner . = amount if(summoner) if(loc == summoner) return FALSE - summoner.adjustBruteLoss(amount) + summoner.apply_damage(/datum/damage_source/abstract, BRUTE, amount, null) if(amount > 0) to_chat(summoner, "Your [name] is under attack! You take damage!") summoner.visible_message("Blood sprays from [summoner] as [src] takes damage!") if(summoner.stat == UNCONSCIOUS) to_chat(summoner, "Your body can't take the strain of sustaining [src] in this condition, it begins to fall apart!") - summoner.adjustCloneLoss(amount * 0.5) //dying hosts take 50% bonus damage as cloneloss - update_health_hud() + var/datum/damage_source/abstract/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(summoner, CLONE, amount * 0.5) //dying hosts take 50% bonus damage as cloneloss + + +/mob/living/simple_animal/hostile/guardian/updatehealth() + . = ..() + update_health_hud() /mob/living/simple_animal/hostile/guardian/ex_act(severity, target) switch(severity) @@ -272,9 +277,9 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians gib() return if(2) - adjustBruteLoss(60) + apply_damage(/datum/damage_source/explosion, BRUTE, 60) if(3) - adjustBruteLoss(30) + apply_damage(/datum/damage_source/explosion, BRUTE, 30) /mob/living/simple_animal/hostile/guardian/gib() if(summoner) diff --git a/code/modules/mob/living/simple_animal/guardian/types/assassin.dm b/code/modules/mob/living/simple_animal/guardian/types/assassin.dm index 1aa8fbf68a2bd..e41e927e98aaa 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/assassin.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/assassin.dm @@ -3,7 +3,7 @@ melee_damage = 15 attacktext = "slashes" attack_sound = 'sound/weapons/bladeslice.ogg' - damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 1, CLONE = 1, STAMINA = 0, OXY = 1) + damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 1, CLONE = 1, STAMINA_DAMTYPE = 0, OXY = 1) playstyle_string = "As an assassin type you do medium damage and have no damage resistance, but can enter stealth, massively increasing the damage of your next attack and causing it to ignore armor. Stealth is broken when you attack or take damage." magic_fluff_string = "..And draw the Space Ninja, a lethal, invisible assassin." tech_fluff_string = "Boot sequence complete. Assassin modules loaded. Holoparasite swarm online." @@ -36,7 +36,7 @@ if(toggle && (isliving(target) || istype(target, /obj/structure/window) || istype(target, /obj/structure/grille))) ToggleMode(1) -/mob/living/simple_animal/hostile/guardian/assassin/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/guardian/assassin/adjustHealth(amount, forced = FALSE) . = ..() if(. > 0 && toggle) ToggleMode(1) diff --git a/code/modules/mob/living/simple_animal/guardian/types/charger.dm b/code/modules/mob/living/simple_animal/guardian/types/charger.dm index 2338e9f409ff4..196f33e15ef16 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/charger.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/charger.dm @@ -5,7 +5,7 @@ ranged_message = "charges" ranged_cooldown_time = 40 speed = -1 - damage_coeff = list(BRUTE = 0.6, BURN = 0.6, TOX = 0.6, CLONE = 0.6, STAMINA = 0, OXY = 0.6) + damage_coeff = list(BRUTE = 0.6, BURN = 0.6, TOX = 0.6, CLONE = 0.6, STAMINA_DAMTYPE = 0, OXY = 0.6) playstyle_string = "As a charger type you do medium damage, have medium damage resistance, move very fast, and can charge at a location, damaging any target hit and forcing them to drop any items they are holding." magic_fluff_string = "..And draw the Hunter, an alien master of rapid assault." tech_fluff_string = "Boot sequence complete. Charge modules loaded. Holoparasite swarm online." @@ -64,7 +64,7 @@ if(!blocked) L.drop_all_held_items() L.visible_message("[src] slams into [L]!", "[src] slams into you!") - L.apply_damage(20, BRUTE) + L.apply_damage(/datum/damage_source/impact, /datum/damage/brute, 20, pick(BODY_ZONE_CHEST, BODY_ZONE_HEAD)) playsound(get_turf(L), 'sound/effects/meteorimpact.ogg', 100, 1) shake_camera(L, 4, 3) shake_camera(src, 2, 3) diff --git a/code/modules/mob/living/simple_animal/guardian/types/dextrous.dm b/code/modules/mob/living/simple_animal/guardian/types/dextrous.dm index 65499d0efd619..a5249fd1208b9 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/dextrous.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/dextrous.dm @@ -1,7 +1,7 @@ //Dextrous /mob/living/simple_animal/hostile/guardian/dextrous melee_damage = 10 - damage_coeff = list(BRUTE = 0.75, BURN = 0.75, TOX = 0.75, CLONE = 0.75, STAMINA = 0, OXY = 0.75) + damage_coeff = list(BRUTE = 0.75, BURN = 0.75, TOX = 0.75, CLONE = 0.75, STAMINA_DAMTYPE = 0, OXY = 0.75) playstyle_string = "As a dextrous type you can hold items, store an item within yourself, and have medium damage resistance, but do low damage on attacks. Recalling and leashing will force you to drop unstored items!" magic_fluff_string = "..And draw the Drone, a dextrous master of construction and repair." tech_fluff_string = "Boot sequence complete. Dextrous combat modules loaded. Holoparasite swarm online." diff --git a/code/modules/mob/living/simple_animal/guardian/types/explosive.dm b/code/modules/mob/living/simple_animal/guardian/types/explosive.dm index 25135c11e66c0..3560289d473cb 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/explosive.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/explosive.dm @@ -7,7 +7,7 @@ //Bomb /mob/living/simple_animal/hostile/guardian/bomb melee_damage = 15 - damage_coeff = list(BRUTE = 0.6, BURN = 0.6, TOX = 0.6, CLONE = 0.6, STAMINA = 0, OXY = 0.6) + damage_coeff = list(BRUTE = 0.6, BURN = 0.6, TOX = 0.6, CLONE = 0.6, STAMINA_DAMTYPE = 0, OXY = 0.6) range = 13 playstyle_string = "As an explosive type, you have moderate close combat abilities, may explosively teleport targets on attack, and are capable of converting nearby items and objects into disguised bombs via alt click." magic_fluff_string = "..And draw the Scientist, master of explosive death." @@ -33,7 +33,7 @@ if(hasmatchingsummoner(L)) //if the summoner matches don't hurt them continue if(L != src && L != summoner) - L.apply_damage(15, BRUTE) + L.apply_damage(/datum/damage_source/explosion, /datum/damage/brute, 15) new /obj/effect/temp_visual/explosion(get_turf(M)) /mob/living/simple_animal/hostile/guardian/bomb/AltClickOn(atom/movable/A) diff --git a/code/modules/mob/living/simple_animal/guardian/types/fire.dm b/code/modules/mob/living/simple_animal/guardian/types/fire.dm index 29fb1430bd450..1bd1c8ee0bca9 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/fire.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/fire.dm @@ -4,7 +4,7 @@ melee_damage = 7 attack_sound = 'sound/items/welder.ogg' attacktext = "ignites" - damage_coeff = list(BRUTE = 0.7, BURN = 0.7, TOX = 0.7, CLONE = 0.7, STAMINA = 0, OXY = 0.7) + damage_coeff = list(BRUTE = 0.7, BURN = 0.7, TOX = 0.7, CLONE = 0.7, STAMINA_DAMTYPE = 0, OXY = 0.7) range = 7 playstyle_string = "As a chaos type, you have only light damage resistance, but will ignite any enemy you bump into. In addition, your melee attacks will cause human targets to see everyone as you." magic_fluff_string = "..And draw the Wizard, bringer of endless chaos!" diff --git a/code/modules/mob/living/simple_animal/guardian/types/gravitokinetic.dm b/code/modules/mob/living/simple_animal/guardian/types/gravitokinetic.dm index f5c0267c18e3c..5536d2061880e 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/gravitokinetic.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/gravitokinetic.dm @@ -1,7 +1,7 @@ //gravitokinetic /mob/living/simple_animal/hostile/guardian/gravitokinetic melee_damage = 15 - damage_coeff = list(BRUTE = 0.75, BURN = 0.75, TOX = 0.75, CLONE = 0.75, STAMINA = 0, OXY = 0.75) + damage_coeff = list(BRUTE = 0.75, BURN = 0.75, TOX = 0.75, CLONE = 0.75, STAMINA_DAMTYPE = 0, OXY = 0.75) playstyle_string = "As a gravitokinetic type, you can alt click to make the gravity on the ground stronger, and punching applies this effect to a target." magic_fluff_string = "..And draw the Singularity, an anomalous force of terror." tech_fluff_string = "Boot sequence complete. Gravitokinetic modules loaded. Holoparasite swarm online." diff --git a/code/modules/mob/living/simple_animal/guardian/types/lightning.dm b/code/modules/mob/living/simple_animal/guardian/types/lightning.dm index 5e7a5bef9a395..dec7b8ef5f435 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/lightning.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/lightning.dm @@ -8,7 +8,7 @@ attacktext = "shocks" melee_damage_type = BURN attack_sound = 'sound/machines/defib_zap.ogg' - damage_coeff = list(BRUTE = 0.7, BURN = 0.7, TOX = 0.7, CLONE = 0.7, STAMINA = 0, OXY = 0.7) + damage_coeff = list(BRUTE = 0.7, BURN = 0.7, TOX = 0.7, CLONE = 0.7, STAMINA_DAMTYPE = 0, OXY = 0.7) range = 7 playstyle_string = "As a lightning type, you will apply lightning chains to targets on attack and have a lightning chain to your summoner. Lightning chains will shock anyone near them." magic_fluff_string = "..And draw the Tesla, a shocking, lethal source of power." diff --git a/code/modules/mob/living/simple_animal/guardian/types/protector.dm b/code/modules/mob/living/simple_animal/guardian/types/protector.dm index 3d89006d49a30..7746a08d0f0ad 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/protector.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/protector.dm @@ -2,7 +2,7 @@ /mob/living/simple_animal/hostile/guardian/protector melee_damage = 15 range = 15 //worse for it due to how it leashes - damage_coeff = list(BRUTE = 0.4, BURN = 0.4, TOX = 0.4, CLONE = 0.4, STAMINA = 0, OXY = 0.4) + damage_coeff = list(BRUTE = 0.4, BURN = 0.4, TOX = 0.4, CLONE = 0.4, STAMINA_DAMTYPE = 0, OXY = 0.4) playstyle_string = "As a protector type you cause your summoner to leash to you instead of you leashing to them and have two modes; Combat Mode, where you do and take medium damage, and Protection Mode, where you do and take almost no damage, but move slightly slower." magic_fluff_string = "..And draw the Guardian, a stalwart protector that never leaves the side of its charge." tech_fluff_string = "Boot sequence complete. Protector modules loaded. Holoparasite swarm online." @@ -13,7 +13,8 @@ /mob/living/simple_animal/hostile/guardian/protector/ex_act(severity) if(severity == 1) - adjustBruteLoss(400) //if in protector mode, will do 20 damage and not actually necessarily kill the summoner + //if in protector mode, will do 20 damage and not actually necessarily kill the summoner + apply_damage(/datum/damage_source/explosion, BRUTE, 400) else ..() if(QDELETED(src)) @@ -21,7 +22,7 @@ if(toggle) visible_message("The explosion glances off [src]'s energy shielding!") -/mob/living/simple_animal/hostile/guardian/protector/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/guardian/protector/adjustHealth(amount, forced = FALSE) . = ..() if(. > 0 && toggle) var/image/I = new('icons/effects/effects.dmi', src, "shield-flash", MOB_LAYER+0.01, dir = pick(GLOB.cardinals)) @@ -37,7 +38,7 @@ cut_overlays() melee_damage = initial(melee_damage) speed = initial(speed) - damage_coeff = list(BRUTE = 0.4, BURN = 0.4, TOX = 0.4, CLONE = 0.4, STAMINA = 0, OXY = 0.4) + damage_coeff = list(BRUTE = 0.4, BURN = 0.4, TOX = 0.4, CLONE = 0.4, STAMINA_DAMTYPE = 0, OXY = 0.4) to_chat(src, "You switch to combat mode.") toggle = FALSE else @@ -47,7 +48,7 @@ add_overlay(shield_overlay) melee_damage = 2 speed = 1 - damage_coeff = list(BRUTE = 0.05, BURN = 0.05, TOX = 0.05, CLONE = 0.05, STAMINA = 0, OXY = 0.05) //damage? what's damage? + damage_coeff = list(BRUTE = 0.05, BURN = 0.05, TOX = 0.05, CLONE = 0.05, STAMINA_DAMTYPE = 0, OXY = 0.05) //damage? what's damage? to_chat(src, "You switch to protection mode.") toggle = TRUE diff --git a/code/modules/mob/living/simple_animal/guardian/types/ranged.dm b/code/modules/mob/living/simple_animal/guardian/types/ranged.dm index fb84fb7ea0eb1..9a4dc3773bfa0 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/ranged.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/ranged.dm @@ -10,7 +10,7 @@ a_intent = INTENT_HELP friendly = "quietly assesses" melee_damage = 10 - damage_coeff = list(BRUTE = 0.9, BURN = 0.9, TOX = 0.9, CLONE = 0.9, STAMINA = 0, OXY = 0.9) + damage_coeff = list(BRUTE = 0.9, BURN = 0.9, TOX = 0.9, CLONE = 0.9, STAMINA_DAMTYPE = 0, OXY = 0.9) projectiletype = /obj/projectile/guardian ranged_cooldown_time = 1 //fast! projectilesound = 'sound/effects/hit_on_shattered_glass.ogg' diff --git a/code/modules/mob/living/simple_animal/guardian/types/support.dm b/code/modules/mob/living/simple_animal/guardian/types/support.dm index 4927ae938d4d8..52d33c15333b3 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/support.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/support.dm @@ -3,7 +3,7 @@ a_intent = INTENT_HARM friendly = "heals" speed = 0 - damage_coeff = list(BRUTE = 0.7, BURN = 0.7, TOX = 0.7, CLONE = 0.7, STAMINA = 0, OXY = 0.7) + damage_coeff = list(BRUTE = 0.7, BURN = 0.7, TOX = 0.7, CLONE = 0.7, STAMINA_DAMTYPE = 0, OXY = 0.7) melee_damage = 15 playstyle_string = "As a support type, you may toggle your basic attacks to a healing mode. In addition, Alt-Clicking on an adjacent object or mob will warp them to your bluespace beacon after a short delay." magic_fluff_string = "..And draw the CMO, a potent force of life... and death." @@ -29,7 +29,7 @@ . = ..() if(is_deployed() && toggle && iscarbon(target)) var/mob/living/carbon/C = target - C.adjustBruteLoss(-5) + C.adjustBruteLossAbstract(-5) C.adjustFireLoss(-5) C.adjustOxyLoss(-5) C.adjustToxLoss(-5, FALSE, FALSE) @@ -46,14 +46,14 @@ if(toggle) a_intent = INTENT_HARM speed = 0 - damage_coeff = list(BRUTE = 0.7, BURN = 0.7, TOX = 0.7, CLONE = 0.7, STAMINA = 0, OXY = 0.7) + damage_coeff = list(BRUTE = 0.7, BURN = 0.7, TOX = 0.7, CLONE = 0.7, STAMINA_DAMTYPE = 0, OXY = 0.7) melee_damage = 15 to_chat(src, "You switch to combat mode.") toggle = FALSE else a_intent = INTENT_HELP speed = 1 - damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 1, CLONE = 1, STAMINA = 0, OXY = 1) + damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 1, CLONE = 1, STAMINA_DAMTYPE = 0, OXY = 1) melee_damage = 0 to_chat(src, "You switch to healing mode.") toggle = TRUE diff --git a/code/modules/mob/living/simple_animal/heretic_monsters.dm b/code/modules/mob/living/simple_animal/heretic_monsters.dm index d6ce63a1bd5a4..70c50448deab8 100644 --- a/code/modules/mob/living/simple_animal/heretic_monsters.dm +++ b/code/modules/mob/living/simple_animal/heretic_monsters.dm @@ -16,7 +16,7 @@ AIStatus = AI_OFF see_in_dark = 7 lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE - damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0) + damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA_DAMTYPE = 0, OXY = 0) atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_plas" = 0, "max_plas" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0) minbodytemp = 0 maxbodytemp = INFINITY @@ -221,15 +221,15 @@ prev.icon_state = "armsy_end" prev.icon_living = "armsy_end" -/mob/living/simple_animal/hostile/heretic_summon/armsy/adjustBruteLoss(amount, updating_health, forced) +/mob/living/simple_animal/hostile/heretic_summon/armsy/adjustBruteLossAbstract(amount, forced) if(back) - return back.adjustBruteLoss(amount, updating_health, forced) + return back.adjustBruteLossAbstract(amount, forced) return ..() -/mob/living/simple_animal/hostile/heretic_summon/armsy/adjustFireLoss(amount, updating_health, forced) +/mob/living/simple_animal/hostile/heretic_summon/armsy/adjustFireLoss(amount, forced) if(back) - return back.adjustFireLoss(amount, updating_health, forced) + return back.adjustFireLoss(amount, forced) return ..() @@ -302,7 +302,7 @@ back.heal() return - adjustBruteLoss(-maxHealth * 0.5, FALSE) + adjustBruteLossAbstract(-maxHealth * 0.5) adjustFireLoss(-maxHealth * 0.5, FALSE) if(health < maxHealth * 0.8) @@ -402,7 +402,7 @@ var/turf/our_turf = get_turf(src) if(HAS_TRAIT(our_turf, TRAIT_RUSTY)) - adjustBruteLoss(-1.5 * delta_time, FALSE) + adjustBruteLossAbstract(-1.5 * delta_time) adjustFireLoss(-1.5 * delta_time, FALSE) return ..() diff --git a/code/modules/mob/living/simple_animal/hostile/alien.dm b/code/modules/mob/living/simple_animal/hostile/alien.dm index e70eaacdeeff5..343041ad8015b 100644 --- a/code/modules/mob/living/simple_animal/hostile/alien.dm +++ b/code/modules/mob/living/simple_animal/hostile/alien.dm @@ -146,10 +146,10 @@ /mob/living/simple_animal/hostile/alien/handle_temperature_damage() if(bodytemperature < minbodytemp) - adjustBruteLoss(2) + apply_damage(/datum/damage_source/temperature/internal, BRUTE, 2) throw_alert("temp", /atom/movable/screen/alert/cold, 1) else if(bodytemperature > maxbodytemp) - adjustBruteLoss(20) + apply_damage(/datum/damage_source/temperature/internal, BRUTE, 20) throw_alert("temp", /atom/movable/screen/alert/hot, 3) else clear_alert("temp") diff --git a/code/modules/mob/living/simple_animal/hostile/bees.dm b/code/modules/mob/living/simple_animal/hostile/bees.dm index a4a8cbcf5e6ae..c0b66477a10b6 100644 --- a/code/modules/mob/living/simple_animal/hostile/bees.dm +++ b/code/modules/mob/living/simple_animal/hostile/bees.dm @@ -267,7 +267,7 @@ var/mob/living/simple_animal/hostile/poison/bees/queen/queen -/obj/item/queen_bee/attackby(obj/item/I, mob/user, params) +/obj/item/queen_bee/item_interact(obj/item/item, mob/user, params) if(istype(I, /obj/item/reagent_containers/syringe)) var/obj/item/reagent_containers/syringe/S = I if(S.reagents.has_reagent(/datum/reagent/royal_bee_jelly)) //checked twice, because I really don't want royal bee jelly to be duped @@ -290,7 +290,8 @@ name = queen.name else to_chat(user, "You don't have enough units of that chemical to modify the bee's DNA!") - ..() + return TRUE + return ..() /obj/item/queen_bee/bought/Initialize(mapload) diff --git a/code/modules/mob/living/simple_animal/hostile/bosses/paperwizard.dm b/code/modules/mob/living/simple_animal/hostile/bosses/paperwizard.dm index fde210d97b072..2b868e45e8e08 100644 --- a/code/modules/mob/living/simple_animal/hostile/bosses/paperwizard.dm +++ b/code/modules/mob/living/simple_animal/hostile/bosses/paperwizard.dm @@ -102,7 +102,7 @@ var/mob/living/simple_animal/hostile/boss/paper_wizard/original //Hit a fake? eat pain! -/mob/living/simple_animal/hostile/boss/paper_wizard/copy/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/boss/paper_wizard/copy/adjustHealth(amount, forced = FALSE) if(amount > 0) //damage if(original) original.minimum_distance = 3 @@ -113,13 +113,13 @@ for(var/mob/living/L in ohearers(5,src)) if(L == original || istype(L, type)) continue - L.adjustBruteLoss(50) + L.apply_damage(/datum/damage_source/abstract, BRUTE, 50, null) qdel(src) else . = ..() //Hit the real guy? copies go bai-bai -/mob/living/simple_animal/hostile/boss/paper_wizard/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/boss/paper_wizard/adjustHealth(amount, forced = FALSE) . = ..() if(. > 0)//damage minimum_distance = 3 diff --git a/code/modules/mob/living/simple_animal/hostile/carp.dm b/code/modules/mob/living/simple_animal/hostile/carp.dm index f9bc602b0bb91..efe4c011eb033 100644 --- a/code/modules/mob/living/simple_animal/hostile/carp.dm +++ b/code/modules/mob/living/simple_animal/hostile/carp.dm @@ -130,7 +130,7 @@ maxHealth += rand(30,60) move_to_delay = rand(3,7) -/mob/living/simple_animal/hostile/carp/megacarp/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/carp/megacarp/adjustHealth(amount, forced = FALSE) . = ..() if(.) regen_cooldown = world.time + REGENERATION_DELAY @@ -196,7 +196,7 @@ disky = null update_icon() else - disky.melee_attack_chain(src, target) + disky.use_on(src, target) return if(istype(target, /obj/machinery/nuclearbomb)) var/obj/machinery/nuclearbomb/nuke = target diff --git a/code/modules/mob/living/simple_animal/hostile/cat_butcher.dm b/code/modules/mob/living/simple_animal/hostile/cat_butcher.dm index 41b4c2687f7c6..e69e382a2c95a 100644 --- a/code/modules/mob/living/simple_animal/hostile/cat_butcher.dm +++ b/code/modules/mob/living/simple_animal/hostile/cat_butcher.dm @@ -87,7 +87,7 @@ L.suppress_bloodloss(1800) if(L.getBruteLoss() >= 50) var/healing = min(L.getBruteLoss(), 120) - L.adjustBruteLoss(-healing) + L.adjustBruteLossAbstract(-healing) L.suppress_bloodloss(1800)//bandage their ass FindTarget() diff --git a/code/modules/mob/living/simple_animal/hostile/floor_cluwne.dm b/code/modules/mob/living/simple_animal/hostile/floor_cluwne.dm index a161cc058947d..b18ae933758a8 100644 --- a/code/modules/mob/living/simple_animal/hostile/floor_cluwne.dm +++ b/code/modules/mob/living/simple_animal/hostile/floor_cluwne.dm @@ -337,7 +337,7 @@ GLOBAL_VAR_INIT(floor_cluwnes, 0) to_chat(H, "You feel the floor closing in on your feet!") H.Paralyze(300) INVOKE_ASYNC(H, TYPE_PROC_REF(/mob, emote), "scream") - H.adjustBruteLoss(10) + H.apply_damage(/datum/damage_source/sharp/heavy, BRUTE, 10, null) manifested = TRUE Manifest() if(!eating) @@ -396,7 +396,7 @@ GLOBAL_VAR_INIT(floor_cluwnes, 0) H.gib(FALSE) else H.cluwneify() - H.adjustBruteLoss(30) + H.apply_damage(/datum/damage_source/sharp/heavy, BRUTE, 30, null) H.adjustOrganLoss(ORGAN_SLOT_BRAIN, 100) H.cure_blind() H.invisibility = initial(H.invisibility) diff --git a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm index da9b4466e37bf..391089d6301d0 100644 --- a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm +++ b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm @@ -174,7 +174,7 @@ to_chat(src, "You should bring food to your broodmother!") return var/mob/living/M = cocoon_target - M.attacked_by(null, src) + M.on_attacked(null, src) busy = SPINNING_COCOON visible_message("[src] begins to secrete a sticky substance around [cocoon_target].","You begin wrapping [cocoon_target] into a cocoon.") stop_automated_movement = TRUE @@ -307,7 +307,7 @@ Goto(C, move_to_delay) addtimer(CALLBACK(src, PROC_REF(GiveUp)), 20 SECONDS) //to prevent infinite chases if(heal_target && get_dist(src, heal_target) <= 1) - UnarmedAttack(heal_target) + primary_interact(heal_target) if(!heal_target || heal_target.health >= heal_target.maxHealth) GiveUp() ..() //Do normal stuff after giving priority to healing attempts @@ -745,10 +745,10 @@ // Flat 10 brute if they're out of safe temperature, making them vulnerable to fire or spacing /mob/living/simple_animal/hostile/poison/giant_spider/handle_temperature_damage() if(bodytemperature < minbodytemp) - adjustBruteLoss(10) + apply_damage(/datum/damage_source/temperature/internal, BRUTE, 10) throw_alert("temp", /atom/movable/screen/alert/cold, 3) else if(bodytemperature > maxbodytemp) - adjustBruteLoss(10) + apply_damage(/datum/damage_source/temperature/internal, BRUTE, 10) throw_alert("temp", /atom/movable/screen/alert/hot, 3) else clear_alert("temp") diff --git a/code/modules/mob/living/simple_animal/hostile/goose.dm b/code/modules/mob/living/simple_animal/hostile/goose.dm index ef8c173cdedf7..faa00e78f43fc 100644 --- a/code/modules/mob/living/simple_animal/hostile/goose.dm +++ b/code/modules/mob/living/simple_animal/hostile/goose.dm @@ -70,7 +70,7 @@ . = ..() . += "Somehow, it still looks hungry." -/mob/living/simple_animal/hostile/retaliate/goose/vomit/attacked_by(obj/item/O, mob/user) +/mob/living/simple_animal/hostile/retaliate/goose/vomit/on_attacked(obj/item/O, mob/user) . = ..() if(istype(O, /obj/item/reagent_containers/food)) feed(O) diff --git a/code/modules/mob/living/simple_animal/hostile/gorilla/gorilla.dm b/code/modules/mob/living/simple_animal/hostile/gorilla/gorilla.dm index 658b8ff38391c..937c0de371b4d 100644 --- a/code/modules/mob/living/simple_animal/hostile/gorilla/gorilla.dm +++ b/code/modules/mob/living/simple_animal/hostile/gorilla/gorilla.dm @@ -20,7 +20,7 @@ response_harm = "thumps" speed = 1 melee_damage = 16 - damage_coeff = list(BRUTE = 1, BURN = 1.5, TOX = 1.5, CLONE = 0, STAMINA = 0, OXY = 1.5) + damage_coeff = list(BRUTE = 1, BURN = 1.5, TOX = 1.5, CLONE = 0, STAMINA_DAMTYPE = 0, OXY = 1.5) obj_damage = 20 environment_smash = ENVIRONMENT_SMASH_WALLS attacktext = "pummels" @@ -122,6 +122,6 @@ loot = list(/obj/effect/gibspawner/generic/animal) butcher_results = list(/obj/item/reagent_containers/food/snacks/meat/slab/gorilla = 4) melee_damage = 20 - damage_coeff = list(BRUTE = 0.8, BURN = 1, TOX = 1, CLONE = 0, STAMINA = 0, OXY = 1) + damage_coeff = list(BRUTE = 0.8, BURN = 1, TOX = 1, CLONE = 0, STAMINA_DAMTYPE = 0, OXY = 1) obj_damage = 50 environment_smash = ENVIRONMENT_SMASH_RWALLS diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index edbfffe7ac6dc..544a608b45cf9 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -114,7 +114,7 @@ Move(get_step(src,chosen_dir)) face_atom(target) //Looks better if they keep looking at you when dodging -/mob/living/simple_animal/hostile/attacked_by(obj/item/I, mob/living/user) +/mob/living/simple_animal/hostile/on_attacked(obj/item/I, mob/living/user) if(stat == CONSCIOUS && !target && AIStatus != AI_OFF && !client && user) FindTarget(list(user), 1) return ..() @@ -319,7 +319,7 @@ approaching_target = FALSE SSmove_manager.move_to(src, target, minimum_distance, delay) -/mob/living/simple_animal/hostile/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/adjustHealth(amount, forced = FALSE) . = ..() if(!ckey && !stat && search_objects < 3 && . > 0)//Not unconscious, and we don't ignore mobs if(search_objects)//Turn off item searching and ignore whatever item we were looking at, we're more concerned with fight or flight @@ -500,7 +500,7 @@ A.attack_animal(src) return 1 -/mob/living/simple_animal/hostile/RangedAttack(atom/A, params) //Player firing +/mob/living/simple_animal/hostile/primary_ranged_attack(atom/A, params) //Player firing if(ranged && ranged_cooldown <= world.time) GiveTarget(A) OpenFire(A) diff --git a/code/modules/mob/living/simple_animal/hostile/jungle/leaper.dm b/code/modules/mob/living/simple_animal/hostile/jungle/leaper.dm index 137d304f56333..da91dd9b9d882 100644 --- a/code/modules/mob/living/simple_animal/hostile/jungle/leaper.dm +++ b/code/modules/mob/living/simple_animal/hostile/jungle/leaper.dm @@ -175,7 +175,7 @@ . = ..() update_icons() -/mob/living/simple_animal/hostile/jungle/leaper/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/jungle/leaper/adjustHealth(amount, forced = FALSE) if(prob(33) && !ckey) ranged_cooldown = 0 //Keeps em on their toes instead of a constant rotation ..() @@ -239,7 +239,7 @@ notransform = FALSE playsound(src, 'sound/effects/meteorimpact.ogg', 200, 1) for(var/mob/living/L in orange(1, src)) - L.adjustBruteLoss(35) + L.apply_damage(/datum/damage_source/crush, BRUTE, 35, null) if(!QDELETED(L)) // Some mobs are deleted on death var/throw_dir = get_dir(src, L) if(L.loc == loc) diff --git a/code/modules/mob/living/simple_animal/hostile/jungle/seedling.dm b/code/modules/mob/living/simple_animal/hostile/jungle/seedling.dm index e4d0a5ada902a..1732a07a5ff48 100644 --- a/code/modules/mob/living/simple_animal/hostile/jungle/seedling.dm +++ b/code/modules/mob/living/simple_animal/hostile/jungle/seedling.dm @@ -39,7 +39,7 @@ damage = 10 damage_type = BURN light_range = 2 - armor_flag = ENERGY + damage_source = /datum/damage_source/energy light_color = LIGHT_COLOR_YELLOW hitsound = 'sound/weapons/sear.ogg' hitsound_wall = 'sound/weapons/effects/searwall.ogg' @@ -199,7 +199,7 @@ update_icons() Goto(target, move_to_delay, minimum_distance) -/mob/living/simple_animal/hostile/jungle/seedling/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/jungle/seedling/adjustHealth(amount, forced = FALSE) . = ..() if(combatant_state == SEEDLING_STATE_ACTIVE && beam_debuff_target) beam_debuff_target.remove_status_effect(/datum/status_effect/seedling_beam_indicator) diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm index 104fb9cfaf1ec..dcb1180d5d43e 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm @@ -107,7 +107,7 @@ Difficulty: Medium force = 6 force_on = 10 -/obj/item/melee/transforming/cleaving_saw/miner/attack(mob/living/target, mob/living/carbon/human/user) +/obj/item/melee/transforming/cleaving_saw/miner/attack_mob_target(mob/living/target, mob/living/carbon/human/user) target.add_stun_absorption("miner", 10, INFINITY) ..() target.stun_absorption -= "miner" @@ -118,7 +118,7 @@ Difficulty: Medium icon_state = "ka_tracer" range = MINER_DASH_RANGE -/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner/adjustHealth(amount, forced = FALSE) var/adjustment_amount = amount * 0.1 if(world.time + adjustment_amount > next_move) changeNext_move(adjustment_amount) //attacking it interrupts it attacking, but only briefly @@ -162,7 +162,7 @@ Difficulty: Medium L.gib() return TRUE changeNext_move(CLICK_CD_MELEE) - miner_saw.melee_attack_chain(src, target) + miner_saw.use_on(src, target) if(guidance) adjustHealth(-2) return TRUE diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm index a36d021a2df01..fd367a7f98d9c 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm @@ -246,8 +246,9 @@ Difficulty: Hard if(!faction_check_mob(L)) to_chat(L, "[src] rends you!") playsound(T, attack_sound, 100, 1, -1) - var/limb_to_hit = L.get_bodypart(pick(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_R_LEG, BODY_ZONE_L_LEG)) - L.apply_damage(10, BRUTE, limb_to_hit, L.run_armor_check(limb_to_hit, MELEE, null, null, armour_penetration)) + var/limb_to_hit = pick(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_R_LEG, BODY_ZONE_L_LEG) + var/datum/damage_source/sharp/light/source = FIND_DAMAGE_SOURCE + source.deal_attack(src, null, L, /datum/damage/brute, 10, limb_to_hit) SLEEP_CHECK_DEATH(3) /mob/living/simple_animal/hostile/megafauna/bubblegum/proc/bloodgrab(turf/T, handedness) @@ -391,7 +392,7 @@ Difficulty: Hard for(var/i in 1 to 3) new /mob/living/simple_animal/hostile/asteroid/hivelordbrood/slaughter(death_turf) -/mob/living/simple_animal/hostile/megafauna/bubblegum/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/megafauna/bubblegum/adjustBruteLossAbstract(amount, forced = FALSE) . = ..() if(. > 0 && prob(25)) var/obj/effect/decal/cleanable/blood/gibs/bubblegum/B = new /obj/effect/decal/cleanable/blood/gibs/bubblegum(loc) @@ -414,7 +415,7 @@ Difficulty: Hard if(.) SSshuttle.shuttle_purchase_requirements_met |= SHUTTLE_UNLOCK_BUBBLEGUM -/mob/living/simple_animal/hostile/megafauna/bubblegum/do_attack_animation(atom/A, visual_effect_icon) +/mob/living/simple_animal/hostile/megafauna/bubblegum/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect) if(!charging) ..() @@ -479,7 +480,8 @@ Difficulty: Hard var/mob/living/L = A L.visible_message("[src] slams into [L]!", "[src] tramples you into the ground!") src.forceMove(get_turf(L)) - L.apply_damage(istype(src, /mob/living/simple_animal/hostile/megafauna/bubblegum/hallucination) ? 15 : 30, BRUTE) + var/datum/damage_source/impact/source = FIND_DAMAGE_SOURCE + source.deal_attack(src, null, L, /datum/damage/brute, istype(src, /mob/living/simple_animal/hostile/megafauna/bubblegum/hallucination) ? 15 : 30) playsound(get_turf(L), 'sound/effects/meteorimpact.ogg', 100, 1) shake_camera(L, 4, 3) shake_camera(src, 2, 3) @@ -546,7 +548,7 @@ Difficulty: Hard /mob/living/simple_animal/hostile/megafauna/bubblegum/hallucination/Life() return -/mob/living/simple_animal/hostile/megafauna/bubblegum/hallucination/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/megafauna/bubblegum/hallucination/adjustBruteLossAbstract(amount, forced = FALSE) return /mob/living/simple_animal/hostile/megafauna/bubblegum/hallucination/OpenFire() diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm index 50c086a154fa3..d8960ce24cc8f 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm @@ -489,7 +489,7 @@ GLOBAL_DATUM(blackbox, /obj/machinery/smartfridge/black_box) return ActivationReaction(user, ACTIVATE_TOUCH) -/obj/machinery/anomalous_crystal/attackby(obj/item/I, mob/user, params) +/obj/machinery/anomalous_crystal/on_attacked(obj/item/I, mob/living/user) if(I.is_hot()) ActivationReaction(user, ACTIVATE_HEAT) else @@ -501,7 +501,7 @@ GLOBAL_DATUM(blackbox, /obj/machinery/smartfridge/black_box) if(istype(P, /obj/projectile/magic)) ActivationReaction(P.firer, ACTIVATE_MAGIC, P.damage_type) return - ActivationReaction(P.firer, P.armor_flag, P.damage_type) + ActivationReaction(P.firer, P.damage_source, P.damage_type) /obj/machinery/anomalous_crystal/proc/ActivationReaction(mob/user, method, damtype) if(world.time < last_use_timer) @@ -713,7 +713,7 @@ GLOBAL_DATUM(blackbox, /obj/machinery/smartfridge/black_box) verb_exclaim = "zaps" verb_yell = "bangs" initial_language_holder = /datum/language_holder/lightbringer - damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0) + damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA_DAMTYPE = 0, OXY = 0) light_range = 4 faction = list("neutral") del_on_death = TRUE diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm index 06263dcb17e68..99b6626a2e370 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm @@ -220,7 +220,7 @@ Difficulty: Medium SLEEP_CHECK_DEATH(0) SetRecoveryTime(80) visible_message("[src] starts to glow vibrantly as its wounds close up!") - adjustBruteLoss(-250) // yeah you're gonna pay for that, don't run nerd + adjustBruteLossAbstract(-250) // yeah you're gonna pay for that, don't run nerd add_atom_colour(rgb(255, 255, 0), TEMPORARY_COLOUR_PRIORITY) move_to_delay = move_to_delay / 2 light_range = 10 @@ -355,7 +355,7 @@ Difficulty: Medium visible_message("[src] slams down on [L], crushing [L.p_them()]!") L.gib() else - L.adjustBruteLoss(75) + L.apply_damage(/datum/damage_source/crush, BRUTE, 75, null) if(L && !QDELETED(L)) // Some mobs are deleted on death var/throw_dir = get_dir(src, L) if(L.loc == loc) @@ -381,7 +381,7 @@ Difficulty: Medium return ..() -/mob/living/simple_animal/hostile/megafauna/dragon/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/megafauna/dragon/adjustHealth(amount, forced = FALSE) if(!forced && (swooping & SWOOP_INVULNERABLE)) return FALSE return ..() @@ -569,7 +569,7 @@ Difficulty: Medium obj_damage = 80 melee_damage = 30 mouse_opacity = MOUSE_OPACITY_ICON - damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 1, CLONE = 1, STAMINA = 0, OXY = 1) + damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 1, CLONE = 1, STAMINA_DAMTYPE = 0, OXY = 1) loot = list() butcher_results = list(/obj/item/stack/ore/diamond = 5, /obj/item/stack/sheet/sinew = 5, /obj/item/stack/sheet/bone = 30) attack_action_types = list() diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm index 435716e38ab0e..763af17c2b83a 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm @@ -425,7 +425,7 @@ Difficulty: Hard if(spawned_beacon && loc == spawned_beacon.loc && did_reset) arena_trap(src) -/mob/living/simple_animal/hostile/megafauna/hierophant/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/megafauna/hierophant/adjustHealth(amount, forced = FALSE) . = ..() if(src && . && !blinking) wander = TRUE @@ -662,9 +662,7 @@ Difficulty: Hard flash_color(L.client, "#660099", 1) playsound(L,'sound/weapons/sear.ogg', 50, 1, -4) to_chat(L, "You're struck by a [name]!") - var/limb_to_hit = L.get_bodypart(pick(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_R_LEG, BODY_ZONE_L_LEG)) - var/armor = L.run_armor_check(limb_to_hit, MELEE, "Your armor absorbs [src]!", "Your armor blocks part of [src]!", 50, "Your armor was penetrated by [src]!") - L.apply_damage(damage, BURN, limb_to_hit, armor) + damage_direct(null, L, pick(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_R_LEG, BODY_ZONE_L_LEG), override_damage = damage) if(ishostile(L)) var/mob/living/simple_animal/hostile/H = L //mobs find and damage you... if(H.stat == CONSCIOUS && !H.target && H.AIStatus != AI_OFF && !H.client) @@ -674,7 +672,7 @@ Difficulty: Hard else H.Goto(get_turf(caster), H.move_to_delay, 3) if(monster_damage_boost && (ismegafauna(L) || istype(L, /mob/living/simple_animal/hostile/asteroid))) - L.adjustBruteLoss(damage) + L.apply_damage(/datum/damage_source/magic, BRUTE, damage, null) if(caster) log_combat(caster, L, "struck with a [name]") for(var/obj/mecha/M in T.contents - hit_things) //also damage mechs. @@ -701,7 +699,7 @@ Difficulty: Hard /obj/effect/hierophant/ex_act() return -/obj/effect/hierophant/attackby(obj/item/I, mob/user, params) +/obj/effect/hierophant/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/hierophant_club)) var/obj/item/hierophant_club/H = I if(H.timer > world.time) @@ -722,5 +720,6 @@ Difficulty: Hard INVOKE_ASYNC(H, TYPE_PROC_REF(/obj/item/hierophant_club, prepare_icon_update)) else to_chat(user, "You touch the beacon with the club, but nothing happens.") + return TRUE else return ..() diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/legion.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/legion.dm index 3c6869f664992..580be272a98f1 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/legion.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/legion.dm @@ -98,7 +98,7 @@ Difficulty: Medium if(target) wander = TRUE -/mob/living/simple_animal/hostile/megafauna/legion/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/megafauna/legion/adjustHealth(amount, forced = FALSE) if(GLOB.necropolis_gate && true_spawn) GLOB.necropolis_gate.toggle_the_gate(null, TRUE) //very clever. return ..() @@ -172,7 +172,7 @@ Difficulty: Medium slot_flags = ITEM_SLOT_BACK w_class = WEIGHT_CLASS_BULKY force = 15 - damtype = BURN + damtype = /datum/damage/burn hitsound = 'sound/weapons/sear.ogg' var/storm_type = /datum/weather/ash_storm var/storm_cooldown = 0 diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm index 4bc2a4358ae2f..5cf05b0809b83 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm @@ -17,7 +17,7 @@ ranged_ignores_vision = TRUE stat_attack = DEAD atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0) - damage_coeff = list(BRUTE = 1, BURN = 0.5, TOX = 1, CLONE = 1, STAMINA = 0, OXY = 1) + damage_coeff = list(BRUTE = 1, BURN = 0.5, TOX = 1, CLONE = 1, STAMINA_DAMTYPE = 0, OXY = 1) minbodytemp = 0 maxbodytemp = INFINITY vision_range = 5 @@ -122,7 +122,7 @@ "[src] devours [L]!", "You feast on [L], restoring your health!") if(!is_station_level(z) || client) //NPC monsters won't heal while on station - adjustBruteLoss(-L.maxHealth/2) + adjustBruteLossAbstract(-L.maxHealth/2) for(var/obj/item/W in L) if(!L.dropItemToGround(W)) qdel(W) @@ -132,13 +132,13 @@ /mob/living/simple_animal/hostile/megafauna/ex_act(severity, target) switch (severity) if (EXPLODE_DEVASTATE) - adjustBruteLoss(250) + apply_damage(/datum/damage_source/explosion, BRUTE, 250) if (EXPLODE_HEAVY) - adjustBruteLoss(100) + apply_damage(/datum/damage_source/explosion, BRUTE, 100) if (EXPLODE_LIGHT) - adjustBruteLoss(50) + apply_damage(/datum/damage_source/explosion, BRUTE, 50) /mob/living/simple_animal/hostile/megafauna/proc/SetRecoveryTime(buffer_time) recovery_time = world.time + buffer_time diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/swarmer.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/swarmer.dm index fce82b60f3204..a5b0cc66859f0 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/swarmer.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/swarmer.dm @@ -84,7 +84,7 @@ GLOBAL_LIST_INIT(AISwarmerCapsByType, list(/mob/living/simple_animal/hostile/swa new createtype(loc) -/mob/living/simple_animal/hostile/megafauna/swarmer_swarm_beacon/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/megafauna/swarmer_swarm_beacon/adjustHealth(amount, forced = FALSE) . = ..() if(. > 0 && world.time > call_help_cooldown) call_help_cooldown = world.time + call_help_cooldown_amt diff --git a/code/modules/mob/living/simple_animal/hostile/mimic.dm b/code/modules/mob/living/simple_animal/hostile/mimic.dm index ee18f8a08bc7c..6694fc5e73b10 100644 --- a/code/modules/mob/living/simple_animal/hostile/mimic.dm +++ b/code/modules/mob/living/simple_animal/hostile/mimic.dm @@ -101,7 +101,7 @@ visible_message("[src] starts to move!") attempt_open = TRUE -/mob/living/simple_animal/hostile/mimic/crate/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/mimic/crate/adjustHealth(amount, forced = FALSE) trigger() . = ..() @@ -150,7 +150,7 @@ GLOBAL_LIST_INIT(protected_objects, list(/obj/structure/table, /obj/structure/ca /mob/living/simple_animal/hostile/mimic/copy/Life() ..() if(idledamage && !target && !mind) //Objects eventually revert to normal if no one is around to terrorize - adjustBruteLoss(1) + apply_damage(/datum/damage_source/body, BRUTE, 1) for(var/mob/living/M in contents) //a fix for animated statues from the flesh to stone spell death() diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/basilisk.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/basilisk.dm index 36223308241ad..433c99dbfc790 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/basilisk.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/basilisk.dm @@ -40,7 +40,7 @@ damage = 0 damage_type = BURN nodamage = TRUE - armor_flag = ENERGY + damage_source = /datum/damage_source/energy temperature = 50 /mob/living/simple_animal/hostile/asteroid/basilisk/GiveTarget(new_target) @@ -54,9 +54,9 @@ if(1) gib() if(2) - adjustBruteLoss(140) + apply_damage(/datum/damage_source/explosion, BRUTE, 140) if(3) - adjustBruteLoss(110) + apply_damage(/datum/damage_source/explosion, BRUTE, 110) //Watcher /mob/living/simple_animal/hostile/asteroid/basilisk/watcher diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/curse_blob.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/curse_blob.dm index b9daac962b972..6765fdbe14ee3 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/curse_blob.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/curse_blob.dm @@ -108,18 +108,16 @@ IGNORE_PROC_IF_NOT_TARGET(attack_paw) IGNORE_PROC_IF_NOT_TARGET(attack_alien) -IGNORE_PROC_IF_NOT_TARGET(attack_larva) - IGNORE_PROC_IF_NOT_TARGET(attack_animal) -IGNORE_PROC_IF_NOT_TARGET(attack_slime) +IGNORE_PROC_IF_NOT_TARGET(after_attacked_by_slime) /mob/living/simple_animal/hostile/asteroid/curseblob/bullet_act(obj/projectile/Proj) if(Proj.firer != set_target) return return ..() -/mob/living/simple_animal/hostile/asteroid/curseblob/attacked_by(obj/item/I, mob/living/L) +/mob/living/simple_animal/hostile/asteroid/curseblob/on_attacked(obj/item/I, mob/living/L) if(L != set_target) return return ..() diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm index 301ae1a9890b5..da6f74d72abfc 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm @@ -209,12 +209,11 @@ While using this makes the system rely on OnFire, it still gives options for tim var/obj/effect/temp_visual/heal/H = new /obj/effect/temp_visual/heal(get_turf(mychild)) H.color = "#FF0000" -/obj/structure/elite_tumor/attackby(obj/item/I, mob/user, params) - . = ..() +/obj/structure/elite_tumor/item_interact(obj/item/item, mob/user, params) if(istype(I, /obj/item/organ/regenerative_core) && activity == TUMOR_INACTIVE && !boosted) var/obj/item/organ/regenerative_core/core = I if(!core.preserved) - return + return TRUE visible_message("As [user] drops the core into [src], [src] appears to swell.") icon_state = "advanced_tumor" boosted = TRUE @@ -222,6 +221,7 @@ While using this makes the system rely on OnFire, it still gives options for tim desc = "[desc] This one seems to glow with a strong intensity." qdel(core) return TRUE + return ..() /obj/structure/elite_tumor/proc/arena_checks() if(activity != TUMOR_ACTIVE || QDELETED(src)) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/goliath_broodmother.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/goliath_broodmother.dm index 27c2d0d675fbe..99e3ee99ba8ba 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/goliath_broodmother.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/goliath_broodmother.dm @@ -201,7 +201,7 @@ continue visible_message("[src] grabs hold of [L]!") L.Stun(10) - L.adjustBruteLoss(rand(30,35)) + L.apply_damage(/datum/damage_source/blunt/light, BRUTE, rand(30,35), null) latched = TRUE if(!latched) retract() diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/legionnaire.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/legionnaire.dm index b7ecca899540d..2535df5403567 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/legionnaire.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/legionnaire.dm @@ -129,13 +129,13 @@ to_chat(L, "[src] grabs you and throws you with much force!") L.safe_throw_at(throwtarget, 10, 1, src) L.Paralyze(20) - L.adjustBruteLoss(50) + L.apply_damage(/datum/damage_source/impact, BRUTE, 50, null) addtimer(CALLBACK(src, PROC_REF(legionnaire_charge_2), move_dir, (times_ran + 1)), 2) /mob/living/simple_animal/hostile/asteroid/elite/legionnaire/proc/head_detach(target) ranged_cooldown = world.time + 10 if(myhead != null) - myhead.adjustBruteLoss(600) + myhead.apply_damage(/datum/damage_source/impact, BRUTE, 600, null) return if(has_head) has_head = FALSE diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/goldgrub.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/goldgrub.dm index 1fe66ddc51e91..c544b8f5d60bf 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/goldgrub.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/goldgrub.dm @@ -74,6 +74,6 @@ visible_message("The [P.name] was repelled by [name]'s girth!") return BULLET_ACT_BLOCK -/mob/living/simple_animal/hostile/asteroid/goldgrub/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/asteroid/goldgrub/adjustHealth(amount, forced = FALSE) vision_range = 9 . = ..() diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/goliath.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/goliath.dm index ac1ec44739b04..5fefc324ce495 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/goliath.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/goliath.dm @@ -69,7 +69,7 @@ icon_state = icon_aggro pre_attack = 0 -/mob/living/simple_animal/hostile/asteroid/goliath/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/asteroid/goliath/adjustHealth(amount, forced = FALSE) ranged_cooldown -= 10 handle_preattack() . = ..() @@ -188,7 +188,7 @@ continue visible_message("[src] grabs hold of [L]!") L.Stun(100) - L.adjustBruteLoss(rand(10,15)) + L.apply_damage(/datum/damage_source/blunt/light, BRUTE, rand(10,15), null) latched = TRUE if(!latched) retract() diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/hivelord.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/hivelord.dm index 5192043b41b55..4cec6fd51b286 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/hivelord.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/hivelord.dm @@ -190,7 +190,7 @@ L = new(H.loc) visible_message("[L] staggers to [L.p_their()] feet!") H.death() - H.adjustBruteLoss(1000) + H.apply_damage(/datum/damage_source/skin_prick, BRUTE, 1000, null) L.stored_mob = H H.forceMove(L) qdel(src) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/mining_mobs.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/mining_mobs.dm index 49c7e0c4f74c8..b6d798c3b9ecb 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/mining_mobs.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/mining_mobs.dm @@ -65,10 +65,10 @@ /mob/living/simple_animal/hostile/asteroid/handle_temperature_damage() if(bodytemperature < minbodytemp) - adjustBruteLoss(2) + apply_damage(/datum/damage_source/temperature/internal, BRUTE, 2) throw_alert("temp", /atom/movable/screen/alert/cold, 1) else if(bodytemperature > maxbodytemp) - adjustBruteLoss(20) + apply_damage(/datum/damage_source/temperature/internal, BRUTE, 20) throw_alert("temp", /atom/movable/screen/alert/hot, 3) else clear_alert("temp") diff --git a/code/modules/mob/living/simple_animal/hostile/mushroom.dm b/code/modules/mob/living/simple_animal/hostile/mushroom.dm index 3879e45b43447..9c1887e650e6c 100644 --- a/code/modules/mob/living/simple_animal/hostile/mushroom.dm +++ b/code/modules/mob/living/simple_animal/hostile/mushroom.dm @@ -45,7 +45,7 @@ /mob/living/simple_animal/hostile/mushroom/Life() ..() if(!stat)//Mushrooms slowly regenerate if conscious, for people who want to save them from being eaten - adjustBruteLoss(-2) + adjustBruteLossAbstract(-2) /mob/living/simple_animal/hostile/mushroom/Initialize(mapload)//Makes every shroom a little unique melee_damage += rand(1,15) @@ -78,7 +78,7 @@ return FALSE -/mob/living/simple_animal/hostile/mushroom/adjustHealth(amount, updating_health = TRUE, forced = FALSE) //Possibility to flee from a fight just to make it more visually interesting +/mob/living/simple_animal/hostile/mushroom/adjustHealth(amount, forced = FALSE) //Possibility to flee from a fight just to make it more visually interesting if(!retreat_distance && prob(33)) retreat_distance = 5 addtimer(CALLBACK(src, PROC_REF(stop_retreat)), 30) @@ -100,7 +100,7 @@ if(level_gain < 1)//So we still gain a level if two mushrooms were the same level level_gain = 1 M.LevelUp(level_gain) - M.adjustBruteLoss(-M.maxHealth) + M.apply_damage(/datum/damage_source/sharp/light, BRUTE, -M.maxHealth, null) qdel(src) return TRUE return ..() @@ -140,24 +140,27 @@ powerlevel += level_gain melee_damage += (level_gain * rand(1,5)) maxHealth += (level_gain * rand(1,5)) - adjustBruteLoss(-maxHealth) //They'll always heal, even if they don't gain a level, in case you want to keep this shroom around instead of harvesting it + adjustBruteLossAbstract(-maxHealth) //They'll always heal, even if they don't gain a level, in case you want to keep this shroom around instead of harvesting it /mob/living/simple_animal/hostile/mushroom/proc/Bruise() if(!bruised && !stat) src.visible_message("The [src.name] was bruised!") bruised = 1 -/mob/living/simple_animal/hostile/mushroom/attackby(obj/item/I, mob/user, params) +/mob/living/simple_animal/hostile/mushroom/item_interact(obj/item/item, mob/user, params) if(istype(I, /obj/item/reagent_containers/food/snacks/grown/mushroom)) if(stat == DEAD && !recovery_cooldown) Recover() qdel(I) else to_chat(user, "[src] won't eat it!") - return + return TRUE + return ..() + +/mob/living/simple_animal/hostile/mushroom/on_attacked(obj/item/I, mob/living/user) if(I.force) Bruise() - ..() + . = ..() /mob/living/simple_animal/hostile/mushroom/attack_hand(mob/living/carbon/human/M) ..() diff --git a/code/modules/mob/living/simple_animal/hostile/netherworld.dm b/code/modules/mob/living/simple_animal/hostile/netherworld.dm index 6aeec87e5efb9..a3f5c43bfbcab 100644 --- a/code/modules/mob/living/simple_animal/hostile/netherworld.dm +++ b/code/modules/mob/living/simple_animal/hostile/netherworld.dm @@ -100,7 +100,7 @@ for(var/mob/living/M in contents) if(M) playsound(src, 'sound/magic/demon_consume.ogg', 50, 1) - M.adjustBruteLoss(60 * delta_time) + M.apply_damage(/datum/damage_source/magic/abstract, BRUTE, 60 * delta_time, null) new /obj/effect/gibspawner/generic(get_turf(M), M) if(M.stat == DEAD) var/mob/living/simple_animal/hostile/netherworld/blankbody/blank diff --git a/code/modules/mob/living/simple_animal/hostile/redgrub.dm b/code/modules/mob/living/simple_animal/hostile/redgrub.dm index 6dd1764ff4691..d45ec7324a79d 100644 --- a/code/modules/mob/living/simple_animal/hostile/redgrub.dm +++ b/code/modules/mob/living/simple_animal/hostile/redgrub.dm @@ -6,7 +6,7 @@ icon_dead = "grub_1_dead" mob_biotypes = list(MOB_ORGANIC, MOB_BEAST) butcher_results = list(/obj/effect/decal/cleanable/insectguts = 1) - damage_coeff = list(BRUTE = 1, BURN = 2, TOX = -1, CLONE = 0, STAMINA = 0, OXY = 0) //can't be eaten by slimes, and healed by toxin damage + damage_coeff = list(BRUTE = 1, BURN = 2, TOX = -1, CLONE = 0, STAMINA_DAMTYPE = 0, OXY = 0) //can't be eaten by slimes, and healed by toxin damage turns_per_move = 5 maxHealth = 4 health = 4 @@ -187,7 +187,7 @@ meat.AddComponent(/datum/component/infective, grubdisease) return ..() -/mob/living/simple_animal/hostile/redgrub/attack_slime(mob/living/simple_animal/slime/M)//this is pretty unlikely to happen in game. +/mob/living/simple_animal/hostile/redgrub/after_attacked_by_slime(mob/living/simple_animal/slime/M)//this is pretty unlikely to happen in game. if(!SSticker.HasRoundStarted()) //since i need to skip simple_animal/attack slime to_chat(M, "You cannot attack people before the game has started.") return diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm index 282bae341d3b3..879eff70b04af 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm @@ -41,10 +41,10 @@ /mob/living/simple_animal/hostile/retaliate/clown/handle_temperature_damage() if(bodytemperature < minbodytemp) - adjustBruteLoss(10) + apply_damage(/datum/damage_source/temperature/internal, BRUTE, 10) throw_alert("temp", /atom/movable/screen/alert/cold, 2) else if(bodytemperature > maxbodytemp) - adjustBruteLoss(15) + apply_damage(/datum/damage_source/temperature/internal, BRUTE, 15) throw_alert("temp", /atom/movable/screen/alert/hot, 3) else clear_alert("temp") diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/retaliate.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/retaliate.dm index dd58dd1f90cb5..0936b991c7226 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/retaliate.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/retaliate.dm @@ -37,7 +37,7 @@ add_enemy(M.occupant) return FALSE -/mob/living/simple_animal/hostile/retaliate/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/retaliate/adjustHealth(amount, forced = FALSE) . = ..() if(. > 0 && stat == CONSCIOUS) Retaliate() diff --git a/code/modules/mob/living/simple_animal/hostile/space_dragon.dm b/code/modules/mob/living/simple_animal/hostile/space_dragon.dm index 43acc437ac32c..7a56a04dde2c6 100644 --- a/code/modules/mob/living/simple_animal/hostile/space_dragon.dm +++ b/code/modules/mob/living/simple_animal/hostile/space_dragon.dm @@ -27,7 +27,7 @@ health = 350 spacewalk = TRUE a_intent = INTENT_HARM - damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 1, CLONE = 1, STAMINA = 0.5, OXY = 1) + damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 1, CLONE = 1, STAMINA_DAMTYPE = 0.5, OXY = 1) speed = 0 attacktext = "chomps" attack_sound = 'sound/magic/demon_attack1.ogg' diff --git a/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm b/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm index b11f5b006f4c9..f4db233f42037 100644 --- a/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm +++ b/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm @@ -44,7 +44,7 @@ if(isliving(AM)) var/mob/living/L = AM if(!("vines" in L.faction)) - L.adjustBruteLoss(5) + L.apply_damage(/datum/damage_source/sharp/heavy, BRUTE, 5, null) to_chat(L, "You cut yourself on the thorny vines.") /mob/living/simple_animal/hostile/venus_human_trap diff --git a/code/modules/mob/living/simple_animal/hostile/wumborian_fugu.dm b/code/modules/mob/living/simple_animal/hostile/wumborian_fugu.dm index 8bffb9044842e..51f1e2a92fcc2 100644 --- a/code/modules/mob/living/simple_animal/hostile/wumborian_fugu.dm +++ b/code/modules/mob/living/simple_animal/hostile/wumborian_fugu.dm @@ -51,7 +51,7 @@ E.Activate() ..() -/mob/living/simple_animal/hostile/asteroid/fugu/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/hostile/asteroid/fugu/adjustHealth(amount, forced = FALSE) if(!forced && wumbo) return FALSE . = ..() diff --git a/code/modules/mob/living/simple_animal/kalo.dm b/code/modules/mob/living/simple_animal/kalo.dm index f201d80a8e284..fdda7829800b0 100644 --- a/code/modules/mob/living/simple_animal/kalo.dm +++ b/code/modules/mob/living/simple_animal/kalo.dm @@ -102,7 +102,7 @@ if(prob(60)) INVOKE_ASYNC(src, TYPE_PROC_REF(/mob, emote), "me", 1, "licks up \the [B]") qdel(B) - adjustBruteLoss(-5) + adjustBruteLossAbstract(-5) stop_automated_movement = 0 if(prob(1)) diff --git a/code/modules/mob/living/simple_animal/parrot.dm b/code/modules/mob/living/simple_animal/parrot.dm index e165d658cdd8c..418a83184f112 100644 --- a/code/modules/mob/living/simple_animal/parrot.dm +++ b/code/modules/mob/living/simple_animal/parrot.dm @@ -328,7 +328,7 @@ GLOBAL_LIST_INIT(strippable_parrot_items, create_strippable_list(list( icon_state = icon_living //Mobs with objects -/mob/living/simple_animal/parrot/attackby(obj/item/O, mob/living/user, params) +/mob/living/simple_animal/parrot/item_interact(obj/item/item, mob/user, params) if(!stat && !client && !istype(O, /obj/item/stack/medical) && !istype(O, /obj/item/reagent_containers/food/snacks/cracker)) if(O.force) if(parrot_state == PARROT_PERCH) @@ -342,13 +342,15 @@ GLOBAL_LIST_INIT(strippable_parrot_items, create_strippable_list(list( parrot_state |= PARROT_FLEE icon_state = icon_living drop_held_item(0) + return TRUE else if(istype(O, /obj/item/reagent_containers/food/snacks/cracker)) //Poly wants a cracker. qdel(O) if(health < maxHealth) - adjustBruteLoss(-10) + adjustBruteLossAbstract(-10) speak_chance *= 1.27 // 20 crackers to go from 1% to 100% speech_shuffle_rate += 10 to_chat(user, "[src] eagerly devours the cracker.") + return TRUE ..() return @@ -774,7 +776,7 @@ GLOBAL_LIST_INIT(strippable_parrot_items, create_strippable_list(list( qdel(held_item) held_item = null if(health < maxHealth) - adjustBruteLoss(-10) + adjustBruteLossAbstract(-10) emote("me", 1, "[src] eagerly downs the cracker.") return 1 diff --git a/code/modules/mob/living/simple_animal/shade.dm b/code/modules/mob/living/simple_animal/shade.dm index 23d79e7e09d1a..fd7f16aaa13b2 100644 --- a/code/modules/mob/living/simple_animal/shade.dm +++ b/code/modules/mob/living/simple_animal/shade.dm @@ -58,9 +58,10 @@ else if(src != M) return ..() -/mob/living/simple_animal/shade/attackby(obj/item/O, mob/user, params) //Marker -Agouri +/mob/living/simple_animal/shade/item_interact(obj/item/item, mob/user, params) if(istype(O, /obj/item/soulstone)) var/obj/item/soulstone/SS = O SS.transfer_soul("SHADE", src, user) + return TRUE else . = ..() diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 4a6d58226ac43..6926bb9f9c99d 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -44,8 +44,16 @@ var/obj_damage = 0 //how much damage this simple animal does to objects, if any var/armour_penetration = 0 //How much armour they ignore, as a flat reduction from the targets armour value + var/melee_damage_source = /datum/damage_source/sharp/light var/melee_damage_type = BRUTE //Damage type of a simple mob's melee attack, should it do damage. - var/list/damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 1, CLONE = 1, STAMINA = 0, OXY = 1) // 1 for full damage , 0 for none , -1 for 1:1 heal from that source + var/list/damage_coeff = list( + /datum/damage/brute = 1, + /datum/damage/burn = 1, + /datum/damage/toxin = 1, + /datum/damage/clone = 1, + /datum/damage/stamina = 0, + /datum/damage/suffocation = 1 + ) // 1 for full damage , 0 for none , -1 for 1:1 heal from that source var/attacktext = "attacks" var/attack_sound = null var/friendly = "nuzzles" //If the mob does no damage with it's attack @@ -622,7 +630,7 @@ if (pulledby || shouldwakeup) toggle_ai(AI_ON) -/mob/living/simple_animal/adjustHealth(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/adjustHealth(amount, forced = FALSE) . = ..() if(!ckey && !stat)//Not unconscious if(AIStatus == AI_IDLE) diff --git a/code/modules/mob/living/simple_animal/slime/life.dm b/code/modules/mob/living/simple_animal/slime/life.dm index 2c0418ed8efb4..68a1ca72c62e2 100644 --- a/code/modules/mob/living/simple_animal/slime/life.dm +++ b/code/modules/mob/living/simple_animal/slime/life.dm @@ -49,7 +49,7 @@ reset_processing() return if((attacked || rabid) && Adjacent(Target)) - Target.attack_slime(src) + deal_generic_attack(Target) attack_cooldown = world.time + attack_cooldown_time else if(src in viewers(7, Target)) if((transformeffects & SLIME_EFFECT_BLUESPACE) && powerlevel >= 5) @@ -83,9 +83,9 @@ if(bodytemperature <= (T0C - 50)) // hurt temperature if(bodytemperature <= 50) // sqrting negative numbers is bad - adjustBruteLoss(200) + apply_damage(/datum/damage_source/temperature/internal, BRUTE, 200) else - adjustBruteLoss(round(sqrt(bodytemperature)) * 2) + apply_damage(/datum/damage_source/temperature/internal, BRUTE, round(sqrt(bodytemperature)) * 2) if(stat != DEAD) var/bz_percentage = environment.total_moles() ? (environment.get_moles(GAS_BZ) / environment.total_moles()) : 0 @@ -95,7 +95,7 @@ var/plas_amt = min(amt,environment.get_moles(GAS_PLASMA)) environment.adjust_moles(GAS_PLASMA, -plas_amt) environment.adjust_moles(GAS_O2, plas_amt) - adjustBruteLoss(plas_amt ? -2 : 0) + adjustBruteLossAbstract(plas_amt ? -2 : 0) if(stat == CONSCIOUS && stasis) to_chat(src, "Nerve gas in the air has put you in stasis!") @@ -110,9 +110,6 @@ update_mobility() regenerate_icons() - updatehealth() - - return //TODO: DEFERRED /mob/living/simple_animal/slime/proc/adjust_body_temperature(current, loc_temp, boost) @@ -138,7 +135,7 @@ var/heal = 1 if(transformeffects & SLIME_EFFECT_PURPLE) heal += 0.5 - adjustBruteLoss(-heal) + adjustBruteLossAbstract(-heal) if((transformeffects & SLIME_EFFECT_RAINBOW) && DT_PROB(5, delta_time)) random_colour() @@ -185,13 +182,14 @@ var/bonus_damage = 1 if(transformeffects & SLIME_EFFECT_RED) bonus_damage *= 1.1 - M.adjustCloneLoss(4*bonus_damage) + var/datum/damage_source/slime/slime_source = FIND_DAMAGE_SOURCE + slime_source.apply_direct(M, CLONE, 4 * bonus_damage) M.adjustToxLoss(2*bonus_damage) if(ismonkey(M)) - M.adjustCloneLoss(monkey_bonus_damage*bonus_damage) + slime_source.apply_direct(M, CLONE, monkey_bonus_damage*bonus_damage) add_nutrition((15 * CONFIG_GET(number/damage_multiplier))) - adjustBruteLoss(-5) + adjustBruteLossAbstract(-5) /mob/living/simple_animal/slime/proc/handle_nutrition() if(docile) //God as my witness, I will never go hungry again @@ -203,7 +201,7 @@ if(nutrition <= 0) set_nutrition(0) - adjustBruteLoss(1) + apply_damage(/datum/damage_source/body, BRUTE, 1) else if (nutrition >= get_grow_nutrition() && amount_grown < SLIME_EVOLUTION_THRESHOLD) adjust_nutrition(-20) amount_grown++ diff --git a/code/modules/mob/living/simple_animal/slime/slime.dm b/code/modules/mob/living/simple_animal/slime/slime.dm index 5cf063dc91991..ab8685a6559ba 100644 --- a/code/modules/mob/living/simple_animal/slime/slime.dm +++ b/code/modules/mob/living/simple_animal/slime/slime.dm @@ -234,7 +234,7 @@ if(istype(O, /obj/structure/window) || istype(O, /obj/structure/grille)) if(attack_cooldown < world.time && nutrition <= get_hunger_nutrition()) if (is_adult || prob(5)) - O.attack_slime(src) + deal_generic_attack(O) attack_cooldown = world.time + attack_cooldown_time /mob/living/simple_animal/slime/Process_Spacemove(movement_dir = 0) @@ -256,7 +256,7 @@ tab_data["Power Level"] = GENERATE_STAT_TEXT("[powerlevel]") return tab_data -/mob/living/simple_animal/slime/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/simple_animal/slime/adjustFireLoss(amount, forced = FALSE) if(!forced) amount = -abs(amount) return ..() //Heals them @@ -264,7 +264,7 @@ /mob/living/simple_animal/slime/bullet_act(obj/projectile/Proj, def_zone, piercing_hit = FALSE) attacked += 10 if((Proj.damage_type == BURN)) - adjustBruteLoss(-abs(Proj.damage)) //fire projectiles heals slimes. + adjustBruteLossAbstract(-abs(Proj.damage)) //fire projectiles heals slimes. Proj.on_hit(src, 0, piercing_hit) else . = ..(Proj) @@ -292,22 +292,18 @@ /mob/living/simple_animal/slime/attack_ui(slot) return -/mob/living/simple_animal/slime/attack_slime(mob/living/simple_animal/slime/M) - if(..()) //successful slime attack - if(M == src) - return - if(buckled) - Feedstop(silent = TRUE) - visible_message("[M] pulls [src] off!", \ - "You pull [src] off!") - return - attacked += 5 - if(nutrition >= 100) //steal some nutrition. negval handled in life() - adjust_nutrition(-(50 + (40 * M.is_adult))) - M.add_nutrition(25 + (20 * M.is_adult)) - if(health > 0) - M.adjustBruteLoss(-10 + (-10 * M.is_adult)) - M.updatehealth() +/mob/living/simple_animal/slime/after_attacked_by_slime(mob/living/simple_animal/slime/M) + if(M == src) + return + if(buckled) + Feedstop(silent = TRUE) + visible_message("[M] pulls [src] off!", \ + "You pull [src] off!") + return + attacked += 5 + if(nutrition >= 100) //steal some nutrition. negval handled in life() + adjust_nutrition(-(50 + (40 * M.is_adult))) + M.add_nutrition(25 + (20 * M.is_adult)) /mob/living/simple_animal/slime/attack_animal(mob/living/simple_animal/M) . = ..() @@ -319,10 +315,6 @@ if(..()) //successful monkey bite. attacked += 10 -/mob/living/simple_animal/slime/attack_larva(mob/living/carbon/alien/larva/L) - if(..()) //successful larva bite. - attacked += 10 - /mob/living/simple_animal/slime/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) if(user.a_intent == INTENT_HARM) discipline_slime(user) @@ -358,38 +350,23 @@ discipline_slime(M) -/mob/living/simple_animal/slime/attackby(obj/item/W, mob/living/user, params) +/mob/living/simple_animal/slime/item_interact(obj/item/item, mob/user, params) if(stat == DEAD && surgeries.len) if(user.a_intent == INTENT_HELP || user.a_intent == INTENT_DISARM) for(var/datum/surgery/S in surgeries) if(S.next_step(user,user.a_intent)) - return 1 + return TRUE if(istype(W, /obj/item/stack/sheet/mineral/plasma) && !stat) //Let's you feed slimes plasma. add_friendship(user, 1) to_chat(user, "You feed the slime the plasma. It chirps happily.") var/obj/item/stack/sheet/mineral/plasma/S = W S.use(1) - return - if(W.force > 0) - attacked += 10 - if(prob(25)) - user.do_attack_animation(src) - user.changeNext_move(CLICK_CD_MELEE) - to_chat(user, "[W] passes right through [src]!") - return - if(Discipline && prob(50)) // wow, buddy, why am I getting attacked?? - Discipline = 0 - if(W.force >= 3) - var/force_effect = 2 * W.force - if(is_adult) - force_effect = round(W.force/2) - if(prob(10 + force_effect)) - discipline_slime(user) + return TRUE if(istype(W, /obj/item/storage/bag/bio)) var/obj/item/storage/P = W if(!effectmod) to_chat(user, "The slime is not currently being mutated.") - return + return TRUE var/hasOutput = FALSE //Have we outputted text? var/hasFound = FALSE //Have we found an extract to be added? for(var/obj/item/slime_extract/S in P.contents) @@ -410,8 +387,27 @@ else to_chat(user, "You feed the slime some extracts from the bag.") playsound(src, 'sound/effects/attackblob.ogg', 50, 1) - return - ..() + return TRUE + if(item.force > 0) + if(prob(25)) + user.do_attack_animation(src) + user.changeNext_move(CLICK_CD_MELEE) + to_chat(user, "[W] passes right through [src]!") + return TRUE + return ..() + +/mob/living/simple_animal/slime/on_attacked(obj/item/W, mob/living/user, nonharmfulhit) + if(W.force > 0) + attacked += 10 + if(Discipline && prob(50)) // wow, buddy, why am I getting attacked?? + Discipline = 0 + if(W.force >= 3) + var/force_effect = 2 * W.force + if(is_adult) + force_effect = round(W.force/2) + if(prob(10 + force_effect)) + discipline_slime(user) + . = ..() /mob/living/simple_animal/slime/proc/spawn_corecross(mob/living/user) var/static/list/crossbreeds = subtypesof(/obj/item/slimecross) @@ -441,7 +437,7 @@ var/new_damage = rand(15,20) if(transformeffects & SLIME_EFFECT_DARK_BLUE) new_damage *= 0.5 - adjustBruteLoss(new_damage) + apply_damage(/datum/damage_source/body, BRUTE, new_damage) if(!client) if(Target) // Like cats set_target(null) @@ -526,7 +522,7 @@ /mob/living/simple_animal/slime/random/Initialize(mapload, new_colour, new_is_adult) . = ..(mapload, pick(slime_colours), prob(50)) -/mob/living/simple_animal/slime/apply_damage(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE) +/mob/living/simple_animal/slime/apply_damage_old(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE) if(damage && damagetype == BRUTE && !forced && (transformeffects & SLIME_EFFECT_ADAMANTINE)) blocked += 50 . = ..(damage, damagetype, def_zone, blocked, forced) diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 20376364bf4e5..6de20ecf12cf3 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -35,7 +35,7 @@ * defaults to 80 */ /proc/ran_zone(zone, probability = 80) - if(prob(probability)) + if(zone && prob(probability)) zone = check_zone(zone) else zone = pick_weight(list(BODY_ZONE_HEAD = 1, BODY_ZONE_CHEST = 1, BODY_ZONE_L_ARM = 4, BODY_ZONE_R_ARM = 4, BODY_ZONE_L_LEG = 4, BODY_ZONE_R_LEG = 4)) diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index d8720c5cd408c..51540c35599bc 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -68,12 +68,11 @@ //keep damage? if (tr_flags & TR_KEEPDAMAGE) O.setToxLoss(getToxLoss(), 0) - O.adjustBruteLoss(getBruteLoss(), 0) + O.apply_damage(/datum/damage_source/abstract, BRUTE, getBruteLoss(), null) O.setOxyLoss(getOxyLoss(), 0) O.setCloneLoss(getCloneLoss(), 0) O.adjustFireLoss(getFireLoss(), 0) O.setOrganLoss(ORGAN_SLOT_BRAIN, getOrganLoss(ORGAN_SLOT_BRAIN)) - O.updatehealth() O.radiation = radiation //move implants to new mob @@ -218,12 +217,11 @@ //keep damage? if (tr_flags & TR_KEEPDAMAGE) O.setToxLoss(getToxLoss(), 0) - O.adjustBruteLoss(getBruteLoss(), 0) + O.apply_damage(/datum/damage_source/abstract, BRUTE, getBruteLoss(), null) O.setOxyLoss(getOxyLoss(), 0) O.setCloneLoss(getCloneLoss(), 0) O.adjustFireLoss(getFireLoss(), 0) O.setOrganLoss(ORGAN_SLOT_BRAIN, getOrganLoss(ORGAN_SLOT_BRAIN)) - O.updatehealth() O.radiation = radiation //move implants to new mob @@ -365,12 +363,11 @@ //keep damage? if (tr_flags & TR_KEEPDAMAGE) O.setToxLoss(getToxLoss(), 0) - O.adjustBruteLoss(getBruteLoss(), 0) + O.apply_damage(/datum/damage_source/abstract, BRUTE, getBruteLoss(), null) O.setOxyLoss(getOxyLoss(), 0) O.setCloneLoss(getCloneLoss(), 0) O.adjustFireLoss(getFireLoss(), 0) O.adjustOrganLoss(ORGAN_SLOT_BRAIN, getOrganLoss(ORGAN_SLOT_BRAIN)) - O.updatehealth() O.radiation = radiation //move implants to new mob diff --git a/code/modules/modular_computers/computers/item/computer.dm b/code/modules/modular_computers/computers/item/computer.dm index 2beee19416427..d9f484266c968 100644 --- a/code/modules/modular_computers/computers/item/computer.dm +++ b/code/modules/modular_computers/computers/item/computer.dm @@ -615,10 +615,10 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar ui_update() return -/obj/item/modular_computer/attackby(obj/item/attacking_item, mob/user, params) +/obj/item/modular_computer/item_interact(obj/item/item, mob/user, params) // Check for ID first if(istype(attacking_item, /obj/item/card/id) && InsertID(attacking_item)) - return + return TRUE // Scan a photo. if(istype(attacking_item, /obj/item/photo)) @@ -630,19 +630,19 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar messenger.ProcessPhoto() to_chat(user, "You scan \the [pic] into \the [src]'s messenger.") ui_update() - return + return TRUE // Insert items into the components for(var/h in all_components) var/obj/item/computer_hardware/H = all_components[h] if(H.try_insert(attacking_item, user)) ui_update() - return + return TRUE // Insert a pAI card if(can_store_pai && !stored_pai_card && istype(attacking_item, /obj/item/paicard)) if(!user.transferItemToLoc(attacking_item, src)) - return + return TRUE stored_pai_card = attacking_item // If the pAI moves out of the PDA, remove the reference. RegisterSignal(stored_pai_card, COMSIG_MOVABLE_MOVED, PROC_REF(stored_pai_moved)) @@ -650,6 +650,7 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar to_chat(user, "You slot \the [attacking_item] into [src].") playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50) update_icon() + return TRUE // Insert new hardware var/obj/item/computer_hardware/inserted_hardware = attacking_item @@ -657,7 +658,7 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar if(install_component(inserted_hardware, user)) inserted_hardware.on_inserted(user) ui_update() - return + return TRUE if(attacking_item.tool_behaviour == TOOL_WRENCH) if(length(all_components)) @@ -668,30 +669,30 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar user.balloon_alert(user, "disassembled") relay_qdel() qdel(src) - return + return TRUE if(attacking_item.tool_behaviour == TOOL_WELDER) if(obj_integrity == max_integrity) to_chat(user, "\The [src] does not require repairs.") - return + return TRUE if(!attacking_item.tool_start_check(user, amount=1)) - return + return TRUE to_chat(user, "You begin repairing damage to \the [src]...") if(attacking_item.use_tool(src, user, 20, volume=50, amount=1)) obj_integrity = max_integrity to_chat(user, "You repair \the [src].") update_icon() - return + return TRUE var/obj/item/computer_hardware/card_slot/card_slot = all_components[MC_CARD] // Check to see if we have an ID inside, and a valid input for money if(card_slot?.GetID() && iscash(attacking_item)) var/obj/item/card/id/id = card_slot.GetID() id.attackby(attacking_item, user) // If we do, try and put that attacking object in - return - ..() + return TRUE + return ..() /// Handle when the pAI moves to exit the PDA /obj/item/modular_computer/proc/stored_pai_moved() diff --git a/code/modules/modular_computers/computers/item/tablet.dm b/code/modules/modular_computers/computers/item/tablet.dm index a523179d7688e..1410f1628d7cf 100644 --- a/code/modules/modular_computers/computers/item/tablet.dm +++ b/code/modules/modular_computers/computers/item/tablet.dm @@ -73,23 +73,26 @@ ui_update() return TRUE -/obj/item/modular_computer/tablet/attackby(obj/item/attacking_item, mob/user) - . = ..() +/obj/item/modular_computer/tablet/item_interact(obj/item/item, mob/user, params) + if(..()) + return TRUE if(is_type_in_list(attacking_item, contained_item)) if(attacking_item.w_class >= WEIGHT_CLASS_SMALL) // Prevent putting spray cans, pipes, etc (subtypes of pens/crayons) - return + return TRUE if(inserted_item) to_chat(user, "There is already \a [inserted_item] in \the [src]!") else if(!user.transferItemToLoc(attacking_item, src)) - return + return TRUE to_chat(user, "You insert \the [attacking_item] into \the [src].") inserted_item = attacking_item playsound(src, 'sound/machines/pda_button1.ogg', 50, TRUE) update_icon() + return TRUE if(!try_scan_paper(attacking_item, user)) - return + return TRUE + return FALSE /obj/item/modular_computer/tablet/pre_attack(atom/target, mob/living/user, params) if(try_scan_paper(target, user)) @@ -99,21 +102,22 @@ return FALSE return ..() -/obj/item/modular_computer/tablet/attack(atom/target, mob/living/user, params) +/obj/item/modular_computer/tablet/attack_mob_target(atom/target, mob/living/user, params) // Send to programs for processing - this should go LAST // Used to implement the physical scanner. for(var/datum/computer_file/program/thread in (idle_threads + active_program)) - if(thread.use_attack && !thread.attack(target, user, params)) + if(thread.use_attack && !thread.attack_mob_target(target, user, params)) return ..() -/obj/item/modular_computer/tablet/attack_obj(obj/target, mob/living/user) - // Send to programs for processing - this should go LAST - // Used to implement the gas scanner. - for(var/datum/computer_file/program/thread in (idle_threads + active_program)) - if(thread.use_attack_obj && !thread.attack_obj(target, user)) - return - ..() +/obj/item/modular_computer/tablet/interact_with(atom/target, mob/user, params) + if (isobj(target)) + // Send to programs for processing - this should go LAST + // Used to implement the gas scanner. + for(var/datum/computer_file/program/thread in (idle_threads + active_program)) + if(thread.use_attack_obj && !thread.attack_obj(target, user)) + return TRUE + return ..() // Eject the pen if the ID was not ejected /obj/item/modular_computer/tablet/AltClick(mob/user) diff --git a/code/modules/modular_computers/computers/machinery/modular_computer.dm b/code/modules/modular_computers/computers/machinery/modular_computer.dm index 7af277c22b21e..208a16db5d6a6 100644 --- a/code/modules/modular_computers/computers/machinery/modular_computer.dm +++ b/code/modules/modular_computers/computers/machinery/modular_computer.dm @@ -118,9 +118,9 @@ if(cpu) return cpu.screwdriver_act(user, tool) -/obj/machinery/modular_computer/attackby(var/obj/item/W as obj, mob/user) +/obj/machinery/modular_computer/item_interact(obj/item/W, mob/user) if(user.a_intent == INTENT_HELP && cpu && !(flags_1 & NODECONSTRUCT_1)) - return cpu.attackby(W, user) + return cpu.item_interact(W, user) return ..() diff --git a/code/modules/modular_computers/file_system/program.dm b/code/modules/modular_computers/file_system/program.dm index 86bf1f179c06f..cd93d8c56ea9d 100644 --- a/code/modules/modular_computers/file_system/program.dm +++ b/code/modules/modular_computers/file_system/program.dm @@ -183,7 +183,7 @@ /// Return TRUE if nothing was processed. Return FALSE to prevent further actions running. /// Set use_attack = TRUE to receive proccalls from the parent computer. -/datum/computer_file/program/proc/attack(atom/target, mob/living/user, params) +/datum/computer_file/program/proc/attack_mob_target(atom/target, mob/living/user, params) return TRUE /// Return TRUE if nothing was processed. Return FALSE to prevent further actions running. diff --git a/code/modules/modular_computers/file_system/programs/airestorer.dm b/code/modules/modular_computers/file_system/programs/airestorer.dm index 0af159655be7d..8e5d42c3a39a2 100644 --- a/code/modules/modular_computers/file_system/programs/airestorer.dm +++ b/code/modules/modular_computers/file_system/programs/airestorer.dm @@ -77,8 +77,7 @@ A.adjustOxyLoss(-1, 0) A.adjustFireLoss(-1, 0) A.adjustToxLoss(-1, 0) - A.adjustBruteLoss(-1, 0) - A.updatehealth() + A.adjustBruteLossAbstract(-1, 0) if(A.health >= 0 && A.stat == DEAD) A.revive() // Finished restoring diff --git a/code/modules/modular_computers/file_system/programs/phys_scanner.dm b/code/modules/modular_computers/file_system/programs/phys_scanner.dm index d98c8d71917f8..084d0f2560b75 100644 --- a/code/modules/modular_computers/file_system/programs/phys_scanner.dm +++ b/code/modules/modular_computers/file_system/programs/phys_scanner.dm @@ -38,7 +38,7 @@ /datum/computer_file/program/phys_scanner/proc/ReadCurrent() return mode_to_names(current_mode) -/datum/computer_file/program/phys_scanner/attack(atom/target, mob/living/user, params) +/datum/computer_file/program/phys_scanner/attack_mob_target(atom/target, mob/living/user, params) switch(current_mode) if(DISK_CHEM) var/mob/living/carbon/carbon = target diff --git a/code/modules/modular_computers/hardware/_hardware.dm b/code/modules/modular_computers/hardware/_hardware.dm index b2398841278f8..735da9beb0bc8 100644 --- a/code/modules/modular_computers/hardware/_hardware.dm +++ b/code/modules/modular_computers/hardware/_hardware.dm @@ -50,17 +50,17 @@ /obj/item/computer_hardware/proc/on_inserted() return -/obj/item/computer_hardware/attackby(obj/item/I, mob/living/user) +/obj/item/computer_hardware/item_interact(obj/item/item, mob/user, params) // Cable coil. Works as repair method, but will probably require multiple applications and more cable. if(istype(I, /obj/item/stack/cable_coil)) var/obj/item/stack/S = I if(obj_integrity == max_integrity) to_chat(user, "\The [src] doesn't seem to require repairs.") - return 1 + return TRUE if(S.use(1)) to_chat(user, "You patch up \the [src] with a bit of \the [I].") obj_integrity = min(obj_integrity + 10, max_integrity) - return 1 + return TRUE if(try_insert(I, user)) return TRUE diff --git a/code/modules/modular_computers/hardware/ai_slot.dm b/code/modules/modular_computers/hardware/ai_slot.dm index a2d2b4721506a..54c95e26a6bda 100644 --- a/code/modules/modular_computers/hardware/ai_slot.dm +++ b/code/modules/modular_computers/hardware/ai_slot.dm @@ -59,10 +59,11 @@ return TRUE return FALSE -/obj/item/computer_hardware/ai_slot/attackby(obj/item/I, mob/living/user) +/obj/item/computer_hardware/ai_slot/item_interact(obj/item/item, mob/user, params) if(..()) - return + return TRUE if(I.tool_behaviour == TOOL_SCREWDRIVER) to_chat(user, "You press down on the manual eject button with \the [I].") try_eject(user, TRUE) - return + return TRUE + return FALSE diff --git a/code/modules/modular_computers/hardware/card_slot.dm b/code/modules/modular_computers/hardware/card_slot.dm index 219dd1c9e4fc9..d5253fae9eff9 100644 --- a/code/modules/modular_computers/hardware/card_slot.dm +++ b/code/modules/modular_computers/hardware/card_slot.dm @@ -110,16 +110,18 @@ holder?.ui_update() return TRUE -/obj/item/computer_hardware/card_slot/attackby(obj/item/I, mob/living/user) +/obj/item/computer_hardware/card_slot/item_interact(obj/item/I, mob/user, params) if(..()) - return + return TRUE if(I.tool_behaviour == TOOL_SCREWDRIVER) if(stored_card) to_chat(user, "You press down on the manual eject button with \the [I].") try_eject(user) - return + return TRUE swap_slot() to_chat(user, "You adjust the connector to fit into [expansion_hw ? "an expansion bay" : "the primary ID bay"].") + return TRUE + return FALSE /** *Swaps the card_slot hardware between using the dedicated card slot bay on a computer, and using an expansion bay. diff --git a/code/modules/modular_computers/laptop_vendor.dm b/code/modules/modular_computers/laptop_vendor.dm index 33bebb3e87245..34122bcaaed76 100644 --- a/code/modules/modular_computers/laptop_vendor.dm +++ b/code/modules/modular_computers/laptop_vendor.dm @@ -245,36 +245,36 @@ ui = new(user, src, "ComputerFabricator") ui.open() -/obj/machinery/lapvend/attackby(obj/item/I, mob/user) +/obj/machinery/lapvend/item_interact(obj/item/I, mob/user) if(istype(I, /obj/item/stack/spacecash)) var/obj/item/stack/spacecash/c = I if(!user.temporarilyRemoveItemFromInventory(c)) - return + return TRUE credits += c.value visible_message("[user] inserts [c.value] credits into [src].") qdel(c) ui_update() - return + return TRUE else if(istype(I, /obj/item/holochip)) var/obj/item/holochip/HC = I credits += HC.credits visible_message("[user] inserts a $[HC.credits] holocredit chip into [src].") qdel(HC) ui_update() - return + return TRUE else if(istype(I, /obj/item/card/id)) if(state != 2) - return + return TRUE var/obj/item/card/id/ID = I var/datum/bank_account/account = ID.registered_account var/target_credits = total_price - credits if(!account.adjust_money(-target_credits)) say("Insufficient money on card to purchase!") - return + return TRUE credits += target_credits say("[target_credits] cr have been withdrawn from your account.") ui_update() - return + return TRUE return ..() // Simplified payment processing, returns 1 on success. diff --git a/code/modules/multiz/movement/mob/living_zfall.dm b/code/modules/multiz/movement/mob/living_zfall.dm index 45f2daa43f03f..7c8a70d8f7703 100644 --- a/code/modules/multiz/movement/mob/living_zfall.dm +++ b/code/modules/multiz/movement/mob/living_zfall.dm @@ -35,11 +35,11 @@ var/obj/item/bodypart/right_leg = get_bodypart(BODY_ZONE_R_LEG) if(left_leg && !left_leg.disabled) total_damage_percent_left -= 0.45 - apply_damage(amount_total * 0.45, BRUTE, BODY_ZONE_L_LEG) + apply_damage(/datum/damage_source/impact, /datum/damage/brute, amount_total * 0.45, BODY_ZONE_L_LEG) if(right_leg && !right_leg.disabled) total_damage_percent_left -= 0.45 - apply_damage(amount_total * 0.45, BRUTE, BODY_ZONE_R_LEG) - adjustBruteLoss(amount_total * total_damage_percent_left) + apply_damage(/datum/damage_source/impact, /datum/damage/brute, amount_total * 0.45, BODY_ZONE_R_LEG) + apply_damage(/datum/damage_source/impact, BRUTE, amount_total * total_damage_percent_left) Knockdown(levels * 50) // Let the species handle it instead diff --git a/code/modules/multiz/zmimic/mimic_movable.dm b/code/modules/multiz/zmimic/mimic_movable.dm index 158e489aed342..22c16f4e99659 100644 --- a/code/modules/multiz/zmimic/mimic_movable.dm +++ b/code/modules/multiz/zmimic/mimic_movable.dm @@ -45,7 +45,7 @@ /atom/movable/openspace/singularity_pull() return -/atom/movable/openspace/attackby(obj/item/W, mob/user, params) +/atom/movable/openspace/item_interact(obj/item/item, mob/user, params) return /atom/movable/openspace/fire_act(exposed_temperature, exposed_volume) @@ -176,7 +176,7 @@ deltimer(destruction_timer) return ..() -/atom/movable/openspace/mimic/attackby(obj/item/W, mob/user) +/atom/movable/openspace/mimic/item_interact(obj/item/item, mob/user, params) to_chat(user, "\The [src] is too far away.") return TRUE @@ -209,8 +209,8 @@ mouse_opacity = MOUSE_OPACITY_TRANSPARENT zmm_flags = ZMM_IGNORE // Only one of these should ever be visible at a time, the mimic logic will handle that. -/atom/movable/openspace/turf_proxy/attackby(obj/item/W, mob/user) - return loc.attackby(W, user) +/atom/movable/openspace/turf_proxy/item_interact(obj/item/W, mob/user, params) + return loc.item_interact(W, user) /atom/movable/openspace/turf_proxy/attack_hand(mob/user as mob) return loc.attack_hand(user) @@ -232,8 +232,8 @@ ASSERT(isturf(loc)) delegate = loc:below -/atom/movable/openspace/turf_mimic/attackby(obj/item/W, mob/user) - loc.attackby(W, user) +/atom/movable/openspace/turf_mimic/item_interact(obj/item/item, mob/user, params) + return loc.attackby(item, user) /atom/movable/openspace/turf_mimic/attack_hand(mob/user as mob) to_chat(user, "You cannot reach \the [src] from here.") diff --git a/code/modules/ninja/suit/suit_attackby.dm b/code/modules/ninja/suit/suit_attackby.dm index 0e70569dc52e2..fd699a047af51 100644 --- a/code/modules/ninja/suit/suit_attackby.dm +++ b/code/modules/ninja/suit/suit_attackby.dm @@ -1,6 +1,6 @@ -/obj/item/clothing/suit/space/space_ninja/attackby(obj/item/I, mob/U, params) +/obj/item/clothing/suit/space/space_ninja/item_interact(obj/item/W, mob/user, params) if(U!=affecting)//Safety, in case you try doing this without wearing the suit/being the person with the suit. return ..() @@ -9,12 +9,12 @@ I.reagents.remove_reagent(/datum/reagent/uranium/radium, a_transfer) a_boost++; to_chat(U, "There are now [a_boost] adrenaline boosts remaining.") - return + return TRUE if(I.reagents.has_reagent(/datum/reagent/smoke_powder, a_transfer) && s_bombs < s_maxamount) I.reagents.remove_reagent(/datum/reagent/smoke_powder, a_transfer) s_bombs++; to_chat(U, "There are now [s_bombs] smoke bombs remaining.") - return + return TRUE else if(istype(I, /obj/item/stock_parts/cell)) @@ -34,7 +34,7 @@ to_chat(U, "Upgrade complete. Maximum capacity: [round(cell.maxcharge/100)]%") else to_chat(U, "Procedure interrupted. Protocol terminated.") - return + return TRUE else if(istype(I, /obj/item/disk/tech_disk))//If it's a data disk, we want to copy the research on to the suit. var/obj/item/disk/tech_disk/TD = I @@ -48,5 +48,5 @@ to_chat(U, "ERROR: Procedure interrupted. Process terminated.") else to_chat(U, "No research information detected.") - return + return TRUE return ..() diff --git a/code/modules/paperwork/clipboard.dm b/code/modules/paperwork/clipboard.dm index e853369c619ab..dea0481453a4c 100644 --- a/code/modules/paperwork/clipboard.dm +++ b/code/modules/paperwork/clipboard.dm @@ -86,23 +86,28 @@ dat += "clipboard_over" add_overlay(dat) -/obj/item/clipboard/attackby(obj/item/weapon, mob/user, params) +/obj/item/clipboard/item_interact(obj/item/weapon, mob/user, params) var/obj/item/paper/toppaper = toppaper_ref?.resolve() if(istype(weapon, /obj/item/paper)) //Add paper into the clipboard if(!user.transferItemToLoc(weapon, src)) - return + return TRUE toppaper_ref = WEAKREF(weapon) to_chat(user, "You clip [weapon] onto [src].") + update_icon() + return TRUE else if(istype(weapon, /obj/item/pen) && !pen) //Add a pen into the clipboard, attack (write) if there is already one if(!usr.transferItemToLoc(weapon, src)) - return + return TRUE pen = weapon to_chat(usr, "You slot [weapon] into [src].") + update_icon() + return TRUE else if(toppaper) - toppaper.attackby(user.get_active_held_item(), user) + . = toppaper.item_interact(user.get_active_held_item(), user) update_icon() + return ..() /obj/item/clipboard/attack_self(mob/user) ui_interact(user) diff --git a/code/modules/paperwork/contract.dm b/code/modules/paperwork/contract.dm index aafc1e3148ef5..3dbdfda8618b5 100644 --- a/code/modules/paperwork/contract.dm +++ b/code/modules/paperwork/contract.dm @@ -31,7 +31,7 @@ add_raw_text("
Conditions of Employment




This Agreement is made and entered into as of the date of last signature below, by and between [target] (hereafter referred to as SLAVE), and Nanotrasen (hereafter referred to as the omnipresent and helpful watcher of humanity).
WITNESSETH:
WHEREAS, SLAVE is a natural born human or humanoid, possessing skills upon which he can aid the omnipresent and helpful watcher of humanity, who seeks employment in the omnipresent and helpful watcher of humanity.
WHEREAS, the omnipresent and helpful watcher of humanity agrees to sporadically provide payment to SLAVE, in exchange for permanent servitude.
NOW THEREFORE in consideration of the mutual covenants herein contained, and other good and valuable consideration, the parties hereto mutually agree as follows:
In exchange for paltry payments, SLAVE agrees to work for the omnipresent and helpful watcher of humanity, for the remainder of his or her current and future lives.
Further, SLAVE agrees to transfer ownership of his or her soul to the loyalty department of the omnipresent and helpful watcher of humanity.
Should transfership of a soul not be possible, a lien shall be placed instead.
Signed,
[target]") -/obj/item/paper/contract/employment/attack(mob/living/M, mob/living/carbon/human/user) +/obj/item/paper/contract/employment/attack_mob_target(mob/living/M, mob/living/carbon/human/user) var/deconvert = FALSE if(M.mind == target && !M.owns_soul()) if(user.mind && (user.mind.assigned_role == JOB_NAME_LAWYER)) @@ -169,18 +169,21 @@ else default_raw_text += "[signature]" -/obj/item/paper/contract/infernal/attackby(obj/item/P, mob/living/carbon/human/user, params) +/obj/item/paper/contract/infernal/item_interact(obj/item/P, mob/living/carbon/human/user, params) add_fingerprint(user) if(istype(P, /obj/item/pen) || istype(P, /obj/item/toy/crayon)) attempt_signature(user) + return TRUE else if(istype(P, /obj/item/stamp)) to_chat(user, "You stamp the paper with your rubber stamp, however the ink ignites as you release the stamp.") + return TRUE else if(P.is_hot()) user.visible_message("[user] brings [P] next to [src], but [src] does not catch fire!", "[src] refuses to ignite!") + return TRUE else return ..() -/obj/item/paper/contract/infernal/attack(mob/M, mob/living/user) +/obj/item/paper/contract/infernal/attack_mob_target(mob/M, mob/living/user) add_fingerprint(user) if(M == user && target == M.mind && M.mind.soulOwner != owner && attempt_signature(user, 1)) user.visible_message("[user] slices [user.p_their()] wrist with [src], and scrawls [user.p_their()] name in blood.", "You slice your wrist open and scrawl your name in blood.") @@ -219,7 +222,7 @@ -/obj/item/paper/contract/infernal/revive/attack(mob/M, mob/living/user) +/obj/item/paper/contract/infernal/revive/attack_mob_target(mob/M, mob/living/user) if (target == M.mind && M.stat == DEAD && M.mind.soulOwner == M.mind) if (cooldown) to_chat(user, "Give [M] a chance to think through the contract, don't rush [M.p_them()].") diff --git a/code/modules/paperwork/desk_bell.dm b/code/modules/paperwork/desk_bell.dm index 80647af201ba5..eaefd53e5a2d1 100644 --- a/code/modules/paperwork/desk_bell.dm +++ b/code/modules/paperwork/desk_bell.dm @@ -34,7 +34,7 @@ COOLDOWN_START(src, ring_cooldown, ring_cooldown_length) return TRUE -/obj/structure/desk_bell/attackby(obj/item/I, mob/user, params) +/obj/structure/desk_bell/item_interact(obj/item/I, mob/user, params) . = ..() times_rang += I.force ring_bell(user) diff --git a/code/modules/paperwork/fax.dm b/code/modules/paperwork/fax.dm index 0c8367b413ed9..b8d7af112e9ad 100644 --- a/code/modules/paperwork/fax.dm +++ b/code/modules/paperwork/fax.dm @@ -176,19 +176,19 @@ fax_name = new_fax_name return TOOL_ACT_TOOLTYPE_SUCCESS -/obj/machinery/fax/attackby(obj/item/item, mob/user, params) +/obj/machinery/fax/item_interact(obj/item/item, mob/user, params) if(jammed && clear_jam(item, user)) - return + return TRUE if(panel_open) if(is_wire_tool(item)) wires.interact(user) - return + return TRUE if(can_load_item(item)) if(!loaded_item_ref?.resolve()) loaded_item_ref = WEAKREF(item) item.forceMove(src) update_icon() - return + return TRUE return ..() /** diff --git a/code/modules/paperwork/filingcabinet.dm b/code/modules/paperwork/filingcabinet.dm index 58d3b27339ca0..2d217a418fd41 100644 --- a/code/modules/paperwork/filingcabinet.dm +++ b/code/modules/paperwork/filingcabinet.dm @@ -45,22 +45,25 @@ I.forceMove(loc) qdel(src) -/obj/structure/filingcabinet/attackby(obj/item/P, mob/user, params) +/obj/structure/filingcabinet/item_interact(obj/item/P, mob/user, params) if(istype(P, /obj/item/paper) || istype(P, /obj/item/folder) || istype(P, /obj/item/photo) || istype(P, /obj/item/documents)) if(!user.transferItemToLoc(P, src)) - return + return TRUE to_chat(user, "You put [P] in [src].") icon_state = "[initial(icon_state)]-open" sleep(5) icon_state = initial(icon_state) updateUsrDialog() + return TRUE else if(P.tool_behaviour == TOOL_WRENCH) to_chat(user, "You begin to [anchored ? "unwrench" : "wrench"] [src].") if(P.use_tool(src, user, 20, volume=50)) to_chat(user, "You successfully [anchored ? "unwrench" : "wrench"] [src].") anchored = !anchored + return TRUE else if(user.a_intent != INTENT_HARM) to_chat(user, "You can't put [P] in [src]!") + return TRUE else return ..() diff --git a/code/modules/paperwork/folders.dm b/code/modules/paperwork/folders.dm index b4465732bb30d..f92de06616300 100644 --- a/code/modules/paperwork/folders.dm +++ b/code/modules/paperwork/folders.dm @@ -62,19 +62,22 @@ if(LAZYLEN(contents)) . += "folder_paper" -/obj/item/folder/attackby(obj/item/W, mob/user, params) +/obj/item/folder/item_interact(obj/item/W, mob/user, params) if(burn_paper_product_attackby_check(W, user)) - return + return TRUE if(istype(W, /obj/item/paper) || istype(W, /obj/item/photo) || istype(W, /obj/item/documents)) //Add paper, photo or documents into the folder if(!user.transferItemToLoc(W, src)) - return + return TRUE to_chat(user, "You put [W] into [src].") update_icon() ui_update() + return TRUE else if(istype(W, /obj/item/pen)) rename(user) ui_update() + return TRUE + return ..() /obj/item/folder/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) diff --git a/code/modules/paperwork/handlabeler.dm b/code/modules/paperwork/handlabeler.dm index de0daed22f05f..2225dbea3a2e2 100644 --- a/code/modules/paperwork/handlabeler.dm +++ b/code/modules/paperwork/handlabeler.dm @@ -83,12 +83,13 @@ else to_chat(user, "You turn off [src].") -/obj/item/hand_labeler/attackby(obj/item/I, mob/user, params) - ..() +/obj/item/hand_labeler/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/hand_labeler_refill)) to_chat(user, "You insert [I] into [src].") qdel(I) labels_left = initial(labels_left) //Yes, it's capped at its initial value + return TRUE + ..() /obj/item/hand_labeler/borg name = "cyborg-hand labeler" diff --git a/code/modules/paperwork/origami.dm b/code/modules/paperwork/origami.dm index e48aa3d3afd42..d4e1ef990d6e9 100644 --- a/code/modules/paperwork/origami.dm +++ b/code/modules/paperwork/origami.dm @@ -57,15 +57,16 @@ qdel(src) user.put_in_hands(internal_paper_tmp) -/obj/item/origami/attackby(obj/item/P, mob/living/carbon/human/user, params) +/obj/item/origami/item_interact(obj/item/P, mob/living/carbon/human/user, params) ..() if(istype(P, /obj/item/pen) || istype(P, /obj/item/toy/crayon)) to_chat(user, "You should unfold [src] before changing it.") - return + return TRUE else if(istype(P, /obj/item/stamp)) //we don't randomize stamps on origami internalPaper.attackby(P, user) //spoofed attack to update internal paper. update_icon() + return TRUE else if(P.is_hot()) if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(10)) @@ -74,15 +75,17 @@ user.dropItemToGround(P) user.adjust_fire_stacks(1) user.IgniteMob() - return + return TRUE if(!(in_range(user, src))) //to prevent issues as a result of telepathically lighting a paper - return + return TRUE user.dropItemToGround(src) user.visible_message("[user] lights [src] ablaze with [P]!", "You light [src] on fire!") fire_act() + return TRUE add_fingerprint(user) + return ..() /obj/item/origami/papercrane name = "paper crane" diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm index d76e2be4fa24a..ab4a11c972381 100644 --- a/code/modules/paperwork/paper.dm +++ b/code/modules/paperwork/paper.dm @@ -365,15 +365,15 @@ add_fingerprint(user) fire_act(I.return_temperature()) -/obj/item/paper/attackby(obj/item/attacking_item, mob/living/user, params) +/obj/item/paper/item_interact(obj/item/attacking_item, mob/living/user, params) if(burn_paper_product_attackby_check(attacking_item, user)) SStgui.close_uis(src) - return + return TRUE // Enable picking paper up by clicking on it with the clipboard or folder if(istype(attacking_item, /obj/item/clipboard) || istype(attacking_item, /obj/item/folder) || istype(attacking_item, /obj/item/paper_bin)) attacking_item.attackby(src, user) - return + return TRUE // Handle writing items. var/writing_stats = istype(attacking_item) ? attacking_item.get_writing_implement_details() : null @@ -385,16 +385,16 @@ if(writing_stats["interaction_mode"] == MODE_WRITING) if(get_total_length() >= MAX_PAPER_LENGTH) to_chat(user, "This sheet of paper is full!") - return + return TRUE ui_interact(user) - return + return TRUE // Handle stamping items. if(writing_stats["interaction_mode"] == MODE_STAMPING) to_chat(user, "You ready your stamp over the paper! ") ui_interact(user) - return + return TRUE ui_interact(user) return ..() diff --git a/code/modules/paperwork/paper_cutter.dm b/code/modules/paperwork/paper_cutter.dm index 7a176a6c183d0..353b5f6cd3f8e 100644 --- a/code/modules/paperwork/paper_cutter.dm +++ b/code/modules/paperwork/paper_cutter.dm @@ -42,29 +42,29 @@ add_overlay("paper") -/obj/item/papercutter/attackby(obj/item/P, mob/user, params) +/obj/item/papercutter/item_interact(obj/item/P, mob/user, params) if(istype(P, /obj/item/paper) && !storedpaper) if(!user.transferItemToLoc(P, src)) - return + return TRUE playsound(loc, "pageturn", 60, 1) to_chat(user, "You place [P] in [src].") storedpaper = P update_icon() - return + return TRUE if(istype(P, /obj/item/hatchet/cutterblade) && !storedcutter) if(!user.transferItemToLoc(P, src)) - return + return TRUE to_chat(user, "You replace [src]'s [P].") P.forceMove(src) storedcutter = P update_icon() - return + return TRUE if(P.tool_behaviour == TOOL_SCREWDRIVER && storedcutter) P.play_tool_sound(src) to_chat(user, "[storedcutter] has been [cuttersecured ? "unsecured" : "secured"].") cuttersecured = !cuttersecured - return - ..() + return TRUE + return ..() /obj/item/papercutter/attack_hand(mob/user) . = ..() @@ -112,9 +112,9 @@ resistance_flags = FLAMMABLE max_integrity = 50 -/obj/item/paperslip/attackby(obj/item/I, mob/living/user, params) +/obj/item/paperslip/item_interact(obj/item/I, mob/living/user, params) if(burn_paper_product_attackby_check(I, user)) - return + return TRUE return ..() diff --git a/code/modules/paperwork/paperbin.dm b/code/modules/paperwork/paperbin.dm index 532da0097b2e3..8353750f93fdb 100644 --- a/code/modules/paperwork/paperbin.dm +++ b/code/modules/paperwork/paperbin.dm @@ -98,22 +98,24 @@ add_fingerprint(user) return ..() -/obj/item/paper_bin/attackby(obj/item/I, mob/user, params) +/obj/item/paper_bin/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/paper)) var/obj/item/paper/P = I if(!user.transferItemToLoc(P, src)) - return + return TRUE to_chat(user, "You put [P] in [src].") papers.Add(P) total_paper++ update_icon() + return TRUE else if(istype(I, /obj/item/pen) && !bin_pen) var/obj/item/pen/P = I if(!user.transferItemToLoc(P, src)) - return + return TRUE to_chat(user, "You put [P] in [src].") bin_pen = P update_icon() + return TRUE else return ..() @@ -155,7 +157,7 @@ /obj/item/paper_bin/bundlenatural/fire_act(exposed_temperature, exposed_volume) qdel(src) -/obj/item/paper_bin/bundlenatural/attackby(obj/item/W, mob/user) +/obj/item/paper_bin/bundlenatural/item_interact(obj/item/W, mob/user) if(W.is_sharp()) to_chat(user, "You snip \the [src], spilling paper everywhere.") var/turf/T = get_turf(src.loc) @@ -170,5 +172,6 @@ P.forceMove(T) CHECK_TICK qdel(src) + return TRUE else - ..() + return ..() diff --git a/code/modules/paperwork/paperplane.dm b/code/modules/paperwork/paperplane.dm index 984927bb91f0d..ed1541a95154c 100644 --- a/code/modules/paperwork/paperplane.dm +++ b/code/modules/paperwork/paperplane.dm @@ -35,18 +35,18 @@ qdel(src) user.put_in_hands(internal_paper_tmp) -/obj/item/origami/paperplane/attackby(obj/item/P, mob/living/carbon/human/user, params) +/obj/item/origami/paperplane/item_interact(obj/item/P, mob/living/carbon/human/user, params) if(burn_paper_product_attackby_check(P, user)) - return + return TRUE if(istype(P, /obj/item/pen) || istype(P, /obj/item/toy/crayon)) to_chat(user, "You should unfold [src] before changing it.") - return + return TRUE else if(istype(P, /obj/item/stamp)) //we don't randomize stamps on a paperplane internalPaper.attackby(P, user) //spoofed attack to update internal paper. update_icon() add_fingerprint(user) - return + return TRUE return ..() diff --git a/code/modules/paperwork/pen.dm b/code/modules/paperwork/pen.dm index 5107b5843c29e..6ec963adb08d1 100644 --- a/code/modules/paperwork/pen.dm +++ b/code/modules/paperwork/pen.dm @@ -135,7 +135,7 @@ to_chat(user, "You rotate the top of the pen to [degrees] degrees.") SEND_SIGNAL(src, COMSIG_PEN_ROTATED, deg, user) -/obj/item/pen/attack(mob/living/M, mob/user,stealth) +/obj/item/pen/attack_mob_target(mob/living/M, mob/user,stealth) if(!istype(M)) return @@ -191,7 +191,7 @@ /obj/item/pen/sleepy -/obj/item/pen/sleepy/attack(mob/living/M, mob/user) +/obj/item/pen/sleepy/attack_mob_target(mob/living/M, mob/user) if(!istype(M)) return @@ -303,20 +303,6 @@ playsound(src, 'sound/machines/pda_button2.ogg', 50, TRUE) // click update_icon() -/obj/item/pen/screwdriver/attack(mob/living/carbon/M, mob/living/carbon/user) - if(!extended) - return ..() - if(!istype(M)) - return ..() - if(user.zone_selected != BODY_ZONE_PRECISE_EYES && user.zone_selected != BODY_ZONE_HEAD) - return ..() - if(HAS_TRAIT(user, TRAIT_PACIFISM)) - to_chat(user, "You don't want to harm [M]!") - return - if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50)) - M = user - return eyestab(M,user) - /obj/item/pen/screwdriver/update_icon() if(extended) icon_state = "pendriverout" diff --git a/code/modules/paperwork/photocopier.dm b/code/modules/paperwork/photocopier.dm index 7fd4f6f9a98cb..bdf845cf856fa 100644 --- a/code/modules/paperwork/photocopier.dm +++ b/code/modules/paperwork/photocopier.dm @@ -389,9 +389,9 @@ object.forceMove(drop_location()) to_chat(user, "You take [object] out of [src]. [busy ? "The [src] comes to a halt." : ""]") -/obj/machinery/photocopier/attackby(obj/item/O, mob/user, params) +/obj/machinery/photocopier/item_interact(obj/item/O, mob/user, params) if(default_unfasten_wrench(user, O)) - return + return TRUE else if(istype(O, /obj/item/paper)) if(copier_empty()) @@ -406,35 +406,40 @@ do_insertion(O, user) else to_chat(user, "There is already something in [src]!") + return TRUE else if(istype(O, /obj/item/photo)) if(copier_empty()) if(!user.temporarilyRemoveItemFromInventory(O)) - return + return TRUE paper_copy = O do_insertion(O, user) else to_chat(user, "There is already something in [src]!") + return TRUE else if(istype(O, /obj/item/documents)) if(copier_empty()) if(!user.temporarilyRemoveItemFromInventory(O)) - return + return TRUE document_copy = O do_insertion(O, user) else to_chat(user, "There is already something in [src]!") + return TRUE else if(istype(O, /obj/item/toner)) if(toner_cartridge) to_chat(user, "[src] already has a toner cartridge inserted. Remove that one first.") - return + return TRUE O.forceMove(src) toner_cartridge = O to_chat(user, "You insert [O] into [src].") + return TRUE else if(istype(O, /obj/item/areaeditor/blueprints)) to_chat(user, "The Blueprint is too large to put into the copier. You need to find something else to record the document.") + return TRUE else return ..() diff --git a/code/modules/photography/camera/camera.dm b/code/modules/photography/camera/camera.dm index f4ac0c3d9b421..739f58334b127 100644 --- a/code/modules/photography/camera/camera.dm +++ b/code/modules/photography/camera/camera.dm @@ -73,20 +73,20 @@ return adjust_zoom(user) -/obj/item/camera/attack(mob/living/carbon/human/M, mob/user) +/obj/item/camera/attack_mob_target(mob/living/carbon/human/M, mob/user) return -/obj/item/camera/attackby(obj/item/I, mob/user, params) +/obj/item/camera/item_interact(obj/item/I, mob/user, params) if(istype(I, /obj/item/camera_film)) if(pictures_left) to_chat(user, "[src] still has some film in it!") - return + return TRUE if(!user.temporarilyRemoveItemFromInventory(I)) - return + return TRUE to_chat(user, "You insert [I] into [src].") qdel(I) pictures_left = pictures_max - return + return TRUE if(istype(I, /obj/item/disk/holodisk)) if (!disk) if(!user.transferItemToLoc(I, src)) @@ -96,8 +96,8 @@ disk = I else to_chat(user, "There's already a disk inside [src].") - return TRUE //no afterattack - ..() + return TRUE //no attack + return ..() /obj/item/camera/examine(mob/user) . = ..() diff --git a/code/modules/photography/photos/frame.dm b/code/modules/photography/photos/frame.dm index 2e8be2ba6a5a2..7064a0acc620a 100644 --- a/code/modules/photography/photos/frame.dm +++ b/code/modules/photography/photos/frame.dm @@ -11,16 +11,17 @@ pixel_shift = -32 var/obj/item/photo/displayed -/obj/item/wallframe/picture/attackby(obj/item/I, mob/user) +/obj/item/wallframe/picture/item_interact(obj/item/I, mob/user) if(istype(I, /obj/item/photo)) if(!displayed) if(!user.transferItemToLoc(I, src)) - return + return TRUE displayed = I update_icon() else to_chat(user, "\The [src] already contains a photo.") - ..() + return TRUE + return ..() //ATTACK HAND IGNORING PARENT RETURN VALUE /obj/item/wallframe/picture/attack_hand(mob/user) @@ -111,19 +112,20 @@ else return ..() -/obj/structure/sign/picture_frame/attackby(obj/item/I, mob/user, params) +/obj/structure/sign/picture_frame/item_interact(obj/item/I, mob/user, params) if(can_decon && (I.tool_behaviour == TOOL_SCREWDRIVER || I.tool_behaviour == TOOL_WRENCH)) to_chat(user, "You start unsecuring [name]...") if(I.use_tool(src, user, 30, volume=50)) playsound(loc, 'sound/items/deconstruct.ogg', 50, 1) to_chat(user, "You unsecure [name].") deconstruct() + return TRUE else if(I.tool_behaviour == TOOL_WIRECUTTER && framed) framed.forceMove(drop_location()) framed = null user.visible_message("[user] cuts away [framed] from [src]!") - return + return TRUE else if(istype(I, /obj/item/photo)) if(!framed) @@ -134,8 +136,9 @@ update_icon() else to_chat(user, "\The [src] already contains a photo.") + return TRUE - ..() + return ..() /obj/structure/sign/picture_frame/attack_hand(mob/user) . = ..() diff --git a/code/modules/photography/photos/photo.dm b/code/modules/photography/photos/photo.dm index e8aaf0ad13594..22d251d82155e 100644 --- a/code/modules/photography/photos/photo.dm +++ b/code/modules/photography/photos/photo.dm @@ -50,18 +50,19 @@ /obj/item/photo/attack_self(mob/user) user.examinate(src) -/obj/item/photo/attackby(obj/item/P, mob/user, params) +/obj/item/photo/item_interact(obj/item/P, mob/user, params) if(burn_paper_product_attackby_check(P, user)) - return + return TRUE if(istype(P, /obj/item/pen) || istype(P, /obj/item/toy/crayon)) if(!user.is_literate()) to_chat(user, "You scribble illegibly on [src]!") - return + return TRUE var/txt = stripped_input(user, "What would you like to write on the back?", "Photo Writing", max_length=128) if(txt && user.canUseTopic(src, BE_CLOSE)) scribble = txt + return TRUE else return ..() diff --git a/code/modules/plumbing/plumbers/pumps.dm b/code/modules/plumbing/plumbers/pumps.dm index 111b0aeef81b4..4c6561c35d7ef 100644 --- a/code/modules/plumbing/plumbers/pumps.dm +++ b/code/modules/plumbing/plumbers/pumps.dm @@ -26,13 +26,13 @@ AddComponent(/datum/component/plumbing/simple_supply, TRUE) update_appearance() //so the input/output pipes will overlay properly during init -/obj/machinery/power/liquid_pump/attackby(obj/item/W, mob/user, params) +/obj/machinery/power/liquid_pump/item_interact(obj/item/W, mob/user, params) if(!powered) if(!anchored) if(default_deconstruction_screwdriver(user, "[initial(icon_state)]_open", "[initial(icon_state)]",W)) - return + return TRUE if(default_deconstruction_crowbar(W)) - return + return TRUE return ..() /obj/machinery/power/liquid_pump/wrench_act(mob/living/user, obj/item/I) diff --git a/code/modules/plumbing/plumbers/synthesizer.dm b/code/modules/plumbing/plumbers/synthesizer.dm index 47fafe4f2cea8..c195cd71a261b 100644 --- a/code/modules/plumbing/plumbers/synthesizer.dm +++ b/code/modules/plumbing/plumbers/synthesizer.dm @@ -71,13 +71,13 @@ reagents.add_reagent(reagent_id, amount*delta_time*0.5) volume_left = max(volume_left - amount*delta_time*0.5, 0) -/obj/machinery/plumbing/synthesizer/attackby(obj/item/O, mob/user, params) +/obj/machinery/plumbing/synthesizer/item_interact(obj/item/O, mob/user, params) if(!istype(O, /obj/item/rcd_ammo)) return ..() var/obj/item/rcd_ammo/R = O if(!R.ammoamt) to_chat(user, "The [R.name] doesn't have any reagent left!") - return ..() + return TRUE var/added_volume = -volume_left //For the difference calculation volume_left = min(volume_left+R.ammoamt*10, src.max_volume) //400 per cartridge added_volume = added_volume+volume_left @@ -85,11 +85,12 @@ if(R.ammoamt <= 0) //Emptied to_chat(user, "You refill the chemical synthesizer with the [R.name], emptying it completely!") qdel(R) - return + return TRUE if(added_volume == 0) //No change to_chat(user, "The chemical synthesizer is full!") - return + return TRUE to_chat(user, "You refill the chemical synthesizer with the [R.name], leaving [R.ammoamt*10] units in it.") + return TRUE /obj/machinery/plumbing/synthesizer/examine(mob/user) . = ..() diff --git a/code/modules/pool/components/swimming_dissolve.dm b/code/modules/pool/components/swimming_dissolve.dm index 09946a63d2fdb..c6fe469a14a71 100644 --- a/code/modules/pool/components/swimming_dissolve.dm +++ b/code/modules/pool/components/swimming_dissolve.dm @@ -15,7 +15,8 @@ var/obj/item/clothing/CH = H.wear_suit if (CH.clothing_flags & THICKMATERIAL) return - L.adjustCloneLoss(1) + var/datum/damage_source/dissolving/slime_source = FIND_DAMAGE_SOURCE + slime_source.apply_direct(L, CLONE, 1) L.alpha = ((L.health-HEALTH_THRESHOLD_DEAD) / (L.maxHealth - HEALTH_THRESHOLD_DEAD)) * 255 if(L.stat == DEAD) L.visible_message("[L] dissolves into the pool!") diff --git a/code/modules/pool/pool_items.dm b/code/modules/pool/pool_items.dm index af27a493e0ed3..7385132820dc0 100644 --- a/code/modules/pool/pool_items.dm +++ b/code/modules/pool/pool_items.dm @@ -3,7 +3,7 @@ lefthand_file = 'icons/mob/inhands/items_lefthand.dmi' righthand_file = 'icons/mob/inhands/items_righthand.dmi' force = 0 - damtype = STAMINA + damtype = /datum/damage/stamina w_class = WEIGHT_CLASS_BULKY block_sound = 'sound/weapons/tap.ogg' attack_verb = list("wacked") @@ -46,7 +46,7 @@ desc = "A long noodle made of foam. Helping those with fears of swimming swim since the 1980s." var/suiciding = FALSE -/obj/item/pool/pool_noodle/attack(mob/target, mob/living/carbon/human/user) +/obj/item/pool/pool_noodle/attack_mob_target(mob/target, mob/living/carbon/human/user) . = ..() if(ISWIELDED(src) && prob(50)) INVOKE_ASYNC(src, PROC_REF(jedi_spin), user) diff --git a/code/modules/power/antimatter/control.dm b/code/modules/power/antimatter/control.dm index df56ec7db625d..241a36c6c00b5 100644 --- a/code/modules/power/antimatter/control.dm +++ b/code/modules/power/antimatter/control.dm @@ -133,7 +133,7 @@ /obj/machinery/power/am_control_unit/bullet_act(obj/projectile/Proj) . = ..() - if(Proj.armor_flag != BULLET) + if(!ispath(Proj.damage_source, /datum/damage_source/bullet)) stability -= Proj.force check_stability() diff --git a/code/modules/power/antimatter/shielding.dm b/code/modules/power/antimatter/shielding.dm index 6dd92d8ba4231..227d7c765df8b 100644 --- a/code/modules/power/antimatter/shielding.dm +++ b/code/modules/power/antimatter/shielding.dm @@ -103,7 +103,7 @@ /obj/machinery/am_shielding/bullet_act(obj/projectile/Proj) . = ..() - if(Proj.armor_flag != BULLET) + if(!ispath(Proj.damage_source, /datum/damage_source/bullet)) stability -= Proj.force/2 check_stability() diff --git a/code/modules/power/apc/apc_power_proc.dm b/code/modules/power/apc/apc_power_proc.dm index 13ea299ff2e43..f566eda85db82 100644 --- a/code/modules/power/apc/apc_power_proc.dm +++ b/code/modules/power/apc/apc_power_proc.dm @@ -184,7 +184,7 @@ area.power_environ = FALSE area.power_change() -/obj/machinery/power/apc/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir) +/obj/machinery/power/apc/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir, armour_penetration = 0) if(damage_flag == MELEE && damage_amount < 10 && (!(machine_stat & BROKEN) || malfai)) return 0 . = ..() diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index 992e025f44816..b42f1e1ebde71 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -134,46 +134,52 @@ By design, d1 is the smallest direction and d2 is the highest add_atom_colour(cable_color, FIXED_COLOUR_PRIORITY) /obj/structure/cable/proc/handlecable(obj/item/W, mob/user, params) + add_fingerprint(user) var/turf/T = get_turf(src) if(T.intact) - return + return TRUE if(W.tool_behaviour == TOOL_WIRECUTTER) if(d1 == UP || d2 == UP) to_chat(user, "You must cut this cable from above.") - return + return TRUE if (shock(user, 50)) - return + return TRUE user.visible_message("[user] cuts the cable.", "You cut the cable.") investigate_log("was cut by [key_name(usr)] in [AREACOORD(src)]", INVESTIGATE_WIRES) deconstruct() - return + return TRUE else if(istype(W, /obj/item/stack/cable_coil)) var/obj/item/stack/cable_coil/coil = W if (coil.get_amount() < 1) to_chat(user, "Not enough cable!") - return + return TRUE coil.cable_join(src, user) + return TRUE else if(istype(W, /obj/item/rcl)) var/obj/item/rcl/R = W if(R.loaded) R.loaded.cable_join(src, user) R.is_empty(user) + return TRUE else if(W.tool_behaviour == TOOL_MULTITOOL) to_chat(user, get_power_info()) shock(user, 5, 0.2) + return TRUE - add_fingerprint(user) + return FALSE // Items usable on a cable : // - Wirecutters : cut it duh ! // - Cable coil : merge cables // - Multitool : get the power currently passing through the cable // -/obj/structure/cable/attackby(obj/item/W, mob/user, params) - handlecable(W, user, params) +/obj/structure/cable/item_interact(obj/item/W, mob/user, params) + if (handlecable(W, user, params)) + return TRUE + return ..() /obj/structure/cable/examine(mob/user) . = ..() diff --git a/code/modules/power/floodlight.dm b/code/modules/power/floodlight.dm index a08deaf49aafb..92391bd670c5c 100644 --- a/code/modules/power/floodlight.dm +++ b/code/modules/power/floodlight.dm @@ -8,12 +8,13 @@ density = TRUE var/state = FLOODLIGHT_NEEDS_WRENCHING -/obj/structure/floodlight_frame/attackby(obj/item/O, mob/user, params) +/obj/structure/floodlight_frame/item_interact(obj/item/O, mob/user, params) if(O.tool_behaviour == TOOL_WRENCH && (state == FLOODLIGHT_NEEDS_WRENCHING)) to_chat(user, "You secure [src].") anchored = TRUE state = FLOODLIGHT_NEEDS_WIRES desc = "A bare metal frame looking vaguely like a floodlight. Requires wiring." + return TRUE else if(istype(O, /obj/item/stack/cable_coil) && (state == FLOODLIGHT_NEEDS_WIRES)) var/obj/item/stack/S = O if(S.use(5)) @@ -54,7 +55,7 @@ /obj/machinery/power/floodlight/Initialize(mapload) . = ..() connect_to_network() - + /obj/machinery/power/floodlight/process() if(avail(active_power_usage)) add_load(active_power_usage) diff --git a/code/modules/power/lighting/light.dm b/code/modules/power/lighting/light.dm index 752740d3260eb..9a61250a17b11 100644 --- a/code/modules/power/lighting/light.dm +++ b/code/modules/power/lighting/light.dm @@ -412,7 +412,7 @@ remove_cell() qdel(src) -/obj/machinery/light/attacked_by(obj/item/I, mob/living/user) +/obj/machinery/light/on_attacked(obj/item/I, mob/living/user) ..() if(status == LIGHT_BROKEN || status == LIGHT_EMPTY) if(on && (I.flags_1 & CONDUCT_1)) diff --git a/code/modules/power/lighting/light_items.dm b/code/modules/power/lighting/light_items.dm index 8bed56028dac2..1af30a0850674 100644 --- a/code/modules/power/lighting/light_items.dm +++ b/code/modules/power/lighting/light_items.dm @@ -108,13 +108,9 @@ ..() return -/obj/item/light/attack(mob/living/M, mob/living/user, def_zone) - ..() - shatter() - -/obj/item/light/attack_obj(obj/O, mob/living/user) - ..() +/obj/item/light/afterattack(atom/target, mob/user, proximity_flag, click_parameters) shatter() + return ..() /obj/item/light/proc/shatter() if(status == LIGHT_OK || status == LIGHT_BURNED) diff --git a/code/modules/power/singularity/containment_field.dm b/code/modules/power/singularity/containment_field.dm index a02c5b7cd66a8..7afbb8e29109e 100644 --- a/code/modules/power/singularity/containment_field.dm +++ b/code/modules/power/singularity/containment_field.dm @@ -135,7 +135,6 @@ "Energy pulse detected, system damaged!", \ "You hear an electrical crack.") - user.updatehealth() bump_field(user) /obj/machinery/field/proc/clear_shock() diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm index 25257dfd67b18..cdc0c51f1257b 100644 --- a/code/modules/power/singularity/field_generator.dm +++ b/code/modules/power/singularity/field_generator.dm @@ -158,7 +158,7 @@ field_generator power level display ..() /obj/machinery/field/generator/bullet_act(obj/projectile/Proj) - if(Proj.armor_flag != BULLET) + if(!ispath(Proj.damage_source, /datum/damage_source/bullet)) power = min(power + Proj.damage, field_generator_max_power) check_power_level() . = ..() diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm index 2b85a17b9475f..6573209549527 100644 --- a/code/modules/power/singularity/singularity.dm +++ b/code/modules/power/singularity/singularity.dm @@ -67,7 +67,7 @@ C.visible_message("[C]'s head begins to collapse in on itself!", "Your head feels like it's collapsing in on itself! This was really not a good idea!", "You hear something crack and explode in gore.") var/turf/T = get_turf(C) for(var/i in 1 to 3) - C.apply_damage(30, BRUTE, BODY_ZONE_HEAD) + C.apply_damage(/datum/damage_source/mental_health, /datum/damage/brute, 30, BODY_ZONE_HEAD) new /obj/effect/gibspawner/generic(T, C) sleep(1) C.ghostize() diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index f199faa3346bd..b0b0267aea45a 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -595,7 +595,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) return FALSE if(!istype(Proj.firer, /obj/machinery/power/emitter)) investigate_log("has been hit by [Proj] fired by [key_name(Proj.firer)]", INVESTIGATE_ENGINES) - if(Proj.armor_flag != BULLET) + if(ispath(Proj.damage_source, /datum/damage_source/laser) || ispath(Proj.damage_source, /datum/damage_source/energy)) if(is_power_processing()) //This needs to be here I swear //Okay bro, but I'm taking the other check because it definitely doesn't. power += Proj.damage * config_bullet_energy if(!has_been_powered) diff --git a/code/modules/projectiles/ammunition/_firing.dm b/code/modules/projectiles/ammunition/_firing.dm index 93082748f1d88..32bd881d58a8b 100644 --- a/code/modules/projectiles/ammunition/_firing.dm +++ b/code/modules/projectiles/ammunition/_firing.dm @@ -76,7 +76,7 @@ if(iscarbon(user)) var/mob/living/carbon/C = user var/obj/item/bodypart/affecting = C.get_holding_bodypart_of_item(src) - C.apply_damage(rand(5, 10), BRUTE, affecting) + C.apply_damage(/datum/damage_source/accidental_burn, /datum/damage/brute, rand(5, 10), affecting) else user.visible_message("[user]'s [I] slips!") fire_casing(user, user) diff --git a/code/modules/projectiles/autofire.dm b/code/modules/projectiles/autofire.dm index 18d62d1c82b55..1d6708d2ed841 100644 --- a/code/modules/projectiles/autofire.dm +++ b/code/modules/projectiles/autofire.dm @@ -94,13 +94,9 @@ Everything else should be handled for you. Good luck soldier. return next_process = world.time + default_fire_delay if(L.Adjacent(autofire_target)) //Melee attack? Or ranged attack? - if(isobj(autofire_target)) - next_process = world.time + CLICK_CD_MELEE - G.attack_obj(autofire_target, L) - return - else if(isliving(autofire_target) && L.a_intent == INTENT_HARM) // Prevents trying to attack turfs next to the shooter - G.attack(autofire_target, L) + if (!isliving(autofire_target) || L.a_intent == INTENT_HARM) next_process = world.time + CLICK_CD_MELEE + G.use_on(L, autofire_target) return G.afterattack(autofire_target,L) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index c5546cdd0df45..6111b42314746 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -437,21 +437,12 @@ /obj/item/gun/proc/reset_semicd() semicd = FALSE -/obj/item/gun/attack(mob/M as mob, mob/user) - if(user.a_intent == INTENT_HARM) //Flogging - if(bayonet) - M.attackby(bayonet, user) - return - else - return ..() - return - -/obj/item/gun/attack_obj(obj/O, mob/user) - if(user.a_intent == INTENT_HARM) - if(bayonet) - O.attackby(bayonet, user) - return - return ..() +/obj/item/gun/attack_mob_target(mob/living/M, mob/living/user) + if(bayonet) + bayonet.attack_mob_target(M, user) + return + else + return ..() /obj/item/gun/attackby(obj/item/I, mob/user, params) if(user.a_intent == INTENT_HARM) diff --git a/code/modules/projectiles/guns/ballistic/revolver.dm b/code/modules/projectiles/guns/ballistic/revolver.dm index 727652d49ee27..e4e80e507aacb 100644 --- a/code/modules/projectiles/guns/ballistic/revolver.dm +++ b/code/modules/projectiles/guns/ballistic/revolver.dm @@ -268,7 +268,7 @@ user.visible_message("[user.name] tries to fire \the [src] at the same time, but only succeeds at looking like an idiot.", "\The [src]'s anti-combat mechanism prevents you from firing it at the same time!") /obj/item/gun/ballistic/revolver/russian/proc/shoot_self(mob/living/carbon/human/user, affecting = BODY_ZONE_HEAD) - user.apply_damage(300, BRUTE, affecting) + user.apply_damage(/datum/damage_source/bullet, /datum/damage/brute, 300, affecting) user.visible_message("[user.name] fires [src] at [user.p_their()] head!", "You fire [src] at your head!", "You hear a gunshot!") /obj/item/gun/ballistic/revolver/russian/soul diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index 5febba8c47753..e442df844255b 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -283,7 +283,7 @@ var/obj/projectile/energy/BB = E.BB if(!BB) . = "" - else if(BB.nodamage || !BB.damage || BB.damage_type == STAMINA) + else if(BB.nodamage || !BB.damage || BB.damage_type == STAMINA_DAMTYPE) user.visible_message("[user] tries to light [A.loc == user ? "[user.p_their()] [A.name]" : A] with [src], but it doesn't do anything. Dumbass.") playsound(user, E.fire_sound, 50, 1) playsound(user, BB.hitsound, 50, 1) diff --git a/code/modules/projectiles/guns/energy/kinetic_accelerator.dm b/code/modules/projectiles/guns/energy/kinetic_accelerator.dm index a298f8e133086..fa1554649cadb 100644 --- a/code/modules/projectiles/guns/energy/kinetic_accelerator.dm +++ b/code/modules/projectiles/guns/energy/kinetic_accelerator.dm @@ -166,7 +166,7 @@ icon_state = null damage = 20 damage_type = BRUTE - armor_flag = BOMB + damage_source = /datum/damage_source/explosion range = 3 log_override = TRUE @@ -386,8 +386,7 @@ M.gets_drilled(K.firer) if(modifier) for(var/mob/living/L in range(1, target_turf) - K.firer - target) - var/armor = L.run_armor_check(K.def_zone, K.armor_flag, "", "", K.armour_penetration) - L.apply_damage(K.damage*modifier, K.damage_type, K.def_zone, armor) + K.deal_attack(null, L, K.def_zone, override_damage = K.damage*modifier) to_chat(L, "You're struck by a [K.name]!") /obj/item/borg/upgrade/modkit/aoe/turfs @@ -492,8 +491,7 @@ var/kill_modifier = 1 if(K.pressure_decrease_active) kill_modifier *= K.pressure_decrease - var/armor = L.run_armor_check(K.def_zone, K.armor_flag, "", "", K.armour_penetration) - L.apply_damage(bounties_reaped[L.type]*kill_modifier, K.damage_type, K.def_zone, armor) + K.deal_attack(null, L, K.def_zone, override_damage = bounties_reaped[L.type]*kill_modifier) /obj/item/borg/upgrade/modkit/bounty/proc/get_kill(mob/living/L) var/bonus_mod = 1 diff --git a/code/modules/projectiles/guns/magic/wand.dm b/code/modules/projectiles/guns/magic/wand.dm index ce80f3c01e65d..0a6e167b43315 100644 --- a/code/modules/projectiles/guns/magic/wand.dm +++ b/code/modules/projectiles/guns/magic/wand.dm @@ -25,7 +25,7 @@ /obj/item/gun/magic/wand/update_icon() icon_state = "[initial(icon_state)][charges ? "" : "-drained"]" -/obj/item/gun/magic/wand/attack(atom/target, mob/living/user) +/obj/item/gun/magic/wand/attack_mob_target(atom/target, mob/living/user) if(target == user) return ..() diff --git a/code/modules/projectiles/guns/misc/beam_rifle.dm b/code/modules/projectiles/guns/misc/beam_rifle.dm index 9c8e43da53cb0..c757575873aef 100644 --- a/code/modules/projectiles/guns/misc/beam_rifle.dm +++ b/code/modules/projectiles/guns/misc/beam_rifle.dm @@ -411,7 +411,7 @@ hitsound = 'sound/effects/explosion3.ogg' damage = 0 //Handled manually. damage_type = BURN - armor_flag = ENERGY + damage_source = /datum/damage_source/energy range = 150 jitter = 10 var/obj/item/gun/energy/beam_rifle/gun diff --git a/code/modules/projectiles/guns/misc/medbeam.dm b/code/modules/projectiles/guns/misc/medbeam.dm index e0642646f7137..30c18301ceae5 100644 --- a/code/modules/projectiles/guns/misc/medbeam.dm +++ b/code/modules/projectiles/guns/misc/medbeam.dm @@ -137,7 +137,7 @@ /obj/item/gun/medbeam/proc/on_beam_tick(var/mob/living/target) if(target.health != target.maxHealth) new /obj/effect/temp_visual/heal(get_turf(target), "#80F5FF") - target.adjustBruteLoss(-4) + target.adjustBruteLossAbstract(-4) target.adjustFireLoss(-4) target.adjustToxLoss(-1, FALSE, TRUE) target.adjustOxyLoss(-1) diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 3ef34b094411d..85b41a194a9b5 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -121,9 +121,9 @@ var/homing_offset_y = 0 var/damage = 10 - var/damage_type = BRUTE //BRUTE, BURN, TOX, OXY, CLONE are the only things that should be in here + damage_source = /datum/damage_source/bullet //Defines what armor to use when it hits things. Must be set to bullet, laser, energy,or bomb + var/damage_type = /datum/damage/brute //BRUTE, BURN, TOX, OXY, CLONE are the only things that should be in here var/nodamage = FALSE //Determines if the projectile will skip any damage inflictions - var/armor_flag = BULLET //Defines what armor to use when it hits things. Must be set to bullet, laser, energy,or bomb ///How much armor this projectile pierces. var/armour_penetration = 0 var/projectile_type = /obj/projectile @@ -584,10 +584,10 @@ return FALSE /obj/projectile/proc/check_ricochet_flag(atom/A) - if((armor_flag in list(ENERGY, LASER)) && (A.flags_ricochet & RICOCHET_SHINY)) + if((ispath(damage_source, /datum/damage_source/energy) || ispath(damage_source, /datum/damage_source/laser)) && (A.flags_ricochet & RICOCHET_SHINY)) return TRUE - if((armor_flag in list(BOMB, BULLET)) && (A.flags_ricochet & RICOCHET_HARD)) + if((ispath(damage_source, /datum/damage_source/explosion) || ispath(damage_source, /datum/damage_source/bullet)) && (A.flags_ricochet & RICOCHET_HARD)) return TRUE return FALSE diff --git a/code/modules/projectiles/projectile/beams.dm b/code/modules/projectiles/projectile/beams.dm index 2ea184dfadd48..c3c59c5856671 100644 --- a/code/modules/projectiles/projectile/beams.dm +++ b/code/modules/projectiles/projectile/beams.dm @@ -6,7 +6,7 @@ damage_type = BURN hitsound = 'sound/weapons/sear.ogg' hitsound_wall = 'sound/weapons/effects/searwall.ogg' - armor_flag = LASER + damage_source = /datum/damage_source/laser eyeblur = 2 impact_effect_type = /obj/effect/temp_visual/impact_effect/red_laser light_system = MOVABLE_LIGHT @@ -76,8 +76,8 @@ name = "disabler beam" icon_state = "omnilaser" damage = 28 - damage_type = STAMINA - armor_flag = ENERGY + damage_type = STAMINA_DAMTYPE + damage_source = /datum/damage_source/energy hitsound = 'sound/weapons/tap.ogg' eyeblur = 0 impact_effect_type = /obj/effect/temp_visual/impact_effect/blue_laser @@ -89,7 +89,7 @@ /obj/projectile/beam/disabler/pass_glass ///this is for the malf ai turret upgrade xdxdxd name = "beam-disabler" damage = 50 - damage_type = STAMINA + damage_type = STAMINA_DAMTYPE pass_flags = PASSTABLE | PASSGRILLE | PASSTRANSPARENT /obj/projectile/beam/pulse @@ -139,8 +139,8 @@ icon_state = "omnilaser" hitsound = null damage = 0 - damage_type = STAMINA - armor_flag = ENERGY + damage_type = /datum/damage/stamina + damage_source = /datum/damage_source/energy var/suit_types = list(/obj/item/clothing/suit/redtag, /obj/item/clothing/suit/bluetag) impact_effect_type = /obj/effect/temp_visual/impact_effect/blue_laser light_color = LIGHT_COLOR_BLUE diff --git a/code/modules/projectiles/projectile/bullets.dm b/code/modules/projectiles/projectile/bullets.dm index 0f0f4d90dc35a..ab3cb3f388717 100644 --- a/code/modules/projectiles/projectile/bullets.dm +++ b/code/modules/projectiles/projectile/bullets.dm @@ -4,6 +4,6 @@ damage = 60 damage_type = BRUTE nodamage = FALSE - armor_flag = BULLET + damage_source = /datum/damage_source/bullet hitsound_wall = "ricochet" impact_effect_type = /obj/effect/temp_visual/impact_effect diff --git a/code/modules/projectiles/projectile/bullets/dart_syringe.dm b/code/modules/projectiles/projectile/bullets/dart_syringe.dm index cdf5344fff3f3..0e9ec2abc9868 100644 --- a/code/modules/projectiles/projectile/bullets/dart_syringe.dm +++ b/code/modules/projectiles/projectile/bullets/dart_syringe.dm @@ -49,7 +49,7 @@ name = "bee" icon_state = "bee" damage = 1 - armor_flag = MELEE + damage_source = /datum/damage_source/biohazard piercing = TRUE /obj/projectile/bullet/dart/bee/on_hit(atom/target, blocked) diff --git a/code/modules/projectiles/projectile/bullets/revolver.dm b/code/modules/projectiles/projectile/bullets/revolver.dm index 93eec07beb971..e9b82a7ad54bd 100644 --- a/code/modules/projectiles/projectile/bullets/revolver.dm +++ b/code/modules/projectiles/projectile/bullets/revolver.dm @@ -99,8 +99,7 @@ if(isliving(target)) var/mob/living/carbon/human/M = target if(M.job == JOB_NAME_MIME) - var/defense = M.getarmor(CHEST, BULLET, armour_penetration) - M.apply_damage(5, BRUTE, CHEST, defense) + damage_direct(null, M, BODY_ZONE_CHEST, override_damage = 5) M.visible_message("A bullet wound appears in [M]'s chest!", \ "You get hit with a .38 bullet from a finger gun! Those hurt!...") else diff --git a/code/modules/projectiles/projectile/bullets/smg.dm b/code/modules/projectiles/projectile/bullets/smg.dm index 95be4cf83c4c1..ee7e448d68a48 100644 --- a/code/modules/projectiles/projectile/bullets/smg.dm +++ b/code/modules/projectiles/projectile/bullets/smg.dm @@ -23,6 +23,6 @@ //Slightly worse disabler, but fully automatic /obj/projectile/bullet/c46x30mm_rubber name = "4.6x30mm rubber bullet" - damage_type = STAMINA - armor_flag = STAMINA + damage_type = STAMINA_DAMTYPE + damage_source = /datum/damage_source/bullet/beanbag damage = 20 diff --git a/code/modules/projectiles/projectile/energy/_energy.dm b/code/modules/projectiles/projectile/energy/_energy.dm index 806adc1d8e2ff..8a06f04c588e8 100644 --- a/code/modules/projectiles/projectile/energy/_energy.dm +++ b/code/modules/projectiles/projectile/energy/_energy.dm @@ -3,5 +3,5 @@ icon_state = "spark" damage = 0 damage_type = BURN - armor_flag = ENERGY + damage_source = /datum/damage_source/energy reflectable = REFLECT_NORMAL diff --git a/code/modules/projectiles/projectile/energy/net_snare.dm b/code/modules/projectiles/projectile/energy/net_snare.dm index 04e496aa21786..7a4dbe3dc80a7 100644 --- a/code/modules/projectiles/projectile/energy/net_snare.dm +++ b/code/modules/projectiles/projectile/energy/net_snare.dm @@ -2,8 +2,8 @@ name = "energy netting" icon_state = "e_netting" damage = 10 - damage_type = STAMINA - armor_flag = STAMINA + damage_type = STAMINA_DAMTYPE + damage_source = /datum/damage_source/stun hitsound = 'sound/weapons/taserhit.ogg' range = 10 diff --git a/code/modules/projectiles/projectile/energy/stun.dm b/code/modules/projectiles/projectile/energy/stun.dm index 0a8efe8fccb9c..f3a81ee74ed21 100644 --- a/code/modules/projectiles/projectile/energy/stun.dm +++ b/code/modules/projectiles/projectile/energy/stun.dm @@ -3,8 +3,8 @@ icon_state = "spark" color = "#FFFF00" damage = 40 - damage_type = STAMINA - armor_flag = STAMINA + damage_type = STAMINA_DAMTYPE + damage_source = /datum/damage_source/stun nodamage = FALSE knockdown = 30 stutter = 5 diff --git a/code/modules/projectiles/projectile/magic.dm b/code/modules/projectiles/projectile/magic.dm index c74f252ea4b4c..e53698a72c2a4 100644 --- a/code/modules/projectiles/projectile/magic.dm +++ b/code/modules/projectiles/projectile/magic.dm @@ -5,7 +5,7 @@ damage_type = OXY nodamage = TRUE armour_penetration = 100 - armor_flag = MAGIC + damage_source = /datum/damage_source/magic martial_arts_no_deflect = TRUE /obj/projectile/magic/death @@ -345,7 +345,7 @@ icon_state = "lavastaff" damage = 15 damage_type = BURN - armor_flag = MAGIC + damage_source = /datum/damage_source/magic dismemberment = 50 nodamage = FALSE martial_arts_no_deflect = FALSE @@ -366,7 +366,7 @@ damage_type = BURN nodamage = FALSE armour_penetration = 0 - armor_flag = MAGIC + damage_source = /datum/damage_source/magic hitsound = 'sound/weapons/barragespellhit.ogg' martial_arts_no_deflect = FALSE @@ -384,7 +384,7 @@ name = "locker bolt" icon_state = "locker" nodamage = TRUE - armor_flag = MAGIC + damage_source = /datum/damage_source/magic martial_arts_no_deflect = FALSE var/weld = TRUE var/created = FALSE //prevents creation of more then one locker if it has multiple hits @@ -628,7 +628,7 @@ damage_type = BURN nodamage = FALSE speed = 0.3 - armor_flag = MAGIC + damage_source = /datum/damage_source/magic var/tesla_power = 20000 var/tesla_range = 15 @@ -723,4 +723,4 @@ nodamage = FALSE armour_penetration = 100 temperature = 50 - armor_flag = MAGIC + damage_source = /datum/damage_source/magic diff --git a/code/modules/projectiles/projectile/special/floral.dm b/code/modules/projectiles/projectile/special/floral.dm index b2cb90c760e60..246c101f94de9 100644 --- a/code/modules/projectiles/projectile/special/floral.dm +++ b/code/modules/projectiles/projectile/special/floral.dm @@ -4,7 +4,7 @@ damage = 0 damage_type = TOX nodamage = TRUE - armor_flag = ENERGY + damage_source = /datum/damage_source/radiation_burn martial_arts_no_deflect = TRUE /obj/projectile/energy/florayield @@ -13,5 +13,5 @@ damage = 0 damage_type = TOX nodamage = TRUE - armor_flag = ENERGY + damage_source = /datum/damage_source/radiation_burn martial_arts_no_deflect = TRUE diff --git a/code/modules/projectiles/projectile/special/hallucination.dm b/code/modules/projectiles/projectile/special/hallucination.dm index 3ee2f0f462afc..59f0d36085dfe 100644 --- a/code/modules/projectiles/projectile/special/hallucination.dm +++ b/code/modules/projectiles/projectile/special/hallucination.dm @@ -175,8 +175,8 @@ /obj/projectile/hallucination/disabler name = "disabler beam" - damage_type = STAMINA - armor_flag = STAMINA + damage_type = STAMINA_DAMTYPE + damage_source = /datum/damage_source/mental_health hal_icon_state = "omnilaser" hal_fire_sound = 'sound/weapons/taser2.ogg' hal_hitsound = 'sound/weapons/tap.ogg' diff --git a/code/modules/projectiles/projectile/special/ion.dm b/code/modules/projectiles/projectile/special/ion.dm index c9e29c54868f1..c547df32a84fc 100644 --- a/code/modules/projectiles/projectile/special/ion.dm +++ b/code/modules/projectiles/projectile/special/ion.dm @@ -4,7 +4,7 @@ damage = 0 damage_type = BURN nodamage = TRUE - armor_flag = ENERGY + damage_source = /datum/damage_source/ion impact_effect_type = /obj/effect/temp_visual/impact_effect/ion /obj/projectile/ion/on_hit(atom/target, blocked = FALSE) diff --git a/code/modules/projectiles/projectile/special/meteor.dm b/code/modules/projectiles/projectile/special/meteor.dm index 62039446b3c43..81770c3efb418 100644 --- a/code/modules/projectiles/projectile/special/meteor.dm +++ b/code/modules/projectiles/projectile/special/meteor.dm @@ -5,7 +5,7 @@ damage = 0 damage_type = BRUTE nodamage = TRUE - armor_flag = BULLET + damage_source = /datum/damage_source/impact /obj/projectile/meteor/Bump(atom/A) if(A == firer) diff --git a/code/modules/projectiles/projectile/special/temperature.dm b/code/modules/projectiles/projectile/special/temperature.dm index 65dfd5c04d42a..6b77faf6d542e 100644 --- a/code/modules/projectiles/projectile/special/temperature.dm +++ b/code/modules/projectiles/projectile/special/temperature.dm @@ -4,7 +4,7 @@ damage = 0 damage_type = BURN nodamage = FALSE - armor_flag = ENERGY + damage_source = /datum/damage_source/temperature var/temperature = 100 /obj/projectile/temp/on_hit(atom/target, blocked = 0) diff --git a/code/modules/projectiles/projectile/special/vortex.dm b/code/modules/projectiles/projectile/special/vortex.dm index 754551daf6155..2df3f351b9cc1 100644 --- a/code/modules/projectiles/projectile/special/vortex.dm +++ b/code/modules/projectiles/projectile/special/vortex.dm @@ -5,7 +5,7 @@ damage_type = BURN reflectable = REFLECT_NORMAL nodamage = FALSE - armor_flag = ENERGY + damage_source = /datum/damage_source/magic range = 10 projectile_phasing = ALL projectile_piercing = NONE diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index ed01d09278635..7596d62e56165 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -361,7 +361,6 @@ SEND_SIGNAL(C, COMSIG_CLEAR_MOOD_EVENT, "[R.type]_overdose") addiction_tick++ if(C && need_mob_update) //some of the metabolized reagents had effects on the mob that requires some updates. - C.updatehealth() C.update_mobility() C.update_stamina() update_total() diff --git a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm index 3557adc89aefd..627367c03d5ee 100644 --- a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm @@ -227,7 +227,7 @@ All effects don't start immediately, but rather get worse over time; the rate is eyes.forceMove(get_turf(M)) to_chat(M, "You double over in pain as you feel your eyeballs liquify in your head!") M.emote("scream") - M.adjustBruteLoss(15) + M.apply_damage(/datum/damage_source/body, BRUTE, 15, null) else to_chat(M, "You scream in terror as you go blind!") eyes.applyOrganDamage(eyes.maxHealth) @@ -494,7 +494,7 @@ All effects don't start immediately, but rather get worse over time; the rate is /datum/reagent/consumable/ethanol/cuba_libre/on_mob_life(mob/living/carbon/M) if(M?.mind?.has_antag_datum(/datum/antagonist/rev)) //Cuba Libre, the traditional drink of revolutions! Heals revolutionaries. - M.adjustBruteLoss(-1, 0) + M.apply_damage(/datum/damage_source/chemical, BRUTE, -1, null, 0) M.adjustFireLoss(-1, 0) M.adjustToxLoss(-1, 0) M.adjustOxyLoss(-5, 0) @@ -747,7 +747,7 @@ All effects don't start immediately, but rather get worse over time; the rate is /datum/reagent/consumable/ethanol/manly_dorf/on_mob_life(mob/living/carbon/M) if(dorf_mode) - M.adjustBruteLoss(-2) + M.adjustBruteLossAbstract(-2) M.adjustFireLoss(-2) return ..() @@ -902,7 +902,7 @@ All effects don't start immediately, but rather get worse over time; the rate is if(ishuman(M)) //Barefoot causes the imbiber to quickly regenerate brute trauma if they're not wearing shoes. var/mob/living/carbon/human/H = M if(!H.shoes) - H.adjustBruteLoss(-3, 0) + H.adjustBruteLossAbstract(-3) . = 1 return ..() || . @@ -1309,9 +1309,9 @@ All effects don't start immediately, but rather get worse over time; the rate is /datum/reagent/consumable/ethanol/hearty_punch/on_mob_life(mob/living/carbon/M) if(M.health <= 0) - M.adjustBruteLoss(-3, 0) + M.adjustBruteLossAbstract(-3, 0) M.adjustFireLoss(-3, 0) - M.adjustCloneLoss(-5, 0) + M.adjustCloneLossAbstract(-5, 0) M.adjustOxyLoss(-4, 0) M.adjustToxLoss(-3, 0) . = 1 @@ -1645,22 +1645,22 @@ All effects don't start immediately, but rather get worse over time; the rate is if(L.health <= 0) heal_points = 20 //heal more if we're in softcrit for(var/i in 1 to min(volume, heal_points)) //only heals 1 point of damage per unit on add, for balance reasons - L.adjustBruteLoss(-1) - L.adjustFireLoss(-1) - L.adjustToxLoss(-1) - L.adjustOxyLoss(-1) - L.adjustStaminaLoss(-1) + L.adjustBruteLossAbstract(-1) + L.adjustFireLoss(-1, FALSE) + L.adjustToxLoss(-1, FALSE) + L.adjustOxyLoss(-1, FALSE) + L.adjustStaminaLoss(-1, TRUE) L.visible_message("[L] shivers with renewed vigor!", "One taste of [lowertext(name)] fills you with energy!") if(!L.stat && heal_points == 20) //brought us out of softcrit L.visible_message("[L] lurches to [L.p_their()] feet!", "Up and at 'em, kid.") /datum/reagent/consumable/ethanol/bastion_bourbon/on_mob_life(mob/living/L) if(L.health > 0) - L.adjustBruteLoss(-1) - L.adjustFireLoss(-1) - L.adjustToxLoss(-0.5) - L.adjustOxyLoss(-3) - L.adjustStaminaLoss(-5) + L.adjustBruteLossAbstract(-1) + L.adjustFireLoss(-1, FALSE) + L.adjustToxLoss(-0.5, FALSE) + L.adjustOxyLoss(-3, FALSE) + L.adjustStaminaLoss(-5, TRUE) . = TRUE ..() @@ -1726,7 +1726,7 @@ All effects don't start immediately, but rather get worse over time; the rate is /datum/reagent/consumable/ethanol/crevice_spike/on_mob_metabolize(mob/living/L) //damage only applies when drink first enters system and won't again until drink metabolizes out - L.adjustBruteLoss(3 * min(5,volume)) //minimum 3 brute damage on ingestion to limit non-drink means of injury - a full 5 unit gulp of the drink trucks you for the full 15 + L.apply_damage(/datum/damage_source/chemical, BRUTE, 3 * min(5,volume), null) //minimum 3 brute damage on ingestion to limit non-drink means of injury - a full 5 unit gulp of the drink trucks you for the full 15 /datum/reagent/consumable/ethanol/sake name = "Sake" @@ -1818,11 +1818,11 @@ All effects don't start immediately, but rather get worse over time; the rate is if(L.IsSleeping()) if(L.getBruteLoss() && L.getFireLoss()) //If you are damaged by both types, slightly increased healing but it only heals one. The more the merrier wink wink. if(prob(50)) - L.adjustBruteLoss(-0.25) + L.adjustBruteLossAbstract(-0.25) else L.adjustFireLoss(-0.25) else if(L.getBruteLoss()) //If you have only one, it still heals but not as well. - L.adjustBruteLoss(-0.2) + L.adjustBruteLossAbstract(-0.2) else if(L.getFireLoss()) L.adjustFireLoss(-0.2) @@ -2503,9 +2503,9 @@ All effects don't start immediately, but rather get worse over time; the rate is /datum/reagent/consumable/ethanol/beesknees/on_mob_life(mob/living/carbon/M) if(is_species(M, /datum/species/apid)) - M.adjustBruteLoss(-1.5, 0) - M.adjustFireLoss(-1.5, 0) - M.adjustToxLoss(-1, 0) + M.adjustBruteLossAbstract(-1.5) + M.adjustFireLoss(-1.5, FALSE) + M.adjustToxLoss(-1, TRUE) . = ..() /datum/reagent/consumable/ethanol/beeffizz diff --git a/code/modules/reagents/chemistry/reagents/drink_reagents.dm b/code/modules/reagents/chemistry/reagents/drink_reagents.dm index d27ea83e154d5..49bb01f3bdd3e 100644 --- a/code/modules/reagents/chemistry/reagents/drink_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drink_reagents.dm @@ -714,7 +714,7 @@ glass_desc = "The space doctor's favorite. Guaranteed to restore bodily injury; side effects include cravings and hunger." /datum/reagent/consumable/doctor_delight/on_mob_life(mob/living/carbon/M) - M.adjustBruteLoss(-0.5, 0) + M.adjustBruteLossAbstract(-0.5) M.adjustFireLoss(-0.5, 0) M.adjustToxLoss(-0.5, 0) M.adjustOxyLoss(-0.5, 0) diff --git a/code/modules/reagents/chemistry/reagents/drug_reagents.dm b/code/modules/reagents/chemistry/reagents/drug_reagents.dm index 3410488f84759..3ece34f3a59dc 100644 --- a/code/modules/reagents/chemistry/reagents/drug_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drug_reagents.dm @@ -88,7 +88,7 @@ var/high_message = pick("You feel jittery.", "You feel like you gotta go fast.", "You feel like you need to step it up.") to_chat(M, "[high_message]") if(prob(8)) - M.adjustBruteLoss(rand(1,4)) + M.apply_damage(/datum/damage_source/chemical, BRUTE, rand(1,4), null) M.Stun(5, 0) to_chat(M, "You stop to furiously scratch at your skin.") M.AdjustStun(-20, FALSE) @@ -104,7 +104,7 @@ /datum/reagent/drug/crank/overdose_process(mob/living/M) M.adjustOrganLoss(ORGAN_SLOT_BRAIN, 2*REM) M.adjustToxLoss(2*REM, 0) - M.adjustBruteLoss(2*REM, FALSE, FALSE, BODYTYPE_ORGANIC) + M.apply_damage(/datum/damage_source/chemical, BRUTE, 2*REM, FALSE, null, FALSE, BODYTYPE_ORGANIC) ..() . = 1 @@ -118,14 +118,14 @@ . = 1 /datum/reagent/drug/crank/addiction_act_stage3(mob/living/M) - M.adjustBruteLoss(5*REM, 0) + M.apply_damage(/datum/damage_source/chemical, BRUTE, 5*REM, null, 0) ..() . = 1 /datum/reagent/drug/crank/addiction_act_stage4(mob/living/M) M.adjustOrganLoss(ORGAN_SLOT_BRAIN, 3*REM) M.adjustToxLoss(5*REM, 0) - M.adjustBruteLoss(5*REM, 0) + M.apply_damage(/datum/damage_source/chemical, BRUTE, 5*REM, null, 0) ..() . = 1 @@ -165,7 +165,7 @@ /datum/reagent/drug/krokodil/addiction_act_stage3(mob/living/M) if(prob(25)) to_chat(M, "Your skin starts to peel away...") - M.adjustBruteLoss(3*REM, 0) + M.apply_damage(/datum/damage_source/chemical, BRUTE, 3*REM, null, 0) ..() . = 1 @@ -174,13 +174,13 @@ if(ishumanbasic(M)) if(!istype(M.dna.species, /datum/species/human/krokodil_addict)) to_chat(M, "Your skin falls off easily!") - M.adjustBruteLoss(50*REM, 0) // holy shit your skin just FELL THE FUCK OFF + M.apply_damage(/datum/damage_source/chemical, BRUTE, 50*REM, null, 0) // holy shit your skin just FELL THE FUCK OFF M.set_species(/datum/species/human/krokodil_addict) else - M.adjustBruteLoss(5*REM, 0) + M.apply_damage(/datum/damage_source/chemical, BRUTE, 5*REM, null, 0) else to_chat(M, "Your skin peels and tears!") - M.adjustBruteLoss(5*REM, 0) // repeats 5 times and then you get over it + M.apply_damage(/datum/damage_source/chemical, BRUTE, 5*REM, null, 0) // repeats 5 times and then you get over it ..() . = 1 diff --git a/code/modules/reagents/chemistry/reagents/food_reagents.dm b/code/modules/reagents/chemistry/reagents/food_reagents.dm index 1e53b4e5d7bda..6bbe3c93933b9 100755 --- a/code/modules/reagents/chemistry/reagents/food_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/food_reagents.dm @@ -584,7 +584,7 @@ if(power == 0) M.reagents.add_reagent(/datum/reagent/consumable/sugar,3) if(prob(55)) - M.adjustBruteLoss(-1*REM+power, 0) + M.adjustBruteLossAbstract(-1*REM+power) M.adjustFireLoss(-1*REM+power, 0) M.adjustOxyLoss(-1*REM+power, 0) M.adjustToxLoss(-1*REM+power, 0) @@ -727,7 +727,7 @@ /datum/reagent/consumable/vitfro/on_mob_life(mob/living/carbon/M) if(prob(80)) - M.adjustBruteLoss(-1*REM, 0) + M.adjustBruteLossAbstract(-1*REM) M.adjustFireLoss(-1*REM, 0) . = TRUE ..() diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index dfc5a370e96d4..fd2446096ec7c 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -151,10 +151,10 @@ var/power = -0.00003 * (M.bodytemperature ** 2) + 3 if(M.bodytemperature < T0C) M.adjustOxyLoss(-3 * power, 0) - M.adjustBruteLoss(-power, 0) + M.adjustBruteLossAbstract(-power) M.adjustFireLoss(-power, 0) M.adjustToxLoss(-power, 0, TRUE) //heals TOXINLOVERs - M.adjustCloneLoss(-power, 0) + M.adjustCloneLossAbstract(-power, 0) REMOVE_TRAIT(M, TRAIT_DISFIGURED, TRAIT_GENERIC) //fixes common causes for disfiguration . = 1 metabolization_rate = REAGENTS_METABOLISM * (0.00001 * (M.bodytemperature ** 2) + 0.5)//Metabolism rate is reduced in colder body temps making it more effective @@ -170,7 +170,7 @@ /datum/reagent/medicine/clonexadone/on_mob_life(mob/living/carbon/M) if(M.bodytemperature < T0C) - M.adjustCloneLoss(0.00006 * (M.bodytemperature ** 2) - 6, 0) + M.adjustCloneLossAbstract(0.00006 * (M.bodytemperature ** 2) - 6, 0) REMOVE_TRAIT(M, TRAIT_DISFIGURED, TRAIT_GENERIC) . = 1 metabolization_rate = REAGENTS_METABOLISM * (0.000015 * (M.bodytemperature ** 2) + 0.75)//Metabolism rate is reduced in colder body temps making it more effective @@ -198,10 +198,10 @@ power *= 2 M.adjustOxyLoss(-2 * power, 0) - M.adjustBruteLoss(-power, 0) + M.adjustBruteLossAbstract(-power) M.adjustFireLoss(-1.5 * power, 0) M.adjustToxLoss(-power, 0, TRUE) - M.adjustCloneLoss(-power, 0) + M.adjustCloneLossAbstract(-power, 0) REMOVE_TRAIT(M, TRAIT_DISFIGURED, TRAIT_GENERIC) . = 1 else //If not the right temperature for pyroxadone to work @@ -333,7 +333,7 @@ /datum/reagent/medicine/styptic_powder/on_mob_life(mob/living/carbon/M) - M.adjustBruteLoss(-0.5*REM, 0) + M.adjustBruteLossAbstract(-0.5*REM) ..() . = 1 @@ -364,7 +364,7 @@ last_added = new_blood_level - M.blood_volume M.blood_volume = new_blood_level if(prob(33)) - M.adjustBruteLoss(-0.5*REM, 0) + M.adjustBruteLossAbstract(-0.5*REM) M.adjustFireLoss(-0.5*REM, 0) . = TRUE ..() @@ -379,7 +379,7 @@ holder.add_reagent(/datum/reagent/consumable/sugar, 1) holder.remove_reagent(/datum/reagent/medicine/salglu_solution, 0.5) if(prob(33)) - M.adjustBruteLoss(0.5*REM, FALSE, FALSE, BODYTYPE_ORGANIC) + M.apply_damage(/datum/damage_source/chemical, BRUTE, 0.5*REM, FALSE, null, FALSE) M.adjustFireLoss(0.5*REM, FALSE, FALSE, BODYTYPE_ORGANIC) . = TRUE ..() @@ -394,7 +394,7 @@ /datum/reagent/medicine/mine_salve/on_mob_life(mob/living/carbon/C) C.hal_screwyhud = SCREWYHUD_HEALTHY - C.adjustBruteLoss(-0.25*REM, 0) + C.adjustBruteLossAbstract(-0.25*REM) C.adjustFireLoss(-0.25*REM, 0) ..() return TRUE @@ -451,7 +451,7 @@ /datum/reagent/medicine/synthflesh/on_mob_life(mob/living/carbon/M) M.adjustFireLoss(-0.5*REM, 0) - M.adjustBruteLoss(-0.5*REM, 0) + M.adjustBruteLossAbstract(-0.5*REM) ..() . = 1 @@ -526,7 +526,7 @@ /datum/reagent/medicine/omnizine/on_mob_life(mob/living/carbon/M) M.adjustToxLoss(-0.5*REM, 0) M.adjustOxyLoss(-0.5*REM, 0) - M.adjustBruteLoss(-0.5*REM, 0) + M.adjustBruteLossAbstract(-0.5*REM) M.adjustFireLoss(-0.5*REM, 0) ..() . = 1 @@ -534,7 +534,7 @@ /datum/reagent/medicine/omnizine/overdose_process(mob/living/M) M.adjustToxLoss(1.5*REM, 0) M.adjustOxyLoss(1.5*REM, 0) - M.adjustBruteLoss(1.5*REM, FALSE, FALSE, BODYTYPE_ORGANIC) + M.apply_damage(/datum/damage_source/chemical, BRUTE, 1.5*REM, FALSE, null, FALSE, BODYTYPE_ORGANIC) M.adjustFireLoss(1.5*REM, FALSE, FALSE, BODYTYPE_ORGANIC) ..() . = 1 @@ -598,14 +598,14 @@ /datum/reagent/medicine/sal_acid/on_mob_life(mob/living/carbon/M) - M.adjustBruteLoss(-3*REM, 0) + M.adjustBruteLossAbstract(-3*REM) if(M.getBruteLoss() != 0) M.adjustStaminaLoss(3*REM, FALSE) ..() . = 1 /datum/reagent/medicine/sal_acid/overdose_process(mob/living/M) - M.adjustBruteLoss(-3*REM, 0) + M.adjustBruteLossAbstract( -3*REM) M.adjustToxLoss(3*REM, 0) M.adjustOrganLoss(ORGAN_SLOT_LIVER, 2) ..() @@ -871,7 +871,7 @@ /datum/reagent/medicine/atropine/on_mob_life(mob/living/carbon/M) if(M.health <= 20) M.adjustToxLoss(-4*REM, 0) - M.adjustBruteLoss(-4*REM, 0) + M.adjustBruteLossAbstract(-4*REM) M.adjustFireLoss(-4*REM, 0) M.adjustOxyLoss(-5*REM, 0) . = 1 @@ -910,7 +910,7 @@ /datum/reagent/medicine/epinephrine/on_mob_life(mob/living/carbon/M) if(M.health <= M.crit_threshold) M.adjustToxLoss(-0.5*REM, 0) - M.adjustBruteLoss(-0.5*REM, 0) + M.adjustBruteLossAbstract(-0.5*REM) M.adjustFireLoss(-0.5*REM, 0) M.adjustOxyLoss(-0.5*REM, 0) if(M.losebreath >= 4) @@ -959,7 +959,7 @@ ..() /datum/reagent/medicine/strange_reagent/on_mob_life(mob/living/carbon/M) - M.adjustBruteLoss(0.5*REM, 0) + M.apply_damage(/datum/damage_source/chemical, BRUTE, 0.5*REM, null, 0) M.adjustFireLoss(0.5*REM, 0) ..() . = 1 @@ -1061,7 +1061,7 @@ if(M.health < 50 && M.health > 0) M.adjustOxyLoss(-1*REM, 0) M.adjustToxLoss(-1*REM, 0) - M.adjustBruteLoss(-1*REM, 0) + M.adjustBruteLossAbstract(-1*REM) M.adjustFireLoss(-1*REM, 0) M.AdjustAllImmobility(-60, FALSE) M.adjustStaminaLoss(-35*REM, 0) @@ -1140,7 +1140,7 @@ overdose_threshold = 30 /datum/reagent/medicine/bicaridine/on_mob_life(mob/living/carbon/M) - M.adjustBruteLoss(-1/METABOLITE_PENALTY(metabolite), 0) + M.adjustBruteLossAbstract(-1/METABOLITE_PENALTY(metabolite)) ..() . = 1 @@ -1335,7 +1335,7 @@ metabolite = /datum/reagent/metabolite/medicine/tricordrazine /datum/reagent/medicine/tricordrazine/on_mob_life(mob/living/carbon/M) - M.adjustBruteLoss(-2/METABOLITE_PENALTY(metabolite), 0) + M.adjustBruteLossAbstract(-2/METABOLITE_PENALTY(metabolite)) M.adjustFireLoss(-2/METABOLITE_PENALTY(metabolite), 0) M.adjustToxLoss(-2/METABOLITE_PENALTY(metabolite), 0) M.adjustOxyLoss(-2/METABOLITE_PENALTY(metabolite), 0) @@ -1357,7 +1357,7 @@ taste_description = "jelly" /datum/reagent/medicine/regen_jelly/on_mob_life(mob/living/carbon/M) - M.adjustBruteLoss(-0.5*REM, 0) + M.adjustBruteLossAbstract(-0.5*REM) M.adjustFireLoss(-0.5*REM, 0) M.adjustOxyLoss(-0.5*REM, 0) M.adjustToxLoss(-0.5*REM, 0, TRUE) //heals TOXINLOVERs @@ -1374,12 +1374,12 @@ process_flags = ORGANIC | SYNTHETIC /datum/reagent/medicine/syndicate_nanites/on_mob_life(mob/living/carbon/M) - M.adjustBruteLoss(-5*REM, 0) //A ton of healing - this is a 50 telecrystal investment. + M.adjustBruteLossAbstract(-5*REM) //A ton of healing - this is a 50 telecrystal investment. M.adjustFireLoss(-5*REM, 0) M.adjustOxyLoss(-15, 0) M.adjustToxLoss(-5*REM, 0) M.adjustOrganLoss(ORGAN_SLOT_BRAIN, -15*REM) - M.adjustCloneLoss(-3*REM, 0) + M.adjustCloneLossAbstract(-3*REM, 0) ..() . = 1 @@ -1398,12 +1398,12 @@ overdose_threshold = 25 /datum/reagent/medicine/earthsblood/on_mob_life(mob/living/carbon/M) - M.adjustBruteLoss(-3 * REM, 0) + M.adjustBruteLossAbstract(-3 * REM) M.adjustFireLoss(-3 * REM, 0) M.adjustOxyLoss(-15 * REM, 0) M.adjustToxLoss(-3 * REM, 0) M.adjustOrganLoss(ORGAN_SLOT_BRAIN, 2 * REM, 150) //This does, after all, come from ambrosia, and the most powerful ambrosia in existence, at that! - M.adjustCloneLoss(-1 * REM, 0) + M.adjustCloneLossAbstract(-1 * REM, 0) M.adjustStaminaLoss(-30 * REM, 0) M.jitteriness = min(max(0, M.jitteriness + 3), 30) M.druggy = min(max(0, M.druggy + 10), 15) //See above @@ -1451,7 +1451,7 @@ return TRUE /datum/reagent/medicine/lavaland_extract/overdose_process(mob/living/M) - M.adjustBruteLoss(3*REM, 0, FALSE, BODYTYPE_ORGANIC) + M.apply_damage(/datum/damage_source/chemical, BRUTE, 3*REM, 0, null, FALSE, BODYTYPE_ORGANIC) M.adjustFireLoss(3*REM, 0, FALSE, BODYTYPE_ORGANIC) M.adjustToxLoss(3*REM, 0) ..() @@ -1676,7 +1676,7 @@ /datum/reagent/medicine/polypyr/on_mob_life(mob/living/carbon/M) //I wanted a collection of small positive effects, this is as hard to obtain as coniine after all. M.adjustOrganLoss(ORGAN_SLOT_LUNGS, -0.25) - M.adjustBruteLoss(-0.35, 0) + M.adjustBruteLossAbstract(-0.35) if(prob(50)) if(ishuman(M)) var/mob/living/carbon/human/H = M @@ -1709,7 +1709,7 @@ /datum/reagent/medicine/stabilizing_nanites/on_mob_life(mob/living/carbon/M) if(M.health <= 80) M.adjustToxLoss(-4*REM, 0) - M.adjustBruteLoss(-4*REM, 0) + M.adjustBruteLossAbstract(-4*REM) M.adjustFireLoss(-4*REM, 0) M.adjustOxyLoss(-5*REM, 0) . = 1 diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index d67f678e080d6..e05fef858346b 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -323,7 +323,7 @@ M.adjustStaminaLoss(-10, 0) M.adjustToxLoss(-2, 0) M.adjustOxyLoss(-2, 0) - M.adjustBruteLoss(-2, 0) + M.adjustBruteLossAbstract(-2) M.adjustFireLoss(-2, 0) if(ishuman(M) && M.blood_volume < BLOOD_VOLUME_NORMAL) M.blood_volume += 3 @@ -332,7 +332,7 @@ M.adjustToxLoss(2, 0) M.adjustFireLoss(2, 0) M.adjustOxyLoss(2, 0) - M.adjustBruteLoss(2, 0) + M.apply_damage(/datum/damage_source/chemical, BRUTE, 2, null, 0) holder.remove_reagent(type, 1) return TRUE @@ -1171,7 +1171,7 @@ taste_description = "acid" /datum/reagent/space_cleaner/ez_clean/on_mob_life(mob/living/carbon/M) - M.adjustBruteLoss(3.33) + M.apply_damage(/datum/damage_source/chemical, BRUTE, 3.33, null) M.adjustFireLoss(3.33) M.adjustToxLoss(3.33) ..() @@ -1179,7 +1179,7 @@ /datum/reagent/space_cleaner/ez_clean/reaction_mob(mob/living/M, method=TOUCH, reac_volume) ..() if((method == TOUCH || method == VAPOR) && !issilicon(M)) - M.adjustBruteLoss(1.5) + M.apply_damage(/datum/damage_source/chemical, BRUTE, 1.5, null) M.adjustFireLoss(1.5) /datum/reagent/cryptobiolin @@ -2160,7 +2160,7 @@ M.adjustStaminaLoss(-10, FALSE) M.adjustToxLoss(-2, FALSE) M.adjustOxyLoss(-2, FALSE) - M.adjustBruteLoss(-2, FALSE) + M.adjustBruteLossAbstract(-2) M.adjustFireLoss(-2, FALSE) if(ishuman(M) && M.blood_volume < BLOOD_VOLUME_NORMAL) M.blood_volume += 3 @@ -2169,7 +2169,7 @@ M.adjustToxLoss(2, FALSE) M.adjustFireLoss(2, FALSE) M.adjustOxyLoss(2, FALSE) - M.adjustBruteLoss(2, FALSE) + M.apply_damage(/datum/damage_source/chemical, BRUTE, 2, null, FALSE) ..() return TRUE diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm index 8e2ec12a2d201..62b5d968dae83 100644 --- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm @@ -397,13 +397,13 @@ if(4) if(prob(75)) to_chat(M, "You scratch at an itch.") - M.adjustBruteLoss(2*REM, 0) + M.apply_damage(/datum/damage_source/chemical, BRUTE, 2*REM, null, 0) . = 1 ..() /datum/reagent/toxin/histamine/overdose_process(mob/living/M) M.adjustOxyLoss(2*REM, 0) - M.adjustBruteLoss(2*REM, FALSE, FALSE, BODYTYPE_ORGANIC) + M.apply_damage(/datum/damage_source/chemical, BRUTE, 2*REM, FALSE, null, FALSE, BODYTYPE_ORGANIC) M.adjustToxLoss(2*REM, 0) ..() . = 1 @@ -436,7 +436,7 @@ /datum/reagent/toxin/venom/on_mob_life(mob/living/carbon/M) toxpwr = 0.2*volume - M.adjustBruteLoss((0.3*volume)*REM, 0) + M.apply_damage(/datum/damage_source/chemical, BRUTE, (0.3*volume)*REM) . = 1 if(prob(15)) M.reagents.add_reagent(/datum/reagent/toxin/histamine, pick(5,10)) @@ -533,15 +533,15 @@ /datum/reagent/toxin/itching_powder/on_mob_life(mob/living/carbon/M) if(prob(15)) to_chat(M, "You scratch at your head.") - M.adjustBruteLoss(0.2*REM, 0) + M.apply_damage(/datum/damage_source/chemical, BRUTE, 0.2*REM, null, 0) . = 1 if(prob(15)) to_chat(M, "You scratch at your leg.") - M.adjustBruteLoss(0.2*REM, 0) + M.apply_damage(/datum/damage_source/chemical, BRUTE, 0.2*REM, null, 0) . = 1 if(prob(15)) to_chat(M, "You scratch at your arm.") - M.adjustBruteLoss(0.2*REM, 0) + M.apply_damage(/datum/damage_source/chemical, BRUTE, 0.2*REM, null, 0) . = 1 if(prob(3)) M.reagents.add_reagent(/datum/reagent/toxin/histamine,rand(1,3)) @@ -735,7 +735,7 @@ if(ishuman(M)) var/mob/living/carbon/human/H = M H.bleed_rate = min(H.bleed_rate + 2, 8) - H.adjustBruteLoss(1, 0) //Brute damage increases with the amount they're bleeding + H.apply_damage(/datum/damage_source/chemical, BRUTE, 1, null, 0) //Brute damage increases with the amount they're bleeding . = 1 return ..() || . @@ -805,10 +805,10 @@ return reac_volume = round(reac_volume,0.1) if(method == INGEST) - C.adjustBruteLoss(min(6*toxpwr, reac_volume * toxpwr)) + C.apply_damage(/datum/damage_source/chemical, BRUTE, min(6*toxpwr, reac_volume * toxpwr), null) return if(method == INJECT) - C.adjustBruteLoss(1.5 * min(6*toxpwr, reac_volume * toxpwr)) + C.apply_damage(/datum/damage_source/chemical, BRUTE, 1.5 * min(6*toxpwr, reac_volume * toxpwr), null) return C.acid_act(acidpwr, reac_volume) diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm index d2216a12da040..41d5fd249253c 100644 --- a/code/modules/reagents/reagent_containers.dm +++ b/code/modules/reagents/reagent_containers.dm @@ -60,7 +60,7 @@ balloon_alert(user, "Transferring [amount_per_transfer_from_this]u.") return -/obj/item/reagent_containers/attack(mob/M, mob/user, def_zone) +/obj/item/reagent_containers/attack_mob_target(mob/M, mob/user, def_zone) if(user.a_intent == INTENT_HARM) return ..() diff --git a/code/modules/reagents/reagent_containers/borghydro.dm b/code/modules/reagents/reagent_containers/borghydro.dm index 939fb14f9738f..37edba8d1f8b9 100644 --- a/code/modules/reagents/reagent_containers/borghydro.dm +++ b/code/modules/reagents/reagent_containers/borghydro.dm @@ -95,7 +95,7 @@ Borg Hypospray R.cell.use(charge_cost) //Take power from borg... RG.add_reagent(reagent_ids[i], 5) //And fill hypo with reagent. -/obj/item/reagent_containers/borghypo/attack(mob/living/carbon/M, mob/user) +/obj/item/reagent_containers/borghypo/attack_mob_target(mob/living/carbon/M, mob/user) var/datum/reagents/R = reagent_list[mode] if(!R.total_volume) to_chat(user, "The injector is empty.") @@ -212,7 +212,7 @@ Borg Shaker /datum/reagent/consumable/tomatojuice, /datum/reagent/consumable/tonic) -/obj/item/reagent_containers/borghypo/borgshaker/attack(mob/M, mob/user) +/obj/item/reagent_containers/borghypo/borgshaker/attack_mob_target(mob/M, mob/user) return //Can't inject stuff with a shaker, can we? //not with that attitude /obj/item/reagent_containers/borghypo/borgshaker/regenerate_reagents() diff --git a/code/modules/reagents/reagent_containers/glass.dm b/code/modules/reagents/reagent_containers/glass.dm index 21f2345694e53..1760b385d4d4a 100755 --- a/code/modules/reagents/reagent_containers/glass.dm +++ b/code/modules/reagents/reagent_containers/glass.dm @@ -9,7 +9,7 @@ spillable = TRUE resistance_flags = ACID_PROOF -/obj/item/reagent_containers/glass/attack(mob/M, mob/user, obj/target) +/obj/item/reagent_containers/glass/attack_mob_target(mob/M, mob/user, obj/target) if(!canconsume(M, user)) return @@ -353,7 +353,7 @@ return FALSE . = ..() -/obj/item/reagent_containers/glass/waterbottle/attack(mob/M, mob/user, obj/target) +/obj/item/reagent_containers/glass/waterbottle/attack_mob_target(mob/M, mob/user, obj/target) if(cap_on && reagents.total_volume && istype(M)) to_chat(user, "You must remove the cap before you can do that!") return diff --git a/code/modules/reagents/reagent_containers/hypospray.dm b/code/modules/reagents/reagent_containers/hypospray.dm index 355c7f671c532..dda8312bc3eee 100644 --- a/code/modules/reagents/reagent_containers/hypospray.dm +++ b/code/modules/reagents/reagent_containers/hypospray.dm @@ -19,7 +19,7 @@ /obj/item/reagent_containers/hypospray/attack_paw(mob/user) return attack_hand(user) -/obj/item/reagent_containers/hypospray/attack(mob/living/M, mob/user) +/obj/item/reagent_containers/hypospray/attack_mob_target(mob/living/M, mob/user) inject(M, user) ///Handles all injection checks, injection and logging. diff --git a/code/modules/reagents/reagent_containers/medspray.dm b/code/modules/reagents/reagent_containers/medspray.dm index 7369017018af3..f5692f1a1644b 100644 --- a/code/modules/reagents/reagent_containers/medspray.dm +++ b/code/modules/reagents/reagent_containers/medspray.dm @@ -32,7 +32,7 @@ amount_per_transfer_from_this = initial(amount_per_transfer_from_this) to_chat(user, "You will now apply the medspray'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/medspray/attack(mob/living/carbon/M, mob/user, def_zone) +/obj/item/reagent_containers/medspray/attack_mob_target(mob/living/carbon/M, mob/user, def_zone) if(!iscarbon(M)) return diff --git a/code/modules/reagents/reagent_containers/patch.dm b/code/modules/reagents/reagent_containers/patch.dm index 75ebe0daa310d..57f5ba5b465b6 100644 --- a/code/modules/reagents/reagent_containers/patch.dm +++ b/code/modules/reagents/reagent_containers/patch.dm @@ -10,7 +10,7 @@ self_delay = 3 SECONDS dissolvable = FALSE -/obj/item/reagent_containers/pill/patch/attack(mob/living/L, mob/user, obj/item/bodypart/affecting) +/obj/item/reagent_containers/pill/patch/attack_mob_target(mob/living/L, mob/user, obj/item/bodypart/affecting) if(!ishuman(L)) return ..() affecting = L.get_bodypart(check_zone(user.zone_selected)) diff --git a/code/modules/reagents/reagent_containers/pill.dm b/code/modules/reagents/reagent_containers/pill.dm index cbee1647f4e10..02b33c09deae7 100644 --- a/code/modules/reagents/reagent_containers/pill.dm +++ b/code/modules/reagents/reagent_containers/pill.dm @@ -27,7 +27,7 @@ return -/obj/item/reagent_containers/pill/attack(mob/M, mob/user, obj/item/bodypart/affecting) +/obj/item/reagent_containers/pill/attack_mob_target(mob/M, mob/user, obj/item/bodypart/affecting) if(!canconsume(M, user)) return FALSE if(iscarbon(M)) diff --git a/code/modules/recycling/disposal/pipe.dm b/code/modules/recycling/disposal/pipe.dm index f434eb0529b6f..0162e61b2a438 100644 --- a/code/modules/recycling/disposal/pipe.dm +++ b/code/modules/recycling/disposal/pipe.dm @@ -109,7 +109,7 @@ H.contents_explosion(severity, target) -/obj/structure/disposalpipe/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir) +/obj/structure/disposalpipe/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir, armour_penetration = 0) if(damage_flag == MELEE && damage_amount < 10) return 0 return ..() diff --git a/code/modules/religion/religion_structures.dm b/code/modules/religion/religion_structures.dm index 0c5ff0452d17c..e0e5a80f96463 100644 --- a/code/modules/religion/religion_structures.dm +++ b/code/modules/religion/religion_structures.dm @@ -106,11 +106,11 @@ continue new /obj/effect/temp_visual/heal(get_turf(src), "#47ac05") if(ispodperson(L) || L.mind?.holy_role) - L.adjustBruteLoss(-2*delta_time, 0) + L.adjustBruteLossAbstract(-2*delta_time) L.adjustToxLoss(-2*delta_time, 0) L.adjustOxyLoss(-2*delta_time, 0) L.adjustFireLoss(-2*delta_time, 0) - L.adjustCloneLoss(-2*delta_time, 0) + L.adjustCloneLossAbstract(-2*delta_time, 0) L.updatehealth() if(L.blood_volume < BLOOD_VOLUME_NORMAL) L.blood_volume += 1.0 diff --git a/code/modules/research/experimentor.dm b/code/modules/research/experimentor.dm index 24efc60a307e3..1116ac75404e8 100644 --- a/code/modules/research/experimentor.dm +++ b/code/modules/research/experimentor.dm @@ -254,7 +254,7 @@ else if(prob(EFFECT_PROB_VERYLOW-badThingCoeff)) visible_message("[src] malfunctions and destroys [exp_on], lashing its arms out at nearby people!") for(var/mob/living/m in ohearers(1, src)) - m.apply_damage(15, BRUTE, pick(BODY_ZONE_HEAD,BODY_ZONE_CHEST,BODY_ZONE_PRECISE_GROIN)) + m.apply_damage(/datum/damage_source/sharp/heavy, /datum/damage/brute, 15, pick(BODY_ZONE_HEAD,BODY_ZONE_CHEST,BODY_ZONE_PRECISE_GROIN)) investigate_log("Experimentor dealt minor brute to [m].", INVESTIGATE_EXPERIMENTOR) ejectItem(TRUE) else if(prob(EFFECT_PROB_LOW-badThingCoeff)) @@ -379,7 +379,7 @@ visible_message("[src] malfunctions, activating its emergency coolant systems!") throwSmoke(loc) for(var/mob/living/m in ohearers(1, src)) - m.apply_damage(5, BURN, pick(BODY_ZONE_HEAD,BODY_ZONE_CHEST,BODY_ZONE_PRECISE_GROIN)) + m.apply_damage(/datum/damage_source/temperature, /datum/damage/burn, 5, pick(BODY_ZONE_HEAD,BODY_ZONE_CHEST,BODY_ZONE_PRECISE_GROIN)) investigate_log("Experimentor has dealt minor burn damage to [key_name(m)]", INVESTIGATE_EXPERIMENTOR) ejectItem() //////////////////////////////////////////////////////////////////////////////////////////////// @@ -485,7 +485,7 @@ visible_message("Experimentor draws the life essence of those nearby!") for(var/mob/living/m in hearers(4,src)) to_chat(m, "You feel your flesh being torn from you, mists of blood drifting to [src]!") - m.apply_damage(50, BRUTE, BODY_ZONE_CHEST) + m.apply_damage(/datum/damage_source/magic, /datum/damage/brute, 50, BODY_ZONE_CHEST) investigate_log("Experimentor has taken 50 brute a blood sacrifice from [m]", INVESTIGATE_EXPERIMENTOR) if(globalMalf > 51 && globalMalf < 75) visible_message("[src] encounters a run-time error!") diff --git a/code/modules/research/nanites/nanite_programs/healing.dm b/code/modules/research/nanites/nanite_programs/healing.dm index af4d62ea04446..0e7b6a15d9671 100644 --- a/code/modules/research/nanites/nanite_programs/healing.dm +++ b/code/modules/research/nanites/nanite_programs/healing.dm @@ -26,8 +26,8 @@ if(L.heal_damage(0.5/parts.len, 0.5/parts.len, null, BODYTYPE_ORGANIC)) host_mob.update_damage_overlays() else - host_mob.adjustBruteLoss(-0.5, TRUE) - host_mob.adjustFireLoss(-0.5, TRUE) + host_mob.adjustBruteLossAbstract(-0.5) + host_mob.adjustFireLoss(-0.5) /datum/nanite_program/temperature name = "Temperature Adjustment" @@ -138,7 +138,7 @@ if(update) host_mob.update_damage_overlays() else - host_mob.adjustBruteLoss(-1.5, TRUE) + host_mob.adjustBruteLossAbstract(-1.5, TRUE) host_mob.adjustFireLoss(-1.5, TRUE) /datum/nanite_program/purging_advanced @@ -186,7 +186,7 @@ if(update) host_mob.update_damage_overlays() else - host_mob.adjustBruteLoss(-3, TRUE) + host_mob.adjustBruteLossAbstract(-3, TRUE) host_mob.adjustFireLoss(-3, TRUE) /datum/nanite_program/brain_heal_advanced diff --git a/code/modules/research/nanites/nanite_programs/rogue.dm b/code/modules/research/nanites/nanite_programs/rogue.dm index baf5634db846b..d6a8a834e2148 100644 --- a/code/modules/research/nanites/nanite_programs/rogue.dm +++ b/code/modules/research/nanites/nanite_programs/rogue.dm @@ -18,7 +18,7 @@ rogue_types = list(/datum/nanite_program/glitch) /datum/nanite_program/necrotic/active_effect() - host_mob.adjustBruteLoss(0.75, TRUE) + host_mob.apply_damage(/datum/damage_source/chemical, BRUTE, 0.75, null, TRUE) if(prob(1)) to_chat(host_mob, "You feel a mild ache from somewhere inside you.") @@ -90,7 +90,7 @@ rogue_types = list(/datum/nanite_program/necrotic) /datum/nanite_program/skin_decay/active_effect() - host_mob.adjustBruteLoss(0.25) + host_mob.apply_damage(/datum/damage_source/chemical, BRUTE, 0.25, null) if(prob(5)) //itching var/picked_bodypart = pick(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_R_LEG, BODY_ZONE_L_LEG) var/obj/item/bodypart/bodypart = host_mob.get_bodypart(picked_bodypart) diff --git a/code/modules/research/nanites/nanite_programs/weapon.dm b/code/modules/research/nanites/nanite_programs/weapon.dm index 254e414b0edab..faf96b4d2736d 100644 --- a/code/modules/research/nanites/nanite_programs/weapon.dm +++ b/code/modules/research/nanites/nanite_programs/weapon.dm @@ -12,7 +12,7 @@ var/mob/living/carbon/C = host_mob C.take_bodypart_damage(1, 0, 0) else - host_mob.adjustBruteLoss(1, TRUE) + host_mob.apply_damage(/datum/damage_source/chemical, BRUTE, 1, null, TRUE) if(prob(3)) to_chat(host_mob, "You feel a stab of pain from somewhere inside you.") @@ -52,7 +52,7 @@ /datum/nanite_program/aggressive_replication/active_effect() var/extra_regen = round(nanites.nanite_volume / 200, 0.1) nanites.adjust_nanites(null, extra_regen) - host_mob.adjustBruteLoss(extra_regen / 2, TRUE) + host_mob.apply_damage(/datum/damage_source/body, BRUTE, extra_regen / 2, null, TRUE) /datum/nanite_program/meltdown name = "Meltdown" diff --git a/code/modules/research/xenobiology/crossbreeding/__corecross.dm b/code/modules/research/xenobiology/crossbreeding/__corecross.dm index 23d22bace5e30..6b6cc29b22eb9 100644 --- a/code/modules/research/xenobiology/crossbreeding/__corecross.dm +++ b/code/modules/research/xenobiology/crossbreeding/__corecross.dm @@ -149,7 +149,7 @@ To add a crossbreed: . = ..() reagents.flags = DRAWABLE // Cannot be refilled, since it's basically an autoinjector! -/obj/item/slimecrossbeaker/autoinjector/attack(mob/living/M, mob/user) +/obj/item/slimecrossbeaker/autoinjector/attack_mob_target(mob/living/M, mob/user) if(!reagents.total_volume) to_chat(user, "[src] is empty!") return diff --git a/code/modules/research/xenobiology/crossbreeding/_misc.dm b/code/modules/research/xenobiology/crossbreeding/_misc.dm index 11175cbc3c3ab..41edbc40eca52 100644 --- a/code/modules/research/xenobiology/crossbreeding/_misc.dm +++ b/code/modules/research/xenobiology/crossbreeding/_misc.dm @@ -190,7 +190,7 @@ Slimecrossing Items icon = 'icons/obj/slimecrossing.dmi' icon_state = "capturedevice" -/obj/item/capturedevice/attack(mob/living/M, mob/user) +/obj/item/capturedevice/attack_mob_target(mob/living/M, mob/user) if(length(contents)) to_chat(user, "The device already has something inside.") return diff --git a/code/modules/research/xenobiology/crossbreeding/_mobs.dm b/code/modules/research/xenobiology/crossbreeding/_mobs.dm index 0fab9be12c3b6..be74766837868 100644 --- a/code/modules/research/xenobiology/crossbreeding/_mobs.dm +++ b/code/modules/research/xenobiology/crossbreeding/_mobs.dm @@ -14,7 +14,7 @@ Slimecrossing Mobs invocation_type = INVOCATION_NONE shapeshift_type = /mob/living/simple_animal/slime/transformedslime convert_damage = TRUE - convert_damage_type = CLONE + convert_damage_type = /datum/damage/clone var/remove_on_restore = FALSE /obj/effect/proc_holder/spell/targeted/shapeshift/slimeform/Restore(mob/living/M) diff --git a/code/modules/research/xenobiology/crossbreeding/_potions.dm b/code/modules/research/xenobiology/crossbreeding/_potions.dm index 618af07fc0c8b..7ebdda3a8e538 100644 --- a/code/modules/research/xenobiology/crossbreeding/_potions.dm +++ b/code/modules/research/xenobiology/crossbreeding/_potions.dm @@ -39,7 +39,7 @@ Slimecrossing Potions icon = 'icons/obj/chemical.dmi' icon_state = "potlightpink" -/obj/item/slimepotion/peacepotion/attack(mob/living/M, mob/user) +/obj/item/slimepotion/peacepotion/attack_mob_target(mob/living/M, mob/user) if(!isliving(M) || M.stat == DEAD) to_chat(user, "[src] only works on the living.") return ..() @@ -73,7 +73,7 @@ Slimecrossing Potions icon = 'icons/obj/chemical.dmi' icon_state = "potpink" -/obj/item/slimepotion/lovepotion/attack(mob/living/M, mob/user) +/obj/item/slimepotion/lovepotion/attack_mob_target(mob/living/M, mob/user) if(!isliving(M) || M.stat == DEAD) to_chat(user, "The love potion only works on living things, sicko!") return ..() @@ -179,7 +179,7 @@ Slimecrossing Potions icon = 'icons/obj/chemical.dmi' icon_state = "potsilver" -/obj/item/slimepotion/slime_reviver/attack(mob/living/simple_animal/slime/M, mob/user) +/obj/item/slimepotion/slime_reviver/attack_mob_target(mob/living/simple_animal/slime/M, mob/user) if(!isslime(M)) to_chat(user, "The potion only works on slimes!") return ..() @@ -203,7 +203,7 @@ Slimecrossing Potions icon = 'icons/obj/chemical.dmi' icon_state = "potcyan" -/obj/item/slimepotion/slime/chargedstabilizer/attack(mob/living/simple_animal/slime/M, mob/user) +/obj/item/slimepotion/slime/chargedstabilizer/attack_mob_target(mob/living/simple_animal/slime/M, mob/user) if(!isslime(M)) to_chat(user, "The stabilizer only works on slimes!") return ..() diff --git a/code/modules/research/xenobiology/crossbreeding/_status_effects.dm b/code/modules/research/xenobiology/crossbreeding/_status_effects.dm index a5e4131ecb5e2..48feb9a30dc45 100644 --- a/code/modules/research/xenobiology/crossbreeding/_status_effects.dm +++ b/code/modules/research/xenobiology/crossbreeding/_status_effects.dm @@ -176,7 +176,7 @@ /datum/status_effect/slime_clone_decay/tick() owner.adjustToxLoss(1, 0) owner.adjustOxyLoss(1, 0) - owner.adjustBruteLoss(1, 0) + owner.apply_damage(/datum/damage_source/slime, BRUTE, 1, null, 0) owner.adjustFireLoss(1, 0) owner.color = "#007BA7" @@ -488,7 +488,7 @@ /datum/status_effect/stabilized/purple/tick() var/is_healing = FALSE if(owner.getBruteLoss() > 0) - owner.adjustBruteLoss(-0.2) + owner.apply_damage(/datum/damage_source/slime, BRUTE, -0.2, null) is_healing = TRUE if(owner.getFireLoss() > 0) owner.adjustFireLoss(-0.2) @@ -895,9 +895,9 @@ if(owner.getCloneLoss() > 0) healing_types += CLONE - owner.apply_damage_type(-heal_amount, damagetype=pick(healing_types)) + //BACONTODO owner.apply_damage_old_type(-heal_amount, damagetype=pick(healing_types)) owner.adjust_nutrition(3) - M.adjustCloneLoss(heal_amount * 1.2) //This way, two people can't just convert each other's damage away. + M.adjustCloneLossAbstract(heal_amount * 1.2) //This way, two people can't just convert each other's damage away. else messagedelivered = FALSE examine_text = null diff --git a/code/modules/research/xenobiology/crossbreeding/_structures.dm b/code/modules/research/xenobiology/crossbreeding/_structures.dm index c9e79d2c662b1..5cd94cc33ce0d 100644 --- a/code/modules/research/xenobiology/crossbreeding/_structures.dm +++ b/code/modules/research/xenobiology/crossbreeding/_structures.dm @@ -167,7 +167,7 @@ GLOBAL_LIST_EMPTY(bluespace_slime_crystals) switch(rand_dam_type) if(0) - carbon_mob.adjustBruteLoss(-heal_amt) + carbon_mob.adjustBruteLossAbstract(-heal_amt) if(1) carbon_mob.adjustFireLoss(-heal_amt) if(2) @@ -175,7 +175,7 @@ GLOBAL_LIST_EMPTY(bluespace_slime_crystals) if(3) carbon_mob.adjustToxLoss(-heal_amt, forced = TRUE) if(4) - carbon_mob.adjustCloneLoss(-heal_amt) + carbon_mob.adjustCloneLossAbstract(-heal_amt) if(5) carbon_mob.adjustStaminaLoss(-heal_amt) if(6 to 10) @@ -202,7 +202,7 @@ GLOBAL_LIST_EMPTY(bluespace_slime_crystals) if(!iscyborg(affected_mob)) return var/mob/living/silicon/borgo = affected_mob - borgo.adjustBruteLoss(-heal_amt) + borgo.adjustBruteLossAbstract(-heal_amt) /obj/structure/slime_crystal/yellow colour = "yellow" @@ -214,7 +214,7 @@ GLOBAL_LIST_EMPTY(bluespace_slime_crystals) . = ..() set_light(3) -/obj/structure/slime_crystal/yellow/attacked_by(obj/item/I, mob/living/user) +/obj/structure/slime_crystal/yellow/on_attacked(obj/item/I, mob/living/user) if(istype(I,/obj/item/stock_parts/cell)) var/obj/item/stock_parts/cell/cell = I //Punishment for greed @@ -470,7 +470,7 @@ GLOBAL_LIST_EMPTY(bluespace_slime_crystals) var/type = pick(/obj/item/reagent_containers/food/snacks/meat/slab,/obj/item/organ/heart,/obj/item/organ/lungs,/obj/item/organ/liver,/obj/item/organ/eyes,/obj/item/organ/tongue,/obj/item/organ/stomach,/obj/item/organ/ears) new type(get_turf(src)) -/obj/structure/slime_crystal/red/attacked_by(obj/item/I, mob/living/user) +/obj/structure/slime_crystal/red/on_attacked(obj/item/I, mob/living/user) if(blood_amt < 10) return ..() @@ -628,7 +628,7 @@ GLOBAL_LIST_EMPTY(bluespace_slime_crystals) for(var/X in subtypesof(/obj/item/slimecross/crystalline) - /obj/item/slimecross/crystalline/rainbow) inserted_cores[X] = FALSE -/obj/structure/slime_crystal/rainbow/attacked_by(obj/item/I, mob/living/user) +/obj/structure/slime_crystal/rainbow/on_attacked(obj/item/I, mob/living/user) . = ..() if(!istype(I,/obj/item/slimecross/crystalline) || istype(I,/obj/item/slimecross/crystalline/rainbow)) @@ -656,9 +656,9 @@ GLOBAL_LIST_EMPTY(bluespace_slime_crystals) SC.attack_hand(user) . = ..() -/obj/structure/slime_crystal/rainbow/attacked_by(obj/item/I, mob/living/user) +/obj/structure/slime_crystal/rainbow/on_attacked(obj/item/I, mob/living/user) for(var/X in inserted_cores) if(inserted_cores[X]) var/obj/structure/slime_crystal/SC = inserted_cores[X] - SC.attacked_by(user) + SC.on_attacked(user) . = ..() diff --git a/code/modules/research/xenobiology/crossbreeding/_weapons.dm b/code/modules/research/xenobiology/crossbreeding/_weapons.dm index 919e89af00f3a..7627ec0606a6f 100644 --- a/code/modules/research/xenobiology/crossbreeding/_weapons.dm +++ b/code/modules/research/xenobiology/crossbreeding/_weapons.dm @@ -11,7 +11,7 @@ Slimecrossing Weapons force = 15 force_string = "painful" -/obj/item/melee/arm_blade/slime/attack(mob/living/L, mob/user) +/obj/item/melee/arm_blade/slime/attack_mob_target(mob/living/L, mob/user) . = ..() if(prob(20)) user.emote("scream") @@ -31,25 +31,25 @@ Slimecrossing Weapons item_state = "rainbowknife" force = 15 throwforce = 15 - damtype = BRUTE + damtype = /datum/damage/brute /obj/item/kitchen/knife/rainbowknife/afterattack(atom/O, mob/user, proximity) if(proximity && istype(O, /mob/living)) - damtype = pick(BRUTE, BURN, TOX, OXY, CLONE) + damtype = pick(/datum/damage/brute, /datum/damage/burn, /datum/damage/toxin, /datum/damage/suffocation, /datum/damage/clone) switch(damtype) - if(BRUTE) + if(/datum/damage/brute) hitsound = 'sound/weapons/bladeslice.ogg' attack_verb = list("slashed","sliced","cut") - if(BURN) + if(/datum/damage/burn) hitsound = 'sound/weapons/sear.ogg' attack_verb = list("burned","singed","heated") - if(TOX) + if(/datum/damage/toxin) hitsound = 'sound/weapons/pierce.ogg' attack_verb = list("poisoned","dosed","toxified") - if(OXY) + if(/datum/damage/suffocation) hitsound = 'sound/effects/space_wind.ogg' attack_verb = list("suffocated","winded","vacuumed") - if(CLONE) + if(/datum/damage/clone) hitsound = 'sound/items/geiger/ext1.ogg' attack_verb = list("irradiated","mutated","maligned") return ..() diff --git a/code/modules/research/xenobiology/crossbreeding/burning.dm b/code/modules/research/xenobiology/crossbreeding/burning.dm index d3b36d169f577..43cf1f6a507fc 100644 --- a/code/modules/research/xenobiology/crossbreeding/burning.dm +++ b/code/modules/research/xenobiology/crossbreeding/burning.dm @@ -213,9 +213,9 @@ Burning extracts: effect_desc = "The user gets a dull arm blade in the hand it is used in." /obj/item/slimecross/burning/green/do_effect(mob/user) - var/which_hand = "l_hand" + var/which_hand = BODY_ZONE_PRECISE_L_HAND if(!(user.active_hand_index % 2)) - which_hand = "r_hand" + which_hand = BODY_ZONE_PRECISE_R_HAND var/mob/living/L = user if(!istype(user)) return @@ -228,7 +228,7 @@ Burning extracts: else user.visible_message("[src] sublimates the flesh around [user]'s arm, transforming the bone into a gruesome blade!") user.emote("scream") - L.apply_damage(30,BURN,which_hand) + L.apply_damage(/datum/damage_source/temperature, /datum/damage/burn, 30, which_hand) ..() /obj/item/slimecross/burning/pink diff --git a/code/modules/research/xenobiology/crossbreeding/chilling.dm b/code/modules/research/xenobiology/crossbreeding/chilling.dm index 0e66d55d89e12..6572024179c95 100644 --- a/code/modules/research/xenobiology/crossbreeding/chilling.dm +++ b/code/modules/research/xenobiology/crossbreeding/chilling.dm @@ -242,9 +242,9 @@ Chilling extracts: effect_desc = "Creates a bone gun in the hand it is used in, which uses blood as ammo." /obj/item/slimecross/chilling/green/do_effect(mob/user) - var/which_hand = "l_hand" + var/which_hand = BODY_ZONE_PRECISE_L_HAND if(!(user.active_hand_index % 2)) - which_hand = "r_hand" + which_hand = BODY_ZONE_PRECISE_R_HAND var/mob/living/L = user if(!istype(user)) return @@ -257,7 +257,7 @@ Chilling extracts: else user.visible_message("[src] chills and snaps off the front of the bone on [user]'s arm, leaving behind a strange, gun-like structure!") user.emote("scream") - L.apply_damage(30,BURN,which_hand) + L.apply_damage(/datum/damage_source/temperature, /datum/damage/burn, 30, which_hand) ..() /obj/item/slimecross/chilling/pink diff --git a/code/modules/research/xenobiology/crossbreeding/consuming.dm b/code/modules/research/xenobiology/crossbreeding/consuming.dm index 448efc4f539eb..b2ef7f52bf01f 100644 --- a/code/modules/research/xenobiology/crossbreeding/consuming.dm +++ b/code/modules/research/xenobiology/crossbreeding/consuming.dm @@ -59,7 +59,7 @@ Consuming extracts: /obj/item/slime_cookie/proc/do_effect(mob/living/M, mob/user) return -/obj/item/slime_cookie/attack(mob/living/M, mob/user) +/obj/item/slime_cookie/attack_mob_target(mob/living/M, mob/user) var/fed = FALSE if(M == user) M.visible_message("[user] eats [src]!", "You eat [src].") @@ -120,11 +120,11 @@ Consuming extracts: taste = "fruit jam and cough medicine" /obj/item/slime_cookie/purple/do_effect(mob/living/M, mob/user) - M.adjustBruteLoss(-5) + M.adjustBruteLossAbstract(-5) M.adjustFireLoss(-5) M.adjustToxLoss(-5, forced=1) //To heal slimepeople. M.adjustOxyLoss(-5) - M.adjustCloneLoss(-5) + M.adjustCloneLossAbstract(-5) M.adjustOrganLoss(ORGAN_SLOT_BRAIN, -5) /obj/item/slimecross/consuming/blue diff --git a/code/modules/research/xenobiology/crossbreeding/regenerative.dm b/code/modules/research/xenobiology/crossbreeding/regenerative.dm index 643514632acb8..d8d5975aaab16 100644 --- a/code/modules/research/xenobiology/crossbreeding/regenerative.dm +++ b/code/modules/research/xenobiology/crossbreeding/regenerative.dm @@ -261,7 +261,7 @@ Regenerative extracts: T.dna.transfer_identity(D) D.updateappearance(mutcolor_update=1) D.real_name = T.real_name - dummy.adjustBruteLoss(target.getBruteLoss()) + dummy.apply_damage(/datum/damage_source/slime, BRUTE, target.getBruteLoss(), null) dummy.adjustFireLoss(target.getFireLoss()) dummy.adjustToxLoss(target.getToxLoss()) dummy.adjustOxyLoss(200) diff --git a/code/modules/research/xenobiology/xenobio_camera.dm b/code/modules/research/xenobiology/xenobio_camera.dm index 1ae8ca15fb5d8..701b045aa8c3d 100644 --- a/code/modules/research/xenobiology/xenobio_camera.dm +++ b/code/modules/research/xenobiology/xenobio_camera.dm @@ -324,7 +324,7 @@ DEFINE_BUFFER_HANDLER(/obj/machinery/computer/camera_advanced/xenobio) if(GLOB.cameranet.checkTurfVis(remote_eye.loc)) for(var/mob/living/simple_animal/slime/S in remote_eye.loc) - X.current_potion.attack(S, C) + X.current_potion.attack_mob_target(S, C) break else to_chat(owner, "Target is not near a camera. Cannot proceed.") @@ -404,7 +404,7 @@ DEFINE_BUFFER_HANDLER(/obj/machinery/computer/camera_advanced/xenobio) to_chat(C, "No potion loaded.") return if(mobarea.name == E.allowed_area || (mobarea.area_flags & XENOBIOLOGY_COMPATIBLE)) - X.current_potion.attack(S, C) + X.current_potion.attack_mob_target(S, C) //Picks up slime /obj/machinery/computer/camera_advanced/xenobio/proc/XenoSlimeClickShift(mob/living/user, mob/living/simple_animal/slime/S) diff --git a/code/modules/research/xenobiology/xenobiology.dm b/code/modules/research/xenobiology/xenobiology.dm index 60f518349e454..c4aaa22d0537e 100644 --- a/code/modules/research/xenobiology/xenobiology.dm +++ b/code/modules/research/xenobiology/xenobiology.dm @@ -54,7 +54,7 @@ return 5 SECONDS //Core-crossing: Feeding adult slimes extracts to obtain a much more powerful, single extract. -/obj/item/slime_extract/attack(mob/living/simple_animal/slime/M, mob/user) +/obj/item/slime_extract/attack_mob_target(mob/living/simple_animal/slime/M, mob/user) if(!isslime(M)) return ..() if(M.stat) @@ -308,7 +308,7 @@ switch(activation_type) if(SLIME_ACTIVATE_MINOR) to_chat(user, "You activate [src]. Your genome feels more stable!") - user.adjustCloneLoss(-15) + user.adjustCloneLossAbstract(-15) user.reagents.add_reagent(/datum/reagent/medicine/mutadone, 10) user.reagents.add_reagent(/datum/reagent/medicine/potass_iodide, 10) return 25 SECONDS @@ -693,7 +693,7 @@ icon = 'icons/obj/chemical.dmi' icon_state = "potsilver" -/obj/item/slimepotion/slime/docility/attack(mob/living/simple_animal/slime/M, mob/user) +/obj/item/slimepotion/slime/docility/attack_mob_target(mob/living/simple_animal/slime/M, mob/user) if(!isslime(M)) to_chat(user, "The potion only works on slimes!") return ..() @@ -727,7 +727,7 @@ var/being_used = FALSE var/sentience_type = SENTIENCE_ORGANIC -/obj/item/slimepotion/slime/sentience/attack(mob/living/M, mob/user) +/obj/item/slimepotion/slime/sentience/attack_mob_target(mob/living/M, mob/user) if(being_used || !ismob(M)) return if(!(GLOB.ghost_role_flags & GHOSTROLE_SPAWNER)) @@ -835,7 +835,7 @@ icon = 'icons/obj/chemical.dmi' icon_state = "potred" -/obj/item/slimepotion/slime/steroid/attack(mob/living/simple_animal/slime/M, mob/user) +/obj/item/slimepotion/slime/steroid/attack_mob_target(mob/living/simple_animal/slime/M, mob/user) if(!isslime(M))//If target is not a slime. to_chat(user, "The steroid only works on baby slimes!") return ..() @@ -865,7 +865,7 @@ icon = 'icons/obj/chemical.dmi' icon_state = "potcyan" -/obj/item/slimepotion/slime/stabilizer/attack(mob/living/simple_animal/slime/M, mob/user) +/obj/item/slimepotion/slime/stabilizer/attack_mob_target(mob/living/simple_animal/slime/M, mob/user) if(!isslime(M)) to_chat(user, "The stabilizer only works on slimes!") return ..() @@ -886,7 +886,7 @@ icon = 'icons/obj/chemical.dmi' icon_state = "potgreen" -/obj/item/slimepotion/slime/mutator/attack(mob/living/simple_animal/slime/M, mob/user) +/obj/item/slimepotion/slime/mutator/attack_mob_target(mob/living/simple_animal/slime/M, mob/user) if(!isslime(M)) to_chat(user, "The mutator only works on slimes!") return ..() @@ -987,7 +987,7 @@ icon = 'icons/obj/chemical.dmi' icon_state = "potlightpink" -/obj/item/slimepotion/genderchange/attack(mob/living/target, mob/user) +/obj/item/slimepotion/genderchange/attack_mob_target(mob/living/target, mob/user) if(!isliving(target) || target.stat == DEAD) to_chat(user, "[src] can only be used on living things!") return @@ -1016,7 +1016,7 @@ var/being_used = FALSE -/obj/item/slimepotion/slime/renaming/attack(mob/living/target, mob/living/user) +/obj/item/slimepotion/slime/renaming/attack_mob_target(mob/living/target, mob/living/user) if(!ismob(target)) return ..() if(being_used) @@ -1094,7 +1094,7 @@ icon = 'icons/obj/chemical.dmi' icon_state = "potgrey" -/obj/item/slimepotion/slime/slimeradio/attack(mob/living/target, mob/user) +/obj/item/slimepotion/slime/slimeradio/attack_mob_target(mob/living/target, mob/user) if(!isanimal(target)) to_chat(user, "[target] is too complex for the potion!") return diff --git a/code/modules/ruins/objects_and_mobs/sin_ruins.dm b/code/modules/ruins/objects_and_mobs/sin_ruins.dm index 2cf58fe8d1585..6d51b22976f1f 100644 --- a/code/modules/ruins/objects_and_mobs/sin_ruins.dm +++ b/code/modules/ruins/objects_and_mobs/sin_ruins.dm @@ -18,7 +18,8 @@ user.visible_message(" As [user] tries to pull \the [src]'s lever, the machine seems to hesitate a bit.", "You feel as if you are trying to put at stake something you don't even have...\ You suddenly feel your mind... Suboptimal?") user.adjustOrganLoss(ORGAN_SLOT_BRAIN, 10) else - user.adjustCloneLoss(20) + var/datum/damage_source/magic/abstract/damage_source = FIND_DAMAGE_SOURCE + damage_source.apply_direct(user, CLONE, 20) obj_flags |= IN_USE if(user.stat) diff --git a/code/modules/ruins/spaceruin_code/hilbertshotel.dm b/code/modules/ruins/spaceruin_code/hilbertshotel.dm index 5d92c5140ea0f..ef0247cd651a0 100644 --- a/code/modules/ruins/spaceruin_code/hilbertshotel.dm +++ b/code/modules/ruins/spaceruin_code/hilbertshotel.dm @@ -32,7 +32,7 @@ GLOBAL_VAR_INIT(hhmysteryRoomNumber, 1337) ejectRooms() return ..() -/obj/item/hilbertshotel/attack(mob/living/M, mob/living/user) +/obj/item/hilbertshotel/attack_mob_target(mob/living/M, mob/living/user) if(M.mind) to_chat(user, "You invite [M] to the hotel.") promptAndCheckIn(M) @@ -299,10 +299,11 @@ GLOBAL_VAR_INIT(hhmysteryRoomNumber, 1337) /turf/closed/indestructible/hoteldoor/attack_hulk(mob/living/carbon/human/user, does_attack_animation) promptExit(user) -/turf/closed/indestructible/hoteldoor/attack_larva(mob/user) +/turf/closed/indestructible/hoteldoor/larva_attack_intercept(mob/user) promptExit(user) + return TRUE -/turf/closed/indestructible/hoteldoor/attack_slime(mob/user) +/turf/closed/indestructible/hoteldoor/after_attacked_by_slime(mob/user) promptExit(user) /turf/closed/indestructible/hoteldoor/attack_robot(mob/user) diff --git a/code/modules/spells/spell.dm b/code/modules/spells/spell.dm index 7719b5bf30d12..c251c85e1f0a5 100644 --- a/code/modules/spells/spell.dm +++ b/code/modules/spells/spell.dm @@ -412,7 +412,7 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th return switch(type) if("bruteloss") - target.adjustBruteLoss(amount) + target.apply_damage(/datum/damage_source/abstract, BRUTE, amount, null) if("fireloss") target.adjustFireLoss(amount) if("toxloss") @@ -693,5 +693,5 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th /obj/effect/proc_holder/spell/self/basic_heal/cast(mob/living/carbon/human/user) //Note the lack of "list/targets" here. Instead, use a "user" var depending on mob requirements. //Also, notice the lack of a "for()" statement that looks through the targets. This is, again, because the spell can only have a single target. user.visible_message("A wreath of gentle light passes over [user]!", "You wreath yourself in healing light!") - user.adjustBruteLoss(-10) + user.adjustBruteLossAbstract(-10) user.adjustFireLoss(-10) diff --git a/code/modules/spells/spell_types/godhand.dm b/code/modules/spells/spell_types/godhand.dm index 485fac26a5c69..57e05f09e8365 100644 --- a/code/modules/spells/spell_types/godhand.dm +++ b/code/modules/spells/spell_types/godhand.dm @@ -21,7 +21,7 @@ . = ..() ADD_TRAIT(src, TRAIT_NODROP, ABSTRACT_ITEM_TRAIT) -/obj/item/melee/touch_attack/attack(mob/target, mob/living/carbon/user) +/obj/item/melee/touch_attack/attack_mob_target(mob/target, mob/living/carbon/user) if(!iscarbon(user)) //Look ma, no hands return if(!(user.mobility_flags & MOBILITY_USE)) diff --git a/code/modules/spells/spell_types/rod_form.dm b/code/modules/spells/spell_types/rod_form.dm index 67d792eb97fbb..da594e77fd28d 100644 --- a/code/modules/spells/spell_types/rod_form.dm +++ b/code/modules/spells/spell_types/rod_form.dm @@ -53,4 +53,4 @@ qdel(src) return L.visible_message("[L] is penetrated by an immovable rod!" , "The rod penetrates you!" , "You hear a CLANG!") - L.adjustBruteLoss(70 + damage_bonus) + L.apply_damage(/datum/damage_source/bullet/unstoppable, BRUTE, 70 + damage_bonus, null) diff --git a/code/modules/spells/spell_types/shapeshift.dm b/code/modules/spells/spell_types/shapeshift.dm index edab5c1660551..08886aba851aa 100644 --- a/code/modules/spells/spell_types/shapeshift.dm +++ b/code/modules/spells/spell_types/shapeshift.dm @@ -14,7 +14,7 @@ var/revert_on_death = TRUE var/die_with_shapeshifted_form = TRUE var/convert_damage = TRUE //If you want to convert the caster's health to the shift, and vice versa. - var/convert_damage_type = BRUTE //Since simplemobs don't have advanced damagetypes, what to convert damage back into. + var/convert_damage_type = /datum/damage/brute //Since simplemobs don't have advanced damagetypes, what to convert damage back into. var/shapeshift_type var/list/possible_shapes = list(/mob/living/simple_animal/mouse,\ @@ -104,10 +104,10 @@ stored.forceMove(src) stored.notransform = TRUE if(convert_damage || istype(source) && source.convert_damage) - var/damage_percent = (stored.maxHealth - stored.health)/stored.maxHealth; - var/damapply = damage_percent * shape.maxHealth; + var/damage_percent = (stored.maxHealth - stored.health)/stored.maxHealth + var/damapply = damage_percent * shape.maxHealth - shape.apply_damage(damapply, source.convert_damage_type, forced = TRUE); + shape.apply_damage(/datum/damage_source/abstract, source.convert_damage_type, damapply, forced = TRUE) slink = soullink(/datum/soullink/shapeshift, stored , shape) slink.source = src @@ -166,7 +166,7 @@ var/damage_percent = (shape.maxHealth - shape.health)/shape.maxHealth; var/damapply = stored.maxHealth * damage_percent - stored.apply_damage(damapply, (istype(source) ? source.convert_damage_type : BRUTE), forced = TRUE) //brute is the default damage convert + stored.apply_damage(/datum/damage_source/abstract, (istype(source) ? source.convert_damage_type : /datum/damage/brute), damapply, forced = TRUE) stored.blood_volume = original_blood_volume if(!QDELETED(shape)) qdel(shape) diff --git a/code/modules/spells/spell_types/wizard.dm b/code/modules/spells/spell_types/wizard.dm index ffef4081e3b99..a700554da465d 100644 --- a/code/modules/spells/spell_types/wizard.dm +++ b/code/modules/spells/spell_types/wizard.dm @@ -285,7 +285,7 @@ if(isliving(AM)) var/mob/living/M = AM M.Paralyze(100) - M.adjustBruteLoss(5) + M.apply_damage(/datum/damage_source/impact, BRUTE, 5, null) to_chat(M, "You're slammed into the floor by [user]!") else new sparkle_path(get_turf(AM), get_dir(user, AM)) //created sparkles will disappear on their own diff --git a/code/modules/surgery/advanced/bioware/experimental_dissection.dm b/code/modules/surgery/advanced/bioware/experimental_dissection.dm index 76361e156f3a7..ac7a072ded439 100644 --- a/code/modules/surgery/advanced/bioware/experimental_dissection.dm +++ b/code/modules/surgery/advanced/bioware/experimental_dissection.dm @@ -49,15 +49,13 @@ /datum/surgery_step/dissection/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) user.visible_message("[user] dissects [target]!", "You dissect [target], and add your discoveries to the research database!") SSresearch.science_tech.add_point_list(list(TECHWEB_POINT_TYPE_DISCOVERY = check_value(target))) - var/obj/item/bodypart/L = target.get_bodypart(BODY_ZONE_CHEST) - target.apply_damage(80, BRUTE, L) + target.apply_damage(/datum/damage_source/sharp/incision, /datum/damage/brute, 80, BODY_ZONE_CHEST) ADD_TRAIT(target, TRAIT_DISSECTED, "surgery") return TRUE /datum/surgery_step/dissection/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) user.visible_message("[user] dissects [target]!", "You dissect [target], but do not find anything particularly interesting.") SSresearch.science_tech.add_point_list(list(TECHWEB_POINT_TYPE_DISCOVERY = (check_value(target) * 0.2))) - var/obj/item/bodypart/L = target.get_bodypart(BODY_ZONE_CHEST) - target.apply_damage(80, BRUTE, L) + target.apply_damage(/datum/damage_source/sharp/incision, /datum/damage/brute, 80, BODY_ZONE_CHEST) ADD_TRAIT(target, TRAIT_DISSECTED, "surgery") return TRUE diff --git a/code/modules/surgery/advanced/revival.dm b/code/modules/surgery/advanced/revival.dm index f18ed376e04f6..e7d530c4903ed 100644 --- a/code/modules/surgery/advanced/revival.dm +++ b/code/modules/surgery/advanced/revival.dm @@ -66,7 +66,6 @@ playsound(get_turf(target), 'sound/magic/lightningbolt.ogg', 50, 1) target.grab_ghost() target.adjustOxyLoss(-50, 0) - target.updatehealth() if(target.revive()) target.visible_message("...[target] wakes up, alive and aware!") target.emote("gasp") diff --git a/code/modules/surgery/anesthetic_machine.dm b/code/modules/surgery/anesthetic_machine.dm index dbfb594cf514c..2cd16de572bb8 100644 --- a/code/modules/surgery/anesthetic_machine.dm +++ b/code/modules/surgery/anesthetic_machine.dm @@ -30,7 +30,7 @@ if(retract_mask()) visible_message("[user] retracts the mask back into \the [src].") -/obj/machinery/anesthetic_machine/attacked_by(obj/item/I, mob/living/user) +/obj/machinery/anesthetic_machine/on_attacked(obj/item/I, mob/living/user) if(istype(I, /obj/item/tank)) if(attached_tank) // If there is an attached tank, remove it and drop it on the floor attached_tank.forceMove(loc) diff --git a/code/modules/surgery/blood_filter.dm b/code/modules/surgery/blood_filter.dm index d1d28b9b42bf2..ad80ba3048105 100644 --- a/code/modules/surgery/blood_filter.dm +++ b/code/modules/surgery/blood_filter.dm @@ -90,7 +90,7 @@ display_results(user, target, "You screw up, brusing [target]'s chest!", "[user] screws up, brusing [target]'s chest!", "[user] screws up!") - target.adjustBruteLoss(5) + target.apply_damage(/datum/damage_source/sharp/incision, BRUTE, 5, null) /datum/surgery/blood_filter/upgraded name = "Filter Blood (Adv.)" diff --git a/code/modules/surgery/bodyparts/bodyparts.dm b/code/modules/surgery/bodyparts/bodyparts.dm index e9c4d411168f6..7f4170ae950a8 100644 --- a/code/modules/surgery/bodyparts/bodyparts.dm +++ b/code/modules/surgery/bodyparts/bodyparts.dm @@ -104,7 +104,7 @@ owner = null return ..() -/obj/item/bodypart/attack(mob/living/carbon/C, mob/user) +/obj/item/bodypart/attack_mob_target(mob/living/carbon/C, mob/user) if(ishuman(C)) var/mob/living/carbon/human/H = C if(HAS_TRAIT(C, TRAIT_LIMBATTACHMENT)) @@ -166,7 +166,7 @@ //Applies brute and burn damage to the organ. Returns 1 if the damage-icon states changed at all. //Damage will not exceed max_damage using this proc //Cannot apply negative damage -/obj/item/bodypart/proc/receive_damage(brute = 0, burn = 0, stamina = 0, blocked = 0, updating_health = TRUE, required_status = null) +/obj/item/bodypart/proc/receive_damage(brute = 0, burn = 0, stamina = 0, blocked = 0, required_status = null) var/hit_percent = (100-blocked)/100 if((!brute && !burn && !stamina) || hit_percent <= 0) return FALSE @@ -209,9 +209,8 @@ var/applied_damage = min(max_stamina_damage - stamina_dam, available_damage) stamina_dam += round(CLAMP(stamina, 0, applied_damage), DAMAGE_PRECISION) - - if(owner && updating_health) - owner.updatehealth() + if (owner) + UPDATE_HEALTH(owner) if(stamina >= DAMAGE_PRECISION) owner.update_stamina(TRUE) owner.stam_regen_start_time = max(owner.stam_regen_start_time, world.time + STAMINA_REGEN_BLOCK_TIME) @@ -222,7 +221,7 @@ //Heals brute and burn damage for the organ. Returns 1 if the damage-icon states changed at all. //Damage cannot go below zero. //Cannot remove negative damage (i.e. apply damage) -/obj/item/bodypart/proc/heal_damage(brute, burn, stamina, required_status, updating_health = TRUE) +/obj/item/bodypart/proc/heal_damage(brute, burn, stamina, required_status) if(required_status && !(bodytype & required_status)) //So we can only heal certain kinds of limbs, ie robotic vs organic. return @@ -230,8 +229,8 @@ brute_dam = round(max(brute_dam - brute, 0), DAMAGE_PRECISION) burn_dam = round(max(burn_dam - burn, 0), DAMAGE_PRECISION) stamina_dam = round(max(stamina_dam - stamina, 0), DAMAGE_PRECISION) - if(owner && updating_health) - owner.updatehealth() + if (owner) + UPDATE_HEALTH(owner) if(owner.dna && owner.dna.species && (REVIVESBYHEALING in owner.dna.species.species_traits)) if(owner.health > 0 && !owner.ishellbound()) owner.revive(0) @@ -295,6 +294,8 @@ brute_dam = 0 brutestate = 0 burnstate = 0 + if (owner) + UPDATE_HEALTH(owner) if(change_icon_to_default) if(IS_ORGANIC_LIMB(src)) @@ -303,7 +304,6 @@ icon = DEFAULT_BODYPART_ICON_ROBOTIC if(owner) - owner.updatehealth() owner.update_body() //if our head becomes robotic, we remove the lizard horns and human hair. owner.update_hair() owner.update_damage_overlays() diff --git a/code/modules/surgery/bodyparts/helpers.dm b/code/modules/surgery/bodyparts/helpers.dm index 5321da254718a..d497d1a9277c8 100644 --- a/code/modules/surgery/bodyparts/helpers.dm +++ b/code/modules/surgery/bodyparts/helpers.dm @@ -160,7 +160,7 @@ which_hand = BODY_ZONE_PRECISE_R_HAND return get_bodypart(check_zone(which_hand)) -//Helper for quickly creating a new limb - used by augment code in species.dm spec_attacked_by +//Helper for quickly creating a new limb - used by augment code in species.dm spec_on_attacked // // FUCK YOU AUGMENT CODE - With love, Kapu /mob/living/carbon/proc/newBodyPart(zone, robotic, fixed_icon) diff --git a/code/modules/surgery/coronary_bypass.dm b/code/modules/surgery/coronary_bypass.dm index c1bb905f58e5c..eb9f0dd713742 100644 --- a/code/modules/surgery/coronary_bypass.dm +++ b/code/modules/surgery/coronary_bypass.dm @@ -35,7 +35,7 @@ "Blood pools around the incision in [H]'s heart.", "") H.bleed_rate += 10 - H.adjustBruteLoss(10) + H.apply_damage(/datum/damage_source/sharp/incision, BRUTE, 10, null) return TRUE /datum/surgery_step/incise_heart/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) @@ -46,7 +46,7 @@ "[user] screws up, causing blood to spurt out of [H]'s chest!") H.bleed_rate += 20 H.adjustOrganLoss(ORGAN_SLOT_HEART, 10) - H.adjustBruteLoss(10) + H.apply_damage(/datum/damage_source/sharp/incision, BRUTE, 10, null) //grafts a coronary bypass onto the individual's heart, success chance is 90% base again /datum/surgery_step/coronary_bypass diff --git a/code/modules/surgery/organic_steps.dm b/code/modules/surgery/organic_steps.dm index fd399e6d52962..681aaddfa7f70 100644 --- a/code/modules/surgery/organic_steps.dm +++ b/code/modules/surgery/organic_steps.dm @@ -121,7 +121,7 @@ "[user] begins to saw through the bone in [target]'s [parse_zone(target_zone)].") /datum/surgery_step/saw/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) - target.apply_damage(50, BRUTE, "[target_zone]") + target.apply_damage(/datum/damage_source/sharp/incision, /datum/damage/brute, 50, target_zone) display_results(user, target, "You saw [target]'s [parse_zone(target_zone)] open.", "[user] saws [target]'s [parse_zone(target_zone)] open!", "[user] saws [target]'s [parse_zone(target_zone)] open!") diff --git a/code/modules/surgery/organs/augments_chest.dm b/code/modules/surgery/organs/augments_chest.dm index 069b3739b4180..869a75613f6ae 100644 --- a/code/modules/surgery/organs/augments_chest.dm +++ b/code/modules/surgery/organs/augments_chest.dm @@ -80,7 +80,7 @@ owner.adjustOxyLoss(-5) revive_cost += 5 if(owner.getBruteLoss()) - owner.adjustBruteLoss(-2) + owner.adjustBruteLossAbstract(-2) revive_cost += 40 if(owner.getFireLoss()) owner.adjustFireLoss(-2) diff --git a/code/modules/surgery/organs/heart.dm b/code/modules/surgery/organs/heart.dm index 97afce1b052a4..df5c40878dffc 100644 --- a/code/modules/surgery/organs/heart.dm +++ b/code/modules/surgery/organs/heart.dm @@ -108,7 +108,7 @@ var/heal_oxy = 0 -/obj/item/organ/heart/cursed/attack(mob/living/carbon/human/H, mob/living/carbon/human/user, obj/target) +/obj/item/organ/heart/cursed/attack_mob_target(mob/living/carbon/human/H, mob/living/carbon/human/user, obj/target) if(H == user && istype(H)) playsound(user,'sound/effects/singlebeat.ogg',40,1) user.temporarilyRemoveItemFromInventory(src, TRUE) @@ -161,7 +161,7 @@ H.blood_volume = min(H.blood_volume + cursed_heart.blood_loss*0.5, BLOOD_VOLUME_MAXIMUM) H.remove_client_colour(/datum/client_colour/cursed_heart_blood) cursed_heart.add_colour = TRUE - H.adjustBruteLoss(-cursed_heart.heal_brute) + H.adjustBruteLossAbstract(-cursed_heart.heal_brute) H.adjustFireLoss(-cursed_heart.heal_burn) H.adjustOxyLoss(-cursed_heart.heal_oxy) diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm index 7f78720d0cd43..ae76a59828d1d 100644 --- a/code/modules/surgery/organs/lungs.dm +++ b/code/modules/surgery/organs/lungs.dm @@ -25,7 +25,7 @@ var/safe_breath_max = 50 var/safe_breath_dam_min = MIN_TOXIC_GAS_DAMAGE var/safe_breath_dam_max = MAX_TOXIC_GAS_DAMAGE - var/safe_damage_type = OXY + var/safe_damage_type = /datum/damage/suffocation var/list/gas_min = list() var/list/gas_max = list( GAS_CO2 = 30, // Yes it's an arbitrary value who cares? @@ -35,12 +35,12 @@ "default" = list( min = MIN_TOXIC_GAS_DAMAGE, max = MAX_TOXIC_GAS_DAMAGE, - damage_type = OXY + damage_type = /datum/damage/suffocation ), GAS_PLASMA = list( min = MIN_TOXIC_GAS_DAMAGE, max = MAX_TOXIC_GAS_DAMAGE, - damage_type = TOX + damage_type = /datum/damage/toxin ) ) @@ -57,7 +57,7 @@ var/cold_level_1_damage = COLD_GAS_DAMAGE_LEVEL_1 //Keep in mind with gas damage levels, you can set these to be negative, if you want someone to heal, instead. var/cold_level_2_damage = COLD_GAS_DAMAGE_LEVEL_2 var/cold_level_3_damage = COLD_GAS_DAMAGE_LEVEL_3 - var/cold_damage_type = BURN + var/cold_damage_type = /datum/damage/burn var/hot_message = "your face burning and a searing heat" var/heat_level_1_threshold = 360 @@ -66,7 +66,7 @@ var/heat_level_1_damage = HEAT_GAS_DAMAGE_LEVEL_1 var/heat_level_2_damage = HEAT_GAS_DAMAGE_LEVEL_2 var/heat_level_3_damage = HEAT_GAS_DAMAGE_LEVEL_3 - var/heat_damage_type = BURN + var/heat_damage_type = /datum/damage/burn var/crit_stabilizing_reagent = /datum/reagent/medicine/epinephrine @@ -198,7 +198,7 @@ H.reagents.add_reagent(danger_reagent,1) var/list/damage_info = (entry in gas_damage) ? gas_damage[entry] : gas_damage["default"] var/dam = found_pp / gas_max[entry] * 10 - H.apply_damage_type(clamp(dam, damage_info["min"], damage_info["max"]), damage_info["damage_type"]) + H.apply_damage(/datum/damage_source/temperature, damage_info["damage_type"], clamp(dam, damage_info["min"], damage_info["max"])) if(alert_category && alert_type) H.throw_alert(alert_category, alert_type) else if(alert_category) @@ -293,11 +293,11 @@ if(!HAS_TRAIT(H, TRAIT_RESISTCOLD)) // COLD DAMAGE var/cold_modifier = H.dna.species.coldmod if(breath_temperature < cold_level_3_threshold) - H.apply_damage_type(cold_level_3_damage*cold_modifier, cold_damage_type) + H.apply_damage(/datum/damage_source/temperature/internal, cold_damage_type, cold_level_3_damage*cold_modifier) if(breath_temperature > cold_level_3_threshold && breath_temperature < cold_level_2_threshold) - H.apply_damage_type(cold_level_2_damage*cold_modifier, cold_damage_type) + H.apply_damage(/datum/damage_source/temperature/internal, cold_damage_type, cold_level_2_damage*cold_modifier) if(breath_temperature > cold_level_2_threshold && breath_temperature < cold_level_1_threshold) - H.apply_damage_type(cold_level_1_damage*cold_modifier, cold_damage_type) + H.apply_damage(/datum/damage_source/temperature/internal, cold_damage_type, cold_level_1_damage*cold_modifier) if(breath_temperature < cold_level_1_threshold) if(prob(20)) to_chat(H, "You feel [cold_message] in your [name]!") @@ -305,11 +305,11 @@ if(!HAS_TRAIT(H, TRAIT_RESISTHEAT)) // HEAT DAMAGE var/heat_modifier = H.dna.species.heatmod if(breath_temperature > heat_level_1_threshold && breath_temperature < heat_level_2_threshold) - H.apply_damage_type(heat_level_1_damage*heat_modifier, heat_damage_type) + H.apply_damage(/datum/damage_source/temperature/internal, heat_damage_type, heat_level_1_damage*heat_modifier) if(breath_temperature > heat_level_2_threshold && breath_temperature < heat_level_3_threshold) - H.apply_damage_type(heat_level_2_damage*heat_modifier, heat_damage_type) + H.apply_damage(/datum/damage_source/temperature/internal, heat_damage_type, heat_level_2_damage*heat_modifier) if(breath_temperature > heat_level_3_threshold) - H.apply_damage_type(heat_level_3_damage*heat_modifier, heat_damage_type) + H.apply_damage(/datum/damage_source/temperature/internal, heat_damage_type, heat_level_3_damage*heat_modifier) if(breath_temperature > heat_level_1_threshold) if(prob(20)) to_chat(H, "You feel [hot_message] in your [name]!") diff --git a/code/modules/surgery/organs/vocal_cords.dm b/code/modules/surgery/organs/vocal_cords.dm index fcddc3608e558..363732582f3a8 100644 --- a/code/modules/surgery/organs/vocal_cords.dm +++ b/code/modules/surgery/organs/vocal_cords.dm @@ -315,7 +315,7 @@ cooldown = COOLDOWN_DAMAGE for(var/V in listeners) var/mob/living/L = V - L.apply_damage(15 * power_multiplier, def_zone = BODY_ZONE_CHEST) + L.apply_damage(/datum/damage_source/magic, /datum/damage/brute, 15 * power_multiplier, BODY_ZONE_CHEST) //BLEED else if((findtext(message, bleed_words))) diff --git a/code/modules/surgery/tools.dm b/code/modules/surgery/tools.dm index a0b4eb823de22..9a3d5d57fee13 100644 --- a/code/modules/surgery/tools.dm +++ b/code/modules/surgery/tools.dm @@ -233,7 +233,7 @@ w_class = WEIGHT_CLASS_TINY attack_verb = list("slapped") -/obj/item/surgical_drapes/attack(mob/living/M, mob/user) +/obj/item/surgical_drapes/attack_mob_target(mob/living/M, mob/user) if(!attempt_initiate_surgery(src, M, user)) ..() diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index 74ba63c071c5b..ec8ad3d3e68ef 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -87,6 +87,8 @@ #include "subsystem_metric_sanity.dm" #include "surgery_linking.dm" #include "techweb_sanity.dm" +#include "test_item_damage.dm" +#include "test_mob_attacks.dm" #include "tgui_create_message.dm" #include "timer_sanity.dm" #include "unit_test.dm" diff --git a/code/modules/unit_tests/metabolizing.dm b/code/modules/unit_tests/metabolizing.dm index 77c79482e70f6..38b3fb6399e28 100644 --- a/code/modules/unit_tests/metabolizing.dm +++ b/code/modules/unit_tests/metabolizing.dm @@ -7,7 +7,7 @@ // Give them enough meth to be consumed in 2 metabolizations pill.reagents.add_reagent(meth, initial(meth.metabolization_rate) * 1.9) - pill.attack(user, user) + pill.attack_mob_target(user, user) user.Life() TEST_ASSERT(user.reagents.has_reagent(meth), "User does not have meth in their system after consuming it") diff --git a/code/modules/unit_tests/test_item_damage.dm b/code/modules/unit_tests/test_item_damage.dm new file mode 100644 index 0000000000000..4b0602916c865 --- /dev/null +++ b/code/modules/unit_tests/test_item_damage.dm @@ -0,0 +1,26 @@ +/datum/unit_test/item_damage/Run() + . = list() + var/mob/living/carbon/human/aggressor = new(run_loc_floor_bottom_left) + var/mob/living/carbon/human/target = new(run_loc_floor_bottom_left) + // Always pass probability checks + GLOB.rigged_prob = TRUE + for (var/obj/item/item_type as() in subtypesof(/obj/item)) + // Ignore non-weapons since they made do weird things + if (!(initial(item_type.item_flags) & ISWEAPON)) + continue + // Heal the target + target.revive(TRUE, TRUE) + RESOLVE_HEALTH(target) + TEST_ASSERT_EQUAL(target.health, 100, "Target should be fully healthy") + // Create the item + var/obj/item/thing = new item_type + aggressor.put_in_active_hand(thing) + aggressor.a_intent = INTENT_HARM + aggressor.ClickOn(target) + RESOLVE_HEALTH(target) + // Check damage was taken + if (target.health != 100 - thing.force) + . += "[thing] did not deal [thing.force] damage on attack, instead it dealt [100 - target.health] damage." + qdel(thing) + if (length(.)) + Fail(jointext(., "\n")) diff --git a/code/modules/unit_tests/test_mob_attacks.dm b/code/modules/unit_tests/test_mob_attacks.dm new file mode 100644 index 0000000000000..ee53eaaae37ee --- /dev/null +++ b/code/modules/unit_tests/test_mob_attacks.dm @@ -0,0 +1,36 @@ +/datum/unit_test/mob_attacks + var/list/combat_mobs = list( + /mob/living/carbon/human, + /mob/living/carbon/monkey, + /mob/living/carbon/alien/humanoid/drone, + /mob/living/carbon/alien/larva, + /mob/living/simple_animal/hostile/bear, + /mob/living/simple_animal/slime, + ) + var/list/mob_targets = list( + /mob/living/carbon/human, + /mob/living/carbon/monkey, + /mob/living/simple_animal/hostile/bear, + /mob/living/simple_animal/chicken, + /mob/living/simple_animal/slime, + ) + +/datum/unit_test/mob_attacks/Run() + . = list() + // Always pass probability checks + GLOB.rigged_prob = TRUE + for (var/attacker in combat_mobs) + for (var/target in mob_targets) + var/mob/living/attacker_mob = new attacker(run_loc_floor_bottom_left) + var/mob/living/target_mob = new target(run_loc_floor_bottom_left) + var/original_health = target_mob.health + attacker_mob.a_intent = INTENT_HARM + attacker_mob.ClickOn(target_mob) + // Instantly resolve health for now + RESOLVE_HEALTH(target_mob) + if (target_mob.health >= original_health) + . += "[target] did not take damage when attacked by [attacker]" + qdel(attacker_mob) + qdel(target_mob) + if (length(.)) + Fail(jointext(., "\n")) diff --git a/code/modules/vehicles/cars/car.dm b/code/modules/vehicles/cars/car.dm index ea2d675daf265..e267155e6de7c 100644 --- a/code/modules/vehicles/cars/car.dm +++ b/code/modules/vehicles/cars/car.dm @@ -39,12 +39,12 @@ playsound(loc, 'sound/effects/splat.ogg', 50, 1) var/damage = 10 - H.apply_damage(2*damage, BRUTE, BODY_ZONE_HEAD) - H.apply_damage(2*damage, BRUTE, BODY_ZONE_CHEST) - H.apply_damage(0.5*damage, BRUTE, BODY_ZONE_L_LEG) - H.apply_damage(0.5*damage, BRUTE, BODY_ZONE_R_LEG) - H.apply_damage(0.5*damage, BRUTE, BODY_ZONE_L_ARM) - H.apply_damage(0.5*damage, BRUTE, BODY_ZONE_R_ARM) + H.apply_damage(/datum/damage_source/impact, /datum/damage/brute, 2*damage, BODY_ZONE_HEAD) + H.apply_damage(/datum/damage_source/impact, /datum/damage/brute, 2*damage, BODY_ZONE_CHEST) + H.apply_damage(/datum/damage_source/impact, /datum/damage/brute, 0.5*damage, BODY_ZONE_L_LEG) + H.apply_damage(/datum/damage_source/impact, /datum/damage/brute, 0.5*damage, BODY_ZONE_R_LEG) + H.apply_damage(/datum/damage_source/impact, /datum/damage/brute, 0.5*damage, BODY_ZONE_L_ARM) + H.apply_damage(/datum/damage_source/impact, /datum/damage/brute, 0.5*damage, BODY_ZONE_R_ARM) var/turf/T = get_turf(src) T.add_mob_blood(H) @@ -69,7 +69,7 @@ mob_exit(M, silent) return TRUE -/obj/vehicle/sealed/car/attacked_by(obj/item/I, mob/living/user) +/obj/vehicle/sealed/car/on_attacked(obj/item/I, mob/living/user) if(!I.force) return if(occupants[user]) diff --git a/code/modules/vehicles/cars/clowncar.dm b/code/modules/vehicles/cars/clowncar.dm index 9d5c108257f06..ff1e68c3fab11 100644 --- a/code/modules/vehicles/cars/clowncar.dm +++ b/code/modules/vehicles/cars/clowncar.dm @@ -56,7 +56,7 @@ visible_message("[src] spews out a ton of space lube!") new /obj/effect/particle_effect/foam(loc) //YEET -/obj/vehicle/sealed/car/clowncar/attacked_by(obj/item/I, mob/living/user) +/obj/vehicle/sealed/car/clowncar/on_attacked(obj/item/I, mob/living/user) . = ..() if(istype(I, /obj/item/reagent_containers/food/snacks/grown/banana)) var/obj/item/reagent_containers/food/snacks/grown/banana/banana = I diff --git a/code/modules/vehicles/scooter.dm b/code/modules/vehicles/scooter.dm index c3b99d2140c72..da281ee446576 100644 --- a/code/modules/vehicles/scooter.dm +++ b/code/modules/vehicles/scooter.dm @@ -113,7 +113,6 @@ if(!head_slot || !(istype(head_slot,/obj/item/clothing/head/helmet) || istype(head_slot,/obj/item/clothing/head/hardhat))) if(prob(multiplier * 100)) //pro skaters get a 70% chance to not get the brain damage H.adjustOrganLoss(ORGAN_SLOT_BRAIN, 5) - H.updatehealth() visible_message("[src] crashes into [A], sending [H] flying!") H.Paralyze(80 * multiplier) else @@ -306,6 +305,5 @@ if(!head_slot || !(istype(head_slot,/obj/item/clothing/head/helmet) || istype(head_slot,/obj/item/clothing/head/hardhat))) if(prob(multiplier * 100)) //Pro skaters have a 70% chance to not get the brain damage H.adjustOrganLoss(ORGAN_SLOT_BRAIN, 1) - H.updatehealth() visible_message("[src] crashes into [A], sending [H] flying!") playsound(src, 'sound/effects/bang.ogg', 50, 1) diff --git a/code/modules/vehicles/speedbike.dm b/code/modules/vehicles/speedbike.dm index 85b0cf08abf6b..9185d306b24ae 100644 --- a/code/modules/vehicles/speedbike.dm +++ b/code/modules/vehicles/speedbike.dm @@ -84,7 +84,7 @@ H.Paralyze(multiplier * 100) H.adjustStaminaLoss(multiplier * 30) if(prob(multiplier * 100)) - H.apply_damage(rand(20,35), BRUTE) + H.apply_damage(/datum/damage_source/impact, /datum/damage/brute, rand(20, 35)) if(!crash_all) H.throw_at(throw_target, 4, 3) visible_message("[src] crashes into [H]!") diff --git a/code/modules/vehicles/vehicle_actions.dm b/code/modules/vehicles/vehicle_actions.dm index 46551c7348b6e..5acb70a80994c 100644 --- a/code/modules/vehicles/vehicle_actions.dm +++ b/code/modules/vehicles/vehicle_actions.dm @@ -251,7 +251,7 @@ if(prob(15)) V.visible_message("You smack against the board, hard.", "[L] misses the landing and falls on [L.p_their()] face!") L.emote("scream") - L.adjustBruteLoss(10) // thats gonna leave a mark + L.apply_damage(/datum/damage_source/impact, BRUTE, 10, null) // thats gonna leave a mark return V.visible_message("You fall flat onto the board!", "[L] misses the landing and falls on [L.p_their()] face!") else diff --git a/code/modules/vending/_vending.dm b/code/modules/vending/_vending.dm index b0f3a5e0a3fe7..56d4a11a78730 100644 --- a/code/modules/vending/_vending.dm +++ b/code/modules/vending/_vending.dm @@ -482,10 +482,10 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C C.bleed(150) var/obj/item/bodypart/l_leg/l = C.get_bodypart(BODY_ZONE_L_LEG) if(l) - l.receive_damage(brute=200, updating_health=TRUE) + l.receive_damage(brute=200) var/obj/item/bodypart/r_leg/r = C.get_bodypart(BODY_ZONE_R_LEG) if(r) - r.receive_damage(brute=200, updating_health=TRUE) + r.receive_damage(brute=200) if(l || r) C.visible_message("[C]'s legs shatter with a sickening crunch!", \ "Your legs shatter with a sickening crunch!") @@ -517,14 +517,14 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C qdel(O) new /obj/effect/gibspawner/human/bodypartless(get_turf(C)) - C.apply_damage(max(0, squish_damage - crit_rebate), forced=TRUE) + C.apply_damage(/datum/damage_source/crush, /datum/damage/brute, max(0, squish_damage - crit_rebate), forced=TRUE) C.AddElement(/datum/element/squish, 80 SECONDS) else L.visible_message("[L] is crushed by [src]!", \ "You are crushed by [src]!") - L.apply_damage(squish_damage, forced=TRUE) + L.apply_damage(/datum/damage_source/crush, /datum/damage/brute, squish_damage, forced=TRUE) if(crit_case) - L.apply_damage(squish_damage, forced=TRUE) + L.apply_damage(/datum/damage_source/crush, /datum/damage/brute, squish_damage, forced=TRUE) L.Paralyze(60) L.emote("scream") diff --git a/code/modules/wiremod/core/marker.dm b/code/modules/wiremod/core/marker.dm index 159219893df17..f851c1415e2fc 100644 --- a/code/modules/wiremod/core/marker.dm +++ b/code/modules/wiremod/core/marker.dm @@ -26,11 +26,14 @@ clear_marked_atom() return TRUE -/obj/item/multitool/circuit/melee_attack_chain(mob/user, atom/target, params) - if(marked_atom || !user.Adjacent(target)) - return ..() +/obj/item/multitool/circuit/interact_with(atom/target, mob/user, params) + if (..()) + return TRUE + if(marked_atom) + balloon_alert(user, "You already have a marked object!") + return TRUE - say("Marked [target].") + balloon_alert(user, "Marked [target].") marked_atom = target RegisterSignal(marked_atom, COMSIG_PARENT_QDELETING, PROC_REF(cleanup_marked_atom)) update_icon() diff --git a/code/modules/xenoarchaeology/traits/xenoartifact_majors.dm b/code/modules/xenoarchaeology/traits/xenoartifact_majors.dm index c0a3a3559c3fa..6f22c29002c45 100644 --- a/code/modules/xenoarchaeology/traits/xenoartifact_majors.dm +++ b/code/modules/xenoarchaeology/traits/xenoartifact_majors.dm @@ -323,7 +323,7 @@ var/mob/living/victim = target switch(healing_type) if(BRUTE) - victim.adjustBruteLoss((X.charge*0.25)*-1) + victim.adjustBruteLossAbstract((X.charge*0.25)*-1) if(BURN) victim.adjustFireLoss((X.charge*0.25)*-1) if(TOX) diff --git a/code/modules/zombie/items.dm b/code/modules/zombie/items.dm index d3bf42e72b6a7..04e60fd5b1bd2 100644 --- a/code/modules/zombie/items.dm +++ b/code/modules/zombie/items.dm @@ -12,7 +12,7 @@ var/icon_right = "bloodhand_right" hitsound = 'sound/hallucinations/growl1.ogg' force = 21 // Just enough to break airlocks with melee attacks - damtype = BRUTE + damtype = /datum/damage/brute /obj/item/zombie_hand/Initialize(mapload) . = ..() @@ -72,10 +72,9 @@ var/hp_gained = target.maxHealth target.gib() // zero as argument for no instant health update - user.adjustBruteLoss(-hp_gained, 0) + user.adjustBruteLossAbstract(-hp_gained) user.adjustToxLoss(-hp_gained, 0) user.adjustFireLoss(-hp_gained, 0) - user.adjustCloneLoss(-hp_gained, 0) - user.updatehealth() + user.adjustCloneLossAbstract(-hp_gained, 0) user.adjustOrganLoss(ORGAN_SLOT_BRAIN, -hp_gained) // Zom Bee gibbers "BRAAAAISNSs!1!" user.set_nutrition(min(user.nutrition + hp_gained, NUTRITION_LEVEL_FULL)) diff --git a/html/changelogs/.all_changelog.yml b/html/changelogs/.all_changelog.yml index 5a8de50d08244..038c76e22c2c9 100644 --- a/html/changelogs/.all_changelog.yml +++ b/html/changelogs/.all_changelog.yml @@ -21669,7 +21669,7 @@ DO NOT EDIT THIS FILE BY HAND! AUTOMATICALLY GENERATED BY ss13_genchangelog.py. - bugfix: Fixed vampires repairing robotic limbs every tick of life()... - bugfix: Fixed shadowpeople healing robotic limbs every tick of life() - bugfix: Fixed poppeople healing robotic limbs every tick of life() - - bugfix: Fixed adjustBruteLoss and adjustFireLoss not properly discriminating for + - bugfix: Fixed adjustBruteLossAbstract and adjustFireLoss not properly discriminating for limb status types. - tweak: Fixed bibles healing robotic limbs, because your false deity can't fix SCIENCE. diff --git a/tools/Runtime Condenser/Input.txt b/tools/Runtime Condenser/Input.txt index 4504436d88500..1cb2b4edd3151 100644 --- a/tools/Runtime Condenser/Input.txt +++ b/tools/Runtime Condenser/Input.txt @@ -543,11 +543,11 @@ proc name: cure (/datum/disease/proc/cure) runtime error: Cannot read null.viruses proc name: cure (/datum/disease/proc/cure) source file: disease.dm,156 -runtime error: undefined proc or verb /obj/machinery/space_heater/attack(). +runtime error: undefined proc or verb /obj/machinery/space_heater/attack_mob_target(). proc name: attackby (/mob/attackby) source file: items.dm,334 -runtime error: undefined proc or verb /obj/machinery/space_heater/attack(). +runtime error: undefined proc or verb /obj/machinery/space_heater/attack_mob_target(). proc name: attackby (/mob/attackby) source file: items.dm,334 @@ -668,7 +668,7 @@ Borg module reset board (/obj/item/borg/upgrade/reset): action(Engineering Cybor Engineering Cyborg -133 (/mob/living/silicon/robot): attackby(Borg module reset board (/obj/item/borg/upgrade/reset), Michigan Slim (/mob/living/carbon/human)) Engineering Cyborg -133 (/mob/living/silicon/robot): DblClick(the floor (95,85,1) (/turf/simulated/floor), "mapwindow.map", "icon-x=14;icon-y=18;left=1;scr...") Engineering Cyborg -133 (/mob/living/silicon/robot): Click(the floor (95,85,1) (/turf/simulated/floor), "mapwindow.map", "icon-x=14;icon-y=18;left=1;scr...") -runtime error: undefined proc or verb /obj/machinery/portable_atmospherics/canister/toxins/attack(). +runtime error: undefined proc or verb /obj/machinery/portable_atmospherics/canister/toxins/attack_mob_target(). proc name: attackby (/mob/attackby) source file: items.dm,334