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

add/refactor: сentcomm rapier #5924

Merged
merged 20 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
11 changes: 6 additions & 5 deletions code/__DEFINES/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@

//Attack types for checking shields/hit reactions

#define MELEE_ATTACK 1
#define UNARMED_ATTACK 2
#define PROJECTILE_ATTACK 3
#define THROWN_PROJECTILE_ATTACK 4
#define LEAP_ATTACK 5
#define ITEM_ATTACK (1 << 0)
#define UNARMED_ATTACK (1 << 1)
#define PROJECTILE_ATTACK (1 << 2)
#define THROWN_PROJECTILE_ATTACK (1 << 3)
#define LEAP_ATTACK (1 << 4)
#define MELEE_ATTACKS (ITEM_ATTACK | THROWN_PROJECTILE_ATTACK | UNARMED_ATTACK | LEAP_ATTACK)

//attack visual effects
#define ATTACK_EFFECT_PUNCH "punch"
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,8 @@
///from base of obj/item/attack_self(): (/mob)
#define COMSIG_ITEM_ATTACK_SELF "item_attack_self"
#define COMPONENT_NO_INTERACT (1<<0)
///from base of /obj/item/attack(): (mob/M, mob/user, params, def_zone)
#define COMSIG_ITEM_ATTACK_SUCCESS "mob_item_attack_success"
///from base of obj/item/attack_obj(): (/obj, /mob)
#define COMSIG_ITEM_ATTACK_OBJ "item_attack_obj"
///from base of obj/item/pre_attackby(): (atom/target, mob/user, params)
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/traits/sources.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#define MECHA_EQUIPMENT_TRAIT "mecha-equip"
#define HIS_GRACE_TRAIT "his-grace"
#define CHAINSAW_TRAIT "chainsaw-wield"
#define CENTCOMM_RAPIER_TRAIT "centcomm_rapier"
#define PYRO_CLAWS_TRAIT "pyro-claws"
#define CONTRACTOR_BATON_TRAIT "contractor-baton"
#define MUZZLE_TRAIT "muzzle"
Expand Down
4 changes: 4 additions & 0 deletions code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@

add_fingerprint(user)
. |= target.proceed_attack_results(src, user, params, def_zone)
if(!ATTACK_CHAIN_SUCCESS_CHECK(.))
return .
SEND_SIGNAL(src, COMSIG_ITEM_ATTACK_SUCCESS, target, user, params, def_zone)



/// The equivalent of the standard version of [/obj/item/proc/attack] but for object targets.
Expand Down
4 changes: 4 additions & 0 deletions code/datums/action.dm
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,10 @@
var/obj/item/clothing/shoes/magboots/gravity/G = target
G.dash(usr)

/datum/action/item_action/toggle_rapier_nodrop
name = "Toggle Anti-Drop"
desc = "Activates/deactivates centcomm rapier Anti-Drop."
dageavtobusnick marked this conversation as resolved.
Show resolved Hide resolved

///prset for organ actions
/datum/action/item_action/organ_action
check_flags = AB_CHECK_CONSCIOUS
Expand Down
32 changes: 32 additions & 0 deletions code/datums/components/attack_effect_sleep.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/datum/component/attack_effect_sleep
var/stamina_damage
var/sleep_time


/datum/component/attack_effect_sleep/Initialize(stamina_damage, sleep_time)
. = ..()
if(!isitem(parent))
return COMPONENT_INCOMPATIBLE
src.stamina_damage = stamina_damage
src.sleep_time = sleep_time
RegisterSignal(parent, COMSIG_ITEM_ATTACK_SUCCESS, PROC_REF(on_attack_success))

/datum/component/attack_effect_sleep/Destroy(force)
UnregisterSignal(parent, COMSIG_ITEM_ATTACK_SUCCESS)
. = ..()


/datum/component/attack_effect_sleep/proc/on_attack_success(datum/source, mob/living/target, mob/living/user, params, def_zone)
SIGNAL_HANDLER

if(!target || !user || !istype(target))
return

if(target.incapacitated(INC_IGNORE_RESTRAINED|INC_IGNORE_GRABBED))
target.visible_message(
span_danger("[user] puts [target] to sleep with [parent]!"),
span_userdanger("You suddenly feel very drowsy!"),
)
target.Sleeping(sleep_time)
add_attack_logs(user, target, "put to sleep with [parent]")
target.apply_damage(stamina_damage, STAMINA)
3 changes: 2 additions & 1 deletion code/datums/outfits/outfit_admin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@

