Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BOUNTY] Adds contraband dual wielding implants #3611

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
#define COMSIG_TABLE_SLAMMED "table_slammed"
///from base of atom/attack_hand(): (mob/user, modifiers)
#define COMSIG_MOB_ATTACK_HAND "mob_attack_hand"
///from base of /obj/item/attack(): (mob/M, mob/user)
///from base of /obj/item/attack(): (mob/M, mob/user, params, obj/item/weapon)
#define COMSIG_MOB_ITEM_ATTACK "mob_item_attack"
///from base of obj/item/afterattack(): (atom/target, obj/item/weapon, proximity_flag, click_parameters)
#define COMSIG_MOB_ITEM_AFTERATTACK "mob_item_afterattack"
Expand Down
6 changes: 3 additions & 3 deletions code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
if(signal_return & COMPONENT_SKIP_ATTACK)
return

SEND_SIGNAL(user, COMSIG_MOB_ITEM_ATTACK, target_mob, user, params)
SEND_SIGNAL(user, COMSIG_MOB_ITEM_ATTACK, target_mob, user, params, src) // monkestation edit

if(item_flags & NOBLUDGEON)
return
Expand All @@ -243,7 +243,7 @@
if(force && target_mob == user && user.client)
user.client.give_award(/datum/award/achievement/misc/selfouch, user)

user.do_attack_animation(target_mob)
user.do_attack_animation(target_mob, used_item = src) // MONKESTATION EDIT: Okay so why the FUCK was an attack proc on *item* not passing the fucking *item* to this? WHY?!
target_mob.attacked_by(src, user)

log_combat(user, target_mob, "attacked", src.name, "(ISTATE: [user.log_istate()]) (DAMTYPE: [uppertext(damtype)])")
Expand All @@ -265,7 +265,7 @@
if(signal_return & COMPONENT_SKIP_ATTACK)
return

SEND_SIGNAL(user, COMSIG_MOB_ITEM_ATTACK, target_mob, user, params)
SEND_SIGNAL(user, COMSIG_MOB_ITEM_ATTACK, target_mob, user, params, src) // monkestation edit

if(item_flags & NOBLUDGEON)
return
Expand Down
91 changes: 91 additions & 0 deletions monkestation/code/modules/cybernetics/augments/chest_augments.dm
Original file line number Diff line number Diff line change
Expand Up @@ -555,3 +555,94 @@
owner.SetKnockdown(1.5 SECONDS)

return TRUE

/datum/bodypart_overlay/simple/dualwield
icon = 'monkestation/code/modules/cybernetics/icons/implants.dmi'
icon_state = "ccms_overlay"
layers = EXTERNAL_ADJACENT

/obj/item/organ/internal/cyberimp/chest/dualwield
name = "C.C.M.S implant"
desc = "Short for Complementary Combat Maneuvering System, it processes spinal nerve signals and enacts forced complementary maneuvers on the opposite side of the user's body when they attack. In layman's terms, it lets you dual wield."
icon = 'monkestation/code/modules/cybernetics/icons/implants.dmi'
icon_state = "ccms"
encode_info = AUGMENT_SYNDICATE_LEVEL

visual_implant = TRUE
bodypart_overlay = /datum/bodypart_overlay/simple/dualwield

/obj/item/organ/internal/cyberimp/chest/dualwield/on_insert(mob/living/carbon/organ_owner, special)
. = ..()
register()

/obj/item/organ/internal/cyberimp/chest/dualwield/on_remove(mob/living/carbon/organ_owner, special)
. = ..()
unregister()

/obj/item/organ/internal/cyberimp/chest/dualwield/proc/register()
RegisterSignal(owner, COMSIG_MOB_ITEM_ATTACK, PROC_REF(on_item_attack))

/obj/item/organ/internal/cyberimp/chest/dualwield/proc/unregister()
UnregisterSignal(owner, COMSIG_MOB_ITEM_ATTACK)

/obj/item/organ/internal/cyberimp/chest/dualwield/proc/on_item_attack(datum/source, mob/target, mob/user, params, obj/item/weapon)
SIGNAL_HANDLER

if(!(owner.istate & ISTATE_HARM)) // No dual wielding outside of combat mode.
return

if(weapon != owner.get_active_held_item()) // Just to be extra careful about loops.
return

var/item = owner.get_inactive_held_item()

if(!item)
return

var/attack_time = (user.next_move - world.time) * 0.5 // Allows us to attack in the "gaps" between our owner's attacks, because it looks cool as fuck.

addtimer(CALLBACK(src, PROC_REF(complement_attack), item, target), attack_time, TIMER_UNIQUE) // TIMER_UNIQUE makes sure this will never go exponential even if a loop is found.

/obj/item/organ/internal/cyberimp/chest/dualwield/proc/complement_attack(obj/item/item, mob/target)
if(QDELETED(owner) || QDELETED(target))
return

if(owner.get_inactive_held_item() != item)
return

if(handle_side_effects(item, target)) // If handle_side_effects returns true, that means we misfired.
return

