Skip to content

Commit

Permalink
add/refactor: сentcomm rapier
Browse files Browse the repository at this point in the history
  • Loading branch information
dageavtobusnick committed Sep 19, 2024
1 parent 9d54dc1 commit 1220890
Show file tree
Hide file tree
Showing 25 changed files with 129 additions and 84 deletions.
12 changes: 7 additions & 5 deletions code/__DEFINES/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,13 @@

//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 MELEE_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 ALL_ATTACK (PROJECTILE_ATTACK | MELEE_ATTACK | THROWN_PROJECTILE_ATTACK | UNARMED_ATTACK | LEAP_ATTACK)
#define ALL_ATTACK_EXCEPT_PROJECTILES (MELEE_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 rapier anti-drop"
desc = "Activates deactivates centcomm rapier anti-drop."

///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 = 0


/datum/component/attack_effect_sleep/Initialize(stamina_damage)
if(!isitem(parent))
return COMPONENT_INCOMPATIBLE
src.stamina_damage = stamina_damage
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
stamina_sleep_effect(target, user)


/datum/component/attack_effect_sleep/proc/stamina_sleep_effect(mob/living/target, mob/living/user)
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(10 SECONDS)
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
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
3 changes: 3 additions & 0 deletions 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_ATTACK
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 @@ -505,6 +506,8 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/g


/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)
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
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 = ALL_ATTACK_EXCEPT_PROJECTILES
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
90 changes: 46 additions & 44 deletions code/game/objects/items/weapons/melee/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@
return OXYLOSS

/obj/item/melee/rapier
name = "captain's rapier"
desc = "An elegant weapon, for a more civilized age."
icon_state = "rapier"
item_state = "rapier"
name = "rapier"
desc = "If you see this, it means there's a bug."
icon_state = "rods-1"
item_state = "rods"
flags = CONDUCT
force = 15
throwforce = 10
w_class = WEIGHT_CLASS_BULKY
block_chance = 50
block_type = ALL_ATTACK_EXCEPT_PROJECTILES
armour_penetration = 75
sharp = TRUE
origin_tech = "combat=5"
Expand All @@ -47,51 +48,56 @@
materials = list(MAT_METAL = 1000)
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ACID_PROOF // Theft targets should be hard to destroy

/obj/item/melee/rapier/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/melee/syndie_rapier
name = "plastitanium rapier"
desc = "A thin blade made of plastitanium with a diamond tip. It appears to be coated in a persistent layer of an unknown substance."
icon_state = "syndie_rapier"
item_state = "syndie_rapier"
flags = CONDUCT
force = 15
throwforce = 10
w_class = WEIGHT_CLASS_BULKY
block_chance = 50
armour_penetration = 75
sharp = TRUE
/obj/item/melee/rapier/poisoned
block_type = ALL_ATTACK
origin_tech = "combat=5;biotech=5;syndicate=4"
attack_verb = list("lunged at", "stabbed")
pickup_sound = 'sound/items/handling/knife_pickup.ogg'
drop_sound = 'sound/items/handling/knife_drop.ogg'
hitsound = 'sound/weapons/rapierhit.ogg'
materials = null
resistance_flags = FIRE_PROOF | ACID_PROOF
/// How much stamina damage we deal on a successful hit against a living, non-cyborg mob.
var/stamina_damage = 30


/obj/item/melee/syndie_rapier/attack(mob/living/target, mob/living/user, params, def_zone, skip_attack_anim = FALSE)
/obj/item/melee/rapier/poisoned/Initialize()
. = ..()
if(!ATTACK_CHAIN_SUCCESS_CHECK(.))
return .
syndie_rapier_effect(target, user)
AddComponent(/datum/component/attack_effect_sleep, stamina_damage)

/obj/item/melee/rapier/captain
name = "captain's rapier"
desc = "An elegant weapon, for a more civilized age."
icon_state = "rapier"
item_state = "rapier"

/obj/item/melee/syndie_rapier/proc/syndie_rapier_effect(mob/living/target, mob/living/user)
if(target.incapacitated(INC_IGNORE_RESTRAINED|INC_IGNORE_GRABBED))
target.visible_message(
span_danger("[user] puts [target] to sleep with [src]!"),
span_userdanger("You suddenly feel very drowsy!"),
)
target.Sleeping(10 SECONDS)
add_attack_logs(user, target, "put to sleep with [src]")
target.apply_damage(stamina_damage, STAMINA)
/obj/item/melee/rapier/poisoned/syndie
name = "plastitanium rapier"
desc = "A thin blade made of plastitanium with a diamond tip. It appears to be coated in a persistent layer of an unknown substance."
icon_state = "syndie_rapier"
item_state = "syndie_rapier"

/obj/item/melee/rapier/poisoned/centcomm
name = "centcomm plastitanium rapier"
desc = "Симбиоз непозволительной роскоши и статуса с титановым лезвием на вашем поясе, обладатель этого шедевра оружейного дела может похвастаться тем, что постиг корпоративную вершину."
icon_state = "centcomm_rapier"
item_state = "centcomm_rapier"
force = 25
throwforce = 20
block_chance = 95
armour_penetration = 100
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ACID_PROOF
stamina_damage = 100
actions_types = list(/datum/action/item_action/toggle_rapier_nodrop)