uniform = /obj/item/clothing/under/rank/centcom/captain
back = /obj/item/storage/backpack/satchel
belt = /obj/item/gun/energy/pulse/pistol
belt = /obj/item/storage/belt/rapier/centcomm
gloves = /obj/item/clothing/gloves/color/white
shoes = /obj/item/clothing/shoes/centcom
head = /obj/item/clothing/head/beret/centcom/captain
Expand All @@ -281,6 +281,7 @@
pda = /obj/item/pda/centcom
backpack_contents = list(
/obj/item/storage/box/centcomofficer = 1,
/obj/item/gun/energy/pulse/pistol = 1,
/obj/item/implanter/death_alarm = 1
)
implants = list(
Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/cult/cult_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@
* If they are blocked, and the shield has an illusion charge, an illusion will be spawned at src.
* The illusion has a 60% chance to be hostile and attack non-cultists, and a 40% chance to just run away from the user.
*/
/obj/item/shield/mirror/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
/obj/item/shield/mirror/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = ITEM_ATTACK)
if(iscultist(owner)) // Cultist holding the shield

// Hit by a projectile
Expand Down Expand Up @@ -673,7 +673,7 @@
playsound(T, 'sound/effects/glassbr3.ogg', 100)
qdel(src)

/obj/item/twohanded/cult_spear/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
/obj/item/twohanded/cult_spear/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = ITEM_ATTACK)
if(wielded)
final_block_chance *= 2
if(prob(final_block_chance))
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/miniantags/abduction/abduction_gear.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
M.name_override = null
M.regenerate_icons()

/obj/item/clothing/suit/armor/abductor/vest/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
/obj/item/clothing/suit/armor/abductor/vest/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = ITEM_ATTACK)
DeactivateStealth()

/obj/item/clothing/suit/armor/abductor/vest/IsReflect()
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/steal_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ GLOBAL_LIST_INIT(ungibbable_items_types, get_ungibbable_items_types())
/datum/theft_objective/highrisk/captains_rapier
id = "cap_rapier"
name = "the captain's rapier"
typepath = /obj/item/melee/rapier
typepath = /obj/item/melee/rapier/captain
protected_jobs = list(JOB_TITLE_CAPTAIN)

/datum/theft_objective/highrisk/hoslaser
Expand Down
1 change: 1 addition & 0 deletions code/game/jobs/job/central.dm
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
jobtype = /datum/job/ntspecops/supreme

suit = /obj/item/clothing/suit/space/deathsquad/officer/supreme
belt = /obj/item/storage/belt/rapier/centcomm
head = /obj/item/clothing/head/helmet/space/deathsquad/beret/supreme
shoes = /obj/item/clothing/shoes/cowboy/white
gloves = /obj/item/clothing/gloves/color/white
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/HolodeckControl.dm
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@
..()
item_color = "red"

/obj/item/holo/esword/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
/obj/item/holo/esword/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = ITEM_ATTACK)
if(active)
return ..()
return 0
Expand Down
5 changes: 4 additions & 1 deletion code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/g
var/breakouttime = 0

var/block_chance = 0
var/block_type = ALL
var/hit_reaction_chance = 0 //If you want to have something unrelated to blocking/armour piercing etc. Maybe not needed, but trying to think ahead/allow more freedom

// Needs to be in /obj/item because corgis can wear a lot of
Expand Down Expand Up @@ -504,7 +505,9 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/g
return ..()


/obj/item/proc/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
/obj/item/proc/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = ITEM_ATTACK)
if (!block_type || !(block_type & attack_type))
final_block_chance = 0
var/signal_result = (SEND_SIGNAL(src, COMSIG_ITEM_HIT_REACT, owner, hitby, damage, attack_type) & COMPONENT_BLOCK_SUCCESSFUL) + prob(final_block_chance)
if(signal_result != 0)
owner.visible_message(span_danger("[owner] blocks [attack_text] with [src]!"))
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/handheld_defib.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
if(istype(I, /obj/item/clothing/suit/space) && !shield_ignore)
if(istype(I, /obj/item/clothing/suit/space/hardsuit))
var/obj/item/clothing/suit/space/hardsuit/hardsuit = I
blocked = hardsuit.hit_reaction(user, src, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
blocked = hardsuit.hit_reaction(user, src, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = ITEM_ATTACK)
if(cooldown)
to_chat(user, span_warning("[src] is still charging!"))
return .
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
if(used)
. += span_warning("Something sinister is strapped to this card. It looks like it was once masked with some sort of cloaking field, which is now nonfunctional.")

/obj/item/syndicate_reverse_card/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
/obj/item/syndicate_reverse_card/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = ITEM_ATTACK)
if(attack_type != PROJECTILE_ATTACK)
return FALSE //this means the attack goes through
if(istype(hitby, /obj/item/projectile))
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/robot/robot_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

