From 8a463ac82242e5294283ff69f61ae36ac7722e90 Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Mon, 16 Dec 2019 19:05:13 -0600 Subject: [PATCH 01/14] Automatic changelog generation for PR #10180 [ci skip] --- html/changelogs/AutoChangeLog-pr-10180.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 html/changelogs/AutoChangeLog-pr-10180.yml diff --git a/html/changelogs/AutoChangeLog-pr-10180.yml b/html/changelogs/AutoChangeLog-pr-10180.yml new file mode 100644 index 00000000..0a229109 --- /dev/null +++ b/html/changelogs/AutoChangeLog-pr-10180.yml @@ -0,0 +1,5 @@ +author: "Ghommie" +delete-after: True +changes: + - bugfix: "Fixes a ghostchat eavesdropping exploit concerning VR." + - bugfix: "Fixes VR deaths being broadcasted in deadchat." From 4714bd901238deeaa2c8edbc5d0e494b155fe5fc Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Thu, 28 Nov 2019 23:08:32 -0700 Subject: [PATCH 02/14] initial element --- code/__DEFINES/components.dm | 8 +++- code/controllers/subsystem/dcs.dm | 15 ++++++-- code/controllers/subsystem/garbage.dm | 4 +- code/datums/components/earhealing.dm | 30 --------------- code/datums/components/mood.dm | 2 +- code/datums/elements/_element.dm | 29 +++++++++++++++ .../{components => elements}/cleaning.dm | 29 +++++++-------- code/datums/elements/earhealing.dm | 37 +++++++++++++++++++ code/modules/clothing/ears/_ears.dm | 2 +- .../modules/mob/living/silicon/robot/robot.dm | 4 +- .../mob/living/simple_animal/hostile/alien.dm | 2 +- code/modules/vehicles/pimpin_ride.dm | 4 +- tgstation.dme | 5 ++- 13 files changed, 110 insertions(+), 61 deletions(-) delete mode 100644 code/datums/components/earhealing.dm create mode 100644 code/datums/elements/_element.dm rename code/datums/{components => elements}/cleaning.dm (64%) create mode 100644 code/datums/elements/earhealing.dm diff --git a/code/__DEFINES/components.dm b/code/__DEFINES/components.dm index d155f3f2..81155b29 100644 --- a/code/__DEFINES/components.dm +++ b/code/__DEFINES/components.dm @@ -25,8 +25,7 @@ ////////////////////////////////////////////////////////////////// // /datum signals -#define COMSIG_PARENT_QDELETED "parent_qdeleted" //after a datum's Destroy() is called: (force, qdel_hint), at this point none of the other components chose to interrupt qdel and Destroy has been called - +#define COMSIG_PARENT_QDELETING "parent_qdeleting" //just before a datum's Destroy() is called: (force), at this point none of the other components chose to interrupt qdel and Destroy will be called // /atom signals //Positions for overrides list //End positions @@ -96,3 +95,8 @@ //Ouch my toes! #define CALTROP_BYPASS_SHOES 1 #define CALTROP_IGNORE_WALKERS 2 + +#define ELEMENT_INCOMPATIBLE 1 // Return value to cancel attaching + +// /datum/element flags +#define ELEMENT_DETACH (1 << 0) diff --git a/code/controllers/subsystem/dcs.dm b/code/controllers/subsystem/dcs.dm index c1e101a0..e94f233f 100644 --- a/code/controllers/subsystem/dcs.dm +++ b/code/controllers/subsystem/dcs.dm @@ -1,6 +1,15 @@ -SUBSYSTEM_DEF(dcs) +PROCESSING_SUBSYSTEM_DEF(dcs) name = "Datum Component System" - flags = SS_NO_INIT | SS_NO_FIRE + flags = SS_NO_INIT + var/list/elements_by_type = list() -/datum/controller/subsystem/dcs/Recover() +/datum/controller/subsystem/processing/dcs/Recover() comp_lookup = SSdcs.comp_lookup + +/datum/controller/subsystem/processing/dcs/proc/GetElement(eletype) + . = elements_by_type[eletype] + if(.) + return + if(!ispath(eletype, /datum/element)) + CRASH("Attempted to instantiate [eletype] as a /datum/element") + . = elements_by_type[eletype] = new eletype \ No newline at end of file diff --git a/code/controllers/subsystem/garbage.dm b/code/controllers/subsystem/garbage.dm index eec9f63a..f8ca1e7e 100644 --- a/code/controllers/subsystem/garbage.dm +++ b/code/controllers/subsystem/garbage.dm @@ -98,7 +98,7 @@ SUBSYSTEM_DEF(garbage) state = SS_RUNNING break - + /datum/controller/subsystem/garbage/proc/HandleQueue(level = GC_QUEUE_CHECK) @@ -266,8 +266,8 @@ SUBSYSTEM_DEF(garbage) D.gc_destroyed = GC_CURRENTLY_BEING_QDELETED var/start_time = world.time var/start_tick = world.tick_usage + SEND_SIGNAL(D, COMSIG_PARENT_QDELETING, force) // Let the (remaining) components know about the result of Destroy var/hint = D.Destroy(arglist(args.Copy(2))) // Let our friend know they're about to get fucked up. - SEND_SIGNAL(D, COMSIG_PARENT_QDELETED, force, hint) // Let the (remaining) components know about the result of Destroy if(world.time != start_time) I.slept_destroy++ else diff --git a/code/datums/components/earhealing.dm b/code/datums/components/earhealing.dm deleted file mode 100644 index bd3d5748..00000000 --- a/code/datums/components/earhealing.dm +++ /dev/null @@ -1,30 +0,0 @@ -// An item worn in the ear slot with this component will heal your ears each -// Life() tick, even if normally your ears would be too damaged to heal. - -/datum/component/earhealing - var/mob/living/carbon/wearer - -/datum/component/earhealing/Initialize() - if(!isitem(parent)) - return COMPONENT_INCOMPATIBLE - RegisterSignal(parent, list(COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED), .proc/equippedChanged) - -/datum/component/earhealing/proc/equippedChanged(datum/source, mob/living/carbon/user, slot) - if (slot == SLOT_EARS && istype(user)) - if (!wearer) - START_PROCESSING(SSobj, src) - wearer = user - else - if (wearer) - STOP_PROCESSING(SSobj, src) - wearer = null - -/datum/component/earhealing/process() - if (!wearer) - STOP_PROCESSING(SSobj, src) - return - if(!HAS_TRAIT(wearer, TRAIT_DEAF)) - var/obj/item/organ/ears/ears = wearer.getorganslot(ORGAN_SLOT_EARS) - if (ears) - ears.deaf = max(ears.deaf - 1, (ears.damage < ears.maxHealth ? 0 : 1)) // Do not clear deafness if our ears are too damaged - ears.damage = max(ears.damage - 0.1, 0) diff --git a/code/datums/components/mood.dm b/code/datums/components/mood.dm index eb381af5..883dc656 100644 --- a/code/datums/components/mood.dm +++ b/code/datums/components/mood.dm @@ -280,7 +280,7 @@ var/datum/hud/hud = owner.hud_used screen_obj = new hud.infodisplay += screen_obj - RegisterSignal(hud, COMSIG_PARENT_QDELETED, .proc/unmodify_hud) + RegisterSignal(hud, COMSIG_PARENT_QDELETING, .proc/unmodify_hud) RegisterSignal(screen_obj, COMSIG_CLICK, .proc/hud_click) /datum/component/mood/proc/unmodify_hud(datum/source) diff --git a/code/datums/elements/_element.dm b/code/datums/elements/_element.dm new file mode 100644 index 00000000..f12835d2 --- /dev/null +++ b/code/datums/elements/_element.dm @@ -0,0 +1,29 @@ +/datum/element + var/element_flags = NONE + +/datum/element/proc/Attach(datum/target) + if(type == /datum/element) + return ELEMENT_INCOMPATIBLE + if(element_flags & ELEMENT_DETACH) + RegisterSignal(target, COMSIG_PARENT_QDELETING, .proc/Detach) + +/datum/element/proc/Detach(datum/source, force) + UnregisterSignal(source, COMSIG_PARENT_QDELETING) + +/datum/element/Destroy(force) + if(!force) + return QDEL_HINT_LETMELIVE + SSdcs.elements_by_type -= type + return ..() + +//DATUM PROCS + +/datum/proc/AddElement(eletype, ...) + var/datum/element/ele = SSdcs.GetElement(eletype) + args[1] = src + if(ele.Attach(arglist(args)) == ELEMENT_INCOMPATIBLE) + CRASH("Incompatible [eletype] assigned to a [type]! args: [json_encode(args)]") + +/datum/proc/RemoveElement(eletype) + var/datum/element/ele = SSdcs.GetElement(eletype) + ele.Detach(src) diff --git a/code/datums/components/cleaning.dm b/code/datums/elements/cleaning.dm similarity index 64% rename from code/datums/components/cleaning.dm rename to code/datums/elements/cleaning.dm index 05c26efc..02084a88 100644 --- a/code/datums/components/cleaning.dm +++ b/code/datums/elements/cleaning.dm @@ -1,19 +1,18 @@ -/datum/component/cleaning - dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS +/datum/element/cleaning/Attach(datum/target) + . = ..() + if(!ismovableatom(target)) + return ELEMENT_INCOMPATIBLE + RegisterSignal(target, COMSIG_MOVABLE_MOVED, .proc/Clean) -/datum/component/cleaning/Initialize() - if(!ismovableatom(parent)) - return COMPONENT_INCOMPATIBLE - RegisterSignal(parent, list(COMSIG_MOVABLE_MOVED), .proc/Clean) +/datum/element/cleaning/Detach(datum/target) + . = ..() + UnregisterSignal(target, COMSIG_MOVABLE_MOVED) -/datum/component/cleaning/proc/Clean() - var/atom/movable/AM = parent - var/turf/tile = AM.loc - if(!isturf(tile)) - return - - SEND_SIGNAL(tile, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD) - for(var/A in tile) +/datum/element/cleaning/proc/Clean(datum/source) + var/atom/movable/AM = source + var/turf/T = AM.loc + SEND_SIGNAL(T, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_WEAK) + for(var/A in T) if(is_cleanable(A)) qdel(A) else if(istype(A, /obj/item)) @@ -36,4 +35,4 @@ SEND_SIGNAL(cleaned_human, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD) cleaned_human.wash_cream() cleaned_human.regenerate_icons() - to_chat(cleaned_human, "[AM] cleans your face!") + to_chat(cleaned_human, "[src] cleans your face!") diff --git a/code/datums/elements/earhealing.dm b/code/datums/elements/earhealing.dm new file mode 100644 index 00000000..74777426 --- /dev/null +++ b/code/datums/elements/earhealing.dm @@ -0,0 +1,37 @@ + +/datum/element/earhealing + element_flags = ELEMENT_DETACH + var/list/user_by_item = list() + +/datum/element/earhealing/New() + START_PROCESSING(SSdcs, src) + +/datum/element/earhealing/Attach(datum/target) + . = ..() + if(!isitem(target)) + return ELEMENT_INCOMPATIBLE + + RegisterSignal(target, list(COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED), .proc/equippedChanged) + +/datum/element/earhealing/Detach(datum/target) + . = ..() + UnregisterSignal(target, list(COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED)) + user_by_item -= target + +/datum/element/earhealing/proc/equippedChanged(datum/source, mob/living/carbon/user, slot) + if(slot == SLOT_EARS && istype(user)) + user_by_item[source] = user + else + user_by_item -= source + +/datum/element/earhealing/process() + for(var/i in user_by_item) + var/mob/living/carbon/user = user_by_item[i] + if(HAS_TRAIT(user, TRAIT_DEAF)) + continue + var/obj/item/organ/ears/ears = user.getorganslot(ORGAN_SLOT_EARS) + if(!ears) + continue + ears.deaf = max(ears.deaf - 0.25, (ears.damage < ears.maxHealth ? 0 : 1)) // Do not clear deafness if our ears are too damaged + ears.damage = max(ears.damage - 0.025, 0) + CHECK_TICK diff --git a/code/modules/clothing/ears/_ears.dm b/code/modules/clothing/ears/_ears.dm index 1dcaeb35..6775279e 100644 --- a/code/modules/clothing/ears/_ears.dm +++ b/code/modules/clothing/ears/_ears.dm @@ -18,7 +18,7 @@ /obj/item/clothing/ears/earmuffs/ComponentInitialize() . = ..() - AddComponent(/datum/component/earhealing) + AddElement(/datum/element/earhealing) AddComponent(/datum/component/wearertargeting/earprotection, list(SLOT_EARS)) /obj/item/clothing/ears/headphones diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 29fbd39e..f066bdf1 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -1078,9 +1078,9 @@ status_flags &= ~CANPUSH if(module.clean_on_move) - AddComponent(/datum/component/cleaning) + AddElement(/datum/element/cleaning) else - qdel(GetComponent(/datum/component/cleaning)) + RemoveElement(/datum/element/cleaning) hat_offset = module.hat_offset diff --git a/code/modules/mob/living/simple_animal/hostile/alien.dm b/code/modules/mob/living/simple_animal/hostile/alien.dm index 3d92912f..79a90132 100644 --- a/code/modules/mob/living/simple_animal/hostile/alien.dm +++ b/code/modules/mob/living/simple_animal/hostile/alien.dm @@ -168,7 +168,7 @@ /mob/living/simple_animal/hostile/alien/maid/Initialize(mapload) . = ..() - AddComponent(/datum/component/cleaning) + AddElement(/datum/element/cleaning) /mob/living/simple_animal/hostile/alien/maid/AttackingTarget() if(ismovableatom(target)) diff --git a/code/modules/vehicles/pimpin_ride.dm b/code/modules/vehicles/pimpin_ride.dm index 53f60788..9d313e9b 100644 --- a/code/modules/vehicles/pimpin_ride.dm +++ b/code/modules/vehicles/pimpin_ride.dm @@ -14,7 +14,7 @@ D.set_riding_offsets(RIDING_OFFSET_ALL, list(TEXT_NORTH = list(0, 4), TEXT_SOUTH = list(0, 7), TEXT_EAST = list(-12, 7), TEXT_WEST = list( 12, 7))) if(floorbuffer) - AddComponent(/datum/component/cleaning) + AddElement(/datum/element/cleaning) /obj/vehicle/ridden/janicart/Destroy() if(mybag) @@ -50,7 +50,7 @@ floorbuffer = TRUE qdel(I) to_chat(user, "You upgrade [src] with the floor buffer.") - AddComponent(/datum/component/cleaning) + AddElement(/datum/element/cleaning) update_icon() else return ..() diff --git a/tgstation.dme b/tgstation.dme index 6c595015..c65c76ec 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -354,10 +354,8 @@ #include "code\datums\components\butchering.dm" #include "code\datums\components\caltrop.dm" #include "code\datums\components\chasm.dm" -#include "code\datums\components\cleaning.dm" #include "code\datums\components\construction.dm" #include "code\datums\components\decal.dm" -#include "code\datums\components\earhealing.dm" #include "code\datums\components\earprotection.dm" #include "code\datums\components\edit_complainer.dm" #include "code\datums\components\empprotection.dm" @@ -455,6 +453,9 @@ #include "code\datums\diseases\advance\symptoms\vomit.dm" #include "code\datums\diseases\advance\symptoms\weight.dm" #include "code\datums\diseases\advance\symptoms\youth.dm" +#include "code\datums\elements\_element.dm" +#include "code\datums\elements\cleaning.dm" +#include "code\datums\elements\earhealing.dm" #include "code\datums\helper_datums\events.dm" #include "code\datums\helper_datums\getrev.dm" #include "code\datums\helper_datums\icon_snapshot.dm" From 00fc2fd10b05f06cdf7b1caed01cfc48402bc686 Mon Sep 17 00:00:00 2001 From: Dip Date: Thu, 1 Oct 2020 22:37:47 -0300 Subject: [PATCH 03/14] duplicate --- code/__DEFINES/components.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/__DEFINES/components.dm b/code/__DEFINES/components.dm index 81155b29..386d67fd 100644 --- a/code/__DEFINES/components.dm +++ b/code/__DEFINES/components.dm @@ -25,7 +25,6 @@ ////////////////////////////////////////////////////////////////// // /datum signals -#define COMSIG_PARENT_QDELETING "parent_qdeleting" //just before a datum's Destroy() is called: (force), at this point none of the other components chose to interrupt qdel and Destroy will be called // /atom signals //Positions for overrides list //End positions From b433eab32486a2c20dc071da1452782b4fa148e6 Mon Sep 17 00:00:00 2001 From: Ghom <42542238+Ghommie@users.noreply.github.com> Date: Sun, 5 Jan 2020 23:05:13 +0100 Subject: [PATCH 04/14] Merge pull request #10350 from Putnam3145 --- code/__DEFINES/dcs/signals.dm | 6 +++ code/__DEFINES/misc.dm | 4 +- code/__HELPERS/game.dm | 10 ++-- code/_globalvars/misc.dm | 4 +- .../configuration/entries/game_options.dm | 8 +++ code/datums/action.dm | 11 ++++ code/datums/elements/_element.dm | 10 ++-- .../datums/elements/ghost_role_eligibility.dm | 54 +++++++++++++++++++ .../dynamic/dynamic_rulesets_midround.dm | 48 ++++++++++++----- code/game/objects/items/holy_weapons.dm | 4 +- code/modules/admin/verbs/one_click_antag.dm | 14 ++--- code/modules/antagonists/blob/blob/powers.dm | 6 +-- code/modules/client/client_defines.dm | 2 +- code/modules/events/holiday/xmas.dm | 2 +- code/modules/mob/dead/observer/observer.dm | 30 ++++++----- .../living/simple_animal/guardian/guardian.dm | 8 +-- code/modules/mob/mob.dm | 16 +++++- config/game_options.txt | 12 +++++ .../code/modules/client/preferences.dm | 1 + tgstation.dme | 1 + 20 files changed, 194 insertions(+), 57 deletions(-) create mode 100644 code/datums/elements/ghost_role_eligibility.dm diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 9609f19c..cff9c7ff 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -302,6 +302,12 @@ #define COMSIG_MOB_ATTACK_RANGED "mob_attack_ranged" ///from base of /mob/throw_item(): (atom/target) #define COMSIG_MOB_THROW "mob_throw" +#define COMSIG_MOB_KEY_CHANGE "mob_key_change" //from base of /mob/transfer_ckey(): (new_character, old_character) +#define COMSIG_MOB_PRE_PLAYER_CHANGE "mob_pre_player_change" //sent to the target mob from base of /mob/transfer_ckey() and /mind/transfer_to(): (our_character, their_character) +#define COMSIG_MOB_GHOSTIZE "mob_ghostize" //from base of mob/Ghostize(): (can_reenter_corpse, special, penalize) + #define COMPONENT_BLOCK_GHOSTING (1<<0) + #define COMPONENT_DO_NOT_PENALIZE_GHOSTING (1<<1) + #define COMPONENT_FREE_GHOSTING (1<<2) ///from base of /mob/verb/examinate(): (atom/target) #define COMSIG_MOB_EXAMINATE "mob_examinate" ///from base of /mob/update_sight(): () diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index a1869b99..35f0482a 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -503,4 +503,6 @@ GLOBAL_LIST_INIT(pda_reskins, list(PDA_SKIN_CLASSIC = 'icons/obj/pda.dmi', PDA_S #define FALL_STOP_INTERCEPTING (1<<2) //Used in situations where halting the whole "intercept" loop would be better, like supermatter dusting (and thus deleting) the atom. //Misc text define. Does 4 spaces. Used as a makeshift tabulator. -#define FOURSPACES "    " \ No newline at end of file +#define FOURSPACES "    " + +#define CANT_REENTER_ROUND -1 diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 23ecbf0c..cc7f5d5d 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -442,12 +442,8 @@ candidates -= M /proc/pollGhostCandidates(Question, jobbanType, datum/game_mode/gametypeCheck, be_special_flag = 0, poll_time = 300, ignore_category = null, flashwindow = TRUE) - var/list/candidates = list() - - for(var/mob/dead/observer/G in GLOB.player_list) - if(G.can_reenter_round) - candidates += G - + var/datum/element/ghost_role_eligibility/eligibility = SSdcs.GetElement(/datum/element/ghost_role_eligibility) + var/list/candidates = eligibility.get_all_ghost_role_eligible() return pollCandidates(Question, jobbanType, gametypeCheck, be_special_flag, poll_time, ignore_category, flashwindow, candidates) /proc/pollCandidates(Question, jobbanType, datum/game_mode/gametypeCheck, be_special_flag = 0, poll_time = 300, ignore_category = null, flashwindow = TRUE, list/group = null) @@ -510,7 +506,7 @@ G_found.client.prefs.copy_to(new_character) new_character.dna.update_dna_identity() - new_character.key = G_found.key + G_found.transfer_ckey(new_character, FALSE) return new_character diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index 899ccbe7..38147262 100644 --- a/code/_globalvars/misc.dm +++ b/code/_globalvars/misc.dm @@ -17,6 +17,8 @@ GLOBAL_VAR_INIT(bsa_unlock, FALSE) //BSA unlocked by head ID swipes GLOBAL_LIST_EMPTY(player_details) // ckey -> /datum/player_details +GLOBAL_LIST_EMPTY(clientless_round_timeouts) // ckey -> time that ckey can rejoin round + // All religion stuff GLOBAL_VAR(religion) GLOBAL_VAR(deity) @@ -24,4 +26,4 @@ GLOBAL_VAR(bible_name) GLOBAL_VAR(bible_icon_state) GLOBAL_VAR(bible_item_state) GLOBAL_VAR(holy_weapon_type) -GLOBAL_VAR(holy_armor_type) \ No newline at end of file +GLOBAL_VAR(holy_armor_type) diff --git a/code/controllers/configuration/entries/game_options.dm b/code/controllers/configuration/entries/game_options.dm index a75d17fa..b487dc3d 100644 --- a/code/controllers/configuration/entries/game_options.dm +++ b/code/controllers/configuration/entries/game_options.dm @@ -132,6 +132,14 @@ min_val = 0 max_val = 1 +/datum/config_entry/number/suicide_reenter_round_timer + config_entry_value = 30 + min_val = 0 + +/datum/config_entry/number/roundstart_suicide_time_limit + config_entry_value = 30 + min_val = 0 + /datum/config_entry/number/shuttle_refuel_delay config_entry_value = 12000 min_val = 0 diff --git a/code/datums/action.dm b/code/datums/action.dm index cd0d31e0..66e837c7 100644 --- a/code/datums/action.dm +++ b/code/datums/action.dm @@ -141,6 +141,17 @@ current_button.add_overlay(mutable_appearance(icon_icon, button_icon_state)) current_button.button_icon_state = button_icon_state +/datum/action/ghost + icon_icon = 'icons/mob/mob.dmi' + button_icon_state = "ghost" + name = "Ghostize" + desc = "Turn into a ghost and freely come back to your body." + +/datum/action/ghost/Trigger() + if(!..()) + return 0 + var/mob/M = target + M.ghostize(1) //Presets for item actions /datum/action/item_action diff --git a/code/datums/elements/_element.dm b/code/datums/elements/_element.dm index f12835d2..1a5b5148 100644 --- a/code/datums/elements/_element.dm +++ b/code/datums/elements/_element.dm @@ -5,7 +5,7 @@ if(type == /datum/element) return ELEMENT_INCOMPATIBLE if(element_flags & ELEMENT_DETACH) - RegisterSignal(target, COMSIG_PARENT_QDELETING, .proc/Detach) + RegisterSignal(target, COMSIG_PARENT_QDELETING, .proc/Detach, override = TRUE) /datum/element/proc/Detach(datum/source, force) UnregisterSignal(source, COMSIG_PARENT_QDELETING) @@ -24,6 +24,10 @@ if(ele.Attach(arglist(args)) == ELEMENT_INCOMPATIBLE) CRASH("Incompatible [eletype] assigned to a [type]! args: [json_encode(args)]") -/datum/proc/RemoveElement(eletype) - var/datum/element/ele = SSdcs.GetElement(eletype) +/** + * Finds the singleton for the element type given and detaches it from src + * You only need additional arguments beyond the type if you're using ELEMENT_BESPOKE + */ +/datum/proc/RemoveElement(eletype, ...) + var/datum/element/ele = SSdcs.GetElement(arglist(args)) ele.Detach(src) diff --git a/code/datums/elements/ghost_role_eligibility.dm b/code/datums/elements/ghost_role_eligibility.dm new file mode 100644 index 00000000..8ecb579b --- /dev/null +++ b/code/datums/elements/ghost_role_eligibility.dm @@ -0,0 +1,54 @@ +/datum/element/ghost_role_eligibility + element_flags = ELEMENT_DETACH + var/list/timeouts = list() + var/list/mob/eligible_mobs = list() + +/datum/element/ghost_role_eligibility/Attach(datum/target,penalize = FALSE) + . = ..() + if(!ismob(target)) + return ELEMENT_INCOMPATIBLE + var/mob/M = target + if(!(M in eligible_mobs)) + eligible_mobs += M + if(penalize) //penalizing them from making a ghost role / midround antag comeback right away. + var/penalty = CONFIG_GET(number/suicide_reenter_round_timer) MINUTES + var/roundstart_quit_limit = CONFIG_GET(number/roundstart_suicide_time_limit) MINUTES + if(world.time < roundstart_quit_limit) //add up the time difference to their antag rolling penalty if they quit before half a (ingame) hour even passed. + penalty += roundstart_quit_limit - world.time + if(penalty) + penalty += world.realtime + if(penalty - SSshuttle.realtimeofstart > SSshuttle.auto_call + SSshuttle.emergencyCallTime + SSshuttle.emergencyDockTime + SSshuttle.emergencyEscapeTime) + penalty = CANT_REENTER_ROUND + if(!(M.ckey in timeouts)) + timeouts += M.ckey + timeouts[M.ckey] = 0 + timeouts[M.ckey] = max(timeouts[M.ckey],penalty) + +/datum/element/ghost_role_eligibility/Detach(mob/M) + . = ..() + if(M in eligible_mobs) + eligible_mobs -= M + +/datum/element/ghost_role_eligibility/proc/get_all_ghost_role_eligible(silent = FALSE) + var/list/candidates = list() + for(var/m in eligible_mobs) + var/mob/M = m + if(M.can_reenter_round(TRUE)) + candidates += M + return candidates + +/mob/proc/can_reenter_round(silent = FALSE) + var/datum/element/ghost_role_eligibility/eli = SSdcs.GetElement(/datum/element/ghost_role_eligibility) + return eli.can_reenter_round(src,silent) + +/datum/element/ghost_role_eligibility/proc/can_reenter_round(var/mob/M,silent = FALSE) + if(!(M in eligible_mobs)) + return FALSE + if(!(M.ckey in timeouts)) + return TRUE + var/timeout = timeouts[M.ckey] + if(timeout != CANT_REENTER_ROUND && timeout <= world.realtime) + return TRUE + if(!silent && M.client) + to_chat(M, "You are unable to reenter the round[timeout != CANT_REENTER_ROUND ? " yet. Your ghost role blacklist will expire in [DisplayTimeText(timeout - world.realtime)]" : ""].") + return FALSE diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm index 25e26856..7bcd6c8a 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm @@ -17,6 +17,7 @@ var/list/living_antags = list() var/list/dead_players = list() var/list/list_observers = list() + var/list/ghost_eligible = list() /datum/dynamic_ruleset/midround/from_ghosts weight = 0 @@ -32,10 +33,11 @@ // So for example you can get the list of all current dead players with var/list/dead_players = candidates[CURRENT_DEAD_PLAYERS] // Make sure to properly typecheck the mobs in those lists, as the dead_players list could contain ghosts, or dead players still in their bodies. // We're still gonna trim the obvious (mobs without clients, jobbanned players, etc) - living_players = trim_list(mode.current_players[CURRENT_LIVING_PLAYERS]) - living_antags = trim_list(mode.current_players[CURRENT_LIVING_ANTAGS]) - dead_players = trim_list(mode.current_players[CURRENT_DEAD_PLAYERS]) - list_observers = trim_list(mode.current_players[CURRENT_OBSERVERS]) + living_players = trim_list(mode.current_players[CURRENT_LIVING_PLAYERS]) + living_antags = trim_list(mode.current_players[CURRENT_LIVING_ANTAGS]) + list_observers = trim_list(mode.current_players[CURRENT_OBSERVERS]) + var/datum/element/ghost_role_eligibility/eligibility = SSdcs.GetElement(/datum/element/ghost_role_eligibility) + ghost_eligible = trim_list(eligibility.get_all_ghost_role_eligible()) /datum/dynamic_ruleset/midround/proc/trim_list(list/L = list()) var/list/trimmed_list = L.Copy() @@ -65,6 +67,25 @@ continue return trimmed_list +/datum/dynamic_ruleset/midround/from_ghosts/trim_list(list/L = list()) + var/list/trimmed_list = L.Copy() + for(var/mob/M in trimmed_list) + if (!M.client) // Are they connected? + trimmed_list.Remove(M) + continue + if(!mode.check_age(M.client, minimum_required_age)) + trimmed_list.Remove(M) + continue + if(antag_flag_override) + if(!(antag_flag_override in M.client.prefs.be_special) || jobban_isbanned(M.ckey, antag_flag_override)) + trimmed_list.Remove(M) + continue + else + if(!(antag_flag in M.client.prefs.be_special) || jobban_isbanned(M.ckey, antag_flag)) + trimmed_list.Remove(M) + continue + return trimmed_list + // You can then for example prompt dead players in execute() to join as strike teams or whatever // Or autotator someone @@ -85,15 +106,16 @@ return FALSE return TRUE -/datum/dynamic_ruleset/midround/from_ghosts/execute() - var/list/possible_candidates = list() - possible_candidates.Add(dead_players) - possible_candidates.Add(list_observers) - send_applications(possible_candidates) - if(assigned.len > 0) - return TRUE - else +/datum/dynamic_ruleset/midround/from_ghosts/ready(forced = FALSE) + if (required_candidates > ghost_eligible.len) + SSblackbox.record_feedback("tally","dynamic",1,"Times rulesets rejected due to not enough ghosts") return FALSE + return ..() + + +/datum/dynamic_ruleset/midround/from_ghosts/execute() + var/application_successful = send_applications(ghost_eligible) + return assigned.len > 0 && application_successful /// This sends a poll to ghosts if they want to be a ghost spawn from a ruleset. /datum/dynamic_ruleset/midround/from_ghosts/proc/send_applications(list/possible_volunteers = list()) @@ -596,4 +618,4 @@ #undef ABDUCTOR_MAX_TEAMS -#undef REVENANT_SPAWN_THRESHOLD \ No newline at end of file +#undef REVENANT_SPAWN_THRESHOLD diff --git a/code/game/objects/items/holy_weapons.dm b/code/game/objects/items/holy_weapons.dm index 040cd53c..01b20d42 100644 --- a/code/game/objects/items/holy_weapons.dm +++ b/code/game/objects/items/holy_weapons.dm @@ -490,10 +490,10 @@ possessed = TRUE - var/list/mob/dead/observer/candidates = pollGhostCandidates("Do you want to play as the spirit of [user.real_name]'s blade?", ROLE_PAI, null, FALSE, 100, POLL_IGNORE_POSSESSED_BLADE) + var/list/mob/candidates = pollGhostCandidates("Do you want to play as the spirit of [user.real_name]'s blade?", ROLE_PAI, null, FALSE, 100, POLL_IGNORE_POSSESSED_BLADE) if(LAZYLEN(candidates)) - var/mob/dead/observer/C = pick(candidates) + var/mob/C = pick(candidates) var/mob/living/simple_animal/shade/S = new(src) S.real_name = name S.name = name diff --git a/code/modules/admin/verbs/one_click_antag.dm b/code/modules/admin/verbs/one_click_antag.dm index 9fdb0ea2..39dac328 100644 --- a/code/modules/admin/verbs/one_click_antag.dm +++ b/code/modules/admin/verbs/one_click_antag.dm @@ -138,9 +138,9 @@ /datum/admins/proc/makeWizard() - var/list/mob/dead/observer/candidates = pollGhostCandidates("Do you wish to be considered for the position of a Wizard Foundation 'diplomat'?", ROLE_WIZARD, null) + var/list/mob/candidates = pollGhostCandidates("Do you wish to be considered for the position of a Wizard Foundation 'diplomat'?", ROLE_WIZARD, null) - var/mob/dead/observer/selected = pick_n_take(candidates) + var/mob/selected = pick_n_take(candidates) var/mob/living/carbon/human/new_character = makeBody(selected) new_character.mind.make_Wizard() @@ -215,9 +215,9 @@ /datum/admins/proc/makeNukeTeam() var/datum/game_mode/nuclear/temp = new - var/list/mob/dead/observer/candidates = pollGhostCandidates("Do you wish to be considered for a nuke team being sent in?", ROLE_OPERATIVE, temp) - var/list/mob/dead/observer/chosen = list() - var/mob/dead/observer/theghost = null + var/list/mob/candidates = pollGhostCandidates("Do you wish to be considered for a nuke team being sent in?", ROLE_OPERATIVE, temp) + var/list/mob/chosen = list() + var/mob/theghost = null if(candidates.len) var/numagents = 5 @@ -379,7 +379,7 @@ ertemplate.enforce_human = prefs["enforce_human"]["value"] == "Yes" ? TRUE : FALSE ertemplate.opendoors = prefs["open_armory"]["value"] == "Yes" ? TRUE : FALSE - var/list/mob/dead/observer/candidates = pollGhostCandidates("Do you wish to be considered for [ertemplate.polldesc] ?", "deathsquad", null) + var/list/mob/candidates = pollGhostCandidates("Do you wish to be considered for [ertemplate.polldesc] ?", "deathsquad", null) var/teamSpawned = FALSE if(candidates.len > 0) @@ -405,7 +405,7 @@ numagents-- continue // This guy's unlucky, not enough spawn points, we skip him. var/spawnloc = spawnpoints[numagents] - var/mob/dead/observer/chosen_candidate = pick(candidates) + var/mob/chosen_candidate = pick(candidates) candidates -= chosen_candidate if(!chosen_candidate.key) continue diff --git a/code/modules/antagonists/blob/blob/powers.dm b/code/modules/antagonists/blob/blob/powers.dm index 9e915ee0..76c9c6f4 100644 --- a/code/modules/antagonists/blob/blob/powers.dm +++ b/code/modules/antagonists/blob/blob/powers.dm @@ -156,7 +156,7 @@ if(!can_buy(40)) return - var/list/mob/dead/observer/candidates = pollGhostCandidates("Do you want to play as a [blob_reagent_datum.name] blobbernaut?", ROLE_BLOB, null, ROLE_BLOB, 50) //players must answer rapidly + var/list/mob/candidates = pollGhostCandidates("Do you want to play as a [blob_reagent_datum.name] blobbernaut?", ROLE_BLOB, null, ROLE_BLOB, 50) //players must answer rapidly if(LAZYLEN(candidates)) //if we got at least one candidate, they're a blobbernaut now. B.max_integrity = initial(B.max_integrity) * 0.25 //factories that produced a blobbernaut have much lower health B.obj_integrity = min(B.obj_integrity, B.max_integrity) @@ -171,8 +171,8 @@ blobber.update_icons() blobber.adjustHealth(blobber.maxHealth * 0.5) blob_mobs += blobber - var/mob/dead/observer/C = pick(candidates) - blobber.key = C.key + var/mob/C = pick(candidates) + C.transfer_ckey(blobber) SEND_SOUND(blobber, sound('sound/effects/blobattack.ogg')) SEND_SOUND(blobber, sound('sound/effects/attackblob.ogg')) to_chat(blobber, "You are a blobbernaut!") diff --git a/code/modules/client/client_defines.dm b/code/modules/client/client_defines.dm index 3dd76c75..53170805 100644 --- a/code/modules/client/client_defines.dm +++ b/code/modules/client/client_defines.dm @@ -83,4 +83,4 @@ var/keysend_tripped = FALSE /// Messages currently seen by this client - var/list/seen_messages \ No newline at end of file + var/list/seen_messages diff --git a/code/modules/events/holiday/xmas.dm b/code/modules/events/holiday/xmas.dm index a76c75dd..bc8be48e 100644 --- a/code/modules/events/holiday/xmas.dm +++ b/code/modules/events/holiday/xmas.dm @@ -75,7 +75,7 @@ /datum/round_event/santa/start() var/list/candidates = pollGhostCandidates("Santa is coming to town! Do you want to be Santa?", poll_time=150) if(LAZYLEN(candidates)) - var/mob/dead/observer/C = pick(candidates) + var/mob/C = pick(candidates) santa = new /mob/living/carbon/human(pick(GLOB.blobstart)) santa.key = C.key diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index d42c5e05..0c05f720 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -135,7 +135,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER) AA.onNewMob(src) . = ..() - + AddElement(/datum/element/ghost_role_eligibility) grant_all_languages() /mob/dead/observer/get_photo_description(obj/item/camera/camera) @@ -261,17 +261,21 @@ Transfer_mind is there to check if mob is being deleted/not going to have a body Works together with spawning an observer, noted above. */ -/mob/proc/ghostize(can_reenter_corpse = 1) - if(key) - if(!cmptext(copytext(key,1,2),"@")) // Skip aghosts. - stop_sound_channel(CHANNEL_HEARTBEAT) //Stop heartbeat sounds because You Are A Ghost Now - var/mob/dead/observer/ghost = new(src) // Transfer safety to observer spawning proc. - SStgui.on_transfer(src, ghost) // Transfer NanoUIs. - ghost.can_reenter_corpse = can_reenter_corpse - ghost.can_reenter_round = (can_reenter_corpse && !suiciding) - ghost.key = key - ghost.client.lastrespawn = world.time + 1800 SECONDS - return ghost +/mob/proc/ghostize(can_reenter_corpse = TRUE, special = FALSE, penalize = FALSE) + penalize = suiciding || penalize // suicide squad. + if(!key || cmptext(copytext(key,1,2),"@") || (SEND_SIGNAL(src, COMSIG_MOB_GHOSTIZE, can_reenter_corpse, special, penalize) & COMPONENT_BLOCK_GHOSTING)) + return //mob has no key, is an aghost or some component hijacked. + stop_sound_channel(CHANNEL_HEARTBEAT) //Stop heartbeat sounds because You Are A Ghost Now + var/mob/dead/observer/ghost = new(src) // Transfer safety to observer spawning proc. + SStgui.on_transfer(src, ghost) // Transfer NanoUIs. + ghost.can_reenter_corpse = can_reenter_corpse + if (client && client.prefs && client.prefs.auto_ooc) + if (!(client.prefs.chat_toggles & CHAT_OOC)) + client.prefs.chat_toggles ^= CHAT_OOC + transfer_ckey(ghost, FALSE) + ghost.AddElement(/datum/element/ghost_role_eligibility,penalize) // technically already run earlier, but this adds the penalty + // needs to be done AFTER the ckey transfer, too + return ghost /* This is the proc mobs get to turn into a ghost. Forked from ghostize due to compatibility issues. @@ -317,7 +321,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp var/response = alert(src, "Are you -sure- you want to ghost?\n(You are alive. If you ghost whilst still alive you won't be able to re-enter this round! You can't change your mind so choose wisely!!)","Are you sure you want to ghost?","Ghost","Stay in body") if(response != "Ghost") return - ghostize(0) + ghostize(0, penalize = TRUE) /mob/dead/observer/Move(NewLoc, direct) if(updatedir) diff --git a/code/modules/mob/living/simple_animal/guardian/guardian.dm b/code/modules/mob/living/simple_animal/guardian/guardian.dm index 5aec56b1..20d33a4b 100644 --- a/code/modules/mob/living/simple_animal/guardian/guardian.dm +++ b/code/modules/mob/living/simple_animal/guardian/guardian.dm @@ -423,9 +423,9 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians var/mob/living/simple_animal/hostile/guardian/G = input(src, "Pick the guardian you wish to reset", "Guardian Reset") as null|anything in guardians if(G) to_chat(src, "You attempt to reset [G.real_name]'s personality...") - var/list/mob/dead/observer/candidates = pollGhostCandidates("Do you want to play as [src.real_name]'s [G.real_name]?", ROLE_PAI, null, FALSE, 100) + var/list/mob/candidates = pollGhostCandidates("Do you want to play as [src.real_name]'s [G.real_name]?", ROLE_PAI, null, FALSE, 100) if(LAZYLEN(candidates)) - var/mob/dead/observer/C = pick(candidates) + var/mob/C = pick(candidates) to_chat(G, "Your user reset you, and your body was taken over by a ghost. Looks like they weren't happy with your performance.") to_chat(src, "Your [G.real_name] has been successfully reset.") message_admins("[key_name_admin(C)] has taken control of ([key_name_admin(G)])") @@ -497,10 +497,10 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians return used = TRUE to_chat(user, "[use_message]") - var/list/mob/dead/observer/candidates = pollGhostCandidates("Do you want to play as the [mob_name] of [user.real_name]?", ROLE_PAI, null, FALSE, 100, POLL_IGNORE_HOLOPARASITE) + var/list/mob/candidates = pollGhostCandidates("Do you want to play as the [mob_name] of [user.real_name]?", ROLE_PAI, null, FALSE, 100, POLL_IGNORE_HOLOPARASITE) if(LAZYLEN(candidates)) - var/mob/dead/observer/C = pick(candidates) + var/mob/C = pick(candidates) spawn_guardian(user, C.key) else to_chat(user, "[failure_message]") diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 1e6be0b3..4e50551f 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -459,7 +459,21 @@ // M.Login() //wat return - +/mob/proc/transfer_ckey(mob/new_mob, send_signal = TRUE) + if(!new_mob || (!ckey && new_mob.ckey)) + CRASH("transfer_ckey() called [new_mob ? "on ckey-less mob with a player mob as target" : "without a valid mob target"]!") + if(!ckey) + return + SEND_SIGNAL(new_mob, COMSIG_MOB_PRE_PLAYER_CHANGE, new_mob, src) + if (client && client.prefs && client.prefs.auto_ooc) + if (client.prefs.chat_toggles & CHAT_OOC && isliving(new_mob)) + client.prefs.chat_toggles ^= CHAT_OOC + if (!(client.prefs.chat_toggles & CHAT_OOC) && isdead(new_mob)) + client.prefs.chat_toggles ^= CHAT_OOC + new_mob.ckey = ckey + if(send_signal) + SEND_SIGNAL(src, COMSIG_MOB_KEY_CHANGE, new_mob, src) + return TRUE /mob/verb/cancel_camera() set name = "Cancel Camera View" diff --git a/config/game_options.txt b/config/game_options.txt index 5e635669..c97a0bfe 100644 --- a/config/game_options.txt +++ b/config/game_options.txt @@ -478,6 +478,18 @@ MIDROUND_ANTAG_TIME_CHECK 60 ## A ratio of living to total crew members, the lower this is, the more people will have to die in order for midround antag to be skipped MIDROUND_ANTAG_LIFE_CHECK 0.7 +## A "timeout", in real-time minutes, applied upon suicide, cryosleep or ghosting whilst alive, +## during which the player shouldn't be able to come back into the round through +## midround playable roles or mob spawners. +## Set to 0 to completely disable it. +SUICIDE_REENTER_ROUND_TIMER 30 + +## A world time threshold, in minutes, under which the player receives +## an extra timeout, purposely similar to the above one (and also stacks with), +## equal to the difference between the current world.time and this threshold. +## Both configs are indipendent from each other, disabling one won't affect the other. +ROUNDSTART_SUICIDE_TIME_LIMIT 30 + ##Limit Spell Choices## ## Uncomment to disallow wizards from using certain spells that may be too chaotic/fun for your playerbase diff --git a/modular_citadel/code/modules/client/preferences.dm b/modular_citadel/code/modules/client/preferences.dm index a8a60db3..827b797c 100644 --- a/modular_citadel/code/modules/client/preferences.dm +++ b/modular_citadel/code/modules/client/preferences.dm @@ -15,6 +15,7 @@ var/arousable = TRUE var/widescreenpref = TRUE var/autostand = TRUE + var/auto_ooc = FALSE var/lewdchem = TRUE //vore prefs diff --git a/tgstation.dme b/tgstation.dme index c65c76ec..2e00b4a8 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -456,6 +456,7 @@ #include "code\datums\elements\_element.dm" #include "code\datums\elements\cleaning.dm" #include "code\datums\elements\earhealing.dm" +#include "code\datums\elements\ghost_role_eligibility.dm" #include "code\datums\helper_datums\events.dm" #include "code\datums\helper_datums\getrev.dm" #include "code\datums\helper_datums\icon_snapshot.dm" From 20c30a15d1594646f2a0925e51e61cb11943a3ed Mon Sep 17 00:00:00 2001 From: Ghom <42542238+Ghommie@users.noreply.github.com> Date: Mon, 20 Jan 2020 03:24:46 +0100 Subject: [PATCH 05/14] Merge pull request #10597 from Putnam3145/player-panel-can-reenter Ghost role eligibility activation in player panel --- .../datums/elements/ghost_role_eligibility.dm | 2 + code/modules/admin/admin.dm | 40 +++++++++-- code/modules/admin/topic.dm | 69 ++++++++++++++++++- modular_citadel/code/modules/admin/admin.dm | 39 ----------- modular_citadel/code/modules/admin/topic.dm | 59 ---------------- tgstation.dme | 2 - 6 files changed, 106 insertions(+), 105 deletions(-) delete mode 100644 modular_citadel/code/modules/admin/admin.dm delete mode 100644 modular_citadel/code/modules/admin/topic.dm diff --git a/code/datums/elements/ghost_role_eligibility.dm b/code/datums/elements/ghost_role_eligibility.dm index 8ecb579b..e57aaddd 100644 --- a/code/datums/elements/ghost_role_eligibility.dm +++ b/code/datums/elements/ghost_role_eligibility.dm @@ -22,6 +22,8 @@ if(!(M.ckey in timeouts)) timeouts += M.ckey timeouts[M.ckey] = 0 + else if(timeouts[M.ckey] == CANT_REENTER_ROUND) + return timeouts[M.ckey] = max(timeouts[M.ckey],penalty) /datum/element/ghost_role_eligibility/Detach(mob/M) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 3d9c9bcd..8c684ecc 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -190,7 +190,6 @@ body += "Shade" body += "
" - if (M.client) body += "