/obj/item/melee/rapier/poisoned/centcomm/attack_self(mob/user)
. = ..()
if(!usr.is_in_hands(src))
return .
if(HAS_TRAIT_FROM(src, TRAIT_NODROP, CENTCOMM_RAPIER_TRAIT))
REMOVE_TRAIT(src, TRAIT_NODROP, CENTCOMM_RAPIER_TRAIT)
to_chat(usr, span_warning("Вы расслабляете руку и отпускаете рукоятку [src]."))
else
ADD_TRAIT(src, TRAIT_NODROP, CENTCOMM_RAPIER_TRAIT)
to_chat(usr, span_warning("Вы сжимаете рукоятку [src] со всей силы. Теперь ничто не может выбить у вас оружие из рук!"))

/obj/item/melee/mantisblade
name = "Gorlex mantis blade"
desc = "A blade designed to be hidden just beneath the skin. The brain is directly linked to this bad boy, allowing it to spring into action."
Expand Down Expand Up @@ -168,14 +174,10 @@
force = 15
armour_penetration = 20
block_chance = 20
block_type = ALL_ATTACK_EXCEPT_PROJECTILES
icon_state = "mantis"
item_state = "mantis"

/obj/item/melee/mantisblade/shellguard/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/melee/icepick
name = "ice pick"
desc = "Used for chopping ice. Also excellent for mafia esque murders."
Expand Down
24 changes: 17 additions & 7 deletions code/game/objects/items/weapons/storage/belt.dm
Original file line number Diff line number Diff line change
Expand Up @@ -683,11 +683,11 @@
storage_slots = 1
w_class = WEIGHT_CLASS_BULKY
max_w_class = WEIGHT_CLASS_BULKY
can_hold = list(/obj/item/melee/rapier)
can_hold = list(/obj/item/melee/rapier/captain)

/obj/item/storage/belt/rapier/populate_contents()
new /obj/item/melee/rapier(src)
update_icon()
new /obj/item/melee/rapier/captain(src)
update_appearance(UPDATE_ICON_STATE)

/obj/item/storage/belt/rapier/attack_hand(mob/user)
if(loc != user)
Expand Down Expand Up @@ -730,12 +730,22 @@
desc = "A sinister, thin sheath, suitable for a rapier."
icon_state = "syndie_sheath"
item_state = "syndie_sheath"
can_hold = list(/obj/item/melee/syndie_rapier)
can_hold = list(/obj/item/melee/rapier/poisoned/syndie)

/obj/item/storage/belt/rapier/syndie/populate_contents()
new /obj/item/melee/syndie_rapier(src)
update_icon()

new /obj/item/melee/rapier/poisoned/syndie(src)
update_appearance(UPDATE_ICON_STATE)

/obj/item/storage/belt/rapier/centcomm
name = "centcomm rapier sheath"
desc = "Украшенные ножны, корпоративный кич в комплекте."
icon_state = "centcomm_sheath"
item_state = "centcomm_sheath"
can_hold = list(/obj/item/melee/rapier/poisoned/centcomm)

/obj/item/storage/belt/rapier/centcomm/populate_contents()
new /obj/item/melee/rapier/poisoned/centcomm(src)
update_appearance(UPDATE_ICON_STATE)

// -------------------------------------
// Bluespace Belt
Expand Down
9 changes: 2 additions & 7 deletions code/modules/antagonists/changeling/powers/mutations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
force = 45
armour_penetration = -30
block_chance = 50
block_type = ALL_ATTACK_EXCEPT_PROJECTILES
hitsound = 'sound/weapons/bladeslice.ogg'
throwforce = 0 //Just to be on the safe side
throw_range = 0
Expand All @@ -181,13 +182,7 @@
parent_action.UnregisterSignal(parent_action.owner, COMSIG_MOB_WEAPON_APPEARS)
parent_action = null
return ..()


/obj/item/melee/arm_blade/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 //only blocks melee
return ..()



/obj/item/melee/arm_blade/afterattack(atom/target, mob/user, proximity, params)
if(!proximity)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mini_games/thunderdome/gamemodes/gamemode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
brawler_type = /obj/effect/mob_spawn/human/thunderdome/cqc
random_items_count = 2
item_pool = list(
/obj/item/melee/rapier = 1,
/obj/item/melee/rapier/captain = 1,
/obj/item/melee/energy/axe = 1,
/obj/item/melee/energy/sword/saber/red = 1,
/obj/item/melee/energy/cleaving_saw = 1,
Expand Down Expand Up @@ -137,7 +137,7 @@
/obj/item/storage/box/thunderdome/crossbow/energy = 1,
/obj/item/storage/box/thunderdome/laser_eyes = 1,
/obj/item/implanter/adrenalin = 1,
/obj/item/melee/rapier = 1,
/obj/item/melee/rapier/captain = 1,
/obj/item/melee/energy/axe = 1,
/obj/item/melee/energy/sword/saber/red = 1,
/obj/item/melee/energy/cleaving_saw = 1,
Expand Down
7 changes: 1 addition & 6 deletions code/modules/mining/lavaland/necropolis_chests.dm
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@
force = 15
armour_penetration = 15
block_chance = 50
block_type = ALL_ATTACK_EXCEPT_PROJECTILES
sharp = TRUE
w_class = WEIGHT_CLASS_HUGE
attack_verb = list("attack", "slash", "stab", "slice", "tear", "lacerate", "rip", "dice", "cut")
Expand Down Expand Up @@ -454,12 +455,6 @@
user.changeNext_move(CLICK_CD_RAPID)
return ..()


/obj/item/cursed_katana/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/cursed_katana/proc/can_combo_attack(mob/user, mob/living/target)
return target.stat != DEAD && target != user

Expand Down
Loading

0 comments on commit 1220890

Please sign in to comment.