/obj/item/borg/stun/attack(mob/living/carbon/human/target, mob/living/silicon/robot/user, params, def_zone, skip_attack_anim = FALSE)
. = ATTACK_CHAIN_PROCEED
if(ishuman(target) && target.check_shields(src, 0, "[target]'s [name]", MELEE_ATTACK))
if(ishuman(target) && target.check_shields(src, 0, "[target]'s [name]", ITEM_ATTACK))
playsound(target, 'sound/weapons/genhit.ogg', 50, TRUE)
return .

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/toys.dm
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@
sharp_when_wielded = FALSE // It's a toy
needs_permit = FALSE

/obj/item/twohanded/dualsaber/toy/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
/obj/item/twohanded/dualsaber/toy/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = ITEM_ATTACK)
return 0

/obj/item/twohanded/dualsaber/toy/IsReflect()
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/batons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@

if(ishuman(target))
var/mob/living/carbon/human/human_target = target
if(human_target.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK))
if(human_target.check_shields(src, 0, "[user]'s [name]", ITEM_ATTACK))
return BATON_ATTACK_DONE
if(check_martial_counter(target, user))
return BATON_ATTACK_DONE
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/flamethrower.dm
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@
create_with_tank = TRUE


/obj/item/flamethrower/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
/obj/item/flamethrower/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = ITEM_ATTACK)
var/obj/item/projectile/P = hitby
if(ptank && damage && attack_type == PROJECTILE_ATTACK && P.damage_type != STAMINA && prob(15))
owner.visible_message("<span class='danger'>[attack_text] hits the fueltank on [owner]'s [src], rupturing it! What a shot!</span>")
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/grenades/chem_grenade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
spawn(det_time)
prime(user)

/obj/item/grenade/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
/obj/item/grenade/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = ITEM_ATTACK)
var/obj/item/projectile/P = hitby
if(damage && attack_type == PROJECTILE_ATTACK && P.damage_type != STAMINA && prob(15))
owner.visible_message("<span class='danger'>[attack_text] hits [owner]'s [src], setting it off! What a shot!</span>")
Expand Down
6 changes: 1 addition & 5 deletions code/game/objects/items/weapons/holy_weapons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,13 @@
w_class = WEIGHT_CLASS_BULKY
slot_flags = ITEM_SLOT_BELT|ITEM_SLOT_BACK
block_chance = 30
block_type = MELEE_ATTACKS
sharp = TRUE
embed_chance = 20
embedded_ignore_throwspeed_threshold = TRUE
hitsound = 'sound/weapons/bladeslice.ogg'
attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")

/obj/item/nullrod/claymore/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
if(attack_type == PROJECTILE_ATTACK)
final_block_chance = 0 //Don't bring a sword to a gunfight
return ..()

/obj/item/nullrod/claymore/darkblade
name = "dark blade"
icon_state = "cultblade"
Expand Down
6 changes: 3 additions & 3 deletions code/game/objects/items/weapons/melee/energy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
if(item_color == null)
item_color = pick("red", "blue", "green", "purple", "yellow", "pink", "darkblue", "orange")

/obj/item/melee/energy/sword/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
/obj/item/melee/energy/sword/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = ITEM_ATTACK)
if(active)
return ..()
return 0
Expand Down Expand Up @@ -173,7 +173,7 @@
..()
item_color = null

/obj/item/melee/energy/sword/cyborg/saw/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
/obj/item/melee/energy/sword/cyborg/saw/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = ITEM_ATTACK)
return 0

/obj/item/melee/energy/sword/saber
Expand Down Expand Up @@ -241,7 +241,7 @@
update_icon(UPDATE_ICON_STATE)


/obj/item/melee/energy/sword/saber/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
/obj/item/melee/energy/sword/saber/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = ITEM_ATTACK)
if(!active)
return FALSE
. = ..()
Expand Down
Loading