From 3e09ee8328b6950586c7f7fc4b1f71fc61552a2d Mon Sep 17 00:00:00 2001
From: kevinz000 <2003111+kevinz000@users.noreply.github.com>
Date: Wed, 22 Apr 2020 10:42:11 -0700
Subject: [PATCH 1/6] Alright
---
code/game/objects/items/shields.dm | 35 +++++++++---
code/modules/assembly/flash.dm | 7 +++
code/modules/surgery/organs/augments_arms.dm | 56 ++++++++++----------
3 files changed, 64 insertions(+), 34 deletions(-)
diff --git a/code/game/objects/items/shields.dm b/code/game/objects/items/shields.dm
index 16f29491be..3bc8362255 100644
--- a/code/game/objects/items/shields.dm
+++ b/code/game/objects/items/shields.dm
@@ -357,20 +357,41 @@ 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
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.
+/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
+ 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()
+ 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/surgery/organs/augments_arms.dm b/code/modules/surgery/organs/augments_arms.dm
index daf3324980..139061a601 100644
--- a/code/modules/surgery/organs/augments_arms.dm
+++ b/code/modules/surgery/organs/augments_arms.dm
@@ -20,7 +20,27 @@
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)
+ 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(contents)
+ if(I == holder)
+ holder = null
/obj/item/organ/cyberimp/arm/proc/SetSlotFromZone()
switch(zone)
@@ -62,7 +82,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 +95,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 +234,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 +271,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(item.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)
From 467497af54a64205d7b2d9d1be8b8eec41cd435a Mon Sep 17 00:00:00 2001
From: kevinz000 <2003111+kevinz000@users.noreply.github.com>
Date: Wed, 22 Apr 2020 10:45:13 -0700
Subject: [PATCH 2/6] woops
---
code/game/objects/items/shields.dm | 2 ++
code/modules/surgery/organs/augments_arms.dm | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/code/game/objects/items/shields.dm b/code/game/objects/items/shields.dm
index 3bc8362255..3b6995f93e 100644
--- a/code/game/objects/items/shields.dm
+++ b/code/game/objects/items/shields.dm
@@ -389,6 +389,8 @@ obj/item/shield/riot/bullet_proof
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!")
diff --git a/code/modules/surgery/organs/augments_arms.dm b/code/modules/surgery/organs/augments_arms.dm
index 139061a601..bdd7da9d5a 100644
--- a/code/modules/surgery/organs/augments_arms.dm
+++ b/code/modules/surgery/organs/augments_arms.dm
@@ -272,7 +272,7 @@
contents = newlist(/obj/item/shield/riot/implant)
/obj/item/organ/cyberimp/arm/shield/Extend(obj/item/I)
- if(item.obj_integrity == 0) //that's how the shield recharge works
+ 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 ..()
From 3626cc5d282fba8742fa7dd1fa3875ab1a90db5f Mon Sep 17 00:00:00 2001
From: kevinz000 <2003111+kevinz000@users.noreply.github.com>
Date: Wed, 22 Apr 2020 10:50:03 -0700
Subject: [PATCH 3/6] okay
---
code/game/objects/items/shields.dm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/code/game/objects/items/shields.dm b/code/game/objects/items/shields.dm
index 3b6995f93e..0da18f0d7c 100644
--- a/code/game/objects/items/shields.dm
+++ b/code/game/objects/items/shields.dm
@@ -364,11 +364,13 @@ obj/item/shield/riot/bullet_proof
block_chance = 50
slowdown = 1
shield_flags = SHIELD_FLAGS_DEFAULT
+ max_integrity = 60
+ obj_integrity = 60
item_flags = SLOWS_WHILE_IN_HAND
var/recharge_timerid
var/recharge_delay = 15 SECONDS
-/// Entirely overriden take_damage.
+/// 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)
@@ -376,6 +378,7 @@ obj/item/shield/riot/bullet_proof
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.
From c551006295ad162a3d86367ede238faccb972fc9 Mon Sep 17 00:00:00 2001
From: kevinz000 <2003111+kevinz000@users.noreply.github.com>
Date: Wed, 22 Apr 2020 10:54:42 -0700
Subject: [PATCH 4/6] catch dropped
---
code/__DEFINES/dcs/signals.dm | 2 ++
code/__DEFINES/misc/return_values.dm | 3 +++
code/game/objects/items.dm | 3 ++-
code/modules/mob/inventory.dm | 3 ++-
code/modules/surgery/organs/augments_arms.dm | 1 +
tgstation.dme | 1 +
6 files changed, 11 insertions(+), 2 deletions(-)
create mode 100644 code/__DEFINES/misc/return_values.dm
diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm
index b32625a539..9d7c33f8a7 100644
--- a/code/__DEFINES/dcs/signals.dm
+++ b/code/__DEFINES/dcs/signals.dm
@@ -241,6 +241,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/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 bdd7da9d5a..cc3928e6ac 100644
--- a/code/modules/surgery/organs/augments_arms.dm
+++ b/code/modules/surgery/organs/augments_arms.dm
@@ -33,6 +33,7 @@
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..
diff --git a/tgstation.dme b/tgstation.dme
index 41708bc0bd..1ec3728280 100755
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -124,6 +124,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"
From fe63eca8176fd0194b5cf91468db2d4c9817f9de Mon Sep 17 00:00:00 2001
From: kevinz000 <2003111+kevinz000@users.noreply.github.com>
Date: Wed, 22 Apr 2020 11:04:01 -0700
Subject: [PATCH 5/6] kay
---
code/game/objects/items/shields.dm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/code/game/objects/items/shields.dm b/code/game/objects/items/shields.dm
index 0da18f0d7c..151e31658c 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)
@@ -366,6 +367,7 @@ obj/item/shield/riot/bullet_proof
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
From e4e2c0195c0403c455545eee41fc68f485f85989 Mon Sep 17 00:00:00 2001
From: kevinz000 <2003111+kevinz000@users.noreply.github.com>
Date: Wed, 22 Apr 2020 12:04:47 -0700
Subject: [PATCH 6/6] epic
---
code/modules/surgery/organs/augments_arms.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/modules/surgery/organs/augments_arms.dm b/code/modules/surgery/organs/augments_arms.dm
index cc3928e6ac..e01059204c 100644
--- a/code/modules/surgery/organs/augments_arms.dm
+++ b/code/modules/surgery/organs/augments_arms.dm
@@ -39,7 +39,7 @@
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(contents)
+ I.forceMove(src)
if(I == holder)
holder = null