" body += "Other actions:" body += "
" @@ -199,9 +198,9 @@ body += "Thunderdome 2 | " body += "Thunderdome Admin | " body += "Thunderdome Observer | " - - body += usr.client.citaPPoptions(M) // CITADEL - + body += "Make mentor | " + body += "Remove mentor" + body += "Allow reentering round" body += "
" body += "" @@ -976,3 +975,36 @@ "Admin login: [key_name(src)]") if(string) message_admins("[string]") + +/client/proc/cmd_admin_man_up(mob/M in GLOB.mob_list) + set category = "Special Verbs" + set name = "Man Up" + + if(!M) + return + if(!check_rights(R_ADMIN)) + return + + to_chat(M, "Man up, and deal with it.
Move on.") + M.playsound_local(M, 'modular_citadel/sound/misc/manup.ogg', 50, FALSE, pressure_affected = FALSE) + + log_admin("Man up: [key_name(usr)] told [key_name(M)] to man up") + var/message = "[key_name_admin(usr)] told [key_name_admin(M)] to man up." + message_admins(message) + admin_ticket_log(M, message) + SSblackbox.record_feedback("tally", "admin_verb", 1, "Man Up") + +/client/proc/cmd_admin_man_up_global() + set category = "Special Verbs" + set name = "Man Up Global" + + if(!check_rights(R_ADMIN)) + return + + to_chat(world, "Man up, and deal with it.
Move on.") + for(var/mob/M in GLOB.player_list) + M.playsound_local(M, 'modular_citadel/sound/misc/manup.ogg', 50, FALSE, pressure_affected = FALSE) + + log_admin("Man up global: [key_name(usr)] told everybody to man up") + message_admins("[key_name_admin(usr)] told everybody to man up.") + SSblackbox.record_feedback("tally", "admin_verb", 1, "Man Up Global") diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 2ac189e4..d2a39a0c 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -22,7 +22,10 @@ if(!CheckAdminHref(href, href_list)) return - citaTopic(href, href_list) //CITADEL EDIT, MENTORS + if(href_list["makementor"]) + makeMentor(href_list["makementor"]) + else if(href_list["removementor"]) + removeMentor(href_list["removementor"]) if(href_list["ahelp"]) if(!check_rights(R_ADMIN, TRUE)) @@ -1728,6 +1731,16 @@ log_admin("[key_name(usr)] forced [key_name(M)] to say: [speech]") message_admins("[key_name_admin(usr)] forced [key_name_admin(M)] to say: [speech]") + else if(href_list["makeeligible"]) + if(!check_rights(R_ADMIN)) + return + var/mob/M = locate(href_list["makeeligible"]) + if(!ismob(M)) + to_chat(usr, "this can only be used on instances of type /mob.") + var/datum/element/ghost_role_eligibility/eli = SSdcs.GetElement(/datum/element/ghost_role_eligibility) + if(M.ckey in eli.timeouts) + eli.timeouts -= M.ckey + else if(href_list["sendtoprison"]) if(!check_rights(R_ADMIN)) return @@ -2904,3 +2917,57 @@ dat += {"Random (default)
"} dat += {"Now: [GLOB.secret_force_mode]"} usr << browse(dat, "window=f_secret") + +/datum/admins/proc/makeMentor(ckey) + if(!usr.client) + return + if (!check_rights(0)) + return + if(!ckey) + return + var/client/C = GLOB.directory[ckey] + if(C) + if(check_rights_for(C, R_ADMIN,0)) + to_chat(usr, "The client chosen is an admin! Cannot mentorize.") + return + if(SSdbcore.Connect()) + var/datum/DBQuery/query_get_mentor = SSdbcore.NewQuery("SELECT id FROM [format_table_name("mentor")] WHERE ckey = '[ckey]'") + if(query_get_mentor.NextRow()) + to_chat(usr, "[ckey] is already a mentor.") + return + var/datum/DBQuery/query_add_mentor = SSdbcore.NewQuery("INSERT INTO `[format_table_name("mentor")]` (`id`, `ckey`) VALUES (null, '[ckey]')") + if(!query_add_mentor.warn_execute()) + return + var/datum/DBQuery/query_add_admin_log = SSdbcore.NewQuery("INSERT INTO `[format_table_name("admin_log")]` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Added new mentor [ckey]');") + if(!query_add_admin_log.warn_execute()) + return + else + to_chat(usr, "Failed to establish database connection. The changes will last only for the current round.") + new /datum/mentors(ckey) + to_chat(usr, "New mentor added.") + +/datum/admins/proc/removeMentor(ckey) + if(!usr.client) + return + if (!check_rights(0)) + return + if(!ckey) + return + var/client/C = GLOB.directory[ckey] + if(C) + if(check_rights_for(C, R_ADMIN,0)) + to_chat(usr, "The client chosen is an admin, not a mentor! Cannot de-mentorize.") + return + C.remove_mentor_verbs() + C.mentor_datum = null + GLOB.mentors -= C + if(SSdbcore.Connect()) + var/datum/DBQuery/query_remove_mentor = SSdbcore.NewQuery("DELETE FROM [format_table_name("mentor")] WHERE ckey = '[ckey]'") + if(!query_remove_mentor.warn_execute()) + return + var/datum/DBQuery/query_add_admin_log = SSdbcore.NewQuery("INSERT INTO `[format_table_name("admin_log")]` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Removed mentor [ckey]');") + if(!query_add_admin_log.warn_execute()) + return + else + to_chat(usr, "Failed to establish database connection. The changes will last only for the current round.") + to_chat(usr, "Mentor removed.") diff --git a/modular_citadel/code/modules/admin/admin.dm b/modular_citadel/code/modules/admin/admin.dm deleted file mode 100644 index 52c787db..00000000 --- a/modular_citadel/code/modules/admin/admin.dm +++ /dev/null @@ -1,39 +0,0 @@ -/client/proc/citaPPoptions(mob/M) // why is this client and not /datum/admins? noone knows, in PP src == client, instead of holder. wtf. - var/body = "
" - if(M.client) - body += "Make mentor | " - body += "Remove mentor" - return body - -/client/proc/cmd_admin_man_up(mob/M in GLOB.mob_list) - set category = "Special Verbs" - set name = "Man Up" - - if(!M) - return - if(!check_rights(R_ADMIN)) - return - - to_chat(M, "Man up, and deal with it.
Move on.") - M.playsound_local(M, 'modular_citadel/sound/misc/manup.ogg', 50, FALSE, pressure_affected = FALSE) - - log_admin("Man up: [key_name(usr)] told [key_name(M)] to man up") - var/message = "[key_name_admin(usr)] told [key_name_admin(M)] to man up." - message_admins(message) - admin_ticket_log(M, message) - SSblackbox.record_feedback("tally", "admin_verb", 1, "Man Up") - -/client/proc/cmd_admin_man_up_global() - set category = "Special Verbs" - set name = "Man Up Global" - - if(!check_rights(R_ADMIN)) - return - - to_chat(world, "Man up, and deal with it.
Move on.") - for(var/mob/M in GLOB.player_list) - M.playsound_local(M, 'modular_citadel/sound/misc/manup.ogg', 50, FALSE, pressure_affected = FALSE) - - log_admin("Man up global: [key_name(usr)] told everybody to man up") - message_admins("[key_name_admin(usr)] told everybody to man up.") - SSblackbox.record_feedback("tally", "admin_verb", 1, "Man Up Global") diff --git a/modular_citadel/code/modules/admin/topic.dm b/modular_citadel/code/modules/admin/topic.dm deleted file mode 100644 index 26bc902b..00000000 --- a/modular_citadel/code/modules/admin/topic.dm +++ /dev/null @@ -1,59 +0,0 @@ -/datum/admins/proc/citaTopic(href, href_list) - if(href_list["makementor"]) - makeMentor(href_list["makementor"]) - else if(href_list["removementor"]) - removeMentor(href_list["removementor"]) - -/datum/admins/proc/makeMentor(ckey) - if(!usr.client) - return - if (!check_rights(0)) - return - if(!ckey) - return - var/client/C = GLOB.directory[ckey] - if(C) - if(check_rights_for(C, R_ADMIN,0)) - to_chat(usr, "The client chosen is an admin! Cannot mentorize.") - return - if(SSdbcore.Connect()) - var/datum/DBQuery/query_get_mentor = SSdbcore.NewQuery("SELECT id FROM [format_table_name("mentor")] WHERE ckey = '[ckey]'") - if(query_get_mentor.NextRow()) - to_chat(usr, "[ckey] is already a mentor.") - return - var/datum/DBQuery/query_add_mentor = SSdbcore.NewQuery("INSERT INTO `[format_table_name("mentor")]` (`id`, `ckey`) VALUES (null, '[ckey]')") - if(!query_add_mentor.warn_execute()) - return - var/datum/DBQuery/query_add_admin_log = SSdbcore.NewQuery("INSERT INTO `[format_table_name("admin_log")]` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Added new mentor [ckey]');") - if(!query_add_admin_log.warn_execute()) - return - else - to_chat(usr, "Failed to establish database connection. The changes will last only for the current round.") - new /datum/mentors(ckey) - to_chat(usr, "New mentor added.") - -/datum/admins/proc/removeMentor(ckey) - if(!usr.client) - return - if (!check_rights(0)) - return - if(!ckey) - return - var/client/C = GLOB.directory[ckey] - if(C) - if(check_rights_for(C, R_ADMIN,0)) - to_chat(usr, "The client chosen is an admin, not a mentor! Cannot de-mentorize.") - return - C.remove_mentor_verbs() - C.mentor_datum = null - GLOB.mentors -= C - if(SSdbcore.Connect()) - var/datum/DBQuery/query_remove_mentor = SSdbcore.NewQuery("DELETE FROM [format_table_name("mentor")] WHERE ckey = '[ckey]'") - if(!query_remove_mentor.warn_execute()) - return - var/datum/DBQuery/query_add_admin_log = SSdbcore.NewQuery("INSERT INTO `[format_table_name("admin_log")]` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Removed mentor [ckey]');") - if(!query_add_admin_log.warn_execute()) - return - else - to_chat(usr, "Failed to establish database connection. The changes will last only for the current round.") - to_chat(usr, "Mentor removed.") \ No newline at end of file diff --git a/tgstation.dme b/tgstation.dme index 2e00b4a8..b3530a8e 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -3031,11 +3031,9 @@ #include "modular_citadel\code\game\objects\structures\crates_lockers\closets\wardrobe.dm" #include "modular_citadel\code\game\objects\structures\crates_lockers\closets\secure\citadel_lockers.dm" #include "modular_citadel\code\game\turfs\cit_turfs.dm" -#include "modular_citadel\code\modules\admin\admin.dm" #include "modular_citadel\code\modules\admin\chat_commands.dm" #include "modular_citadel\code\modules\admin\holder2.dm" #include "modular_citadel\code\modules\admin\secrets.dm" -#include "modular_citadel\code\modules\admin\topic.dm" #include "modular_citadel\code\modules\arousal\arousal.dm" #include "modular_citadel\code\modules\arousal\organs\breasts.dm" #include "modular_citadel\code\modules\arousal\organs\eggsack.dm" From ac25b449f7838240bbea30e916a6b1a12c957ca5 Mon Sep 17 00:00:00 2001 From: Lin Date: Tue, 31 Dec 2019 22:54:53 +0000 Subject: [PATCH 06/14] Merge pull request #9856 from Ghommie/Ghommie-cit367 --- code/__DEFINES/dcs/signals.dm | 4 + code/__DEFINES/traits.dm | 4 + code/__HELPERS/unsorted.dm | 10 - code/_onclick/item_attack.dm | 19 +- code/datums/helper_datums/teleport.dm | 1 + code/datums/martial.dm | 1 + code/datums/martial/boxing.dm | 2 + code/datums/martial/psychotic_brawl.dm | 3 +- code/game/atoms.dm | 2 +- code/game/objects/items.dm | 6 + code/game/objects/items/melee/misc.dm | 7 +- code/game/objects/items/robot/robot_items.dm | 10 +- code/game/objects/items/stunbaton.dm | 10 +- .../abductor/equipment/abduction_gear.dm | 8 +- .../mob/living/carbon/alien/alien_defense.dm | 66 ++--- .../carbon/alien/humanoid/caste/hunter.dm | 7 +- .../carbon/alien/humanoid/humanoid_defense.dm | 80 +++--- .../carbon/alien/larva/larva_defense.dm | 41 +-- .../mob/living/carbon/carbon_defense.dm | 109 ++++---- .../mob/living/carbon/human/human_defense.dm | 254 +++++++----------- .../mob/living/carbon/human/species.dm | 7 +- .../mob/living/carbon/monkey/combat.dm | 17 ++ .../living/carbon/monkey/monkey_defense.dm | 173 ++++++------ code/modules/mob/living/living_defense.dm | 129 +++++++-- .../mob/living/silicon/ai/ai_defense.dm | 12 +- .../mob/living/silicon/pai/pai_defense.dm | 20 +- .../mob/living/silicon/robot/robot_defense.dm | 65 ++--- .../mob/living/silicon/silicon_defense.dm | 48 ++-- .../living/simple_animal/animal_defense.dm | 62 ++--- .../mob/living/simple_animal/bot/honkbot.dm | 2 +- .../mob/living/simple_animal/friendly/cat.dm | 8 +- .../mob/living/simple_animal/friendly/dog.dm | 4 +- .../friendly/drone/interaction.dm | 6 +- .../simple_animal/guardian/types/charger.dm | 6 +- .../living/simple_animal/hostile/mushroom.dm | 4 +- .../mob/living/simple_animal/slime/slime.dm | 43 +-- .../ninja/suit/n_suit_verbs/ninja_stealth.dm | 4 +- code/modules/paperwork/paperplane.dm | 2 +- .../living/silicon/robot/dogborg_equipment.dm | 7 +- 39 files changed, 675 insertions(+), 588 deletions(-) diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index cff9c7ff..fbee222f 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -261,6 +261,7 @@ ///called when the movable is added to a disposal holder object for disposal movement: (obj/structure/disposalholder/holder, obj/machinery/disposal/source) #define COMSIG_MOVABLE_DISPOSING "movable_disposing" +#define COMSIG_MOVABLE_TELEPORTED "movable_teleported" //from base of do_teleport(): (channel, turf/origin, turf/destination) // /mob signals @@ -349,6 +350,9 @@ #define COMSIG_LIVING_MINOR_SHOCK "living_minor_shock" ///from base of mob/living/revive() (full_heal, admin_revive) #define COMSIG_LIVING_REVIVE "living_revive" + +#define COMSIG_LIVING_GUN_PROCESS_FIRE "living_gun_process_fire" //from base of /obj/item/gun/proc/process_fire(): (atom/target, params, zone_override) + ///from base of /mob/living/regenerate_limbs(): (noheal, excluded_limbs) #define COMSIG_LIVING_REGENERATE_LIMBS "living_regen_limbs" ///from base of /obj/item/bodypart/proc/attach_limb(): (new_limb, special) allows you to fail limb attachment diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index e86200ce..bc5ff183 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -168,6 +168,10 @@ #define TRAIT_COLDBLOODED "coldblooded" // Your body is literal room temperature. Does not make you immune to the temp. #define TRAIT_FLIMSY "flimsy" //you have 20% less maxhealth #define TRAIT_TOUGH "tough" //you have 10% more maxhealth +#define TRAIT_AUTO_CATCH_ITEM "auto_catch_item" +#define TRAIT_CLOWN_MENTALITY "clown_mentality" // The future is now, clownman. +#define TRAIT_FREESPRINT "free_sprinting" + // common trait sources #define TRAIT_GENERIC "generic" diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 7173aa73..2df393fb 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -768,16 +768,6 @@ GLOBAL_LIST_INIT(can_embed_types, typecacheof(list( /obj/item/stack/rods, /obj/item/pipe))) -/proc/can_embed(obj/item/W) - if(W.is_sharp()) - return 1 - if(is_pointed(W)) - return 1 - - if(is_type_in_typecache(W, GLOB.can_embed_types)) - return 1 - - /* Checks if that loc and dir has an item on the wall */ diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index c080777b..6fb20a93 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -109,17 +109,18 @@ take_damage(I.force, I.damtype, "melee", 1) /mob/living/attacked_by(obj/item/I, mob/living/user) + var/totitemdamage = I.force + if(iscarbon(user)) + var/mob/living/carbon/tempcarb = user + if(!tempcarb.combatmode) + totitemdamage *= 0.5 + if(user.resting) + totitemdamage *= 0.5 + //CIT CHANGES END HERE + if(user != src && check_shields(I, totitemdamage, "the [I.name]", MELEE_ATTACK, I.armour_penetration)) + return FALSE send_item_attack_message(I, user) if(I.force) - //CIT CHANGES START HERE - combatmode and resting checks - var/totitemdamage = I.force - if(iscarbon(user)) - var/mob/living/carbon/tempcarb = user - if(!tempcarb.combatmode) - totitemdamage *= 0.5 - if(user.resting) - totitemdamage *= 0.5 - //CIT CHANGES END HERE apply_damage(totitemdamage, I.damtype) //CIT CHANGE - replaces I.force with totitemdamage if(I.damtype == BRUTE) if(prob(33)) diff --git a/code/datums/helper_datums/teleport.dm b/code/datums/helper_datums/teleport.dm index d60f8127..1c2ce851 100644 --- a/code/datums/helper_datums/teleport.dm +++ b/code/datums/helper_datums/teleport.dm @@ -79,6 +79,7 @@ tele_play_specials(teleatom, destturf, effectout, asoundout) if(ismegafauna(teleatom)) message_admins("[teleatom] [ADMIN_FLW(teleatom)] has teleported from [ADMIN_VERBOSEJMP(curturf)] to [ADMIN_VERBOSEJMP(destturf)].") + SEND_SIGNAL(teleatom, COMSIG_MOVABLE_TELEPORTED, channel, curturf, destturf) if(ismob(teleatom)) var/mob/M = teleatom diff --git a/code/datums/martial.dm b/code/datums/martial.dm index d119759e..39070c5e 100644 --- a/code/datums/martial.dm +++ b/code/datums/martial.dm @@ -10,6 +10,7 @@ var/block_chance = 0 //Chance to block melee attacks using items while on throw mode. var/restraining = 0 //used in cqc's disarm_act to check if the disarmed is being restrained and so whether they should be put in a chokehold or not var/help_verb + var/pacifism_check = TRUE //are the martial arts combos/attacks unable to be used by pacifist. var/no_guns = FALSE var/allow_temp_override = TRUE //if this martial art can be overridden by temporary martial arts diff --git a/code/datums/martial/boxing.dm b/code/datums/martial/boxing.dm index 7399528e..502d3ada 100644 --- a/code/datums/martial/boxing.dm +++ b/code/datums/martial/boxing.dm @@ -1,6 +1,8 @@ /datum/martial_art/boxing name = "Boxing" id = MARTIALART_BOXING + pacifism_check = FALSE //Let's pretend pacifists can boxe the heck out of other people, it only deals stamina damage right now. + /datum/martial_art/boxing/disarm_act(mob/living/carbon/human/A, mob/living/carbon/human/D) to_chat(A, "Can't disarm while boxing!") diff --git a/code/datums/martial/psychotic_brawl.dm b/code/datums/martial/psychotic_brawl.dm index 34301516..00fb0524 100644 --- a/code/datums/martial/psychotic_brawl.dm +++ b/code/datums/martial/psychotic_brawl.dm @@ -1,6 +1,7 @@ /datum/martial_art/psychotic_brawling name = "Psychotic Brawling" id = MARTIALART_PSYCHOBRAWL + pacifism_check = FALSE //Quite uncontrollable and unpredictable, people will still end up harming others with it. /datum/martial_art/psychotic_brawling/disarm_act(mob/living/carbon/human/A, mob/living/carbon/human/D) return psycho_attack(A,D) @@ -64,4 +65,4 @@ if(atk_verb) log_combat(A, D, "[atk_verb] (Psychotic Brawling)") - return 1 \ No newline at end of file + return 1 diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 761553b9..23124b94 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -165,7 +165,7 @@ return FALSE -/atom/proc/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) +/atom/proc/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) SEND_SIGNAL(src, COMSIG_ATOM_HULK_ATTACK, user) if(does_attack_animation) user.changeNext_move(CLICK_CD_MELEE) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index eec9ca8b..e8935cf5 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -619,6 +619,12 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) /obj/item/proc/is_sharp() return sharpness +/obj/item/proc/get_temperature() + return heat + +/obj/item/proc/get_sharpness() + return sharpness + /obj/item/proc/get_dismemberment_chance(obj/item/bodypart/affecting) if(affecting.can_dismember(src)) if((sharpness || damtype == BURN) && w_class >= WEIGHT_CLASS_NORMAL && force >= 10) diff --git a/code/game/objects/items/melee/misc.dm b/code/game/objects/items/melee/misc.dm index cdb9c146..160c4fa6 100644 --- a/code/game/objects/items/melee/misc.dm +++ b/code/game/objects/items/melee/misc.dm @@ -212,11 +212,12 @@ if(!iscyborg(target)) return else - if(cooldown <= world.time) + if(cooldown < world.time) + if(target.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) + playsound(target, 'sound/weapons/genhit.ogg', 50, 1) + return if(ishuman(target)) var/mob/living/carbon/human/H = target - if (H.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) - return if(check_martial_counter(H, user)) return playsound(get_turf(src), 'sound/effects/woodhit.ogg', 75, 1, -1) diff --git a/code/game/objects/items/robot/robot_items.dm b/code/game/objects/items/robot/robot_items.dm index 2a8f0806..5d8ccc02 100644 --- a/code/game/objects/items/robot/robot_items.dm +++ b/code/game/objects/items/robot/robot_items.dm @@ -11,11 +11,9 @@ var/charge_cost = 30 /obj/item/borg/stun/attack(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)) - playsound(M, 'sound/weapons/genhit.ogg', 50, 1) - return FALSE + if(M.check_shields(src, 0, "[M]'s [name]", MELEE_ATTACK)) + playsound(M, 'sound/weapons/genhit.ogg', 50, 1) + return FALSE if(iscyborg(user)) var/mob/living/silicon/robot/R = user if(!R.cell.use(charge_cost)) @@ -944,4 +942,4 @@ /obj/item/borg/apparatus/circuit/pre_attack(atom/A, mob/living/user, params) . = ..() if(istype(A, /obj/item/aiModule) && !stored) //If an admin wants a borg to upload laws, who am I to stop them? Otherwise, we can hint that it fails - to_chat(user, "This circuit board doesn't seem to have standard robot apparatus pin holes. You're unable to pick it up.") \ No newline at end of file + to_chat(user, "This circuit board doesn't seem to have standard robot apparatus pin holes. You're unable to pick it up.") diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm index 4a6c15f7..5d86947d 100644 --- a/code/game/objects/items/stunbaton.dm +++ b/code/game/objects/items/stunbaton.dm @@ -167,11 +167,9 @@ /obj/item/melee/baton/proc/baton_stun(mob/living/L, mob/user) - if(ishuman(L)) - var/mob/living/carbon/human/H = L - if(H.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) //No message; check_shields() handles that - playsound(L, 'sound/weapons/genhit.ogg', 50, 1) - return FALSE + if(L.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) //No message; check_shields() handles that + playsound(L, 'sound/weapons/genhit.ogg', 50, 1) + return FALSE var/stunpwr = stunforce var/obj/item/stock_parts/cell/our_cell = get_cell() if(!our_cell) @@ -250,4 +248,4 @@ sparkler?.activate() . = ..() -#undef STUNBATON_CHARGE_LENIENCY \ No newline at end of file +#undef STUNBATON_CHARGE_LENIENCY diff --git a/code/modules/antagonists/abductor/equipment/abduction_gear.dm b/code/modules/antagonists/abductor/equipment/abduction_gear.dm index 1573204d..b8bda0db 100644 --- a/code/modules/antagonists/abductor/equipment/abduction_gear.dm +++ b/code/modules/antagonists/abductor/equipment/abduction_gear.dm @@ -479,11 +479,9 @@ Congratulations! You are now trained for invasive xenobiology research!"} user.do_attack_animation(L) - if(ishuman(L)) - var/mob/living/carbon/human/H = L - if(H.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) - playsound(L, 'sound/weapons/genhit.ogg', 50, 1) - return 0 + if(L.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) + playsound(L, 'sound/weapons/genhit.ogg', 50, TRUE) + return FALSE switch (mode) if(BATON_STUN) diff --git a/code/modules/mob/living/carbon/alien/alien_defense.dm b/code/modules/mob/living/carbon/alien/alien_defense.dm index 8edf1946..f9494a25 100644 --- a/code/modules/mob/living/carbon/alien/alien_defense.dm +++ b/code/modules/mob/living/carbon/alien/alien_defense.dm @@ -6,7 +6,10 @@ return 2 //no ears /mob/living/carbon/alien/hitby(atom/movable/AM, skipcatch, hitpush) - ..(AM, skipcatch = TRUE, hitpush = FALSE) + return ..(AM, skipcatch = TRUE, hitpush = FALSE) + +/mob/living/carbon/alien/can_embed(obj/item/I) + return FALSE /*Code for aliens attacking aliens. Because aliens act on a hivemind, I don't see them as very aggressive with each other. @@ -14,13 +17,12 @@ As such, they can either help or harm other aliens. Help works like the human he In all, this is a lot like the monkey code. /N */ /mob/living/carbon/alien/attack_alien(mob/living/carbon/alien/M) - if(isturf(loc) && istype(loc.loc, /area/start)) - to_chat(M, "No attacking people at spawn, you jackass.") + . = ..() + if(!.) // the attack was blocked or was help/grab intent return - switch(M.a_intent) - if ("help") + if (INTENT_HELP) if(!recoveringstam) resting = 0 AdjustStun(-60) @@ -28,11 +30,7 @@ In all, this is a lot like the monkey code. /N AdjustUnconscious(-60) AdjustSleeping(-100) visible_message("[M.name] nuzzles [src] trying to wake [p_them()] up!") - - if ("grab") - grabbedby(M) - - else + if(INTENT_DISARM, INTENT_HARM) if(health > 0) M.do_attack_animation(src, ATTACK_EFFECT_BITE) playsound(loc, 'sound/weapons/bite.ogg', 50, 1, -1) @@ -50,29 +48,31 @@ In all, this is a lot like the monkey code. /N /mob/living/carbon/alien/attack_hand(mob/living/carbon/human/M) - if(..()) //to allow surgery to return properly. - return 0 - + . = ..() + if(.) //To allow surgery to return properly. + return switch(M.a_intent) - if("help") + if(INTENT_HELP) help_shake_act(M) - if("grab") + if(INTENT_GRAB) grabbedby(M) - if ("harm") + if (INTENT_HARM) + if(HAS_TRAIT(M, TRAIT_PACIFISM)) + to_chat(M, "You don't want to hurt [src]!") + return TRUE M.do_attack_animation(src, ATTACK_EFFECT_PUNCH) - return 1 - if("disarm") + if(INTENT_DISARM) + if(HAS_TRAIT(M, TRAIT_PACIFISM)) + to_chat(M, "You don't want to hurt [src]!") + return TRUE M.do_attack_animation(src, ATTACK_EFFECT_DISARM) - return 1 - return 0 /mob/living/carbon/alien/attack_paw(mob/living/carbon/monkey/M) - if(..()) - if (stat != DEAD) - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) - apply_damage(rand(1, 3), BRUTE, affecting) - + . = ..() + if(.) //successful monkey bite. + var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) + apply_damage(rand(1, 3), BRUTE, affecting) /mob/living/carbon/alien/attack_animal(mob/living/simple_animal/M) . = ..() @@ -93,13 +93,15 @@ In all, this is a lot like the monkey code. /N adjustStaminaLoss(damage) /mob/living/carbon/alien/attack_slime(mob/living/simple_animal/slime/M) - if(..()) //successful slime attack - var/damage = rand(5, 35) - if(M.is_adult) - damage = rand(10, 40) - adjustBruteLoss(damage) - log_combat(M, src, "attacked") - updatehealth() + . = ..() + if(!.) //unsuccessful slime attack + return + var/damage = rand(5, 35) + if(M.is_adult) + damage = rand(10, 40) + 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)) diff --git a/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm b/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm index 43f0c320..3babab45 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm @@ -63,12 +63,7 @@ if(A) if(isliving(A)) var/mob/living/L = A - var/blocked = FALSE - if(ishuman(A)) - var/mob/living/carbon/human/H = A - if(H.check_shields(src, 0, "the [name]", attack_type = LEAP_ATTACK)) - blocked = TRUE - if(!blocked) + if(!L.check_shields(src, 0, "the [name]", attack_type = LEAP_ATTACK)) L.visible_message("[src] pounces on [L]!", "[src] pounces on you!") L.Knockdown(100) sleep(2)//Runtime prevention (infinite bump() calls on hulks) 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 b3839a60..1d613db0 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm @@ -5,9 +5,11 @@ else ..() -/mob/living/carbon/alien/humanoid/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) +/mob/living/carbon/alien/humanoid/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) if(user.a_intent == INTENT_HARM) - ..(user, 1) + . = ..(user, TRUE) + if(.) + return adjustBruteLoss(15) var/hitverb = "punched" if(mob_size < MOB_SIZE_LARGE) @@ -21,46 +23,46 @@ return 1 /mob/living/carbon/alien/humanoid/attack_hand(mob/living/carbon/human/M) - if(..()) - switch(M.a_intent) - if ("harm") - var/damage = rand(1, 9) - if (prob(90)) - playsound(loc, "punch", 25, 1, -1) - visible_message("[M] has punched [src]!", \ - "[M] has punched [src]!", null, COMBAT_MESSAGE_RANGE) - if ((stat != DEAD) && (damage > 9 || prob(5)))//Regular humans have a very small chance of knocking an alien down. - Unconscious(40) - visible_message("[M] has knocked [src] down!", \ - "[M] has knocked [src] down!") - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) - apply_damage(damage, BRUTE, affecting) - log_combat(M, src, "attacked") + . = ..() + if(.) //To allow surgery to return properly. + return + switch(M.a_intent) + if (INTENT_HARM) + var/damage = rand(1, 9) + if (prob(90)) + playsound(loc, "punch", 25, 1, -1) + visible_message("[M] has punched [src]!", \ + "[M] has punched [src]!", null, COMBAT_MESSAGE_RANGE) + if ((stat != DEAD) && (damage > 9 || prob(5)))//Regular humans have a very small chance of knocking an alien down. + Unconscious(40) + visible_message("[M] has knocked [src] down!", \ + "[M] has knocked [src] down!") + var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) + apply_damage(damage, BRUTE, affecting) + log_combat(M, src, "attacked") + else + playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) + visible_message("[M] has attempted to punch [src]!", \ + "[M] has attempted to punch [src]!", null, COMBAT_MESSAGE_RANGE) + + if (INTENT_DISARM) + if (!lying) + if (prob(5)) + Unconscious(40) + playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) + log_combat(M, src, "pushed") + visible_message("[M] has pushed down [src]!", \ + "[M] has pushed down [src]!") else - playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) - visible_message("[M] has attempted to punch [src]!", \ - "[M] has attempted to punch [src]!", null, COMBAT_MESSAGE_RANGE) - - if ("disarm") - if (!lying) - if (prob(5)) - Unconscious(40) + if (prob(50)) + dropItemToGround(get_active_held_item()) playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) - log_combat(M, src, "pushed") - visible_message("[M] has pushed down [src]!", \ - "[M] has pushed down [src]!") + visible_message("[M] has disarmed [src]!", \ + "[M] has disarmed [src]!", null, COMBAT_MESSAGE_RANGE) else - if (prob(50)) - dropItemToGround(get_active_held_item()) - playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) - visible_message("[M] has disarmed [src]!", \ - "[M] has disarmed [src]!", null, COMBAT_MESSAGE_RANGE) - else - playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) - visible_message("[M] has attempted to disarm [src]!",\ - "[M] has attempted to disarm [src]!", null, COMBAT_MESSAGE_RANGE) - - + playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) + visible_message("[M] has attempted to disarm [src]!",\ + "[M] has attempted to disarm [src]!", null, COMBAT_MESSAGE_RANGE) /mob/living/carbon/alien/humanoid/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect) if(!no_effect && !visual_effect_icon) 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 69c1be70..7dabcf5a 100644 --- a/code/modules/mob/living/carbon/alien/larva/larva_defense.dm +++ b/code/modules/mob/living/carbon/alien/larva/larva_defense.dm @@ -1,26 +1,33 @@ /mob/living/carbon/alien/larva/attack_hand(mob/living/carbon/human/M) - if(..()) - var/damage = rand(1, 9) - if (prob(90)) - playsound(loc, "punch", 25, 1, -1) - log_combat(M, src, "attacked") - visible_message("[M] has kicked [src]!", \ - "[M] has kicked [src]!", null, COMBAT_MESSAGE_RANGE) - if ((stat != DEAD) && (damage > 4.9)) - Unconscious(rand(100,200)) + . = ..() + if(. || M.a_intent == INTENT_HELP || M.a_intent == INTENT_GRAB) + return + var/damage = rand(1, 9) + if (prob(90)) + playsound(loc, "punch", 25, 1, -1) + log_combat(M, src, "attacked") + visible_message("[M] has kicked [src]!", \ + "[M] has kicked [src]!", null, COMBAT_MESSAGE_RANGE) + if ((stat != DEAD) && (damage > 4.9)) + Unconscious(rand(100,200)) - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) - apply_damage(damage, BRUTE, affecting) - else - playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) - visible_message("[M] has attempted to kick [src]!", \ - "[M] has attempted to kick [src]!", null, COMBAT_MESSAGE_RANGE) + var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) + apply_damage(damage, BRUTE, affecting) + else + playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) + visible_message("[M] has attempted to kick [src]!", \ + "[M] has attempted to kick [src]!", null, COMBAT_MESSAGE_RANGE) -/mob/living/carbon/alien/larva/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) +/mob/living/carbon/alien/larva/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) if(user.a_intent == INTENT_HARM) - ..(user, 1) + . = ..(user, TRUE) + if(.) + return + playsound(loc, "punch", 25, 1, -1) + visible_message("[user] has pummeled [src]!", \ + "[user] has pummeled [src]!", null, COMBAT_MESSAGE_RANGE) adjustBruteLoss(5 + rand(1,9)) new /datum/forced_movement(src, get_step_away(user,src, 30), 1) return 1 diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index bd9c20ae..50ebba9a 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -48,31 +48,42 @@ if(affecting && affecting.dismemberable && affecting.get_damage() >= (affecting.max_damage - P.dismemberment)) affecting.dismember(P.damtype) -/mob/living/carbon/proc/can_catch_item(skip_throw_mode_check) - . = FALSE - if(!skip_throw_mode_check && !in_throw_mode) +/mob/living/carbon/catch_item(obj/item/I, skip_throw_mode_check = FALSE) + . = ..() + if(!HAS_TRAIT(src, TRAIT_AUTO_CATCH_ITEM) && !skip_throw_mode_check && !in_throw_mode) return - if(get_active_held_item()) + if(get_active_held_item() || restrained()) return - if(restrained()) - return - return TRUE - -/mob/living/carbon/hitby(atom/movable/AM, skipcatch, hitpush = TRUE, blocked = FALSE) - if(!skipcatch) //ugly, but easy - if(can_catch_item()) - if(istype(AM, /obj/item)) - var/obj/item/I = AM - if(isturf(I.loc)) - I.attack_hand(src) - if(get_active_held_item() == I) //if our attack_hand() picks up the item... - visible_message("[src] catches [I]!") //catch that sucker! - throw_mode_off() - return 1 - ..() + I.attack_hand(src) + if(get_active_held_item() == I) //if our attack_hand() picks up the item... + visible_message("[src] catches [I]!") //catch that sucker! + throw_mode_off() + return TRUE +/mob/living/carbon/embed_item(obj/item/I) + throw_alert("embeddedobject", /obj/screen/alert/embeddedobject) + var/obj/item/bodypart/L = pick(bodyparts) + L.embedded_objects |= I + I.add_mob_blood(src)//it embedded itself in you, of course it's bloody! + I.forceMove(src) + L.receive_damage(I.w_class*I.embedding.embedded_impact_pain_multiplier) + visible_message("[I] embeds itself in [src]'s [L.name]!","[I] embeds itself in your [L.name]!") + SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "embedded", /datum/mood_event/embedded) /mob/living/carbon/attacked_by(obj/item/I, mob/living/user) + //CIT CHANGES START HERE - combatmode and resting checks + var/totitemdamage = I.force + if(iscarbon(user)) + var/mob/living/carbon/tempcarb = user + if(!tempcarb.combatmode) + totitemdamage *= 0.5 + if(user.resting) + totitemdamage *= 0.5 + if(!combatmode) + totitemdamage *= 1.5 + //CIT CHANGES END HERE + if(user != src && check_shields(I, totitemdamage, "the [I.name]", MELEE_ATTACK, I.armour_penetration)) + return FALSE var/obj/item/bodypart/affecting if(user == src) affecting = get_bodypart(check_zone(user.zone_selected)) //we're self-mutilating! yay! @@ -83,17 +94,6 @@ SEND_SIGNAL(I, COMSIG_ITEM_ATTACK_ZONE, src, user, affecting) send_item_attack_message(I, user, affecting.name) if(I.force) - //CIT CHANGES START HERE - combatmode and resting checks - var/totitemdamage = I.force - if(iscarbon(user)) - var/mob/living/carbon/tempcarb = user - if(!tempcarb.combatmode) - totitemdamage *= 0.5 - if(user.resting) - totitemdamage *= 0.5 - if(!combatmode) - totitemdamage *= 1.5 - //CIT CHANGES END HERE apply_damage(totitemdamage, I.damtype, affecting) //CIT CHANGE - replaces I.force with totitemdamage if(I.damtype == BRUTE && affecting.status == BODYPART_ORGANIC) var/basebloodychance = affecting.brute_dam + totitemdamage @@ -127,7 +127,9 @@ //ATTACK HAND IGNORING PARENT RETURN VALUE /mob/living/carbon/attack_hand(mob/living/carbon/human/user) - + . = ..() + if(.) //was the attack blocked? + return for(var/thing in diseases) var/datum/disease/D = thing if(D.spread_flags & DISEASE_SPREAD_CONTACT_SKIN) @@ -142,8 +144,7 @@ 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 0 + return TRUE /mob/living/carbon/attack_paw(mob/living/carbon/monkey/M) @@ -163,7 +164,8 @@ help_shake_act(M) return 0 - if(..()) //successful monkey bite. + . = ..() + if(.) //successful monkey bite. for(var/thing in M.diseases) var/datum/disease/D = thing ForceContractDisease(D) @@ -171,26 +173,27 @@ /mob/living/carbon/attack_slime(mob/living/simple_animal/slime/M) - if(..()) //successful slime attack - if(M.powerlevel > 0) - var/stunprob = M.powerlevel * 7 + 10 // 17 at level 1, 80 at level 10 - if(prob(stunprob)) - M.powerlevel -= 3 - if(M.powerlevel < 0) - M.powerlevel = 0 + . = ..() + if(!.) + return + if(M.powerlevel > 0) + var/stunprob = M.powerlevel * 7 + 10 // 17 at level 1, 80 at level 10 + if(prob(stunprob)) + M.powerlevel -= 3 + if(M.powerlevel < 0) + M.powerlevel = 0 - visible_message("The [M.name] has shocked [src]!", \ - "The [M.name] has shocked [src]!") + visible_message("The [M.name] has shocked [src]!", \ + "The [M.name] has shocked [src]!") - do_sparks(5, TRUE, src) - var/power = M.powerlevel + rand(0,3) - Knockdown(power*20) - if(stuttering < power) - stuttering = power - if (prob(stunprob) && M.powerlevel >= 8) - adjustFireLoss(M.powerlevel * rand(6,10)) - updatehealth() - return 1 + do_sparks(5, TRUE, src) + var/power = M.powerlevel + rand(0,3) + Knockdown(power*20) + if(stuttering < power) + stuttering = power + if (prob(stunprob) && M.powerlevel >= 8) + adjustFireLoss(M.powerlevel * rand(6,10)) + updatehealth() /mob/living/carbon/proc/dismembering_strike(mob/living/attacker, dam_zone) if(!attacker.limb_destroyer) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index f6793aa2..27733ca5 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -60,63 +60,36 @@ P.firer = src P.setAngle(rand(0, 360))//SHING return FALSE + return ..() - if(!(P.original == src && P.firer == src)) //can't block or reflect when shooting yourself - if(P.is_reflectable) - if(check_reflect(def_zone)) // Checks if you've passed a reflection% check - visible_message("The [P.name] gets reflected by [src]!", \ - "The [P.name] gets reflected by [src]!") - // Find a turf near or on the original location to bounce to - if(P.starting) - var/new_x = P.starting.x + pick(0, 0, 0, 0, 0, -1, 1, -2, 2) - var/new_y = P.starting.y + pick(0, 0, 0, 0, 0, -1, 1, -2, 2) - var/turf/curloc = get_turf(src) +/mob/living/carbon/human/check_reflect(def_zone) + if(wear_suit?.IsReflect(def_zone)) + return TRUE + return ..() - // redirect the projectile - P.original = locate(new_x, new_y, P.z) - P.starting = curloc - P.firer = src - P.yo = new_y - curloc.y - P.xo = new_x - curloc.x - var/new_angle_s = P.Angle + rand(120,240) - while(new_angle_s > 180) // Translate to regular projectile degrees - new_angle_s -= 360 - P.setAngle(new_angle_s) - - return -1 // complete projectile permutation - - if(check_shields(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration)) - P.on_hit(src, 100, def_zone) - return 2 - - return (..(P , def_zone)) - -/mob/living/carbon/human/proc/check_reflect(def_zone) //Reflection checks for anything in your l_hand, r_hand, or wear_suit based on the reflection chance of the object - if(wear_suit) - if(wear_suit.IsReflect(def_zone) == 1) - return 1 - for(var/obj/item/I in held_items) - if(I.IsReflect(def_zone) == 1) - return 1 - return 0 - -/mob/living/carbon/human/proc/check_shields(atom/AM, var/damage, attack_text = "the attack", attack_type = MELEE_ATTACK, armour_penetration = 0) +/mob/living/carbon/human/check_shields(atom/AM, damage, attack_text = "the attack", attack_type = MELEE_ATTACK, armour_penetration = 0) + . = ..() + if(.) + return var/block_chance_modifier = round(damage / -3) - - for(var/obj/item/I in held_items) - if(!istype(I, /obj/item/clothing)) - var/final_block_chance = I.block_chance - (CLAMP((armour_penetration-I.armour_penetration)/2,0,100)) + block_chance_modifier //So armour piercing blades can still be parried by other blades, for example - if(I.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type)) - return 1 if(wear_suit) var/final_block_chance = wear_suit.block_chance - (CLAMP((armour_penetration-wear_suit.armour_penetration)/2,0,100)) + block_chance_modifier if(wear_suit.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type)) - return 1 + return TRUE if(w_uniform) var/final_block_chance = w_uniform.block_chance - (CLAMP((armour_penetration-w_uniform.armour_penetration)/2,0,100)) + block_chance_modifier if(w_uniform.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type)) - return 1 - return 0 + return TRUE + if(wear_neck) + var/final_block_chance = wear_neck.block_chance - (CLAMP((armour_penetration-wear_neck.armour_penetration)/2,0,100)) + block_chance_modifier + if(wear_neck.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type)) + return TRUE + return FALSE + +/mob/living/carbon/human/can_embed(obj/item/I) + if(I.get_sharpness() || is_pointed(I) || is_type_in_typecache(I, GLOB.can_embed_types)) + return TRUE + return FALSE /mob/living/carbon/human/proc/check_block() if(mind) @@ -125,37 +98,7 @@ return FALSE /mob/living/carbon/human/hitby(atom/movable/AM, skipcatch = FALSE, hitpush = TRUE, blocked = FALSE) - if(dna && dna.species) - var/spec_return = dna.species.spec_hitby(AM, src) - if(spec_return) - return spec_return - var/obj/item/I - var/throwpower = 30 - if(istype(AM, /obj/item)) - I = AM - throwpower = I.throwforce - if(I.thrownby == src) //No throwing stuff at yourself to trigger hit reactions - return ..() - if(check_shields(AM, throwpower, "\the [AM.name]", THROWN_PROJECTILE_ATTACK)) - hitpush = FALSE - skipcatch = TRUE - blocked = TRUE - else if(I) - if(I.throw_speed >= EMBED_THROWSPEED_THRESHOLD) - if(can_embed(I)) - if(prob(I.embedding.embed_chance) && !HAS_TRAIT(src, TRAIT_PIERCEIMMUNE)) - throw_alert("embeddedobject", /obj/screen/alert/embeddedobject) - var/obj/item/bodypart/L = pick(bodyparts) - L.embedded_objects |= I - I.add_mob_blood(src)//it embedded itself in you, of course it's bloody! - I.forceMove(src) - L.receive_damage(I.w_class*I.embedding.embedded_impact_pain_multiplier) - visible_message("[I] embeds itself in [src]'s [L.name]!","[I] embeds itself in your [L.name]!") - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "embedded", /datum/mood_event/embedded) - hitpush = FALSE - skipcatch = TRUE //can't catch the now embedded item - - return ..() + return dna?.species?.spec_hitby(AM, src) || ..() /mob/living/carbon/human/grabbedby(mob/living/carbon/user, supress_message = 0) if(user == src && pulling && !pulling.anchored && grab_state >= GRAB_AGGRESSIVE && (HAS_TRAIT(src, TRAIT_FAT)) && ismonkey(pulling)) @@ -189,12 +132,12 @@ return dna.species.spec_attacked_by(I, user, affecting, a_intent, src) -/mob/living/carbon/human/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) +/mob/living/carbon/human/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) if(user.a_intent == INTENT_HARM) - var/hulk_verb = pick("smash","pummel") - if(check_shields(user, 15, "the [hulk_verb]ing")) + . = ..(user, TRUE) + if(.) return - ..(user, 1) + var/hulk_verb = pick("smash","pummel") playsound(loc, user.dna.species.attack_sound, 25, 1, -1) var/message = "[user] has [hulk_verb]ed [src]!" visible_message("[message]", \ @@ -203,7 +146,8 @@ return 1 /mob/living/carbon/human/attack_hand(mob/user) - if(..()) //to allow surgery to return properly. + . = ..() + if(.) //To allow surgery to return properly. return if(ishuman(user)) var/mob/living/carbon/human/H = user @@ -215,8 +159,7 @@ if(!affecting) affecting = get_bodypart(BODY_ZONE_CHEST) if(M.a_intent == INTENT_HELP) - ..() //shaking - return 0 + return ..() //shaking if(M.a_intent == INTENT_DISARM) //Always drop item in hand, if no item, get stunned instead. var/obj/item/I = get_active_held_item() @@ -237,78 +180,67 @@ if(can_inject(M, 1, affecting))//Thick suits can stop monkey bites. if(..()) //successful monkey bite, this handles disease contraction. var/damage = rand(1, 3) - if(check_shields(M, damage, "the [M.name]")) - return 0 - if(stat != DEAD) - apply_damage(damage, BRUTE, affecting, run_armor_check(affecting, "melee")) + apply_damage(damage, BRUTE, affecting, run_armor_check(affecting, "melee")) return 1 /mob/living/carbon/human/attack_alien(mob/living/carbon/alien/humanoid/M) - if(check_shields(M, 0, "the M.name")) - visible_message("[M] attempted to touch [src]!") - return 0 - - if(..()) - if(M.a_intent == INTENT_HARM) - if (w_uniform) - w_uniform.add_fingerprint(M) - var/damage = prob(90) ? 20 : 0 - if(!damage) - playsound(loc, 'sound/weapons/slashmiss.ogg', 50, 1, -1) - visible_message("[M] has lunged at [src]!", \ - "[M] has lunged at [src]!") - return 0 - 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", null, null,10) - - playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1) - visible_message("[M] has slashed at [src]!", \ - "[M] has slashed at [src]!") - log_combat(M, src, "attacked") - if(!dismembering_strike(M, M.zone_selected)) //Dismemberment successful - return 1 - apply_damage(damage, BRUTE, affecting, armor_block) - - if(M.a_intent == INTENT_DISARM) //Always drop item in hand, if no item, get stun instead. - var/obj/item/I = get_active_held_item() - if(I && dropItemToGround(I)) - playsound(loc, 'sound/weapons/slash.ogg', 25, 1, -1) - visible_message("[M] disarmed [src]!", \ - "[M] disarmed [src]!") + . = ..() + if(!.) + return + if(M.a_intent == INTENT_HARM) + if (w_uniform) + w_uniform.add_fingerprint(M) + var/damage = prob(90) ? 20 : 0 + if(!damage) + playsound(loc, 'sound/weapons/slashmiss.ogg', 50, 1, -1) + visible_message("[M] has lunged at [src]!", \ + "[M] has lunged at [src]!") + return 0 + 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", null, null,10) + playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1) + visible_message("[M] has slashed at [src]!", \ + "[M] has slashed at [src]!") + log_combat(M, src, "attacked") + if(!dismembering_strike(M, M.zone_selected)) //Dismemberment successful + return 1 + apply_damage(damage, BRUTE, affecting, armor_block) + if(M.a_intent == INTENT_DISARM) //Always drop item in hand, if no item, get stun instead. + var/obj/item/I = get_active_held_item() + if(I && dropItemToGround(I)) + playsound(loc, 'sound/weapons/slash.ogg', 25, 1, -1) + visible_message("[M] disarmed [src]!", \ + "[M] disarmed [src]!") + else + playsound(loc, 'sound/weapons/pierce.ogg', 25, 1, -1) + if(!lying) //CITADEL EDIT + Knockdown(100, TRUE, FALSE, 30, 25) else - playsound(loc, 'sound/weapons/pierce.ogg', 25, 1, -1) - if(!lying) //CITADEL EDIT - Knockdown(100, TRUE, FALSE, 30, 25) - else - Knockdown(100) - log_combat(M, src, "tackled") - visible_message("[M] has tackled down [src]!", \ - "[M] has tackled down [src]!") - + Knockdown(100) + log_combat(M, src, "tackled") + visible_message("[M] has tackled down [src]!", \ + "[M] has tackled down [src]!") /mob/living/carbon/human/attack_larva(mob/living/carbon/alien/larva/L) - - if(..()) //successful larva bite. - var/damage = rand(1, 3) - if(check_shields(L, damage, "the [L.name]")) - 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) + . = ..() + if(!.) //unsuccessful larva bite. + return + 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) + var/armor_block = run_armor_check(affecting, "melee") + apply_damage(damage, BRUTE, affecting, armor_block) /mob/living/carbon/human/attack_animal(mob/living/simple_animal/M) . = ..() if(.) var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) - if(check_shields(M, damage, "the [M.name]", MELEE_ATTACK, M.armour_penetration)) - return FALSE 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 @@ -320,23 +252,21 @@ /mob/living/carbon/human/attack_slime(mob/living/simple_animal/slime/M) - if(..()) //successful slime attack - var/damage = rand(5, 25) - if(M.is_adult) - damage = rand(10, 35) + . = ..() + if(!.) //unsuccessful slime attack + return + var/damage = rand(5, 25) + if(M.is_adult) + damage = rand(10, 35) - 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) + 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) /mob/living/carbon/human/mech_melee_attack(obj/mecha/M) diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index f547d0a9..cc2d088d 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -1640,11 +1640,8 @@ GLOBAL_LIST_EMPTY(roundstart_races) return if(M.mind) attacker_style = M.mind.martial_art - if((M != H) && M.a_intent != INTENT_HELP && H.check_shields(M, 0, M.name, attack_type = UNARMED_ATTACK)) - log_combat(M, H, "attempted to touch") - H.visible_message("[M] attempted to touch [H]!") - return 0 - SEND_SIGNAL(M, COMSIG_MOB_ATTACK_HAND, M, H, attacker_style) + if(attacker_style?.pacifism_check && HAS_TRAIT(M, TRAIT_PACIFISM)) // most martial arts are quite harmful, alas. + attacker_style = null switch(M.a_intent) if("help") help(M, H, attacker_style) diff --git a/code/modules/mob/living/carbon/monkey/combat.dm b/code/modules/mob/living/carbon/monkey/combat.dm index 92ad87f6..56ef4fe2 100644 --- a/code/modules/mob/living/carbon/monkey/combat.dm +++ b/code/modules/mob/living/carbon/monkey/combat.dm @@ -369,6 +369,23 @@ retaliate(L) return ..() +/mob/living/carbon/monkey/attack_alien(mob/living/carbon/alien/humanoid/M) + if(M.a_intent == INTENT_HARM && prob(MONKEY_RETALIATE_HARM_PROB)) + retaliate(M) + else if(M.a_intent == INTENT_DISARM && prob(MONKEY_RETALIATE_DISARM_PROB)) + retaliate(M) + return ..() + +/mob/living/carbon/monkey/attack_larva(mob/living/carbon/alien/larva/L) + if(L.a_intent == INTENT_HARM && prob(MONKEY_RETALIATE_HARM_PROB)) + retaliate(L) + return ..() + +/mob/living/carbon/monkey/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) + if(user.a_intent == INTENT_HARM && prob(MONKEY_RETALIATE_HARM_PROB)) + retaliate(user) + return ..() + /mob/living/carbon/monkey/attack_paw(mob/living/L) if(L.a_intent == INTENT_HARM && prob(MONKEY_RETALIATE_HARM_PROB)) retaliate(L) diff --git a/code/modules/mob/living/carbon/monkey/monkey_defense.dm b/code/modules/mob/living/carbon/monkey/monkey_defense.dm index df90dd56..32e3d21e 100644 --- a/code/modules/mob/living/carbon/monkey/monkey_defense.dm +++ b/code/modules/mob/living/carbon/monkey/monkey_defense.dm @@ -6,37 +6,55 @@ ..() /mob/living/carbon/monkey/attack_paw(mob/living/M) - if(..()) //successful monkey bite. - 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)) - if(!affecting) - affecting = get_bodypart(BODY_ZONE_CHEST) - if(M.limb_destroyer) - dismembering_strike(M, affecting.body_zone) - if(stat != DEAD) - var/dmg = rand(1, 5) - apply_damage(dmg, BRUTE, affecting) + . = ..() + if(!.) //unsuccessful monkey bite. + return + 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)) + if(!affecting) + affecting = get_bodypart(BODY_ZONE_CHEST) + if(M.limb_destroyer) + dismembering_strike(M, affecting.body_zone) + 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) + . = ..() + if(!.) //unsuccessful larva bite + return + 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) + +/mob/living/carbon/monkey/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) + . = ..(user, TRUE) + if(.) + return + var/hulk_verb = pick("smash","pummel") + playsound(loc, user.dna.species.attack_sound, 25, 1, -1) + var/message = "[user] has [hulk_verb]ed [src]!" + visible_message("[message]", \ + "[message]") + adjustBruteLoss(15) + return TRUE /mob/living/carbon/monkey/attack_hand(mob/living/carbon/human/M) - if(..()) //To allow surgery to return properly. + . = ..() + if(.) //To allow surgery to return properly. return - switch(M.a_intent) - if("help") + if(INTENT_HELP) help_shake_act(M) - if("grab") + if(INTENT_GRAB) grabbedby(M) - if("harm") + if(INTENT_HARM) + if(HAS_TRAIT(M, TRAIT_PACIFISM)) + to_chat(M, "You don't want to hurt [src]!") + return M.do_attack_animation(src, ATTACK_EFFECT_PUNCH) if (prob(75)) visible_message("[M] has punched [name]!", \ @@ -60,7 +78,7 @@ playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) visible_message("[M] has attempted to punch [name]!", \ "[M] has attempted to punch [name]!", null, COMBAT_MESSAGE_RANGE) - if("disarm") + if(INTENT_DISARM) if(!IsUnconscious()) M.do_attack_animation(src, ATTACK_EFFECT_DISARM) if (prob(25)) @@ -74,50 +92,51 @@ visible_message("[M] has disarmed [src]!", "[M] has disarmed [src]!", null, COMBAT_MESSAGE_RANGE) /mob/living/carbon/monkey/attack_alien(mob/living/carbon/alien/humanoid/M) - if(..()) //if harm or disarm intent. - if (M.a_intent == INTENT_HARM) - if ((prob(95) && health > 0)) - playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1) - var/damage = rand(15, 30) - if (damage >= 25) - damage = rand(20, 40) - if(AmountUnconscious() < 300) - Unconscious(rand(200, 300)) - visible_message("[M] has wounded [name]!", \ - "[M] has wounded [name]!", null, COMBAT_MESSAGE_RANGE) - else - visible_message("[M] has slashed [name]!", \ - "[M] has slashed [name]!", null, COMBAT_MESSAGE_RANGE) - - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) - log_combat(M, src, "attacked") - if(!affecting) - affecting = get_bodypart(BODY_ZONE_CHEST) - if(!dismembering_strike(M, affecting.body_zone)) //Dismemberment successful - return 1 - apply_damage(damage, BRUTE, affecting) - + . = ..() + if(!.) // the attack was blocked or was help/grab intent + return + if (M.a_intent == INTENT_HARM) + if ((prob(95) && health > 0)) + playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1) + var/damage = rand(15, 30) + if (damage >= 25) + damage = rand(20, 40) + if(AmountUnconscious() < 300) + Unconscious(rand(200, 300)) + visible_message("[M] has wounded [name]!", \ + "[M] has wounded [name]!", null, COMBAT_MESSAGE_RANGE) else - playsound(loc, 'sound/weapons/slashmiss.ogg', 25, 1, -1) - visible_message("[M] has attempted to lunge at [name]!", \ - "[M] has attempted to lunge at [name]!", null, COMBAT_MESSAGE_RANGE) + visible_message("[M] has slashed [name]!", \ + "[M] has slashed [name]!", null, COMBAT_MESSAGE_RANGE) - if (M.a_intent == INTENT_DISARM) - var/obj/item/I = null - playsound(loc, 'sound/weapons/pierce.ogg', 25, 1, -1) - if(prob(95)) - Knockdown(20) - visible_message("[M] has tackled down [name]!", \ - "[M] has tackled down [name]!", null, COMBAT_MESSAGE_RANGE) + var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) + log_combat(M, src, "attacked") + if(!affecting) + affecting = get_bodypart(BODY_ZONE_CHEST) + if(!dismembering_strike(M, affecting.body_zone)) //Dismemberment successful + return 1 + apply_damage(damage, BRUTE, affecting) + + else + playsound(loc, 'sound/weapons/slashmiss.ogg', 25, 1, -1) + visible_message("[M] has attempted to lunge at [name]!", \ + "[M] has attempted to lunge at [name]!", null, COMBAT_MESSAGE_RANGE) + + else + var/obj/item/I = null + playsound(loc, 'sound/weapons/pierce.ogg', 25, 1, -1) + if(prob(95)) + Knockdown(20) + visible_message("[M] has tackled down [name]!", \ + "[M] has tackled down [name]!", null, COMBAT_MESSAGE_RANGE) + else + I = get_active_held_item() + if(dropItemToGround(I)) + visible_message("[M] has disarmed [name]!", "[M] has disarmed [name]!", null, COMBAT_MESSAGE_RANGE) else - I = get_active_held_item() - if(dropItemToGround(I)) - visible_message("[M] has disarmed [name]!", "[M] has disarmed [name]!", null, COMBAT_MESSAGE_RANGE) - else - I = null - log_combat(M, src, "disarmed", "[I ? " removing \the [I]" : ""]") - updatehealth() - + I = null + log_combat(M, src, "disarmed", "[I ? " removing \the [I]" : ""]") + updatehealth() /mob/living/carbon/monkey/attack_animal(mob/living/simple_animal/M) . = ..() @@ -132,17 +151,19 @@ 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 = rand(5, 35) - if(M.is_adult) - damage = rand(20, 40) - 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) + . = ..() + if(!.) //unsuccessful slime attack + return + var/damage = rand(5, 35) + if(M.is_adult) + damage = rand(20, 40) + 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) /mob/living/carbon/monkey/acid_act(acidpwr, acid_volume, bodyzone_hit) . = 1 diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index f80a9a64..3c1c09e9 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -36,7 +36,50 @@ /mob/living/proc/on_hit(obj/item/projectile/P) return +/mob/living/proc/check_shields(atom/AM, damage, attack_text = "the attack", attack_type = MELEE_ATTACK, armour_penetration = 0) + var/block_chance_modifier = round(damage / -3) + for(var/obj/item/I in held_items) + if(!istype(I, /obj/item/clothing)) + var/final_block_chance = I.block_chance - (CLAMP((armour_penetration-I.armour_penetration)/2,0,100)) + block_chance_modifier //So armour piercing blades can still be parried by other blades, for example + if(I.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type)) + return TRUE + return FALSE + +/mob/living/proc/check_reflect(def_zone) //Reflection checks for anything in your hands, based on the reflection chance of the object(s) + for(var/obj/item/I in held_items) + if(I.IsReflect(def_zone)) + return TRUE + return FALSE + +/mob/living/proc/reflect_bullet_check(obj/item/projectile/P, def_zone) + if(P.is_reflectable && check_reflect(def_zone)) // Checks if you've passed a reflection% check + visible_message("The [P.name] gets reflected by [src]!", \ + "The [P.name] gets reflected by [src]!") + // Find a turf near or on the original location to bounce to + if(P.starting) + var/new_x = P.starting.x + pick(0, 0, 0, 0, 0, -1, 1, -2, 2) + var/new_y = P.starting.y + pick(0, 0, 0, 0, 0, -1, 1, -2, 2) + var/turf/curloc = get_turf(src) + // redirect the projectile + P.original = locate(new_x, new_y, P.z) + P.starting = curloc + P.firer = src + P.yo = new_y - curloc.y + P.xo = new_x - curloc.x + var/new_angle_s = P.Angle + rand(120,240) + while(new_angle_s > 180) // Translate to regular projectile degrees + new_angle_s -= 360 + P.setAngle(new_angle_s) + return TRUE + return FALSE + /mob/living/bullet_act(obj/item/projectile/P, def_zone) + if(P.original != src || P.firer != src) //try to block or reflect the bullet, can't do so when shooting oneself + if(reflect_bullet_check(P, def_zone)) + return -1 // complete projectile permutation + if(check_shields(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration)) + P.on_hit(src, 100, def_zone) + return 2 var/armor = run_armor_check(def_zone, P.flag, null, null, P.armour_penetration, null) if(!P.nodamage) apply_damage(P.damage, P.damage_type, def_zone, armor) @@ -55,9 +98,32 @@ else return 0 +/mob/living/proc/catch_item(obj/item/I, skip_throw_mode_check = FALSE) + return FALSE + +/mob/living/proc/embed_item(obj/item/I) + return + +/mob/living/proc/can_embed(obj/item/I) + return FALSE + /mob/living/hitby(atom/movable/AM, skipcatch, hitpush = TRUE, blocked = FALSE) - if(istype(AM, /obj/item)) - var/obj/item/I = AM + var/obj/item/I + var/throwpower = 30 + if(isitem(AM)) + I = AM + throwpower = I.throwforce + if(check_shields(AM, throwpower, "\the [AM.name]", THROWN_PROJECTILE_ATTACK)) + hitpush = FALSE + skipcatch = TRUE + blocked = TRUE + else if(I && I.throw_speed >= EMBED_THROWSPEED_THRESHOLD && can_embed(I, src) && prob(I.embedding.embed_chance) && !HAS_TRAIT(src, TRAIT_PIERCEIMMUNE) && (!HAS_TRAIT(src, TRAIT_AUTO_CATCH_ITEM) || incapacitated() || get_active_held_item())) + embed_item(I) + hitpush = FALSE + skipcatch = TRUE //can't catch the now embedded item + if(I) + if(!skipcatch && isturf(I.loc) && catch_item(I)) + return TRUE 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() @@ -205,6 +271,24 @@ Move(user.loc) return 1 +/mob/living/attack_hand(mob/user) + ..() //Ignoring parent return value here. + SEND_SIGNAL(src, COMSIG_MOB_ATTACK_HAND, user) + if((user != src) && user.a_intent != INTENT_HELP && check_shields(user, 0, user.name, attack_type = UNARMED_ATTACK)) + log_combat(user, src, "attempted to touch") + visible_message("[user] attempted to touch [src]!") + return TRUE + +/mob/living/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) + if(user.a_intent == INTENT_HARM) + if(HAS_TRAIT(user, TRAIT_PACIFISM)) + to_chat(user, "You don't want to hurt [src]!") + return TRUE + var/hulk_verb = pick("smash","pummel") + if(user != src && check_shields(user, 15, "the [hulk_verb]ing")) + return TRUE + ..() + return FALSE /mob/living/attack_slime(mob/living/simple_animal/slime/M) if(!SSticker.HasRoundStarted()) @@ -220,6 +304,12 @@ to_chat(M, "You don't want to hurt anyone!") return FALSE + var/damage = rand(5, 35) + if(M.is_adult) + damage = rand(20, 40) + if(check_shields(M, damage, "the [M.name]")) + return FALSE + if (stat != DEAD) log_combat(M, src, "attacked") M.do_attack_animation(src) @@ -236,7 +326,8 @@ if(HAS_TRAIT(M, TRAIT_PACIFISM)) to_chat(M, "You don't want to hurt anyone!") return FALSE - + if(check_shields(M, rand(M.melee_damage_lower, M.melee_damage_upper), "the [M.name]", MELEE_ATTACK, M.armour_penetration)) + return FALSE if(M.attack_sound) playsound(loc, M.attack_sound, 50, 1, 1) M.do_attack_animation(src) @@ -247,10 +338,6 @@ /mob/living/attack_paw(mob/living/carbon/monkey/M) - if(isturf(loc) && istype(loc.loc, /area/start)) - to_chat(M, "No attacking people at spawn, you jackass.") - return FALSE - if (M.a_intent == INTENT_HARM) if(HAS_TRAIT(M, TRAIT_PACIFISM)) to_chat(M, "You don't want to hurt anyone!") @@ -259,6 +346,8 @@ if(M.is_muzzled() || (M.wear_mask && M.wear_mask.flags_cover & MASKCOVERSMOUTH)) to_chat(M, "You can't bite with your mouth covered!") return FALSE + if(check_shields(M, 0, "the [M.name]")) + return FALSE M.do_attack_animation(src, ATTACK_EFFECT_BITE) if (prob(75)) log_combat(M, src, "attacked") @@ -273,14 +362,16 @@ /mob/living/attack_larva(mob/living/carbon/alien/larva/L) switch(L.a_intent) - if("help") + if(INTENT_HELP) visible_message("[L.name] rubs its head against [src].") return FALSE else if(HAS_TRAIT(L, TRAIT_PACIFISM)) to_chat(L, "You don't want to hurt anyone!") - return + return FALSE + if(L != src && check_shields(L, rand(1, 3), "the [L.name]")) + return FALSE L.do_attack_animation(src) if(prob(90)) @@ -295,21 +386,27 @@ return FALSE /mob/living/attack_alien(mob/living/carbon/alien/humanoid/M) + if((M != src) && M.a_intent != INTENT_HELP && check_shields(M, 0, "the [M.name]")) + visible_message("[M] attempted to touch [src]!") + return FALSE switch(M.a_intent) - if ("help") - visible_message("[M] caresses [src] with its scythe like arm.") + if (INTENT_HELP) + if(!isalien(src)) //I know it's ugly, but the alien vs alien attack_alien behaviour is a bit different. + visible_message("[M] caresses [src] with its scythe like arm.") return FALSE - if ("grab") + if (INTENT_GRAB) grabbedby(M) return FALSE - if("harm") + if(INTENT_HARM) if(HAS_TRAIT(M, TRAIT_PACIFISM)) to_chat(M, "You don't want to hurt anyone!") return FALSE - M.do_attack_animation(src) + if(!isalien(src)) + M.do_attack_animation(src) return TRUE - if("disarm") - M.do_attack_animation(src, ATTACK_EFFECT_DISARM) + if(INTENT_DISARM) + if(!isalien(src)) + M.do_attack_animation(src, ATTACK_EFFECT_DISARM) return TRUE /mob/living/ex_act(severity, target, origin) diff --git a/code/modules/mob/living/silicon/ai/ai_defense.dm b/code/modules/mob/living/silicon/ai/ai_defense.dm index 7c59c2b7..97d26f67 100644 --- a/code/modules/mob/living/silicon/ai/ai_defense.dm +++ b/code/modules/mob/living/silicon/ai/ai_defense.dm @@ -1,15 +1,9 @@ - /mob/living/silicon/ai/attacked_by(obj/item/I, mob/living/user, def_zone) + . = ..() + if(!.) + return FALSE if(I.force && I.damtype != STAMINA && stat != DEAD) //only sparks if real damage is dealt. spark_system.start() - return ..() - - -/mob/living/silicon/ai/attack_alien(mob/living/carbon/alien/humanoid/M) - if(!SSticker.HasRoundStarted()) - to_chat(M, "You cannot attack people before the game has started.") - return - ..() /mob/living/silicon/ai/attack_slime(mob/living/simple_animal/slime/user) return //immune to slimes diff --git a/code/modules/mob/living/silicon/pai/pai_defense.dm b/code/modules/mob/living/silicon/pai/pai_defense.dm index f36e996b..d1dd8602 100644 --- a/code/modules/mob/living/silicon/pai/pai_defense.dm +++ b/code/modules/mob/living/silicon/pai/pai_defense.dm @@ -26,13 +26,14 @@ fold_in(force = 1) Knockdown(200) +//ATTACK HAND IGNORING PARENT RETURN VALUE /mob/living/silicon/pai/attack_hand(mob/living/carbon/human/user) switch(user.a_intent) - if("help") + if(INTENT_HELP) visible_message("[user] gently pats [src] on the head, eliciting an off-putting buzzing from its holographic field.") - if("disarm") + if(INTENT_DISARM) visible_message("[user] boops [src] on the head!") - if("harm") + if(INTENT_HARM) user.do_attack_animation(src) if (user.name == master) visible_message("Responding to its master's touch, [src] disengages its holochassis emitter, rapidly losing coherence.") @@ -41,14 +42,19 @@ if(user.put_in_hands(card)) user.visible_message("[user] promptly scoops up [user.p_their()] pAI's card.") else + if(HAS_TRAIT(user, TRAIT_PACIFISM)) + to_chat(user, "You don't want to hurt [src]!") + return visible_message("[user] stomps on [src]!.") take_holo_damage(2) + else + grabbedby(user) -/mob/living/silicon/pai/bullet_act(obj/item/projectile/Proj) - if(Proj.stun) +/mob/living/silicon/pai/bullet_act(obj/item/projectile/P, def_zone) + if(P.stun) fold_in(force = TRUE) - src.visible_message("The electrically-charged projectile disrupts [src]'s holomatrix, forcing [src] to fold in!") - . = ..(Proj) + visible_message("The electrically-charged projectile disrupts [src]'s holomatrix, forcing [src] to fold in!") + . = ..() /mob/living/silicon/pai/stripPanelUnequip(obj/item/what, mob/who, where) //prevents stripping to_chat(src, "Your holochassis stutters and warps intensely as you attempt to interact with the object, forcing you to cease lest the field fail.") diff --git a/code/modules/mob/living/silicon/robot/robot_defense.dm b/code/modules/mob/living/silicon/robot/robot_defense.dm index c90c719e..a85b8648 100644 --- a/code/modules/mob/living/silicon/robot/robot_defense.dm +++ b/code/modules/mob/living/silicon/robot/robot_defense.dm @@ -13,7 +13,19 @@ spark_system.start() return ..() +/mob/living/silicon/robot/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) + . = ..() + if(.) + spark_system.start() + spawn(0) + step_away(src,user,15) + sleep(3) + step_away(src,user,15) + /mob/living/silicon/robot/attack_alien(mob/living/carbon/alien/humanoid/M) + . = ..() + if(!.) // the attack was blocked or was help/grab intent + return if (M.a_intent == INTENT_DISARM) if(!(lying)) M.do_attack_animation(src, ATTACK_EFFECT_DISARM) @@ -30,24 +42,19 @@ visible_message("[M] has forced back [src]!", \ "[M] has forced back [src]!", null, COMBAT_MESSAGE_RANGE) playsound(loc, 'sound/weapons/pierce.ogg', 50, 1, -1) - else - ..() - return /mob/living/silicon/robot/attack_slime(mob/living/simple_animal/slime/M) - if(..()) //successful slime shock - flash_act() - var/stunprob = M.powerlevel * 7 + 10 - if(prob(stunprob) && M.powerlevel >= 8) - adjustBruteLoss(M.powerlevel * rand(6,10)) - - var/damage = rand(1, 3) - + . = ..() + if(!.) //unsuccessful slime shock + return + var/stunprob = M.powerlevel * 7 + 10 + var/damage = M.powerlevel * rand(6,10) + if(prob(stunprob) && M.powerlevel >= 8) + flash_act(affect_silicon = TRUE) //my borg eyes! if(M.is_adult) - damage = rand(20, 40) + damage += rand(10, 20) else - damage = rand(5, 35) - damage = round(damage / 2) // borgs receive half damage + damage += rand(2, 17) adjustBruteLoss(damage) updatehealth() @@ -56,23 +63,17 @@ //ATTACK HAND IGNORING PARENT RETURN VALUE /mob/living/silicon/robot/attack_hand(mob/living/carbon/human/user) add_fingerprint(user) - if(opened && !wiresexposed && !issilicon(user)) - if(cell) - cell.update_icon() - cell.add_fingerprint(user) - user.put_in_active_hand(cell) - to_chat(user, "You remove \the [cell].") - cell = null - update_icons() - diag_hud_set_borgcell() + if(opened && !wiresexposed && cell && !issilicon(user)) + cell.update_icon() + cell.add_fingerprint(user) + user.put_in_active_hand(cell) + to_chat(user, "You remove \the [cell].") + cell = null + update_icons() + diag_hud_set_borgcell() if(!opened) - if(..()) // hulk attack - spark_system.start() - spawn(0) - step_away(src,user,15) - sleep(3) - step_away(src,user,15) + return ..() /mob/living/silicon/robot/fire_act() if(!on_fire) //Silicons don't gain stacks from hotspots, but hotspots can ignite them @@ -177,9 +178,9 @@ if (stat != DEAD) adjustBruteLoss(30) -/mob/living/silicon/robot/bullet_act(var/obj/item/projectile/Proj) - ..(Proj) +/mob/living/silicon/robot/bullet_act(obj/item/projectile/P, def_zone) + ..() updatehealth() - if(prob(75) && Proj.damage > 0) + if(prob(75) && P.damage > 0) spark_system.start() return 2 diff --git a/code/modules/mob/living/silicon/silicon_defense.dm b/code/modules/mob/living/silicon/silicon_defense.dm index 073a2eec..ca8ad257 100644 --- a/code/modules/mob/living/silicon/silicon_defense.dm +++ b/code/modules/mob/living/silicon/silicon_defense.dm @@ -6,7 +6,10 @@ return 2 /mob/living/silicon/attack_alien(mob/living/carbon/alien/humanoid/M) - if(..()) //if harm or disarm intent + . = ..() + if(!.) // the attack was blocked or was help/grab intent + return + if(M.a_intent == INTENT_HARM) var/damage = 20 if (prob(90)) log_combat(M, src, "attacked") @@ -49,34 +52,33 @@ /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) +/mob/living/silicon/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) if(user.a_intent == INTENT_HARM) - ..(user, 1) + . = ..(user, TRUE) + if(.) + return adjustBruteLoss(rand(10, 15)) playsound(loc, "punch", 25, 1, -1) visible_message("[user] has punched [src]!", \ "[user] has punched [src]!") - return 1 - return 0 + return TRUE + return FALSE -//ATTACK HAND IGNORING PARENT RETURN VALUE /mob/living/silicon/attack_hand(mob/living/carbon/human/M) + . = ..() + if(.) //the attack was blocked + return switch(M.a_intent) - if ("help") + if (INTENT_HELP) M.visible_message("[M] pets [src].", \ "You pet [src].") - if("grab") + if(INTENT_GRAB) grabbedby(M) else M.do_attack_animation(src, ATTACK_EFFECT_PUNCH) playsound(src.loc, 'sound/effects/bang.ogg', 10, 1) visible_message("[M] punches [src], but doesn't leave a dent.", \ "[M] punches [src], but doesn't leave a dent.", null, COMBAT_MESSAGE_RANGE) - return 0 /mob/living/silicon/attack_drone(mob/living/simple_animal/drone/M) if(M.a_intent == INTENT_HARM) @@ -108,19 +110,25 @@ M.visible_message("[M] is thrown off of [src]!") flash_act(affect_silicon = 1) -/mob/living/silicon/bullet_act(obj/item/projectile/Proj) - if((Proj.damage_type == BRUTE || Proj.damage_type == BURN)) - adjustBruteLoss(Proj.damage) - if(prob(Proj.damage*1.5)) +/mob/living/silicon/bullet_act(obj/item/projectile/P, def_zone) + if(P.original != src || P.firer != src) //try to block or reflect the bullet, can't do so when shooting oneself + if(reflect_bullet_check(P, def_zone)) + return -1 // complete projectile permutation + if(check_shields(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration)) + P.on_hit(src, 100, def_zone) + return 2 + if((P.damage_type == BRUTE || P.damage_type == BURN)) + adjustBruteLoss(P.damage) + if(prob(P.damage*1.5)) for(var/mob/living/M in buckled_mobs) M.visible_message("[M] is knocked off of [src]!") unbuckle_mob(M) M.Knockdown(40) - if(Proj.stun || Proj.knockdown) + if(P.stun || P.knockdown) for(var/mob/living/M in buckled_mobs) unbuckle_mob(M) - M.visible_message("[M] is knocked off of [src] by the [Proj]!") - Proj.on_hit(src) + M.visible_message("[M] is knocked off of [src] by the [P]!") + P.on_hit(src) return 2 /mob/living/silicon/flash_act(intensity = 1, override_blindness_check = 0, affect_silicon = 0, visual = 0, type = /obj/screen/fullscreen/flash/static) diff --git a/code/modules/mob/living/simple_animal/animal_defense.dm b/code/modules/mob/living/simple_animal/animal_defense.dm index 793df63c..0dfa126e 100644 --- a/code/modules/mob/living/simple_animal/animal_defense.dm +++ b/code/modules/mob/living/simple_animal/animal_defense.dm @@ -1,20 +1,22 @@ /mob/living/simple_animal/attack_hand(mob/living/carbon/human/M) - ..() + . = ..() + if(.) //the attack was blocked + return switch(M.a_intent) - if("help") + if(INTENT_HELP) if (health > 0) visible_message("[M] [response_help] [src].") playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) - if("grab") + if(INTENT_GRAB) if(grab_state >= GRAB_AGGRESSIVE && isliving(pulling)) vore_attack(M, pulling) else grabbedby(M) - if("harm", "disarm") + if(INTENT_HARM, INTENT_DISARM) if(HAS_TRAIT(M, TRAIT_PACIFISM)) to_chat(M, "You don't want to hurt [src]!") return @@ -27,12 +29,11 @@ updatehealth() return TRUE -/mob/living/simple_animal/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) +/mob/living/simple_animal/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) if(user.a_intent == INTENT_HARM) - if(HAS_TRAIT(user, TRAIT_PACIFISM)) - to_chat(user, "You don't want to hurt [src]!") - return FALSE - ..(user, 1) + . = ..(user, TRUE) + if(.) + return playsound(loc, "punch", 25, 1, -1) visible_message("[user] has punched [src]!", \ "[user] has punched [src]!", null, COMBAT_MESSAGE_RANGE) @@ -40,32 +41,32 @@ 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) - return 1 + . = ..() + if(.) //successful larva bite + var/damage = rand(1, 3) + attack_threshold_check(damage) + return 1 if (M.a_intent == INTENT_HELP) if (health > 0) visible_message("[M.name] [response_help] [src].") playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) - /mob/living/simple_animal/attack_alien(mob/living/carbon/alien/humanoid/M) - if(..()) //if harm or disarm intent. - if(M.a_intent == INTENT_DISARM) - playsound(loc, 'sound/weapons/pierce.ogg', 25, 1, -1) - visible_message("[M] [response_disarm] [name]!", \ - "[M] [response_disarm] [name]!", null, COMBAT_MESSAGE_RANGE) - log_combat(M, src, "disarmed") - else - var/damage = rand(15, 30) - visible_message("[M] has slashed at [src]!", \ - "[M] has slashed at [src]!", null, COMBAT_MESSAGE_RANGE) - playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1) - attack_threshold_check(damage) - log_combat(M, src, "attacked") - return 1 + . = ..() + if(!.) // the attack was blocked or was help/grab intent + return + if(M.a_intent == INTENT_DISARM) + playsound(loc, 'sound/weapons/pierce.ogg', 25, 1, -1) + visible_message("[M] [response_disarm] [name]!", \ + "[M] [response_disarm] [name]!", null, COMBAT_MESSAGE_RANGE) + log_combat(M, src, "disarmed") + else + var/damage = rand(15, 30) + visible_message("[M] has slashed at [src]!", \ + "[M] has slashed at [src]!", null, COMBAT_MESSAGE_RANGE) + playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1) + attack_threshold_check(damage) + log_combat(M, src, "attacked") /mob/living/simple_animal/attack_larva(mob/living/carbon/alien/larva/L) . = ..() @@ -82,7 +83,8 @@ 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 + . = ..() + if(.) //successful slime shock var/damage = rand(15, 25) if(M.is_adult) damage = rand(20, 35) diff --git a/code/modules/mob/living/simple_animal/bot/honkbot.dm b/code/modules/mob/living/simple_animal/bot/honkbot.dm index e069b46e..cf64f4ee 100644 --- a/code/modules/mob/living/simple_animal/bot/honkbot.dm +++ b/code/modules/mob/living/simple_animal/bot/honkbot.dm @@ -112,7 +112,7 @@ Maintenance panel panel is [open ? "opened" : "closed"]"}, mode = BOT_HUNT /mob/living/simple_animal/bot/honkbot/attack_hand(mob/living/carbon/human/H) - if(H.a_intent == "harm") + if(H.a_intent == INTENT_HARM) retaliate(H) addtimer(CALLBACK(src, .proc/react_buzz), 5) return ..() diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index 4c47a606..501a853f 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -234,9 +234,9 @@ /mob/living/simple_animal/pet/cat/attack_hand(mob/living/carbon/human/M) . = ..() switch(M.a_intent) - if("help") + if(INTENT_HELP) wuv(1, M) - if("harm") + if(INTENT_HARM) wuv(-1, M) /mob/living/simple_animal/pet/cat/proc/wuv(change, mob/M) @@ -292,7 +292,9 @@ D.frost_donut() /mob/living/simple_animal/pet/cat/cak/attack_hand(mob/living/L) - ..() + . = ..() + if(.) //the attack was blocked + return if(L.a_intent == INTENT_HARM && L.reagents && !stat) L.reagents.add_reagent("nutriment", 0.4) L.reagents.add_reagent("vitamin", 0.4) diff --git a/code/modules/mob/living/simple_animal/friendly/dog.dm b/code/modules/mob/living/simple_animal/friendly/dog.dm index 00f9350d..13cc11de 100644 --- a/code/modules/mob/living/simple_animal/friendly/dog.dm +++ b/code/modules/mob/living/simple_animal/friendly/dog.dm @@ -645,9 +645,9 @@ /mob/living/simple_animal/pet/dog/attack_hand(mob/living/carbon/human/M) . = ..() switch(M.a_intent) - if("help") + if(INTENT_HELP) wuv(1,M) - if("harm") + if(INTENT_HARM) wuv(-1,M) /mob/living/simple_animal/pet/dog/proc/wuv(change, mob/M) 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 e40eb585..c9207fcf 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm @@ -31,9 +31,9 @@ //picky up the drone c: /mob/living/simple_animal/drone/attack_hand(mob/user) - ..() - if(user.a_intent == INTENT_HELP) - mob_try_pickup(user) + if(user.a_intent != INTENT_HELP) + return ..() // TODO: convert picking up mobs into an element or component. + mob_try_pickup(user) /mob/living/simple_animal/drone/proc/try_reactivate(mob/living/user) var/mob/dead/observer/G = get_ghost() 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 3ece5d4e..3719861d 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/charger.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/charger.dm @@ -54,10 +54,8 @@ var/blocked = FALSE if(hasmatchingsummoner(A)) //if the summoner matches don't hurt them blocked = TRUE - if(ishuman(A)) - var/mob/living/carbon/human/H = A - if(H.check_shields(src, 90, "[name]", attack_type = THROWN_PROJECTILE_ATTACK)) - blocked = TRUE + if(L.check_shields(src, 90, "[name]", attack_type = THROWN_PROJECTILE_ATTACK)) + blocked = TRUE if(!blocked) L.drop_all_held_items() L.visible_message("[src] slams into [L]!", "[src] slams into you!") diff --git a/code/modules/mob/living/simple_animal/hostile/mushroom.dm b/code/modules/mob/living/simple_animal/hostile/mushroom.dm index f53639d2..f7301be1 100644 --- a/code/modules/mob/living/simple_animal/hostile/mushroom.dm +++ b/code/modules/mob/living/simple_animal/hostile/mushroom.dm @@ -166,7 +166,9 @@ ..() /mob/living/simple_animal/hostile/mushroom/attack_hand(mob/living/carbon/human/M) - ..() + . = ..() + if(.) // the attack was blocked + return if(M.a_intent == INTENT_HARM) Bruise() diff --git a/code/modules/mob/living/simple_animal/slime/slime.dm b/code/modules/mob/living/simple_animal/slime/slime.dm index 2001c61e..b5baff4c 100644 --- a/code/modules/mob/living/simple_animal/slime/slime.dm +++ b/code/modules/mob/living/simple_animal/slime/slime.dm @@ -252,33 +252,34 @@ 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!") - return - attacked += 5 - if(nutrition >= 100) //steal some nutrition. negval handled in life() - nutrition -= (50 + (40 * M.is_adult)) - M.add_nutrition(50 + (40 * M.is_adult)) - if(health > 0) - M.adjustBruteLoss(-10 + (-10 * M.is_adult)) - M.updatehealth() + . = ..() + if(!. || M == src) //unsuccessful slime shock + return + if(buckled) + Feedstop(silent = TRUE) + visible_message("[M] pulls [src] off!") + return + attacked += 5 + if(nutrition >= 100) //steal some nutrition. negval handled in life() + nutrition -= (50 + (40 * M.is_adult)) + M.add_nutrition(50 + (40 * M.is_adult)) + if(health > 0) + M.adjustBruteLoss(-10 + (-10 * M.is_adult)) + M.updatehealth() /mob/living/simple_animal/slime/attack_animal(mob/living/simple_animal/M) . = ..() if(.) attacked += 10 - /mob/living/simple_animal/slime/attack_paw(mob/living/carbon/monkey/M) - if(..()) //successful monkey bite. + . = ..() + if(.)//successful monkey bite. attacked += 10 /mob/living/simple_animal/slime/attack_larva(mob/living/carbon/alien/larva/L) - if(..()) //successful larva bite. + . = ..() + if(.) //successful larva bite. attacked += 10 /mob/living/simple_animal/slime/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) @@ -320,9 +321,11 @@ attacked += 10 /mob/living/simple_animal/slime/attack_alien(mob/living/carbon/alien/humanoid/M) - if(..()) //if harm or disarm intent. - attacked += 10 - discipline_slime(M) + . = ..() + if(!.) // the attack was blocked or was help/grab intent + return + attacked += 10 + discipline_slime(M) /mob/living/simple_animal/slime/attackby(obj/item/W, mob/living/user, params) diff --git a/code/modules/ninja/suit/n_suit_verbs/ninja_stealth.dm b/code/modules/ninja/suit/n_suit_verbs/ninja_stealth.dm index 94be922f..575ae081 100644 --- a/code/modules/ninja/suit/n_suit_verbs/ninja_stealth.dm +++ b/code/modules/ninja/suit/n_suit_verbs/ninja_stealth.dm @@ -20,7 +20,7 @@ Contents: animate(affecting, alpha = 10,time = 15) affecting.visible_message("[affecting.name] vanishes into thin air!", \ "You are now mostly invisible to normal detection.") - RegisterSignal(affecting, list(COMSIG_MOB_ITEM_ATTACK, COMSIG_MOB_ATTACK_RANGED, COMSIG_MOB_ATTACK_HAND, COMSIG_MOB_THROW, COMSIG_PARENT_ATTACKBY), .proc/reduce_stealth) + RegisterSignal(affecting, list(COMSIG_MOB_ITEM_ATTACK, COMSIG_MOB_ATTACK_RANGED, COMSIG_HUMAN_MELEE_UNARMED_ATTACK, COMSIG_MOB_ATTACK_HAND, COMSIG_MOB_THROW, COMSIG_PARENT_ATTACKBY, COMSIG_MOVABLE_TELEPORTED, COMSIG_LIVING_GUN_PROCESS_FIRE), .proc/reduce_stealth) RegisterSignal(affecting, COMSIG_MOVABLE_BUMP, .proc/bumping_stealth) /obj/item/clothing/suit/space/space_ninja/proc/reduce_stealth() @@ -34,7 +34,7 @@ Contents: if(!affecting || !stealth) return FALSE stealth = !stealth - UnregisterSignal(affecting, list(COMSIG_MOB_ITEM_ATTACK, COMSIG_MOB_ATTACK_RANGED, COMSIG_MOB_ATTACK_HAND, COMSIG_MOB_THROW, COMSIG_PARENT_ATTACKBY, COMSIG_MOVABLE_BUMP)) + UnregisterSignal(affecting, list(COMSIG_MOB_ITEM_ATTACK, COMSIG_MOB_ATTACK_RANGED, COMSIG_HUMAN_MELEE_UNARMED_ATTACK, COMSIG_MOB_ATTACK_HAND, COMSIG_MOB_THROW, COMSIG_PARENT_ATTACKBY, COMSIG_MOVABLE_BUMP, COMSIG_MOVABLE_TELEPORTED, COMSIG_LIVING_GUN_PROCESS_FIRE)) animate(affecting, alpha = 255, time = 15) affecting.visible_message("[affecting.name] appears from thin air!", \ "You are now visible.") diff --git a/code/modules/paperwork/paperplane.dm b/code/modules/paperwork/paperplane.dm index 4b08ccf6..80077ecc 100644 --- a/code/modules/paperwork/paperplane.dm +++ b/code/modules/paperwork/paperplane.dm @@ -100,7 +100,7 @@ /obj/item/paperplane/throw_impact(atom/hit_atom) if(iscarbon(hit_atom)) var/mob/living/carbon/C = hit_atom - if(C.can_catch_item(TRUE)) + if(!C.get_active_held_item() && !C.restrained()) var/datum/action/innate/origami/origami_action = locate() in C.actions if(origami_action?.active) //if they're a master of origami and have the ability turned on, force throwmode on so they'll automatically catch the plane. C.throw_mode_on() diff --git a/modular_citadel/code/modules/mob/living/silicon/robot/dogborg_equipment.dm b/modular_citadel/code/modules/mob/living/silicon/robot/dogborg_equipment.dm index 432c928e..80e3a9c1 100644 --- a/modular_citadel/code/modules/mob/living/silicon/robot/dogborg_equipment.dm +++ b/modular_citadel/code/modules/mob/living/silicon/robot/dogborg_equipment.dm @@ -358,12 +358,7 @@ SLEEPER CODE IS IN game/objects/items/devices/dogborg_sleeper.dm ! if(A) if(isliving(A)) var/mob/living/L = A - var/blocked = 0 - if(ishuman(A)) - var/mob/living/carbon/human/H = A - if(H.check_shields(0, "the [name]", src, attack_type = LEAP_ATTACK)) - blocked = 1 - if(!blocked) + if(!L.check_shields(0, "the [name]", src, attack_type = LEAP_ATTACK)) L.visible_message("[src] pounces on [L]!", "[src] pounces on you!") L.Knockdown(iscarbon(L) ? 225 : 45) // Temporary. If someone could rework how dogborg pounces work to accomodate for combat changes, that'd be nice. playsound(src, 'sound/weapons/Egloves.ogg', 50, 1) From 014bc3e026592897d3560bd080112363cfd64fa6 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Thu, 5 Dec 2019 21:50:19 -0700 Subject: [PATCH 07/14] Merge pull request #10046 from Ghommie/Ghommie-cit424 Ports flag for bespoke elements. --- code/__DEFINES/components.dm | 6 ++++++ code/controllers/subsystem/dcs.dm | 18 +++++++++++++++--- code/datums/elements/_element.dm | 8 +++++++- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/code/__DEFINES/components.dm b/code/__DEFINES/components.dm index 386d67fd..bab1e65d 100644 --- a/code/__DEFINES/components.dm +++ b/code/__DEFINES/components.dm @@ -98,4 +98,10 @@ #define ELEMENT_INCOMPATIBLE 1 // Return value to cancel attaching // /datum/element flags +/// Causes the detach proc to be called when the host object is being deleted #define ELEMENT_DETACH (1 << 0) +/** + * Only elements created with the same arguments given after `id_arg_index` share an element instance + * The arguments are the same when the text and number values are the same and all other values have the same ref + */ +#define ELEMENT_BESPOKE (1 << 1) diff --git a/code/controllers/subsystem/dcs.dm b/code/controllers/subsystem/dcs.dm index e94f233f..faf95fd3 100644 --- a/code/controllers/subsystem/dcs.dm +++ b/code/controllers/subsystem/dcs.dm @@ -6,10 +6,22 @@ PROCESSING_SUBSYSTEM_DEF(dcs) /datum/controller/subsystem/processing/dcs/Recover() comp_lookup = SSdcs.comp_lookup -/datum/controller/subsystem/processing/dcs/proc/GetElement(eletype) - . = elements_by_type[eletype] +/datum/controller/subsystem/processing/dcs/proc/GetElement(datum/element/eletype, ...) + var/element_id = eletype + + if(initial(eletype.element_flags) & ELEMENT_BESPOKE) + var/list/fullid = list("[eletype]") + for(var/i in initial(eletype.id_arg_index) to length(args)) + var/argument = args[i] + if(istext(argument) || isnum(argument)) + fullid += "[argument]" + else + fullid += "[REF(argument)]" + element_id = fullid.Join("&") + + . = elements_by_type[element_id] if(.) return if(!ispath(eletype, /datum/element)) CRASH("Attempted to instantiate [eletype] as a /datum/element") - . = elements_by_type[eletype] = new eletype \ No newline at end of file + . = elements_by_type[element_id] = new eletype \ No newline at end of file diff --git a/code/datums/elements/_element.dm b/code/datums/elements/_element.dm index 1a5b5148..17e2b122 100644 --- a/code/datums/elements/_element.dm +++ b/code/datums/elements/_element.dm @@ -1,5 +1,11 @@ /datum/element var/element_flags = NONE + /** + * The index of the first attach argument to consider for duplicate elements + * Is only used when flags contains ELEMENT_BESPOKE + * This is infinity so you must explicitly set this + */ + var/id_arg_index = INFINITY /datum/element/proc/Attach(datum/target) if(type == /datum/element) @@ -19,7 +25,7 @@ //DATUM PROCS /datum/proc/AddElement(eletype, ...) - var/datum/element/ele = SSdcs.GetElement(eletype) + var/datum/element/ele = SSdcs.GetElement(arglist(args)) args[1] = src if(ele.Attach(arglist(args)) == ELEMENT_INCOMPATIBLE) CRASH("Incompatible [eletype] assigned to a [type]! args: [json_encode(args)]") From 0fc4cbeff5906b58244da872ef0a4df0966aee09 Mon Sep 17 00:00:00 2001 From: Lin Date: Tue, 7 Jan 2020 00:55:19 +0000 Subject: [PATCH 08/14] Merge pull request #10047 from Ghommie/Ghommie-cit425 Turns dog/cat petting into an element datum. --- code/datums/elements/wuv.dm | 60 +++++++++++++++++++ .../mood_events/generic_positive_events.dm | 11 ++-- .../mob/living/simple_animal/friendly/cat.dm | 22 ++----- .../mob/living/simple_animal/friendly/dog.dm | 25 ++------ tgstation.dme | 1 + 5 files changed, 77 insertions(+), 42 deletions(-) create mode 100644 code/datums/elements/wuv.dm diff --git a/code/datums/elements/wuv.dm b/code/datums/elements/wuv.dm new file mode 100644 index 00000000..84f32750 --- /dev/null +++ b/code/datums/elements/wuv.dm @@ -0,0 +1,60 @@ + +/datum/element/wuv //D'awwwww + element_flags = ELEMENT_BESPOKE + id_arg_index = 2 + //the for the me emote proc call when petted. + var/pet_emote + //whether the emote is visible or audible + var/pet_type + //same as above, except when harmed. "You are going into orbit, you stupid mutt!" + var/punt_emote + //same as pet_type + var/punt_type + //mood typepath for the moodlet signal when petted. + var/pet_moodlet + //same as above but for harm + var/punt_moodlet + +/datum/element/wuv/Attach(datum/target, pet, pet_t, pet_mood, punt, punt_t, punt_mood) + . = ..() + + if(!isliving(target)) + return ELEMENT_INCOMPATIBLE + + pet_emote = pet + pet_type = pet_t + punt_emote = punt + punt_type = punt_t + pet_moodlet = pet_mood + punt_moodlet = punt_mood + + RegisterSignal(target, COMSIG_MOB_ATTACK_HAND, .proc/on_attack_hand) + +/datum/element/wuv/proc/on_attack_hand(datum/source, mob/user) + var/mob/living/L = source + + if(L.stat == DEAD) + return + //we want to delay the effect to be displayed after the mob is petted, not before. + switch(user.a_intent) + if(INTENT_HARM, INTENT_DISARM) + addtimer(CALLBACK(src, .proc/kick_the_dog, source, user), 1) + if(INTENT_HELP) + addtimer(CALLBACK(src, .proc/pet_the_dog, source, user), 1) + +/datum/element/wuv/proc/pet_the_dog(mob/target, mob/user) + if(!QDELETED(target) || !QDELETED(user) || target.stat != CONSCIOUS) + return + new /obj/effect/temp_visual/heart(target.loc) + if(pet_emote) + target.emote("me", pet_type, pet_emote) + if(pet_moodlet && !CHECK_BITFIELD(target.flags_1, HOLOGRAM_1)) //prevents unlimited happiness petting park exploit. + SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, target, pet_moodlet, target) + +/datum/element/wuv/proc/kick_the_dog(mob/target, mob/user) + if(!QDELETED(target) || !QDELETED(user) || target.stat != CONSCIOUS) + return + if(punt_emote) + target.emote("me", punt_type, punt_emote) + if(punt_moodlet && !CHECK_BITFIELD(target.flags_1, HOLOGRAM_1)) + SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, target, punt_moodlet, target) diff --git a/code/datums/mood_events/generic_positive_events.dm b/code/datums/mood_events/generic_positive_events.dm index 922c5a6e..8504f88b 100644 --- a/code/datums/mood_events/generic_positive_events.dm +++ b/code/datums/mood_events/generic_positive_events.dm @@ -23,10 +23,13 @@ mood_change = 3 timeout = 3000 -/datum/mood_event/pet_corgi - description = "Corgis are adorable! I can't stop petting them!\n" - mood_change = 3 - timeout = 3000 +/datum/mood_event/pet_animal + description = "Animals are adorable! I can't stop petting them!\n" + mood_change = 2 + timeout = 5 MINUTES + +/datum/mood_event/pet_animal/add_effects(mob/animal) + description = "\The [animal.name] is adorable! I can't stop petting [animal.p_them()]!\n" /datum/mood_event/honk description = "Maybe clowns aren't so bad after all. Honk!\n" diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index 501a853f..b3cb4ec4 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -40,6 +40,10 @@ . = ..() verbs += /mob/living/proc/lay_down +/mob/living/simple_animal/pet/cat/ComponentInitialize() + . = ..() + AddElement(/datum/element/wuv, "purrs!", EMOTE_AUDIBLE, /datum/mood_event/pet_animal, "hisses!", EMOTE_AUDIBLE) + /mob/living/simple_animal/pet/cat/update_canmove() ..() if(client && stat != DEAD) @@ -231,24 +235,6 @@ stop_automated_movement = 1 walk_to(src,movement_target,0,3) -/mob/living/simple_animal/pet/cat/attack_hand(mob/living/carbon/human/M) - . = ..() - switch(M.a_intent) - if(INTENT_HELP) - wuv(1, M) - if(INTENT_HARM) - wuv(-1, M) - -/mob/living/simple_animal/pet/cat/proc/wuv(change, mob/M) - if(change) - if(change > 0) - if(M && stat != DEAD) - new /obj/effect/temp_visual/heart(loc) - emote("me", 1, "purrs!") - else - if(M && stat != DEAD) - emote("me", 1, "hisses!") - /mob/living/simple_animal/pet/cat/cak //I told you I'd do it, Remie name = "Keeki" desc = "It's a cat made out of cake." diff --git a/code/modules/mob/living/simple_animal/friendly/dog.dm b/code/modules/mob/living/simple_animal/friendly/dog.dm index 13cc11de..1979f9aa 100644 --- a/code/modules/mob/living/simple_animal/friendly/dog.dm +++ b/code/modules/mob/living/simple_animal/friendly/dog.dm @@ -18,6 +18,10 @@ do_footstep = TRUE can_be_held = TRUE +/mob/living/simple_animal/pet/dog/ComponentInitialize() + . = ..() + AddElement(/datum/element/wuv, "yaps_happily!", EMOTE_AUDIBLE, /datum/mood_event/pet_animal, "growls!", EMOTE_AUDIBLE) + //Corgis and pugs are now under one dog subtype /mob/living/simple_animal/pet/dog/corgi @@ -270,7 +274,7 @@ return if(!item_to_add) user.visible_message("[user] pets [src].","You rest your hand on [src]'s head for a moment.") - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "pet_corgi", /datum/mood_event/pet_corgi) + SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, src, /datum/mood_event/pet_animal, src) return if(user && !user.temporarilyRemoveItemFromInventory(item_to_add)) @@ -641,22 +645,3 @@ for(var/i in list(1,2,4,8,4,2,1,2,4,8,4,2,1,2,4,8,4,2)) setDir(i) sleep(1) - -/mob/living/simple_animal/pet/dog/attack_hand(mob/living/carbon/human/M) - . = ..() - switch(M.a_intent) - if(INTENT_HELP) - wuv(1,M) - if(INTENT_HARM) - wuv(-1,M) - -/mob/living/simple_animal/pet/dog/proc/wuv(change, mob/M) - if(change) - if(change > 0) - if(M && stat != DEAD) // Added check to see if this mob (the dog) is dead to fix issue 2454 - new /obj/effect/temp_visual/heart(loc) - emote("me", 1, "yaps happily!") - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "pet_corgi", /datum/mood_event/pet_corgi) - else - if(M && stat != DEAD) // Same check here, even though emote checks it as well (poor form to check it only in the help case) - emote("me", 1, "growls!") diff --git a/tgstation.dme b/tgstation.dme index b3530a8e..d48447f7 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -457,6 +457,7 @@ #include "code\datums\elements\cleaning.dm" #include "code\datums\elements\earhealing.dm" #include "code\datums\elements\ghost_role_eligibility.dm" +#include "code\datums\elements\wuv.dm" #include "code\datums\helper_datums\events.dm" #include "code\datums\helper_datums\getrev.dm" #include "code\datums\helper_datums\icon_snapshot.dm" From 730307bc055172ecd3fda05bd5d990d04425e68d Mon Sep 17 00:00:00 2001 From: Lin Date: Tue, 4 Feb 2020 20:34:59 +0000 Subject: [PATCH 09/14] Merge pull request #10874 from Citadel-Station-13/Ghommie-patch-6 Fixes the petting element. --- code/datums/elements/wuv.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/datums/elements/wuv.dm b/code/datums/elements/wuv.dm index 84f32750..bac7d1ff 100644 --- a/code/datums/elements/wuv.dm +++ b/code/datums/elements/wuv.dm @@ -43,7 +43,7 @@ addtimer(CALLBACK(src, .proc/pet_the_dog, source, user), 1) /datum/element/wuv/proc/pet_the_dog(mob/target, mob/user) - if(!QDELETED(target) || !QDELETED(user) || target.stat != CONSCIOUS) + if(QDELETED(target) || QDELETED(user) || target.stat != CONSCIOUS) return new /obj/effect/temp_visual/heart(target.loc) if(pet_emote) @@ -52,7 +52,7 @@ SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, target, pet_moodlet, target) /datum/element/wuv/proc/kick_the_dog(mob/target, mob/user) - if(!QDELETED(target) || !QDELETED(user) || target.stat != CONSCIOUS) + if(QDELETED(target) || QDELETED(user) || target.stat != CONSCIOUS) return if(punt_emote) target.emote("me", punt_type, punt_emote) From f318dbe1b281c6fc6f37f40c51ebbb42c158400c Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Thu, 6 Feb 2020 00:41:28 -0700 Subject: [PATCH 10/14] Merge pull request #10881 from Ghommie/Ghommie-cit552 --- code/__DEFINES/components.dm | 4 - code/__DEFINES/dcs/signals.dm | 99 +++-- code/_onclick/click.dm | 5 +- code/datums/elements/mob_holder.dm | 184 +++++++++ code/datums/elements/wuv.dm | 4 + code/modules/mob/living/carbon/examine.dm | 6 +- .../mob/living/carbon/human/examine.dm | 1 + code/modules/mob/living/carbon/human/human.dm | 3 +- .../mob/living/carbon/monkey/monkey.dm | 351 +++++++++--------- code/modules/mob/living/inhand_holder.dm | 129 ------- code/modules/mob/living/living.dm | 10 - code/modules/mob/living/living_defines.dm | 2 +- code/modules/mob/living/silicon/pai/pai.dm | 10 +- .../mob/living/silicon/pai/pai_shell.dm | 19 +- .../mob/living/simple_animal/friendly/cat.dm | 9 +- .../mob/living/simple_animal/friendly/dog.dm | 23 +- .../simple_animal/friendly/drone/_drone.dm | 12 +- .../friendly/drone/interaction.dm | 6 - .../mob/living/simple_animal/friendly/fox.dm | 5 +- .../living/simple_animal/friendly/lizard.dm | 9 +- .../living/simple_animal/friendly/mouse.dm | 12 +- .../living/simple_animal/friendly/sloth.dm | 4 +- code/modules/mob/mob.dm | 6 +- hyperstation/code/modules/resize/resizing.dm | 4 +- tgstation.dme | 4 +- 25 files changed, 469 insertions(+), 452 deletions(-) create mode 100644 code/datums/elements/mob_holder.dm delete mode 100644 code/modules/mob/living/inhand_holder.dm diff --git a/code/__DEFINES/components.dm b/code/__DEFINES/components.dm index bab1e65d..c16c95e0 100644 --- a/code/__DEFINES/components.dm +++ b/code/__DEFINES/components.dm @@ -31,16 +31,12 @@ #define COMSIG_ATOM_RATVAR_ACT "atom_ratvar_act" //from base of atom/ratvar_act(): () ///////////////// - - // /area signals // /turf signals // /atom/movable signals -// /mob signals - // /mob/living signals // /mob/living/carbon signals diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index fbee222f..4036bab9 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -180,21 +180,17 @@ ///from base of area/Exited(): (/area) #define COMSIG_EXIT_AREA "exit_area" ///from base of atom/Click(): (location, control, params, mob/user) -#define COMSIG_CLICK "atom_click" -///from base of atom/ShiftClick(): (/mob) -#define COMSIG_CLICK_SHIFT "shift_click" - #define COMPONENT_ALLOW_EXAMINATE (1<<0) //Allows the user to examinate regardless of client.eye. -///from base of atom/CtrlClickOn(): (/mob) -#define COMSIG_CLICK_CTRL "ctrl_click" -///from base of atom/AltClick(): (/mob) -#define COMSIG_CLICK_ALT "alt_click" -///from base of atom/CtrlShiftClick(/mob) -#define COMSIG_CLICK_CTRL_SHIFT "ctrl_shift_click" -///from base of atom/MouseDrop(): (/atom/over, /mob/user) -#define COMSIG_MOUSEDROP_ONTO "mousedrop_onto" - #define COMPONENT_NO_MOUSEDROP (1<<0) -///from base of atom/MouseDrop_T: (/atom/from, /mob/user) -#define COMSIG_MOUSEDROPPED_ONTO "mousedropped_onto" +#define COMSIG_CLICK "atom_click" //from base of atom/Click(): (location, control, params, mob/user) +#define COMSIG_CLICK_SHIFT "shift_click" //from base of atom/ShiftClick(): (/mob) + #define COMPONENT_ALLOW_EXAMINATE 1 + #define COMPONENT_DENY_EXAMINATE 2 //Higher priority compared to the above one + +#define COMSIG_CLICK_CTRL "ctrl_click" //from base of atom/CtrlClickOn(): (/mob) +#define COMSIG_CLICK_ALT "alt_click" //from base of atom/AltClick(): (/mob) +#define COMSIG_CLICK_CTRL_SHIFT "ctrl_shift_click" //from base of atom/CtrlShiftClick(/mob) +#define COMSIG_MOUSEDROP_ONTO "mousedrop_onto" //from base of atom/MouseDrop(): (/atom/over, /mob/user) + #define COMPONENT_NO_MOUSEDROP 1 +#define COMSIG_MOUSEDROPPED_ONTO "mousedropped_onto" // /area signals @@ -264,13 +260,42 @@ #define COMSIG_MOVABLE_TELEPORTED "movable_teleported" //from base of do_teleport(): (channel, turf/origin, turf/destination) // /mob signals +// /mob signals +#define COMSIG_MOB_EXAMINATE "mob_examinate" //from base of /mob/verb/examinate(): (atom/A) +#define COMSIG_MOB_DEATH "mob_death" //from base of mob/death(): (gibbed) + #define COMPONENT_BLOCK_DEATH_BROADCAST 1 //stops the death from being broadcasted in deadchat. +#define COMSIG_MOB_GHOSTIZE "mob_ghostize" //from base of mob/Ghostize(): (can_reenter_corpse, special, penalize) + #define COMPONENT_BLOCK_GHOSTING 1 +#define COMSIG_MOB_ALLOWED "mob_allowed" //from base of obj/allowed(mob/M): (/obj) returns bool, if TRUE the mob has id access to the obj +#define COMSIG_MOB_RECEIVE_MAGIC "mob_receive_magic" //from base of mob/anti_magic_check(): (mob/user, magic, holy, tinfoil, chargecost, self, protection_sources) + #define COMPONENT_BLOCK_MAGIC 1 +#define COMSIG_MOB_HUD_CREATED "mob_hud_created" //from base of mob/create_mob_hud(): () +#define COMSIG_MOB_ATTACK_HAND "mob_attack_hand" //from base of +#define COMSIG_MOB_ITEM_ATTACK "mob_item_attack" //from base of /obj/item/attack(): (mob/M, mob/user) + #define COMPONENT_ITEM_NO_ATTACK 1 +#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_THROW "mob_throw" //from base of /mob/throw_item(): (atom/target) +#define COMSIG_MOB_KEY_CHANGE "mob_key_change" //from base of /mob/transfer_ckey(): (new_character, old_character) +#define COMSIG_MOB_PRE_PLAYER_CHANGE "mob_pre_player_change" //sent to the target mob from base of /mob/transfer_ckey() and /mind/transfer_to(): (our_character, their_character) +// #define COMPONENT_STOP_MIND_TRANSFER 1 +#define COMSIG_MOB_UPDATE_SIGHT "mob_update_sight" //from base of /mob/update_sight(): () +#define COMSIG_MOB_ON_NEW_MIND "mob_on_new_mind" //called when a new mind is assigned to a mob: () +#define COMSIG_MOB_SAY "mob_say" // from /mob/living/say(): (proc args list) + #define COMPONENT_UPPERCASE_SPEECH 1 + // used to access COMSIG_MOB_SAY argslist + #define SPEECH_MESSAGE 1 + // #define SPEECH_BUBBLE_TYPE 2 + #define SPEECH_SPANS 3 + /* #define SPEECH_SANITIZE 4 + #define SPEECH_LANGUAGE 5 + #define SPEECH_IGNORE_SPAM 6 + #define SPEECH_FORCED 7 */ ///from base of /mob/Login(): () #define COMSIG_MOB_LOGIN "mob_login" ///from base of /mob/Logout(): () #define COMSIG_MOB_LOGOUT "mob_logout" -///from base of mob/death(): (gibbed) -#define COMSIG_MOB_DEATH "mob_death" ///from base of mob/set_stat(): (new_stat) #define COMSIG_MOB_STATCHANGE "mob_statchange" ///from base of mob/clickon(): (atom/A, params) @@ -280,50 +305,12 @@ ///from base of mob/AltClickOn(): (atom/A) #define COMSIG_MOB_ALTCLICKON "mob_altclickon" #define COMSIG_MOB_CANCEL_CLICKON (1<<0) - -///from base of obj/allowed(mob/M): (/obj) returns bool, if TRUE the mob has id access to the obj -#define COMSIG_MOB_ALLOWED "mob_allowed" -///from base of mob/anti_magic_check(): (mob/user, magic, holy, tinfoil, chargecost, self, protection_sources) -#define COMSIG_MOB_RECEIVE_MAGIC "mob_receive_magic" - #define COMPONENT_BLOCK_MAGIC (1<<0) -///from base of mob/create_mob_hud(): () -#define COMSIG_MOB_HUD_CREATED "mob_hud_created" -///from base of atom/attack_hand(): (mob/user) -#define COMSIG_MOB_ATTACK_HAND "mob_attack_hand" -///from base of /obj/item/attack(): (mob/M, mob/user) -#define COMSIG_MOB_ITEM_ATTACK "mob_item_attack" - #define COMPONENT_ITEM_NO_ATTACK (1<<0) ///from base of /mob/living/proc/apply_damage(): (damage, damagetype, def_zone) #define COMSIG_MOB_APPLY_DAMGE "mob_apply_damage" -///from base of obj/item/afterattack(): (atom/target, mob/user, proximity_flag, click_parameters) -#define COMSIG_MOB_ITEM_AFTERATTACK "mob_item_afterattack" ///from base of obj/item/attack_qdeleted(): (atom/target, mob/user, proxiumity_flag, click_parameters) -#define COMSIG_MOB_ITEM_ATTACK_QDELETED "mob_item_attack_qdeleted" -///from base of mob/RangedAttack(): (atom/A, params) -#define COMSIG_MOB_ATTACK_RANGED "mob_attack_ranged" -///from base of /mob/throw_item(): (atom/target) -#define COMSIG_MOB_THROW "mob_throw" -#define COMSIG_MOB_KEY_CHANGE "mob_key_change" //from base of /mob/transfer_ckey(): (new_character, old_character) -#define COMSIG_MOB_PRE_PLAYER_CHANGE "mob_pre_player_change" //sent to the target mob from base of /mob/transfer_ckey() and /mind/transfer_to(): (our_character, their_character) -#define COMSIG_MOB_GHOSTIZE "mob_ghostize" //from base of mob/Ghostize(): (can_reenter_corpse, special, penalize) - #define COMPONENT_BLOCK_GHOSTING (1<<0) +#define COMSIG_MOB_ITEM_ATTACK_QDELETED "mob_item_attack_qdeleted" //from base of /mob/transfer_ckey(): (new_character, old_character) #define COMPONENT_DO_NOT_PENALIZE_GHOSTING (1<<1) #define COMPONENT_FREE_GHOSTING (1<<2) -///from base of /mob/verb/examinate(): (atom/target) -#define COMSIG_MOB_EXAMINATE "mob_examinate" -///from base of /mob/update_sight(): () -#define COMSIG_MOB_UPDATE_SIGHT "mob_update_sight" -////from /mob/living/say(): () -#define COMSIG_MOB_SAY "mob_say" - #define COMPONENT_UPPERCASE_SPEECH (1<<0) - // used to access COMSIG_MOB_SAY argslist - #define SPEECH_MESSAGE 1 - // #define SPEECH_BUBBLE_TYPE 2 - #define SPEECH_SPANS 3 - /* #define SPEECH_SANITIZE 4 - #define SPEECH_LANGUAGE 5 - #define SPEECH_IGNORE_SPAM 6 - #define SPEECH_FORCED 7 */ ///from /mob/say_dead(): (mob/speaker, message) #define COMSIG_MOB_DEADSAY "mob_deadsay" diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index e59aafda..8b5a754d 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -315,9 +315,10 @@ /mob/proc/ShiftClickOn(atom/A) A.ShiftClick(src) return + /atom/proc/ShiftClick(mob/user) - SEND_SIGNAL(src, COMSIG_CLICK_SHIFT, user) - if(user.client && user.client.eye == user || user.client.eye == user.loc) + var/flags = SEND_SIGNAL(src, COMSIG_CLICK_SHIFT, user) + if(!(flags & COMPONENT_DENY_EXAMINATE) && user.client && (user.client.eye == user || user.client.eye == user.loc || flags & COMPONENT_ALLOW_EXAMINATE)) user.examinate(src) return diff --git a/code/datums/elements/mob_holder.dm b/code/datums/elements/mob_holder.dm new file mode 100644 index 00000000..a63be406 --- /dev/null +++ b/code/datums/elements/mob_holder.dm @@ -0,0 +1,184 @@ +/datum/element/mob_holder + element_flags = ELEMENT_BESPOKE + id_arg_index = 2 + var/worn_state + var/alt_worn + var/right_hand + var/left_hand + var/inv_slots + var/proctype //if present, will be invoked on headwear generation. + +/datum/element/mob_holder/Attach(datum/target, _worn_state, _alt_worn, _right_hand, _left_hand, _inv_slots = NONE, _proctype) + . = ..() + + if(!isliving(target)) + return ELEMENT_INCOMPATIBLE + + worn_state = _worn_state + alt_worn = _alt_worn + right_hand = _right_hand + left_hand = _left_hand + inv_slots = _inv_slots + proctype = _proctype + + RegisterSignal(target, COMSIG_CLICK_ALT, .proc/mob_try_pickup) + RegisterSignal(target, COMSIG_PARENT_EXAMINE, .proc/on_examine) + +/datum/element/mob_holder/Detach(datum/source, force) + . = ..() + UnregisterSignal(source, COMSIG_CLICK_ALT) + UnregisterSignal(source, COMSIG_PARENT_EXAMINE) + +/datum/element/mob_holder/proc/on_examine(mob/living/source, mob/user, list/examine_list) + if(ishuman(user) && !istype(source.loc, /obj/item/clothing/head/mob_holder)) + examine_list += "Looks like [source.p_they(TRUE)] can be picked up with Alt+Click!" + +/datum/element/mob_holder/proc/mob_try_pickup(mob/living/source, mob/user) + if(!ishuman(user) || !user.Adjacent(source) || user.incapacitated()) + return FALSE + if(user.get_active_held_item()) + to_chat(user, "Your hands are full!") + return FALSE + if(source.buckled) + to_chat(user, "[src] is buckled to something!") + return FALSE + if(source == user) + to_chat(user, "You can't pick yourself up.") + return FALSE + source.visible_message("[user] starts picking up [source].", \ + "[user] starts picking you up!") + if(!do_after(user, 20, target = source) || source.buckled) + return FALSE + + source.visible_message("[user] picks up [source]!", \ + "[user] picks you up!") + to_chat(user, "You pick [src] up.") + source.drop_all_held_items() + var/obj/item/clothing/head/mob_holder/holder = new(get_turf(source), source, worn_state, alt_worn, right_hand, left_hand, inv_slots) + if(proctype) + INVOKE_ASYNC(src, proctype, source, holder, user) + user.put_in_hands(holder) + return TRUE + +/datum/element/mob_holder/proc/drone_worn_icon(mob/living/simple_animal/drone/D, obj/item/clothing/head/mob_holder/holder, mob/user) + var/new_state = "[D.visualAppearence]_hat" + holder.item_state = new_state + holder.icon_state = new_state + + +//The item itself, +/obj/item/clothing/head/mob_holder + name = "bugged mob" + desc = "Yell at coderbrush." + icon = null + alternate_worn_icon = 'icons/mob/animals_held.dmi' + righthand_file = 'icons/mob/animals_held_rh.dmi' + lefthand_file = 'icons/mob/animals_held_lh.dmi' + icon_state = "" + w_class = WEIGHT_CLASS_BULKY + var/mob/living/held_mob + +/obj/item/clothing/head/mob_holder/Initialize(mapload, mob/living/target, worn_state, alt_worn, right_hand, left_hand, slots = NONE) + . = ..() + + if(target) + assimilate(target) + + if(alt_worn) + alternate_worn_icon = alt_worn + if(worn_state) + item_state = worn_state + icon_state = worn_state + if(left_hand) + lefthand_file = left_hand + if(right_hand) + righthand_file = right_hand + slot_flags = slots + +/obj/item/clothing/head/mob_holder/proc/assimilate(mob/living/target) + target.setDir(SOUTH) + held_mob = target + target.forceMove(src) + var/image/I = new //work around to retain the same appearance to the mob idependently from inhands/worn states. + I.appearance = target.appearance + I.override = TRUE + add_overlay(I) + name = target.name + desc = target.desc + switch(target.mob_size) + if(MOB_SIZE_TINY) + w_class = WEIGHT_CLASS_TINY + if(MOB_SIZE_SMALL) + w_class = WEIGHT_CLASS_NORMAL + if(MOB_SIZE_LARGE) + w_class = WEIGHT_CLASS_HUGE + RegisterSignal(src, COMSIG_CLICK_SHIFT, .proc/examine_held_mob) + +/obj/item/clothing/head/mob_holder/Destroy() + if(held_mob) + release() + return ..() + +/obj/item/clothing/head/mob_holder/proc/examine_held_mob(datum/source, mob/user) + held_mob.ShiftClick(user) + return COMPONENT_DENY_EXAMINATE + +/obj/item/clothing/head/mob_holder/Exited(atom/movable/AM, atom/newloc) + . = ..() + if(AM == held_mob) + held_mob.reset_perspective() + held_mob = null + qdel(src) + +/obj/item/clothing/head/mob_holder/Entered(atom/movable/AM, atom/newloc) + . = ..() + if(AM != held_mob) + var/destination = loc + if(isliving(loc)) //the mob is held or worn, drop things on the floor + destination = get_turf(loc) + AM.forceMove(destination) + +/obj/item/clothing/head/mob_holder/dropped() + . = ..() + if(held_mob && isturf(loc))//don't release on soft-drops + release() + +/obj/item/clothing/head/mob_holder/proc/release() + if(held_mob) + var/mob/living/L = held_mob + held_mob = null + L.forceMove(get_turf(L)) + L.reset_perspective() + L.setDir(SOUTH) + qdel(src) + +/obj/item/clothing/head/mob_holder/relaymove(mob/user) + return + +/obj/item/clothing/head/mob_holder/container_resist() + if(isliving(loc)) + var/mob/living/L = loc + L.visible_message("[src] escapes from [L]!", "[src] escapes your grip!") + release() + +/obj/item/clothing/head/mob_holder/assume_air(datum/gas_mixture/env) + var/atom/location = loc + if(!loc) + return //null + var/turf/T = get_turf(loc) + while(location != T) + location = location.loc + if(ismob(location)) + return location.loc.assume_air(env) + return loc.assume_air(env) + +/obj/item/clothing/head/mob_holder/remove_air(amount) + var/atom/location = loc + if(!loc) + return //null + var/turf/T = get_turf(loc) + while(location != T) + location = location.loc + if(ismob(location)) + return location.loc.remove_air(amount) + return loc.remove_air(amount) diff --git a/code/datums/elements/wuv.dm b/code/datums/elements/wuv.dm index bac7d1ff..55bc9baf 100644 --- a/code/datums/elements/wuv.dm +++ b/code/datums/elements/wuv.dm @@ -30,6 +30,10 @@ RegisterSignal(target, COMSIG_MOB_ATTACK_HAND, .proc/on_attack_hand) +/datum/element/wuv/Detach(datum/source, force) + . = ..() + UnregisterSignal(source, COMSIG_MOB_ATTACK_HAND) + /datum/element/wuv/proc/on_attack_hand(datum/source, mob/user) var/mob/living/L = source diff --git a/code/modules/mob/living/carbon/examine.dm b/code/modules/mob/living/carbon/examine.dm index b05b796c..b36a2b95 100644 --- a/code/modules/mob/living/carbon/examine.dm +++ b/code/modules/mob/living/carbon/examine.dm @@ -16,10 +16,6 @@ msg += "[t_He] [t_is] wearing [wear_mask.get_examine_string(user)] on [t_his] face.\n" if (wear_neck) msg += "[t_He] [t_is] wearing [wear_neck.get_examine_string(user)] around [t_his] neck.\n" - if(can_be_held) - msg += "[t_He] might be able to be picked up with Alt+Click!\n" - - for(var/obj/item/I in held_items) if(!(I.item_flags & ABSTRACT)) @@ -111,7 +107,7 @@ msg += "[t_He] look[p_s()] very happy.\n" if(MOOD_LEVEL_HAPPY4 to INFINITY) msg += "[t_He] look[p_s()] ecstatic.\n" + SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE, user, msg) msg += "*---------*" - to_chat(user, msg) return msg diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index e017ec34..03259bd2 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -399,6 +399,7 @@ msg += "...?
" else msg += "[print_flavor_text()]\n" + SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE, user, msg) msg += "*---------*" to_chat(user, msg) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index fbbfe1bc..65259212 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1110,7 +1110,8 @@ race = /datum/species/krokodil_addict //define holder_type on nerds we wanna commit scoop to -/mob/living/carbon/human +/* /mob/living/carbon/human var/holder_type = /obj/item/clothing/head/mob_holder/micro can_be_held = "micro" +*/ diff --git a/code/modules/mob/living/carbon/monkey/monkey.dm b/code/modules/mob/living/carbon/monkey/monkey.dm index 47a177f7..54fddea2 100644 --- a/code/modules/mob/living/carbon/monkey/monkey.dm +++ b/code/modules/mob/living/carbon/monkey/monkey.dm @@ -1,176 +1,175 @@ -/mob/living/carbon/monkey - name = "monkey" - verb_say = "chimpers" - initial_language_holder = /datum/language_holder/monkey - icon = 'icons/mob/monkey.dmi' - icon_state = "" - gender = NEUTER - pass_flags = PASSTABLE - ventcrawler = VENTCRAWLER_NUDE - mob_biotypes = list(MOB_ORGANIC, MOB_HUMANOID) - butcher_results = list(/obj/item/reagent_containers/food/snacks/meat/slab/monkey = 5, /obj/item/stack/sheet/animalhide/monkey = 1) - type_of_meat = /obj/item/reagent_containers/food/snacks/meat/slab/monkey - gib_type = /obj/effect/decal/cleanable/blood/gibs - unique_name = TRUE - bodyparts = list(/obj/item/bodypart/chest/monkey, /obj/item/bodypart/head/monkey, /obj/item/bodypart/l_arm/monkey, - /obj/item/bodypart/r_arm/monkey, /obj/item/bodypart/r_leg/monkey, /obj/item/bodypart/l_leg/monkey) - hud_type = /datum/hud/monkey - can_be_held = "monkey" - -/mob/living/carbon/monkey/Initialize(mapload, cubespawned=FALSE, mob/spawner) - verbs += /mob/living/proc/mob_sleep - verbs += /mob/living/proc/lay_down - - if(unique_name) //used to exclude pun pun - gender = pick(MALE, FEMALE) - real_name = name - - //initialize limbs - create_bodyparts() - create_internal_organs() - - . = ..() - - if (cubespawned) - var/cap = CONFIG_GET(number/monkeycap) - if (LAZYLEN(SSmobs.cubemonkeys) > cap) - if (spawner) - to_chat(spawner, "Bluespace harmonics prevent the spawning of more than [cap] monkeys on the station at one time!") - return INITIALIZE_HINT_QDEL - SSmobs.cubemonkeys += src - - create_dna(src) - dna.initialize_dna(random_blood_type()) - -/mob/living/carbon/monkey/Destroy() - SSmobs.cubemonkeys -= src - return ..() - -/mob/living/carbon/monkey/generate_mob_holder() - var/obj/item/clothing/head/mob_holder/holder = new(get_turf(src), src, "monkey", 'icons/mob/animals_held.dmi', 'icons/mob/animals_held_lh.dmi', 'icons/mob/animals_held_rh.dmi', TRUE) - return holder - -/mob/living/carbon/monkey/create_internal_organs() - internal_organs += new /obj/item/organ/appendix - internal_organs += new /obj/item/organ/lungs - internal_organs += new /obj/item/organ/heart - internal_organs += new /obj/item/organ/brain - internal_organs += new /obj/item/organ/tongue - internal_organs += new /obj/item/organ/eyes - internal_organs += new /obj/item/organ/ears - internal_organs += new /obj/item/organ/liver - internal_organs += new /obj/item/organ/stomach - ..() - -/mob/living/carbon/monkey/on_reagent_change() - . = ..() - remove_movespeed_modifier(MOVESPEED_ID_MONKEY_REAGENT_SPEEDMOD, TRUE) - var/amount - if(reagents.has_reagent("morphine")) - amount = -1 - if(reagents.has_reagent("nuka_cola")) - amount = -1 - if(amount) - add_movespeed_modifier(MOVESPEED_ID_MONKEY_REAGENT_SPEEDMOD, TRUE, 100, override = TRUE, multiplicative_slowdown = amount) - -/mob/living/carbon/monkey/updatehealth() - . = ..() - var/slow = 0 - var/health_deficiency = (100 - health) - if(health_deficiency >= 45) - slow += (health_deficiency / 25) - add_movespeed_modifier(MOVESPEED_ID_MONKEY_HEALTH_SPEEDMOD, TRUE, 100, override = TRUE, multiplicative_slowdown = slow) - -/mob/living/carbon/monkey/adjust_bodytemperature(amount) - . = ..() - var/slow = 0 - if (bodytemperature < 283.222) - slow += (283.222 - bodytemperature) / 10 * 1.75 - if(slow <= 0) - return - add_movespeed_modifier(MOVESPEED_ID_MONKEY_TEMPERATURE_SPEEDMOD, TRUE, 100, override = TRUE, multiplicative_slowdown = amount) - -/mob/living/carbon/monkey/Stat() - ..() - if(statpanel("Status")) - stat(null, "Intent: [a_intent]") - stat(null, "Move Mode: [m_intent]") - if(client && mind) - var/datum/antagonist/changeling/changeling = mind.has_antag_datum(/datum/antagonist/changeling) - if(changeling) - stat("Chemical Storage", "[changeling.chem_charges]/[changeling.chem_storage]") - stat("Absorbed DNA", changeling.absorbedcount) - return - - -/mob/living/carbon/monkey/verb/removeinternal() - set name = "Remove Internals" - set category = "IC" - internal = null - return - - -/mob/living/carbon/monkey/IsAdvancedToolUser()//Unless its monkey mode monkeys cant use advanced tools - if(mind && is_monkey(mind)) - return TRUE - return FALSE - -/mob/living/carbon/monkey/reagent_check(datum/reagent/R) //can metabolize all reagents - return FALSE - -/mob/living/carbon/monkey/canBeHandcuffed() - return TRUE - -/mob/living/carbon/monkey/assess_threat(judgement_criteria, lasercolor = "", datum/callback/weaponcheck=null) - if(judgement_criteria & JUDGE_EMAGGED) - return 10 //Everyone is a criminal! - - var/threatcount = 0 - - //Securitrons can't identify monkeys - if( !(judgement_criteria & JUDGE_IGNOREMONKEYS) && (judgement_criteria & JUDGE_IDCHECK) ) - threatcount += 4 - - //Lasertag bullshit - if(lasercolor) - if(lasercolor == "b")//Lasertag turrets target the opposing team, how great is that? -Sieve - if(is_holding_item_of_type(/obj/item/gun/energy/laser/redtag)) - threatcount += 4 - - if(lasercolor == "r") - if(is_holding_item_of_type(/obj/item/gun/energy/laser/bluetag)) - threatcount += 4 - - return threatcount - - //Check for weapons - if( (judgement_criteria & JUDGE_WEAPONCHECK) && weaponcheck ) - for(var/obj/item/I in held_items) //if they're holding a gun - if(weaponcheck.Invoke(I)) - threatcount += 4 - if(weaponcheck.Invoke(back)) //if a weapon is present in the back slot - threatcount += 4 //trigger look_for_perp() since they're nonhuman and very likely hostile - - //mindshield implants imply trustworthyness - if(HAS_TRAIT(src, TRAIT_MINDSHIELD)) - threatcount -= 1 - - return threatcount - -/mob/living/carbon/monkey/IsVocal() - if(!getorganslot(ORGAN_SLOT_LUNGS)) - return 0 - return 1 - -/mob/living/carbon/monkey/can_use_guns(obj/item/G) - return TRUE - -/mob/living/carbon/monkey/angry - aggressive = TRUE - -/mob/living/carbon/monkey/angry/Initialize() - . = ..() - if(prob(10)) - var/obj/item/clothing/head/helmet/justice/escape/helmet = new(src) - equip_to_slot_or_del(helmet,SLOT_HEAD) - helmet.attack_self(src) // todo encapsulate toggle +/mob/living/carbon/monkey + name = "monkey" + verb_say = "chimpers" + initial_language_holder = /datum/language_holder/monkey + icon = 'icons/mob/monkey.dmi' + icon_state = "" + gender = NEUTER + pass_flags = PASSTABLE + ventcrawler = VENTCRAWLER_NUDE + mob_biotypes = list(MOB_ORGANIC, MOB_HUMANOID) + butcher_results = list(/obj/item/reagent_containers/food/snacks/meat/slab/monkey = 5, /obj/item/stack/sheet/animalhide/monkey = 1) + type_of_meat = /obj/item/reagent_containers/food/snacks/meat/slab/monkey + gib_type = /obj/effect/decal/cleanable/blood/gibs + unique_name = TRUE + bodyparts = list(/obj/item/bodypart/chest/monkey, /obj/item/bodypart/head/monkey, /obj/item/bodypart/l_arm/monkey, + /obj/item/bodypart/r_arm/monkey, /obj/item/bodypart/r_leg/monkey, /obj/item/bodypart/l_leg/monkey) + hud_type = /datum/hud/monkey + +/mob/living/carbon/monkey/Initialize(mapload, cubespawned=FALSE, mob/spawner) + verbs += /mob/living/proc/mob_sleep + verbs += /mob/living/proc/lay_down + + if(unique_name) //used to exclude pun pun + gender = pick(MALE, FEMALE) + real_name = name + + //initialize limbs + create_bodyparts() + create_internal_organs() + + . = ..() + + if (cubespawned) + var/cap = CONFIG_GET(number/monkeycap) + if (LAZYLEN(SSmobs.cubemonkeys) > cap) + if (spawner) + to_chat(spawner, "Bluespace harmonics prevent the spawning of more than [cap] monkeys on the station at one time!") + return INITIALIZE_HINT_QDEL + SSmobs.cubemonkeys += src + + create_dna(src) + dna.initialize_dna(random_blood_type()) + +/mob/living/carbon/monkey/ComponentInitialize() + . = ..() + AddElement(/datum/element/mob_holder, "monkey", null, null, null, SLOT_HEAD) + +/mob/living/carbon/monkey/Destroy() + SSmobs.cubemonkeys -= src + return ..() + +/mob/living/carbon/monkey/create_internal_organs() + internal_organs += new /obj/item/organ/appendix + internal_organs += new /obj/item/organ/lungs + internal_organs += new /obj/item/organ/heart + internal_organs += new /obj/item/organ/brain + internal_organs += new /obj/item/organ/tongue + internal_organs += new /obj/item/organ/eyes + internal_organs += new /obj/item/organ/ears + internal_organs += new /obj/item/organ/liver + internal_organs += new /obj/item/organ/stomach + ..() + +/mob/living/carbon/monkey/on_reagent_change() + . = ..() + remove_movespeed_modifier(MOVESPEED_ID_MONKEY_REAGENT_SPEEDMOD, TRUE) + var/amount + if(reagents.has_reagent("morphine")) + amount = -1 + if(reagents.has_reagent("nuka_cola")) + amount = -1 + if(amount) + add_movespeed_modifier(MOVESPEED_ID_MONKEY_REAGENT_SPEEDMOD, TRUE, 100, override = TRUE, multiplicative_slowdown = amount) + +/mob/living/carbon/monkey/updatehealth() + . = ..() + var/slow = 0 + var/health_deficiency = (100 - health) + if(health_deficiency >= 45) + slow += (health_deficiency / 25) + add_movespeed_modifier(MOVESPEED_ID_MONKEY_HEALTH_SPEEDMOD, TRUE, 100, override = TRUE, multiplicative_slowdown = slow) + +/mob/living/carbon/monkey/adjust_bodytemperature(amount) + . = ..() + var/slow = 0 + if (bodytemperature < 283.222) + slow += (283.222 - bodytemperature) / 10 * 1.75 + if(slow <= 0) + return + add_movespeed_modifier(MOVESPEED_ID_MONKEY_TEMPERATURE_SPEEDMOD, TRUE, 100, override = TRUE, multiplicative_slowdown = amount) + +/mob/living/carbon/monkey/Stat() + ..() + if(statpanel("Status")) + stat(null, "Intent: [a_intent]") + stat(null, "Move Mode: [m_intent]") + if(client && mind) + var/datum/antagonist/changeling/changeling = mind.has_antag_datum(/datum/antagonist/changeling) + if(changeling) + stat("Chemical Storage", "[changeling.chem_charges]/[changeling.chem_storage]") + stat("Absorbed DNA", changeling.absorbedcount) + return + + +/mob/living/carbon/monkey/verb/removeinternal() + set name = "Remove Internals" + set category = "IC" + internal = null + return + + +/mob/living/carbon/monkey/IsAdvancedToolUser()//Unless its monkey mode monkeys cant use advanced tools + if(mind && is_monkey(mind)) + return TRUE + return FALSE + +/mob/living/carbon/monkey/reagent_check(datum/reagent/R) //can metabolize all reagents + return FALSE + +/mob/living/carbon/monkey/canBeHandcuffed() + return TRUE + +/mob/living/carbon/monkey/assess_threat(judgement_criteria, lasercolor = "", datum/callback/weaponcheck=null) + if(judgement_criteria & JUDGE_EMAGGED) + return 10 //Everyone is a criminal! + + var/threatcount = 0 + + //Securitrons can't identify monkeys + if( !(judgement_criteria & JUDGE_IGNOREMONKEYS) && (judgement_criteria & JUDGE_IDCHECK) ) + threatcount += 4 + + //Lasertag bullshit + if(lasercolor) + if(lasercolor == "b")//Lasertag turrets target the opposing team, how great is that? -Sieve + if(is_holding_item_of_type(/obj/item/gun/energy/laser/redtag)) + threatcount += 4 + + if(lasercolor == "r") + if(is_holding_item_of_type(/obj/item/gun/energy/laser/bluetag)) + threatcount += 4 + + return threatcount + + //Check for weapons + if( (judgement_criteria & JUDGE_WEAPONCHECK) && weaponcheck ) + for(var/obj/item/I in held_items) //if they're holding a gun + if(weaponcheck.Invoke(I)) + threatcount += 4 + if(weaponcheck.Invoke(back)) //if a weapon is present in the back slot + threatcount += 4 //trigger look_for_perp() since they're nonhuman and very likely hostile + + //mindshield implants imply trustworthyness + if(HAS_TRAIT(src, TRAIT_MINDSHIELD)) + threatcount -= 1 + + return threatcount + +/mob/living/carbon/monkey/IsVocal() + if(!getorganslot(ORGAN_SLOT_LUNGS)) + return 0 + return 1 + +/mob/living/carbon/monkey/can_use_guns(obj/item/G) + return TRUE + +/mob/living/carbon/monkey/angry + aggressive = TRUE + +/mob/living/carbon/monkey/angry/Initialize() + . = ..() + if(prob(10)) + var/obj/item/clothing/head/helmet/justice/escape/helmet = new(src) + equip_to_slot_or_del(helmet,SLOT_HEAD) + helmet.attack_self(src) // todo encapsulate toggle diff --git a/code/modules/mob/living/inhand_holder.dm b/code/modules/mob/living/inhand_holder.dm deleted file mode 100644 index e68260de..00000000 --- a/code/modules/mob/living/inhand_holder.dm +++ /dev/null @@ -1,129 +0,0 @@ -//Generic system for picking up mobs. -//Currently works for head and hands. -/obj/item/clothing/head/mob_holder - name = "bugged mob" - desc = "Yell at coderbrush." - icon = null - icon_state = "" - var/mob/living/held_mob - var/can_head = FALSE - w_class = WEIGHT_CLASS_BULKY - -/obj/item/clothing/head/mob_holder/Initialize(mapload, mob/living/M, _worn_state, alt_worn, lh_icon, rh_icon, _can_head_override = FALSE) - . = ..() - - if(M) - M.setDir(SOUTH) - held_mob = M - M.forceMove(src) - appearance = M.appearance - name = M.name - desc = M.desc - - if(_can_head_override) - can_head = _can_head_override - if(alt_worn) - alternate_worn_icon = alt_worn - if(_worn_state) - item_state = _worn_state - icon_state = _worn_state - if(lh_icon) - lefthand_file = lh_icon - if(rh_icon) - righthand_file = rh_icon - if(!can_head) - slot_flags = NONE - -/obj/item/clothing/head/mob_holder/Destroy() - if(held_mob) - release() - return ..() - -/obj/item/clothing/head/mob_holder/dropped() - ..() - if(isturf(loc))//don't release on soft-drops - release() - -/obj/item/clothing/head/mob_holder/proc/release() - if(isliving(loc)) - var/mob/living/L = loc - L.dropItemToGround(src) - if(held_mob) - var/mob/living/m = held_mob - m.forceMove(get_turf(m)) - m.reset_perspective() - m.setDir(SOUTH) - held_mob = null - qdel(src) - -/obj/item/clothing/head/mob_holder/relaymove(mob/user) - return - -/obj/item/clothing/head/mob_holder/container_resist() - if(isliving(loc)) - var/mob/living/L = loc - visible_message("[src] escapes [L]!") - release() - -/mob/living/proc/mob_pickup(mob/living/L) - var/obj/item/clothing/head/mob_holder/holder = generate_mob_holder() - if(!holder) - return - drop_all_held_items() - L.put_in_hands(holder) - return - -/mob/living/proc/mob_try_pickup(mob/living/user) - if(!ishuman(user) || !src.Adjacent(user) || user.incapacitated() || !can_be_held) - return FALSE - if(src.can_be_held == "micro") - return FALSE - if(user.get_active_held_item()) - to_chat(user, "Your hands are full!") - return FALSE - if(buckled) - to_chat(user, "[src] is buckled to something!") - return FALSE - if(src == user) - to_chat(user, "You can't pick yourself up.") - return FALSE - visible_message("[user] starts picking up [src].", \ - "[user] starts picking you up!") - if(!do_after(user, 20, target = src)) - return FALSE - - if(user.get_active_held_item()||buckled) - return FALSE - - visible_message("[user] picks up [src]!", \ - "[user] picks you up!") - to_chat(user, "You pick [src] up.") - mob_pickup(user) - return TRUE - -/mob/living/AltClick(mob/user) - . = ..() - if(mob_try_pickup(user)) - return TRUE - -/obj/item/clothing/head/mob_holder/assume_air(datum/gas_mixture/env) - var/atom/location = loc - if(!loc) - return //null - var/turf/T = get_turf(loc) - while(location != T) - location = location.loc - if(ismob(location)) - return location.loc.assume_air(env) - return location.assume_air(env) - -/obj/item/clothing/head/mob_holder/remove_air(amount) - var/atom/location = loc - if(!loc) - return //null - var/turf/T = get_turf(loc) - while(location != T) - location = location.loc - if(ismob(location)) - return location.loc.remove_air(amount) - return location.remove_air(amount) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 2ba4be99..4c400ee4 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -40,14 +40,6 @@ QDEL_LIST(diseases) return ..() - -/mob/living/proc/generate_mob_holder() - if(ishuman(src)) - var/obj/item/clothing/head/mob_holder/micro/holder = new(get_turf(src), src, (istext(can_be_held) ? can_be_held : ""), 'icons/mob/animals_held.dmi', 'icons/mob/animals_held_lh.dmi', 'icons/mob/animals_held_rh.dmi') - return holder - var/obj/item/clothing/head/mob_holder/holder = new(get_turf(src), src, (istext(can_be_held) ? can_be_held : ""), 'icons/mob/animals_held.dmi', 'icons/mob/animals_held_lh.dmi', 'icons/mob/animals_held_rh.dmi') - return holder - /mob/living/onZImpact(turf/T, levels) if(!isgroundlessturf(T)) ZImpactDamage(T, levels) @@ -1153,8 +1145,6 @@ return if(!over.Adjacent(src) || (user != src) || !canUseTopic(over)) return - if(can_be_held) - mob_try_pickup(over) /mob/living/proc/get_static_viruses() //used when creating blood and other infective objects diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index d283a4fa..9d346a44 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -107,7 +107,7 @@ var/last_words //used for database logging var/list/obj/effect/proc_holder/abilities = list() - + var/can_be_held = FALSE var/radiation = 0 //If the mob is irradiated. diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 1601ccfe..c298d89c 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -11,7 +11,7 @@ health = 500 maxHealth = 500 layer = BELOW_MOB_LAYER - can_be_held = TRUE + var/datum/element/mob_holder/current_mob_holder //because only a few of their chassis can be actually held. var/network = "ss13" var/obj/machinery/camera/current = null @@ -58,10 +58,12 @@ var/canholo = TRUE var/obj/item/card/id/access_card = null var/chassis = "repairbot" + var/dynamic_chassis + var/dynamic_chassis_sit = FALSE //whether we're sitting instead of resting spritewise + var/dynamic_chassis_bellyup = FALSE //whether we're lying down bellyup var/list/possible_chassis = list("cat" = TRUE, "mouse" = TRUE, "monkey" = TRUE, "corgi" = FALSE, "fox" = FALSE, "repairbot" = TRUE, "rabbit" = TRUE, "operator" = TRUE) //assoc value is whether it can be picked up. - var/static/item_head_icon = 'icons/mob/pai_item_head.dmi' - var/static/item_lh_icon = 'icons/mob/pai_item_lh.dmi' - var/static/item_rh_icon = 'icons/mob/pai_item_rh.dmi' + var/list/dynamic_chassis_icons //ditto. + var/list/chassis_pixel_offsets_x //stupid dogborgs var/emitterhealth = 20 var/emittermaxhealth = 20 diff --git a/code/modules/mob/living/silicon/pai/pai_shell.dm b/code/modules/mob/living/silicon/pai/pai_shell.dm index 164a3e73..bf625f67 100644 --- a/code/modules/mob/living/silicon/pai/pai_shell.dm +++ b/code/modules/mob/living/silicon/pai/pai_shell.dm @@ -86,6 +86,12 @@ if(resting) icon_state = "[chassis]_rest" to_chat(src, "You switch your holochassis projection composite to [chassis]") + if(possible_chassis[chassis]) + current_mob_holder = AddElement(/datum/element/mob_holder, chassis, 'icons/mob/pai_item_head.dmi', 'icons/mob/pai_item_rh.dmi', 'icons/mob/pai_item_lh.dmi', SLOT_HEAD) + else + current_mob_holder?.Detach(src) + current_mob_holder = null + return /mob/living/silicon/pai/lay_down() ..() @@ -109,16 +115,3 @@ else set_light(0) to_chat(src, "You disable your integrated light.") - -/mob/living/silicon/pai/mob_pickup(mob/living/L) - var/obj/item/clothing/head/mob_holder/holder = new(get_turf(src), src, chassis, item_head_icon, item_lh_icon, item_rh_icon) - if(!L.put_in_hands(holder)) - qdel(holder) - else - L.visible_message("[L] scoops up [src]!") - -/mob/living/silicon/pai/mob_try_pickup(mob/living/user) - if(!possible_chassis[chassis]) - to_chat(user, "[src]'s current form isn't able to be carried!") - return 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 b3cb4ec4..5ea3eed5 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -31,9 +31,9 @@ var/mob/living/simple_animal/mouse/movement_target gold_core_spawnable = FRIENDLY_SPAWN collar_type = "cat" - can_be_held = "cat2" size_multiplier = 0.5 + var/held_icon = "cat2" do_footstep = TRUE /mob/living/simple_animal/pet/cat/Initialize() @@ -43,6 +43,7 @@ /mob/living/simple_animal/pet/cat/ComponentInitialize() . = ..() AddElement(/datum/element/wuv, "purrs!", EMOTE_AUDIBLE, /datum/mood_event/pet_animal, "hisses!", EMOTE_AUDIBLE) + AddElement(/datum/element/mob_holder, held_icon) /mob/living/simple_animal/pet/cat/update_canmove() ..() @@ -62,6 +63,7 @@ icon_state = "spacecat" icon_living = "spacecat" icon_dead = "spacecat_dead" + held_icon = "spacecat" unsuitable_atmos_damage = 0 minbodytemp = TCMB maxbodytemp = T0C + 40 @@ -73,6 +75,7 @@ icon_state = "original" icon_living = "original" icon_dead = "original_dead" + held_icon = "original" collar_type = null unique_pet = TRUE @@ -86,7 +89,7 @@ pass_flags = PASSMOB mob_size = MOB_SIZE_SMALL collar_type = "kitten" - can_be_held = "cat" + held_icon = "cat" //RUNTIME IS ALIVE! SQUEEEEEEEE~ /mob/living/simple_animal/pet/cat/Runtime @@ -251,7 +254,7 @@ attacked_sound = 'sound/items/eatfood.ogg' deathmessage = "loses its false life and collapses!" death_sound = "bodyfall" - can_be_held = "cak" + held_icon = "cak" /mob/living/simple_animal/pet/cat/cak/CheckParts(list/parts) ..() diff --git a/code/modules/mob/living/simple_animal/friendly/dog.dm b/code/modules/mob/living/simple_animal/friendly/dog.dm index 1979f9aa..bf7eb05f 100644 --- a/code/modules/mob/living/simple_animal/friendly/dog.dm +++ b/code/modules/mob/living/simple_animal/friendly/dog.dm @@ -14,13 +14,14 @@ speak_chance = 1 turns_per_move = 10 size_multiplier = 0.5 + var/held_icon = "corgi" do_footstep = TRUE - can_be_held = TRUE /mob/living/simple_animal/pet/dog/ComponentInitialize() . = ..() AddElement(/datum/element/wuv, "yaps_happily!", EMOTE_AUDIBLE, /datum/mood_event/pet_animal, "growls!", EMOTE_AUDIBLE) + AddElement(/datum/element/mob_holder, held_icon) //Corgis and pugs are now under one dog subtype @@ -35,13 +36,11 @@ childtype = list(/mob/living/simple_animal/pet/dog/corgi/puppy = 95, /mob/living/simple_animal/pet/dog/corgi/puppy/void = 5) animal_species = /mob/living/simple_animal/pet/dog gold_core_spawnable = FRIENDLY_SPAWN - can_be_held = TRUE collar_type = "corgi" var/obj/item/inventory_head var/obj/item/inventory_back var/shaved = FALSE var/nofur = FALSE //Corgis that have risen past the material plane of existence. - can_be_held = "corgi" /mob/living/simple_animal/pet/dog/corgi/Destroy() QDEL_NULL(inventory_head) @@ -70,7 +69,7 @@ butcher_results = list(/obj/item/reagent_containers/food/snacks/meat/slab/pug = 3) gold_core_spawnable = FRIENDLY_SPAWN collar_type = "pug" - can_be_held = "pug" + held_icon = "pug" /mob/living/simple_animal/pet/dog/corgi/exoticcorgi name = "Exotic Corgi" @@ -157,13 +156,6 @@ ..() update_corgi_fluff() -/mob/living/simple_animal/pet/dog/corgi/mob_pickup(mob/living/L) - var/obj/item/clothing/head/mob_holder/holder = new(get_turf(src), src, "corgi", null, 'icons/mob/pets_held_lh.dmi', 'icons/mob/pets_held_rh.dmi', FALSE) - if(!L.put_in_hands(holder)) - qdel(holder) - else - L.visible_message("[L] scoops up [src]!") - /mob/living/simple_animal/pet/dog/corgi/Topic(href, href_list) if(!(iscarbon(usr) || iscyborg(usr)) || !usr.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) usr << browse(null, "window=mob[REF(src)]") @@ -368,7 +360,10 @@ icon_dead = "old_corgi_dead" desc = "At a ripe old age of [record_age] Ian's not as spry as he used to be, but he'll always be the HoP's beloved corgi." //RIP turns_per_move = 20 - can_be_held = "old_corgi" + var/datum/element/mob_holder/ele = SSdcs.GetElement(/datum/element/mob_holder, held_icon) + if(ele) + ele.Detach(src) + AddElement(/datum/element/mob_holder, "old_corgi") /mob/living/simple_animal/pet/dog/corgi/Ian/Life() if(!stat && SSticker.current_state == GAME_STATE_FINISHED && !memory_saved) @@ -591,7 +586,7 @@ unsuitable_atmos_damage = 0 minbodytemp = TCMB maxbodytemp = T0C + 40 - can_be_held = "void_puppy" + held_icon = "void_puppy" /mob/living/simple_animal/pet/dog/corgi/puppy/void/Process_Spacemove(movement_dir = 0) return 1 //Void puppies can navigate space. @@ -613,7 +608,7 @@ response_harm = "kicks" var/turns_since_scan = 0 var/puppies = 0 - can_be_held = "lisa" + held_icon = "lisa" //Lisa already has a cute bow! /mob/living/simple_animal/pet/dog/corgi/Lisa/Topic(href, href_list) 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 f880adb7..c9ac7377 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm @@ -50,7 +50,8 @@ dextrous_hud_type = /datum/hud/dextrous/drone lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE see_in_dark = 7 - can_be_held = TRUE + blood_volume = 0 + can_be_held = TRUE //mob holder element. held_items = list(null, null) var/staticChoice = "static" var/list/staticChoices = list("static", "blank", "letter", "animal") @@ -100,6 +101,11 @@ for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds) diag_hud.add_to_hud(src) +/mob/living/simple_animal/drone/ComponentInitialize() + . = ..() + if(can_be_held) + //icon/item state is defined in mob_holder/drone_worn_icon() + AddElement(/datum/element/mob_holder, null, 'icons/mob/head.dmi', 'icons/mob/inhands/clothing_righthand.dmi', 'icons/mob/inhands/clothing_lefthand.dmi', TRUE, /datum/element/mob_holder.proc/drone_worn_icon) /mob/living/simple_animal/drone/med_hud_set_health() var/image/holder = hud_list[DIAG_HUD] @@ -274,7 +280,3 @@ /mob/living/simple_animal/drone/electrocute_act(shock_damage, obj/source, siemens_coeff = 1, safety = 0, tesla_shock = 0, illusion = 0, stun = TRUE) return 0 //So they don't die trying to fix wiring - -/mob/living/simple_animal/drone/generate_mob_holder() - var/obj/item/clothing/head/mob_holder/holder = new(get_turf(src), src, "[visualAppearence]_hat", null, null, null, TRUE) - return holder 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 c9207fcf..0f97a4c4 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm @@ -29,12 +29,6 @@ if("Nothing") return -//picky up the drone c: -/mob/living/simple_animal/drone/attack_hand(mob/user) - if(user.a_intent != INTENT_HELP) - return ..() // TODO: convert picking up mobs into an element or component. - mob_try_pickup(user) - /mob/living/simple_animal/drone/proc/try_reactivate(mob/living/user) var/mob/dead/observer/G = get_ghost() if(!client && (!G || !G.client)) diff --git a/code/modules/mob/living/simple_animal/friendly/fox.dm b/code/modules/mob/living/simple_animal/friendly/fox.dm index 3f58ca59..95b082b7 100644 --- a/code/modules/mob/living/simple_animal/friendly/fox.dm +++ b/code/modules/mob/living/simple_animal/friendly/fox.dm @@ -18,9 +18,12 @@ response_disarm = "gently pushes aside" response_harm = "kicks" gold_core_spawnable = FRIENDLY_SPAWN - can_be_held = "fox" do_footstep = TRUE +/mob/living/simple_animal/pet/fox/ComponentInitialize() + . = ..() + AddElement(/datum/element/mob_holder, "fox") + //Captain fox /mob/living/simple_animal/pet/fox/Renault name = "Renault" diff --git a/code/modules/mob/living/simple_animal/friendly/lizard.dm b/code/modules/mob/living/simple_animal/friendly/lizard.dm index 6076e412..8d33d3a2 100644 --- a/code/modules/mob/living/simple_animal/friendly/lizard.dm +++ b/code/modules/mob/living/simple_animal/friendly/lizard.dm @@ -23,9 +23,12 @@ obj_damage = 0 environment_smash = ENVIRONMENT_SMASH_NONE var/static/list/edibles = typecacheof(list(/mob/living/simple_animal/butterfly, /mob/living/simple_animal/cockroach)) //list of atoms, however turfs won't affect AI, but will affect consumption. - can_be_held = "lizard" size_multiplier = 0.5 +/mob/living/simple_animal/hostile/lizard/ComponentInitialize() + . = ..() + AddElement(/datum/element/mob_holder, "lizard", null, null, null, SLOT_HEAD) //you can hold lizards now. + /mob/living/simple_animal/hostile/lizard/CanAttack(atom/the_target)//Can we actually attack a possible target? if(see_invisible < the_target.invisibility)//Target's invisible to us, forget it return FALSE @@ -41,7 +44,3 @@ return TRUE else return ..() - -/mob/living/simple_animal/hostile/lizard/generate_mob_holder() - var/obj/item/clothing/head/mob_holder/holder = new(get_turf(src), src, "lizard", 'icons/mob/animals_held.dmi', 'icons/mob/animals_held_lh.dmi', 'icons/mob/animals_held_rh.dmi', TRUE) - return holder diff --git a/code/modules/mob/living/simple_animal/friendly/mouse.dm b/code/modules/mob/living/simple_animal/friendly/mouse.dm index 028bada0..97db2047 100644 --- a/code/modules/mob/living/simple_animal/friendly/mouse.dm +++ b/code/modules/mob/living/simple_animal/friendly/mouse.dm @@ -25,18 +25,17 @@ var/body_color //brown, gray and white, leave blank for random gold_core_spawnable = FRIENDLY_SPAWN var/chew_probability = 1 - can_be_held = TRUE size_multiplier = 0.5 /mob/living/simple_animal/mouse/Initialize() . = ..() AddComponent(/datum/component/squeak, list('sound/effects/mousesqueek.ogg'=1), 100) if(!body_color) - body_color = pick( list("brown","gray","white") ) + body_color = pick(list("brown","gray","white")) + AddElement(/datum/element/mob_holder, "mouse_[body_color]") icon_state = "mouse_[body_color]" icon_living = "mouse_[body_color]" icon_dead = "mouse_[body_color]_dead" - can_be_held = "mouse_[body_color]" /mob/living/simple_animal/mouse/proc/splat() src.health = 0 @@ -89,17 +88,14 @@ /mob/living/simple_animal/mouse/white body_color = "white" icon_state = "mouse_white" - can_be_held = "mouse_white" /mob/living/simple_animal/mouse/gray body_color = "gray" icon_state = "mouse_gray" - can_be_held = "mouse_gray" /mob/living/simple_animal/mouse/brown body_color = "brown" icon_state = "mouse_brown" - can_be_held = "mouse_brown" //TOM IS ALIVE! SQUEEEEEEEE~K :) /mob/living/simple_animal/mouse/brown/Tom @@ -124,7 +120,3 @@ /obj/item/reagent_containers/food/snacks/deadmouse/on_grind() reagents.clear_reagents() -/mob/living/simple_animal/mouse/generate_mob_holder() - var/obj/item/clothing/head/mob_holder/holder = new(get_turf(src), src, (istext(can_be_held) ? can_be_held : ""), 'icons/mob/animals_held.dmi', 'icons/mob/animals_held_lh.dmi', 'icons/mob/animals_held_rh.dmi') - holder.w_class = WEIGHT_CLASS_TINY - return holder diff --git a/code/modules/mob/living/simple_animal/friendly/sloth.dm b/code/modules/mob/living/simple_animal/friendly/sloth.dm index fb114ace..f488e5ee 100644 --- a/code/modules/mob/living/simple_animal/friendly/sloth.dm +++ b/code/modules/mob/living/simple_animal/friendly/sloth.dm @@ -22,10 +22,12 @@ maxHealth = 50 speed = 10 glide_size = 2 - can_be_held = "sloth" //finally oranges can be held size_multiplier = 0.5 do_footstep = TRUE +/mob/living/simple_animal/pet/fox/ComponentInitialize() + . = ..() + AddElement(/datum/element/mob_holder, "sloth") //finally oranges can be held //Cargo Sloth /mob/living/simple_animal/sloth/paperwork diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 4e50551f..c7ce6577 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -314,11 +314,13 @@ return if(is_blind(src)) - to_chat(src, "Something is there but you can't see it.") + to_chat(src, "Something is there but you can't see it!") return face_atom(A) - A.examine(src) + var/list/result = A.examine(src) + to_chat(src, result.Join("\n")) + SEND_SIGNAL(src, COMSIG_MOB_EXAMINATE, A) //same as above //note: ghosts can point, this is intended diff --git a/hyperstation/code/modules/resize/resizing.dm b/hyperstation/code/modules/resize/resizing.dm index 647de2c9..d889b77c 100644 --- a/hyperstation/code/modules/resize/resizing.dm +++ b/hyperstation/code/modules/resize/resizing.dm @@ -162,10 +162,10 @@ mob/living/get_effective_size() else if(istype(H) && H.dna.features["taur"] == "Naga" || H.dna.features["taur"] == "Tentacle") tmob.visible_message("[src] snatches up [tmob] underneath their tail!", "[src]'s tail winds around you and snatches you in its coils!") - tmob.mob_pickup_micro_feet(H) + //tmob.mob_pickup_micro_feet(H) else tmob.visible_message("[src] stomps down on [tmob], curling their toes and picking them up!", "[src]'s toes pin you down and curl around you, picking you up!") - tmob.mob_pickup_micro_feet(H) + //tmob.mob_pickup_micro_feet(H) return 1 if(abs(tmob.get_effective_size()/get_effective_size()) >= 2) diff --git a/tgstation.dme b/tgstation.dme index d48447f7..45b3be68 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -457,6 +457,7 @@ #include "code\datums\elements\cleaning.dm" #include "code\datums\elements\earhealing.dm" #include "code\datums\elements\ghost_role_eligibility.dm" +#include "code\datums\elements\mob_holder.dm" #include "code\datums\elements\wuv.dm" #include "code\datums\helper_datums\events.dm" #include "code\datums\helper_datums\getrev.dm" @@ -1984,7 +1985,6 @@ #include "code\modules\mob\living\damage_procs.dm" #include "code\modules\mob\living\death.dm" #include "code\modules\mob\living\emote.dm" -#include "code\modules\mob\living\inhand_holder.dm" #include "code\modules\mob\living\life.dm" #include "code\modules\mob\living\living.dm" #include "code\modules\mob\living\living_defense.dm" @@ -2931,7 +2931,7 @@ #include "hyperstation\code\modules\crafting\recipes.dm" #include "hyperstation\code\modules\integrated_electronics\input.dm" #include "hyperstation\code\modules\patreon\patreon.dm" -#include "hyperstation\code\modules\resize\holder_micro.dm" +// #include "hyperstation\code\modules\resize\holder_micro.dm" #include "hyperstation\code\modules\resize\resizing.dm" #include "hyperstation\code\modules\resize\sizechems.dm" #include "hyperstation\code\modules\resize\sizegun.dm" From 0c9bc3e9d7f1c5e67e926ce6a475f20887cc675f Mon Sep 17 00:00:00 2001 From: Dip Date: Fri, 2 Oct 2020 02:22:47 -0300 Subject: [PATCH 11/14] src fix --- code/datums/elements/mob_holder.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/datums/elements/mob_holder.dm b/code/datums/elements/mob_holder.dm index a63be406..3bd0c7d6 100644 --- a/code/datums/elements/mob_holder.dm +++ b/code/datums/elements/mob_holder.dm @@ -40,7 +40,7 @@ to_chat(user, "Your hands are full!") return FALSE if(source.buckled) - to_chat(user, "[src] is buckled to something!") + to_chat(user, "[source] is buckled to something!") return FALSE if(source == user) to_chat(user, "You can't pick yourself up.") @@ -52,7 +52,7 @@ source.visible_message("[user] picks up [source]!", \ "[user] picks you up!") - to_chat(user, "You pick [src] up.") + to_chat(user, "You pick [source] up.") source.drop_all_held_items() var/obj/item/clothing/head/mob_holder/holder = new(get_turf(source), source, worn_state, alt_worn, right_hand, left_hand, inv_slots) if(proctype) From 4d39d175c445c2467856804c26b3658c5e00c9a0 Mon Sep 17 00:00:00 2001 From: Dip Date: Fri, 2 Oct 2020 14:40:10 -0300 Subject: [PATCH 12/14] partially enable micro holding --- code/datums/elements/mob_holder.dm | 6 ++++++ hyperstation/code/modules/resize/holder_micro.dm | 6 ++++++ hyperstation/code/modules/resize/resizing.dm | 2 +- tgstation.dme | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/code/datums/elements/mob_holder.dm b/code/datums/elements/mob_holder.dm index 3bd0c7d6..1cd57f6e 100644 --- a/code/datums/elements/mob_holder.dm +++ b/code/datums/elements/mob_holder.dm @@ -54,6 +54,9 @@ "[user] picks you up!") to_chat(user, "You pick [source] up.") source.drop_all_held_items() + if(ishuman(source)) //Slightly hacky edit to at least not disable the micro holding system entirely + var/obj/item/clothing/head/mob_holder/micro/holder = new(get_turf(source), source, worn_state, alt_worn, right_hand, left_hand, inv_slots) + return holder var/obj/item/clothing/head/mob_holder/holder = new(get_turf(source), source, worn_state, alt_worn, right_hand, left_hand, inv_slots) if(proctype) INVOKE_ASYNC(src, proctype, source, holder, user) @@ -77,6 +80,7 @@ icon_state = "" w_class = WEIGHT_CLASS_BULKY var/mob/living/held_mob + var/can_head = FALSE /obj/item/clothing/head/mob_holder/Initialize(mapload, mob/living/target, worn_state, alt_worn, right_hand, left_hand, slots = NONE) . = ..() @@ -110,6 +114,8 @@ w_class = WEIGHT_CLASS_TINY if(MOB_SIZE_SMALL) w_class = WEIGHT_CLASS_NORMAL + if(MOB_SIZE_HUMAN) + w_class = WEIGHT_CLASS_BULKY if(MOB_SIZE_LARGE) w_class = WEIGHT_CLASS_HUGE RegisterSignal(src, COMSIG_CLICK_SHIFT, .proc/examine_held_mob) diff --git a/hyperstation/code/modules/resize/holder_micro.dm b/hyperstation/code/modules/resize/holder_micro.dm index e3612f64..5654a8da 100644 --- a/hyperstation/code/modules/resize/holder_micro.dm +++ b/hyperstation/code/modules/resize/holder_micro.dm @@ -33,6 +33,7 @@ if(rh_icon) righthand_file = rh_icon +/* This has no need to exist as default assimilate already got it all covered /obj/item/clothing/head/mob_holder/micro/proc/assimilate(mob/living/M) switch(M.mob_size) if(MOB_SIZE_TINY) @@ -43,6 +44,7 @@ w_class = WEIGHT_CLASS_BULKY if(MOB_SIZE_LARGE) w_class = WEIGHT_CLASS_HUGE +*/ /obj/item/clothing/head/mob_holder/micro/Destroy() @@ -73,6 +75,8 @@ visible_message("[src] escapes [L]!") release() +//The following code has been disabled, hopefully temporarily. - HS13 elements update +/* /mob/living/proc/mob_pickup_micro(mob/living/L) var/obj/item/clothing/head/mob_holder/micro/holder = generate_mob_holder() if(!holder) @@ -124,6 +128,8 @@ if(mob_try_pickup_micro(user)) return TRUE +*/ + /obj/item/clothing/head/mob_holder/micro/assume_air(datum/gas_mixture/env) var/atom/location = loc if(!loc) diff --git a/hyperstation/code/modules/resize/resizing.dm b/hyperstation/code/modules/resize/resizing.dm index d889b77c..4ff4e9b0 100644 --- a/hyperstation/code/modules/resize/resizing.dm +++ b/hyperstation/code/modules/resize/resizing.dm @@ -162,7 +162,7 @@ mob/living/get_effective_size() else if(istype(H) && H.dna.features["taur"] == "Naga" || H.dna.features["taur"] == "Tentacle") tmob.visible_message("[src] snatches up [tmob] underneath their tail!", "[src]'s tail winds around you and snatches you in its coils!") - //tmob.mob_pickup_micro_feet(H) + //tmob.mob_pickup_micro_feet(H) //These two procs have been disabled. Hopefully temporarily. else tmob.visible_message("[src] stomps down on [tmob], curling their toes and picking them up!", "[src]'s toes pin you down and curl around you, picking you up!") //tmob.mob_pickup_micro_feet(H) diff --git a/tgstation.dme b/tgstation.dme index 45b3be68..e6d71e20 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -2931,7 +2931,7 @@ #include "hyperstation\code\modules\crafting\recipes.dm" #include "hyperstation\code\modules\integrated_electronics\input.dm" #include "hyperstation\code\modules\patreon\patreon.dm" -// #include "hyperstation\code\modules\resize\holder_micro.dm" +#include "hyperstation\code\modules\resize\holder_micro.dm" #include "hyperstation\code\modules\resize\resizing.dm" #include "hyperstation\code\modules\resize\sizechems.dm" #include "hyperstation\code\modules\resize\sizegun.dm" From 461cd2b04263f5e11419cd8a6097770b6e07b4b7 Mon Sep 17 00:00:00 2001 From: Dip Date: Fri, 2 Oct 2020 19:46:12 -0300 Subject: [PATCH 13/14] getting micro to work again --- code/datums/elements/mob_holder.dm | 5 +- code/modules/mob/living/carbon/human/human.dm | 1 + .../elements}/holder_micro.dm | 135 +++++++++--------- tgstation.dme | 2 +- 4 files changed, 67 insertions(+), 76 deletions(-) rename hyperstation/code/{modules/resize => datums/elements}/holder_micro.dm (69%) diff --git a/code/datums/elements/mob_holder.dm b/code/datums/elements/mob_holder.dm index 1cd57f6e..c1a475ac 100644 --- a/code/datums/elements/mob_holder.dm +++ b/code/datums/elements/mob_holder.dm @@ -1,5 +1,5 @@ /datum/element/mob_holder - element_flags = ELEMENT_BESPOKE + element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH id_arg_index = 2 var/worn_state var/alt_worn @@ -54,9 +54,6 @@ "[user] picks you up!") to_chat(user, "You pick [source] up.") source.drop_all_held_items() - if(ishuman(source)) //Slightly hacky edit to at least not disable the micro holding system entirely - var/obj/item/clothing/head/mob_holder/micro/holder = new(get_turf(source), source, worn_state, alt_worn, right_hand, left_hand, inv_slots) - return holder var/obj/item/clothing/head/mob_holder/holder = new(get_turf(source), source, worn_state, alt_worn, right_hand, left_hand, inv_slots) if(proctype) INVOKE_ASYNC(src, proctype, source, holder, user) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 65259212..405152fd 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -40,6 +40,7 @@ . = ..() if(!CONFIG_GET(flag/disable_human_mood)) AddComponent(/datum/component/mood) + AddElement(/datum/element/mob_holder/micro, "micro") /mob/living/carbon/human/Destroy() QDEL_NULL(physiology) diff --git a/hyperstation/code/modules/resize/holder_micro.dm b/hyperstation/code/datums/elements/holder_micro.dm similarity index 69% rename from hyperstation/code/modules/resize/holder_micro.dm rename to hyperstation/code/datums/elements/holder_micro.dm index 5654a8da..84940bcc 100644 --- a/hyperstation/code/modules/resize/holder_micro.dm +++ b/hyperstation/code/datums/elements/holder_micro.dm @@ -1,4 +1,66 @@ -// Micro Holders - Extends /obj/item/holder... TO:DO, just use most of the already-set procs in inhand_holder.dm +/datum/element/mob_holder/micro + +/datum/element/mob_holder/micro/Attach(datum/target, _worn_state, _alt_worn, _right_hand, _left_hand, _inv_slots = NONE, _proctype) + . = ..() + + if(!isliving(target)) + return ELEMENT_INCOMPATIBLE + + worn_state = _worn_state + alt_worn = _alt_worn + right_hand = _right_hand + left_hand = _left_hand + inv_slots = _inv_slots + proctype = _proctype + + RegisterSignal(target, COMSIG_CLICK_ALT, .proc/mob_try_pickup_micro, override = TRUE) + RegisterSignal(target, COMSIG_PARENT_EXAMINE, .proc/on_examine, override = TRUE) + +/datum/element/mob_holder/micro/proc/mob_pickup_micro(mob/living/source, mob/user) + var/obj/item/clothing/head/mob_holder/micro/holder = new(get_turf(source), source, worn_state, alt_worn, right_hand, left_hand, inv_slots) + if(!holder) + return + user.put_in_hands(holder) + return + +//shoehorned (get it?) and lazy way to do instant foot pickups cause haha funny. +/datum/element/mob_holder/micro/proc/mob_pickup_micro_feet(mob/living/source, mob/user) + var/obj/item/clothing/head/mob_holder/micro/holder = new(get_turf(source), source, worn_state, alt_worn, right_hand, left_hand, inv_slots) + if(!holder) + return + user.equip_to_slot(holder, SLOT_SHOES) + return + +/datum/element/mob_holder/micro/proc/mob_try_pickup_micro(mob/living/source, mob/user) + if(!ishuman(user) || !user.Adjacent(source) || user.incapacitated()) + return FALSE + if(abs(user.get_effective_size()/source.get_effective_size()) < 2.0 ) + to_chat(user, "They're too big to pick up!") + return FALSE + if(user.get_active_held_item()) + to_chat(user, "Your hands are full!") + return FALSE + if(source.buckled) + to_chat(user, "[source] is buckled to something!") + return FALSE + if(source == user) + to_chat(user, "You can't pick yourself up.") + return FALSE + source.visible_message("[user] starts picking up [source].", \ + "[user] starts picking you up!") + var/p = abs(source.get_effective_size()/user.get_effective_size() * 40) //Scale how fast the pickup will be depending on size difference + if(!do_after(user, p, target = source)) + return FALSE + + if(user.get_active_held_item()||source.buckled) + return FALSE + + source.visible_message("[user] picks up [source]!", \ + "[user] picks you up!") + to_chat(user, "You pick [source] up.") + source.drop_all_held_items() + mob_pickup_micro(source, user) + return TRUE /obj/item/clothing/head/mob_holder/micro name = "micro" @@ -33,20 +95,6 @@ if(rh_icon) righthand_file = rh_icon -/* This has no need to exist as default assimilate already got it all covered -/obj/item/clothing/head/mob_holder/micro/proc/assimilate(mob/living/M) - switch(M.mob_size) - if(MOB_SIZE_TINY) - w_class = WEIGHT_CLASS_TINY - if(MOB_SIZE_SMALL) - w_class = WEIGHT_CLASS_SMALL - if(MOB_SIZE_HUMAN) - w_class = WEIGHT_CLASS_BULKY - if(MOB_SIZE_LARGE) - w_class = WEIGHT_CLASS_HUGE -*/ - - /obj/item/clothing/head/mob_holder/micro/Destroy() if(held_mob) release() @@ -75,61 +123,6 @@ visible_message("[src] escapes [L]!") release() -//The following code has been disabled, hopefully temporarily. - HS13 elements update -/* -/mob/living/proc/mob_pickup_micro(mob/living/L) - var/obj/item/clothing/head/mob_holder/micro/holder = generate_mob_holder() - if(!holder) - return - drop_all_held_items() - L.put_in_hands(holder) - return - -//shoehorned (get it?) and lazy way to do instant foot pickups cause haha funny. -/mob/living/proc/mob_pickup_micro_feet(mob/living/L) - var/obj/item/clothing/head/mob_holder/micro/holder = generate_mob_holder() - if(!holder) - return - L.equip_to_slot(holder, SLOT_SHOES) - return - -/mob/living/proc/mob_try_pickup_micro(mob/living/user) - if(!ishuman(user) || !src.Adjacent(user) || user.incapacitated() || !can_be_held) - return FALSE - if(abs(user.get_effective_size()/src.get_effective_size()) < 2.0 ) - to_chat(user, "They're too big to pick up!") - return FALSE - if(user.get_active_held_item()) - to_chat(user, "Your hands are full!") - return FALSE - if(buckled) - to_chat(user, "[src] is buckled to something!") - return FALSE - if(src == user) - to_chat(user, "You can't pick yourself up.") - return FALSE - visible_message("[user] starts picking up [src].", \ - "[user] starts picking you up!") - var/p = abs(src.get_effective_size()/user.get_effective_size() * 40) //Scale how fast the pickup will be depending on size difference - if(!do_after(user, p, target = src)) - return FALSE - - if(user.get_active_held_item()||buckled) - return FALSE - - visible_message("[user] picks up [src]!", \ - "[user] picks you up!") - to_chat(user, "You pick [src] up.") - mob_pickup_micro(user) - return TRUE - -/mob/living/AltClick(mob/user) - . = ..() - if(mob_try_pickup_micro(user)) - return TRUE - -*/ - /obj/item/clothing/head/mob_holder/micro/assume_air(datum/gas_mixture/env) var/atom/location = loc if(!loc) @@ -188,4 +181,4 @@ /obj/item/clothing/head/mob_holder/micro/attacked_by(obj/item/I, mob/living/user) for(var/mob/living/carbon/human/M in contents) - M.attacked_by(I, user) + M.attacked_by(I, user) diff --git a/tgstation.dme b/tgstation.dme index e6d71e20..1f28b6de 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -2917,6 +2917,7 @@ #include "code\modules\VR\vr_sleeper.dm" #include "code\modules\zombie\items.dm" #include "code\modules\zombie\organs.dm" +#include "hyperstation\code\datums\elements\holder_micro.dm" #include "hyperstation\code\gamemode\traitor_lewd.dm" #include "hyperstation\code\gamemode\traitor_thief.dm" #include "hyperstation\code\gamemode\werewolf\werewolf.dm" @@ -2931,7 +2932,6 @@ #include "hyperstation\code\modules\crafting\recipes.dm" #include "hyperstation\code\modules\integrated_electronics\input.dm" #include "hyperstation\code\modules\patreon\patreon.dm" -#include "hyperstation\code\modules\resize\holder_micro.dm" #include "hyperstation\code\modules\resize\resizing.dm" #include "hyperstation\code\modules\resize\sizechems.dm" #include "hyperstation\code\modules\resize\sizegun.dm" From fbbdfdfeb49125a96f791894cd844d80c1ed78b2 Mon Sep 17 00:00:00 2001 From: Dip Date: Fri, 2 Oct 2020 19:49:58 -0300 Subject: [PATCH 14/14] a --- code/datums/elements/mob_holder.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/elements/mob_holder.dm b/code/datums/elements/mob_holder.dm index c1a475ac..9b9bc6f9 100644 --- a/code/datums/elements/mob_holder.dm +++ b/code/datums/elements/mob_holder.dm @@ -115,7 +115,7 @@ w_class = WEIGHT_CLASS_BULKY if(MOB_SIZE_LARGE) w_class = WEIGHT_CLASS_HUGE - RegisterSignal(src, COMSIG_CLICK_SHIFT, .proc/examine_held_mob) + RegisterSignal(src, COMSIG_CLICK_SHIFT, .proc/examine_held_mob, override = TRUE) /obj/item/clothing/head/mob_holder/Destroy() if(held_mob)