if(owner.CanReach(target, item))
unregister() // Prevent looping in on ourselves if the user switches items during the delay.
item.attack(target, owner)
register()

/obj/item/organ/internal/cyberimp/chest/dualwield/proc/handle_side_effects(obj/item/item, mob/target)
return FALSE // Returning true means we misfired, i.e. failed to dual wield even though it should have triggered under normal circumstances.

/datum/bodypart_overlay/simple/dualwield/refurbished
icon_state = "ccms_overlay_refurbished"

/obj/item/organ/internal/cyberimp/chest/dualwield/refurbished
name = "refurbished C.C.M.S implant"
desc = "A refurbished dual wielding implant. It looks old and the nerve filaments have degraded, but it's still functional."
icon_state = "ccms_refurbished"

bodypart_overlay = /datum/bodypart_overlay/simple/dualwield/refurbished

/obj/item/organ/internal/cyberimp/chest/dualwield/refurbished/handle_side_effects(obj/item/item, mob/target)
if(prob(20)) // Low probability for it to not work at all.
owner.visible_message(
message = span_warning("[owner]'s arm twitches."),
self_message = span_danger("Your C.C.M.S misfires!")
)
return TRUE // Cancels the complementary attack.

if(prob(30)) // And if it does work, it might cause some damage.
owner.visible_message(
message = span_warning("[owner]'s arm spazzes out!"),
self_message = span_danger("Your arm spazzes out!")
)
var/obj/item/bodypart/arm = owner.get_holding_bodypart_of_item(item)
arm?.receive_damage(brute = 10, wound_bonus = 10, sharpness = NONE) // You can get away with like 5 spazzes before you get a dislocation.
14 changes: 12 additions & 2 deletions monkestation/code/modules/cybernetics/augments/uplink/uplink.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/datum/uplink_item/bundles_tc/sandy
name = "Sandevistan Bundle"
desc = "A box containing various implants"
desc = "A box containing autosurgeons for a cyberlink and a sandevistan, allowing you to outspeed targets."
item = /obj/item/storage/box/syndie_kit/sandy
cost = 12
purchasable_from = UPLINK_TRAITORS
Expand All @@ -12,7 +12,7 @@

/datum/uplink_item/bundles_tc/mantis
name = "Mantis Blade Bundle"
desc = "A box containing various implants"
desc = "A box containing autosurgeons for a cyberlink and two mantis blade implants, one for each arm."
item = /obj/item/storage/box/syndie_kit/mantis
cost = 12
purchasable_from = UPLINK_TRAITORS
Expand All @@ -22,3 +22,13 @@
new /obj/item/autosurgeon/organ/syndicate/syndie_mantis(src)
new /obj/item/autosurgeon/organ/syndicate/syndie_mantis/l(src)

/datum/uplink_item/bundles_tc/dualwield
name = "C.C.M.S Bundle"
desc = "A box containing autosurgeons for a cyberlink and a C.C.M.S implant that lets you dual wield melee weapons."
item = /obj/item/storage/box/syndie_kit/dualwield
cost = 12
purchasable_from = UPLINK_TRAITORS

/obj/item/storage/box/syndie_kit/dualwield/PopulateContents()
new /obj/item/autosurgeon/organ/cyberlink_syndicate(src)
new /obj/item/autosurgeon/organ/syndicate/dualwield(src)
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@
price_min = CARGO_CRATE_VALUE * 5
price_max = CARGO_CRATE_VALUE * 7

/datum/market_item/auction/shoddy_implant/chest/dualwield
name = "refurbished C.C.M.S implant"
desc = "A refurbished dual wielding implant. It's old and might misfire, but it's still functional."
item = /obj/item/organ/internal/cyberimp/chest/dualwield/refurbished
auction_weight = 1 // It practically doubles your damage.

price_min = CARGO_CRATE_VALUE * 6
price_max = CARGO_CRATE_VALUE * 8

/datum/market_item/auction/shoddy_implant/arm
category = "Arm Implants"

Expand Down
Binary file modified monkestation/code/modules/cybernetics/icons/implants.dmi
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
/obj/item/autosurgeon/organ/syndicate/sandy
starting_organ = /obj/item/organ/internal/cyberimp/chest/sandevistan

/obj/item/autosurgeon/organ/syndicate/dualwield
starting_organ = /obj/item/organ/internal/cyberimp/chest/dualwield

/obj/item/autosurgeon/skillchip
name = "skillchip autosurgeon"
desc = "A device that automatically inserts a skillchip into the user's brain without the hassle of extensive surgery. \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
if(!istype(some_item,type))
return

user.do_attack_animation(M,null,some_item)
some_item.attack(M,user)
some_item.attack(M, user)


/obj/item/mantis_blade/chromata
Expand Down Expand Up @@ -96,4 +95,4 @@
var/mob/living/living = user
living.stamina?.adjust(-30) // cost of a lunge

attack(target,user)
attack(target, user)
Binary file modified monkestation/icons/obj/medical/organs/organs.dmi
Binary file not shown.
Loading