diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 4861047e1f..4222322f31 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -242,6 +242,8 @@ #define COMSIG_ITEM_ALT_AFTERATTACK "item_alt_afterattack" //from base of obj/item/altafterattack(): (atom/target, mob/user, proximity, params) #define COMSIG_ITEM_EQUIPPED "item_equip" //from base of obj/item/equipped(): (/mob/equipper, slot) #define COMSIG_ITEM_DROPPED "item_drop" //from base of obj/item/dropped(): (mob/user) + // relocated, tell inventory procs if those called this that the item isn't available anymore. + #define COMPONENT_DROPPED_RELOCATION 1 #define COMSIG_ITEM_PICKUP "item_pickup" //from base of obj/item/pickup(): (/mob/taker) #define COMSIG_ITEM_ATTACK_ZONE "item_attack_zone" //from base of mob/living/carbon/attacked_by(): (mob/living/carbon/target, mob/living/user, hit_zone) #define COMSIG_ITEM_IMBUE_SOUL "item_imbue_soul" //return a truthy value to prevent ensouling, checked in /obj/effect/proc_holder/spell/targeted/lichdom/cast(): (mob/user) diff --git a/code/__DEFINES/misc/return_values.dm b/code/__DEFINES/misc/return_values.dm new file mode 100644 index 0000000000..d55f603de9 --- /dev/null +++ b/code/__DEFINES/misc/return_values.dm @@ -0,0 +1,3 @@ +// obj/item/dropped +/// dropped() relocated this item, return FALSE for doUnEquip. +#define ITEM_RELOCATED_BY_DROPPED "relocated_by_dropped" diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 5c80b81ba5..9455a610c5 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -392,7 +392,8 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) if(item_flags & DROPDEL) qdel(src) item_flags &= ~IN_INVENTORY - SEND_SIGNAL(src, COMSIG_ITEM_DROPPED,user) + if(SEND_SIGNAL(src, COMSIG_ITEM_DROPPED,user) & COMPONENT_DROPPED_RELOCATION) + return ITEM_RELOCATED_BY_DROPPED user.update_equipment_speed_mods() // called just as an item is picked up (loc is not yet changed) diff --git a/code/game/objects/items/shields.dm b/code/game/objects/items/shields.dm index 5f42fdce89..863a825771 100644 --- a/code/game/objects/items/shields.dm +++ b/code/game/objects/items/shields.dm @@ -165,6 +165,7 @@ attack_verb = list("shoved", "bashed") var/cooldown = 0 //shield bash cooldown. based on world.time var/repair_material = /obj/item/stack/sheet/mineral/titanium + var/can_shatter = TRUE shield_flags = SHIELD_FLAGS_DEFAULT | SHIELD_TRANSPARENT max_integrity = 75 @@ -214,7 +215,7 @@ new /obj/item/shard((get_turf(src))) /obj/item/shield/riot/on_shield_block(mob/living/owner, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance, list/block_return) - if(obj_integrity <= damage) + if(can_shatter && (obj_integrity <= damage)) var/turf/T = get_turf(owner) T.visible_message("[attack_text] destroys [src]!") shatter(owner) @@ -355,20 +356,47 @@ obj/item/shield/riot/bullet_proof block_chance = 50 /obj/item/shield/riot/implant - name = "riot tower shield" - desc = "A massive shield that can block a lot of attacks and can take a lot of abuse before breaking." //It cant break unless it is removed from the implant + name = "telescoping shield implant" + desc = "A compact, arm-mounted telescopic shield. While nigh-indestructible when powered by a host user, it will eventually overload from damage. Recharges while inside its implant." item_state = "metal" icon_state = "metal" - block_chance = 30 //May be big but hard to move around to block. + block_chance = 50 slowdown = 1 shield_flags = SHIELD_FLAGS_DEFAULT + max_integrity = 60 + obj_integrity = 60 + can_shatter = FALSE item_flags = SLOWS_WHILE_IN_HAND + var/recharge_timerid + var/recharge_delay = 15 SECONDS -/obj/item/shield/riot/implant/run_block(mob/living/owner, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance, list/block_return) - if(attack_type & ATTACK_TYPE_PROJECTILE) - final_block_chance = 60 //Massive shield - return ..() +/// Entirely overriden take_damage. This shouldn't exist outside of an implant (other than maybe christmas). +/obj/item/shield/riot/implant/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir, armour_penetration = 0) + obj_integrity -= damage_amount + if(obj_integrity < 0) + obj_integrity = 0 + if(obj_integrity == 0) + if(ismob(loc)) + var/mob/living/L = loc + playsound(src, 'sound/effects/glassbr3.ogg', 100) + L.visible_message("[src] overloads from the damage sustained!") + L.dropItemToGround(src) //implant component catch hook will grab it. +/obj/item/shield/riot/implant/Moved() + . = ..() + if(istype(loc, /obj/item/organ/cyberimp/arm/shield)) + recharge_timerid = addtimer(CALLBACK(src, .proc/recharge), recharge_delay, flags = TIMER_STOPPABLE) + else //extending + if(recharge_timerid) + deltimer(recharge_timerid) + recharge_timerid = null + +/obj/item/shield/riot/implant/proc/recharge() + if(obj_integrity == max_integrity) + return + obj_integrity = max_integrity + if(ismob(loc.loc)) //cyberimplant.user + to_chat(loc, "[src] has recharged its reinforcement matrix and is ready for use!") /obj/item/shield/energy name = "energy combat shield" diff --git a/code/modules/assembly/flash.dm b/code/modules/assembly/flash.dm index 0fbc5cf71c..8a0645f311 100644 --- a/code/modules/assembly/flash.dm +++ b/code/modules/assembly/flash.dm @@ -229,6 +229,7 @@ var/flashcd = 20 var/overheat = 0 var/obj/item/organ/cyberimp/arm/flash/I = null + var/active_light_strength = 7 /obj/item/assembly/flash/armimplant/burn_out() if(I && I.owner) @@ -248,6 +249,12 @@ update_icon(1) return TRUE +/obj/item/assembly/flash/armimplant/Moved(oldLoc, dir) + . = ..() + if(!ismob(loc)) + set_light(0) + else + set_light(7) /obj/item/assembly/flash/armimplant/proc/cooldown() overheat = FALSE diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 9f7d2067de..fad3a7e534 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -333,7 +333,8 @@ I.moveToNullspace() else I.forceMove(newloc) - I.dropped(src) + if(I.dropped(src) == ITEM_RELOCATED_BY_DROPPED) + return FALSE return TRUE //Outdated but still in use apparently. This should at least be a human proc. diff --git a/code/modules/surgery/organs/augments_arms.dm b/code/modules/surgery/organs/augments_arms.dm index daf3324980..e01059204c 100644 --- a/code/modules/surgery/organs/augments_arms.dm +++ b/code/modules/surgery/organs/augments_arms.dm @@ -20,7 +20,28 @@ update_icon() SetSlotFromZone() - items_list = contents.Copy() + for(var/obj/item/I in contents) + add_item(I) + +/obj/item/organ/cyberimp/arm/proc/add_item(obj/item/I) + if(I in items_list) + return + I.forceMove(src) + items_list += I + // ayy only dropped signal for performance, we can't possibly have shitcode that doesn't call it when removing items from a mob, right? + // .. right??! + RegisterSignal(I, COMSIG_ITEM_DROPPED, .proc/magnetic_catch) + +/obj/item/organ/cyberimp/arm/proc/magnetic_catch(datum/source, mob/user) + . = COMPONENT_DROPPED_RELOCATION + var/obj/item/I = source //if someone is misusing the signal, just runtime + if(I in items_list) + if(I in contents) //already in us somehow? i probably shouldn't catch this so it's easier to spot bugs but eh.. + return + I.visible_message("[I] snaps back into [src]!") + I.forceMove(src) + if(I == holder) + holder = null /obj/item/organ/cyberimp/arm/proc/SetSlotFromZone() switch(zone) @@ -62,7 +83,7 @@ . = ..() if(. & EMP_PROTECT_SELF) return - if(prob(15/severity) && owner) + if(owner) to_chat(owner, "[src] is hit by EMP!") // give the owner an idea about why his implant is glitching Retract() @@ -75,29 +96,20 @@ "[holder] snaps back into your [zone == BODY_ZONE_R_ARM ? "right" : "left"] arm.", "You hear a short mechanical noise.") - if(istype(holder, /obj/item/assembly/flash/armimplant)) - var/obj/item/assembly/flash/F = holder - F.set_light(0) - owner.transferItemToLoc(holder, src, TRUE) holder = null playsound(get_turf(owner), 'sound/mecha/mechmove03.ogg', 50, 1) -/obj/item/organ/cyberimp/arm/proc/Extend(var/obj/item/item) +/obj/item/organ/cyberimp/arm/proc/Extend(obj/item/item) if(!(item in src)) return holder = item - ADD_TRAIT(holder, TRAIT_NODROP, HAND_REPLACEMENT_TRAIT) holder.resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF holder.slot_flags = null holder.set_custom_materials(null) - if(istype(holder, /obj/item/assembly/flash/armimplant)) - var/obj/item/assembly/flash/F = holder - F.set_light(7) - var/obj/item/arm_item = owner.get_active_held_item() if(arm_item) @@ -223,21 +235,6 @@ icon_state = "arm_taser" contents = newlist(/obj/item/gun/energy/e_gun/advtaser/mounted) -/obj/item/organ/cyberimp/arm/gun/emp_act(severity) - . = ..() - if(. & EMP_PROTECT_SELF) - return - if(prob(30/severity) && owner && !(organ_flags & ORGAN_FAILING)) - Retract() - owner.visible_message("A loud bang comes from [owner]\'s [zone == BODY_ZONE_R_ARM ? "right" : "left"] arm!") - playsound(get_turf(owner), 'sound/weapons/flashbang.ogg', 100, 1) - to_chat(owner, "You feel an explosion erupt inside your [zone == BODY_ZONE_R_ARM ? "right" : "left"] arm as your implant breaks!") - owner.adjust_fire_stacks(20) - owner.IgniteMob() - owner.adjustFireLoss(25) - crit_fail = 1 - organ_flags |= ORGAN_FAILING - /obj/item/organ/cyberimp/arm/flash name = "integrated high-intensity photon projector" //Why not desc = "An integrated projector mounted onto a user's arm that is able to be used as a powerful flash." @@ -275,6 +272,12 @@ desc = "A deployable riot shield to help deal with civil unrest." contents = newlist(/obj/item/shield/riot/implant) +/obj/item/organ/cyberimp/arm/shield/Extend(obj/item/I) + if(I.obj_integrity == 0) //that's how the shield recharge works + to_chat(owner, "[I] is still too unstable to extend. Give it some time!") + return FALSE + return ..() + /obj/item/organ/cyberimp/arm/shield/emag_act() . = ..() if(obj_flags & EMAGGED) diff --git a/tgstation.dme b/tgstation.dme index 7bfbd2dde2..5a9fcc618b 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -123,6 +123,7 @@ #include "code\__DEFINES\dcs\helpers.dm" #include "code\__DEFINES\dcs\signals.dm" #include "code\__DEFINES\flags\shields.dm" +#include "code\__DEFINES\misc\return_values.dm" #include "code\__HELPERS\_cit_helpers.dm" #include "code\__HELPERS\_lists.dm" #include "code\__HELPERS\_logging.dm"