From cb50f1bf4c9fe798f768dae5158eb73ff8c74c37 Mon Sep 17 00:00:00 2001 From: MalorMorfin Date: Sat, 7 Dec 2024 05:58:44 +1000 Subject: [PATCH] FixMB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Попробывал пофиксить --- code/game/objects/items/implants/implant.dm | 7 --- .../implants/skill_implants/implant_code.dm | 49 +++++------------- .../implants/skill_implants/implant_skill.dm | 23 +++++---- .../skill_implants/implantator_code.dm | 51 ++----------------- .../skill_implants/implantator_skill.dm | 14 ++--- code/modules/unit_tests/implanting.dm | 4 +- 6 files changed, 39 insertions(+), 109 deletions(-) diff --git a/code/game/objects/items/implants/implant.dm b/code/game/objects/items/implants/implant.dm index 1017ee866e3..e60760c42b4 100644 --- a/code/game/objects/items/implants/implant.dm +++ b/code/game/objects/items/implants/implant.dm @@ -35,13 +35,6 @@ if(!allowed_limbs) allowed_limbs = GLOB.human_body_parts -/obj/item/implant/proc/on_initialize() - if(flags_implant & GRANT_ACTIVATION_ACTION) - activation_action = new(src, src) - if(allow_reagents) - reagents = new /datum/reagents(MAX_IMPLANT_REAGENTS) - reagents.my_atom = WEAKREF(src) - /obj/item/implant/Destroy(force) unimplant() QDEL_NULL(activation_action) diff --git a/code/game/objects/items/implants/skill_implants/implant_code.dm b/code/game/objects/items/implants/skill_implants/implant_code.dm index df77e8fd37d..fe38ca3564a 100644 --- a/code/game/objects/items/implants/skill_implants/implant_code.dm +++ b/code/game/objects/items/implants/skill_implants/implant_code.dm @@ -31,52 +31,31 @@ /obj/item/implant/skill/Initialize() . = ..() name = name + " implant" - if(!allowed_limbs) - allowed_limbs = GLOB.human_body_parts -/obj/item/implant/skill/on_initialize() - return - -/obj/item/implant/skill/try_implant(mob/living/carbon/human/target, mob/living/user) - if(!ishuman(target)) - return - if(!(user.zone_selected in allowed_limbs)) - to_chat(user, span_warning("You cannot implant this into that limb!")) - return FALSE - implanted = TRUE - return implant(target, user) +/obj/item/implant/skill/Destroy(force) + unimplant() + QDEL_NULL(activation_action) + part?.implants -= src + return ..() /obj/item/implant/skill/implant(mob/living/carbon/human/target, mob/living/user) - forceMove(target) - implant_owner = target - implanted = TRUE - var/limb_targeting = (user ? user.zone_selected : BODY_ZONE_CHEST) - var/datum/limb/affected = target.get_limb(limb_targeting) - if(!affected) - CRASH("[src] implanted into [target] [user ? "by [user]" : ""] but had no limb, despite being set to implant in [limb_targeting].") - affected.implants += src - part = affected - activation_action?.give_action(target) - embed_into(target, limb_targeting, TRUE) + for(var/skill in max_skills) + if(user.skills.getRating(skill) >= max_skills[skill]) + balloon_alert(user, "Nothing to learn!") + return + . = ..() target.set_skills(target.skills.modifyRating(cqc, melee_weapons, firearms, pistols, shotguns, rifles, smgs, heavy_weapons, swordplay, smartgun,\ engineer, construction, leadership, medical, surgery, pilot, police, powerloader, large_vehicle, stamina)) return TRUE /obj/item/implant/skill/unimplant() - if(!implanted) - return FALSE - activation_action?.remove_action(implant_owner) - implanted = FALSE - part.implants -= src - part = null implant_owner.set_skills(implant_owner.skills.modifyRating(-cqc, -melee_weapons, -firearms, -pistols, -shotguns, -rifles, -smgs, -heavy_weapons, -swordplay, -smartgun,\ -engineer, -construction, -leadership, -medical, -surgery, -pilot, -police, -powerloader, -large_vehicle, -stamina)) - forceMove(get_turf(implant_owner)) - implant_owner = null + . = ..() /obj/item/implant/skill/combat - name = "combat implants" - desc = "Non-game" + name = "Combat implants" + desc = "All combat" icon_state = "combat_implant" allowed_limbs = list(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM) @@ -87,7 +66,7 @@ allowed_limbs = list(BODY_ZONE_CHEST, BODY_ZONE_PRECISE_GROIN) /obj/item/implant/skill/oper_system - name = "HEAD SLOT!" + name = "Leader slot" desc = "All non-sorted special shit (leadership, probaly SG and more)" icon_state = "skill_implant" allowed_limbs = list(BODY_ZONE_HEAD) diff --git a/code/game/objects/items/implants/skill_implants/implant_skill.dm b/code/game/objects/items/implants/skill_implants/implant_skill.dm index 4a75c3c2c90..1d1f7af632f 100644 --- a/code/game/objects/items/implants/skill_implants/implant_skill.dm +++ b/code/game/objects/items/implants/skill_implants/implant_skill.dm @@ -1,42 +1,43 @@ /obj/item/implant/skill/combat/firearms - name = "aiming support" + name = "Aiming support" desc = "integrated aiming support system! Update weapons skills!" firearms = 1 max_skills = list(SKILL_FIREARMS = SKILL_FIREARMS_TRAINED) /obj/item/implant/skill/combat/melee - name = "close combat codex" + name = "Close combat codex" desc = "integrated hit support system! Update melee skills!" melee_weapons = 1 max_skills = list(SKILL_MELEE_WEAPONS = SKILL_MELEE_TRAINED) /obj/item/implant/skill/codex/medical - name = "medtech" + name = "Medtech" desc = "A compact device that electro-shakes you every time you apply bandages counterclockwise, right next to your heart! Update medical skills!" medical = 1 max_skills = list(SKILL_MEDICAL = SKILL_MEDICAL_COMPETENT) /obj/item/implant/skill/codex/surgery - name = "surgery assisting system" - desc = "compensates for hand trembling from Parkinson's syndrome, thanks to the reliable suspension of the shoulder joints! Update surgery skills!" + name = "Surgery assisting system" + desc = "Compensates for hand trembling from Parkinson's syndrome, thanks to the reliable suspension of the shoulder joints! Update surgery skills!" surgery = 1 max_skills = list(SKILL_SURGERY = SKILL_SURGERY_PROFESSIONAL) /obj/item/implant/skill/codex/engineer - name = "construction support system" - desc = "laying brickwork has never been easier than with this corrective endoskeleton! Update engineering skills!" + name = "Construction support system" + desc = "Laying brickwork has never been easier than with this corrective endoskeleton! Update engineering skills!" engineer = 1 max_skills = list(SKILL_ENGINEER = SKILL_ENGINEER_MASTER) /obj/item/implant/skill/oper_system/leadership - name = "command protocols 'Graiyor' codex" - desc = "uploading knowledge of advanced mnemonics of inspiration and persuasion to the brain so that people around go under bullets even more willingly! Update leadership skills!" + name = "Command protocols 'Graiyor' codex" + desc = "Uploading knowledge of advanced mnemonics of inspiration and persuasion to the brain so that people around go under bullets even more willingly! Update leadership skills!" icon_state = "leadership_implant" leadership = 1 max_skills = list(SKILL_LEAD = SKILL_LEAD_MASTER) /obj/item/implant/skill/oper_system/leadership/delux - name = "delux command protocols 'Graiyor' codex" - desc = "uploading advanced knowledge of futuristic mnemonics of inspiration and persuasion to the brain so that people around go under bullets even more willingly! Update leadership skills even more!" + name = "Delux command protocols 'Graiyor' codex" + desc = "Uploading advanced knowledge of futuristic mnemonics of inspiration and persuasion to the brain so that people around go under bullets even more willingly! Update leadership skills even more!" icon_state = "deluxleadership_implant" + leadership = 2 max_skills = list(SKILL_LEAD = SKILL_LEAD_SUPER) diff --git a/code/game/objects/items/implants/skill_implants/implantator_code.dm b/code/game/objects/items/implants/skill_implants/implantator_code.dm index 5efbacfc394..1b2faae1448 100644 --- a/code/game/objects/items/implants/skill_implants/implantator_code.dm +++ b/code/game/objects/items/implants/skill_implants/implantator_code.dm @@ -1,5 +1,5 @@ /obj/item/implanter/implantator - name = "skill" //teeeeest. + name = "skill" desc = "Used to implant occupants with skill implants." icon = 'icons/obj/items/implants.dmi' icon_state = "skill" @@ -12,69 +12,26 @@ throw_speed = 1 throw_range = 5 w_class = WEIGHT_CLASS_TINY - obj/item/implant/internal_implant = /obj/item/implant/skill - allowed_limbs - var/spented = FALSE var/max_skills var/list/implants - var/allowed_limbs /obj/item/implanter/implantator/Initialize(mapload, ...) . = ..() - name = name + " implanter" - desc = internal_implant.desc - if(!allowed_limbs) - allowed_limbs = GLOB.human_body_parts + +/obj/item/implanter/implantator/Destroy() + return ..() /obj/item/implanter/update_icon_state() return -/obj/item/implanter/implantator/proc/has_implant(datum/limb/targetlimb) - for (var/obj/item/implant/skill/I in targetlimb.implants) - if(!is_type_in_list(I, GLOB.known_implants)) - return TRUE - return FALSE - /obj/item/implanter/implantator/attack(mob/living/target, mob/living/user, list/implants, datum/limb/targetlimb, var/obj/item/implant/skill/i) . = ..() - if(spented == TRUE) - return FALSE - if(!ishuman(target)) - return FALSE - if(!internal_implant) - to_chat(user, span_warning("There is no implant in the [src]!")) - return FALSE - if(!(user.zone_selected in allowed_limbs)) - balloon_alert(user, "wrong limb!") - return FALSE - for(i in user.zone_selected) - has_implant(targetlimb) - balloon_alert(user, "limb already implanted!") - return FALSE - user.visible_message(span_warning("[user] is attemping to implant [target]."), span_notice("You're attemping to implant [target].")) - if(!do_after(user, 5 SECONDS, NONE, target, BUSY_ICON_GENERIC)) - to_chat(user, span_notice("You failed to implant [target].")) - return FALSE - if(internal_implant.try_implant(target, user)) - target.visible_message(span_warning("[target] has been implanted by [user].")) - log_combat(user, target, "implanted", src) - internal_implant = null - name = name + "used" - desc = desc + "It's spent." - icon_state = empty_icon + "_s" - spented = TRUE - return TRUE - to_chat(user, span_notice("You fail to implant [target].")) - return /obj/item/implanter/implantator/combat - allowed_limbs = list(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM) internal_implant = /obj/item/implant/skill/combat /obj/item/implanter/implantator/codex - allowed_limbs = list(BODY_ZONE_CHEST, BODY_ZONE_PRECISE_GROIN) internal_implant = /obj/item/implant/skill/codex /obj/item/implanter/implantator/oper_system - allowed_limbs = list(BODY_ZONE_HEAD) internal_implant = /obj/item/implant/skill/oper_system diff --git a/code/game/objects/items/implants/skill_implants/implantator_skill.dm b/code/game/objects/items/implants/skill_implants/implantator_skill.dm index a91480e3288..2a45a71a40d 100644 --- a/code/game/objects/items/implants/skill_implants/implantator_skill.dm +++ b/code/game/objects/items/implants/skill_implants/implantator_skill.dm @@ -1,42 +1,42 @@ //////////////////////////////[COMBAT]////////////////////////////// /obj/item/implanter/implantator/combat/firearms - name = "aiming support" + name = "Aiming support" icon_state = "weapon" internal_implant = /obj/item/implant/skill/combat/firearms /obj/item/implanter/implantator/combat/melee - name = "close combat codex" + name = "Close combat codex" icon_state = "melee" internal_implant = /obj/item/implant/skill/combat/melee //////////////////////////////[SUPPORT]////////////////////////////// /obj/item/implanter/implantator/codex/medical - name = "medtech" + name = "Medtech" icon_state = "medical" internal_implant = /obj/item/implant/skill/codex/medical /obj/item/implanter/implantator/codex/surgery - name = "surgery assisting system" + name = "Surgery assisting system" icon_state = "surgery" internal_implant = /obj/item/implant/skill/codex/surgery /obj/item/implanter/implantator/codex/engineer - name = "construction support system" + name = "Construction support system" icon_state = "enginering" internal_implant = /obj/item/implant/skill/codex/engineer //////////////////////////////[SPECIAL]////////////////////////////// /obj/item/implanter/implantator/oper_system/leadership - name = "command protocols 'Graiyor' codex" + name = "Command protocols 'Graiyor' codex" icon_state = "leadership" empty_icon = "leadership" internal_implant = /obj/item/implant/skill/oper_system/leadership /obj/item/implanter/implantator/oper_system/leadership/delux - name = "delux command protocols 'Graiyor' codex" + name = "Delux command protocols 'Graiyor' codex" icon_state = "deluxleadership" empty_icon = "deluxleadership" internal_implant = /obj/item/implant/skill/oper_system/leadership/delux diff --git a/code/modules/unit_tests/implanting.dm b/code/modules/unit_tests/implanting.dm index cf96e38c718..6bf7893958f 100644 --- a/code/modules/unit_tests/implanting.dm +++ b/code/modules/unit_tests/implanting.dm @@ -5,12 +5,12 @@ var/mob/living/carbon/human/implanted_guy = allocate(/mob/living/carbon/human) var/obj/item/implanter/implanter_to_inject = allocate(/obj/item/implanter/cloak) - var/obj/item/implant/implant_in_planter = implanter_to_inject.imp + var/obj/item/implant/implant_in_planter = implanter_to_inject.internal_implant implanted_guy.put_in_active_hand(implanter_to_inject) TEST_ASSERT(implanter_to_inject.attack(implanted_guy, implanted_guy), "[implanted_guy] failed to inject himself with [implanter_to_inject]") - TEST_ASSERT(!implanter_to_inject.imp, "[implanter_to_inject] still has an implant in its implanter, despite being injected into [implanted_guy]") + TEST_ASSERT(!implanter_to_inject.internal_implant, "[implanter_to_inject] still has an implant in its implanter, despite being injected into [implanted_guy]") qdel(implanted_guy) TEST_ASSERT(QDELETED(implant_in_planter), "[implant_in_planter] has been injected into [implanted_guy], who has been deleted, but the implant still exists.")