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

Armor is now split into multiple sections for melee #44

Merged
merged 7 commits into from
Nov 19, 2024
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: 2 additions & 0 deletions code/__DEFINES/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#define STAMINA "stamina"
#define BRAIN "brain"

#define MELEE_TYPES list("blunt", "slash", "stab")

//bitflag damage defines used for suicide_act
#define BRUTELOSS (1<<0)
#define FIRELOSS (1<<1)
Expand Down
32 changes: 16 additions & 16 deletions code/__DEFINES/roguetown.dm
Original file line number Diff line number Diff line change
Expand Up @@ -264,32 +264,32 @@ Thing can move up or down an armor class by significant changes to coverage & cr


/*--------------------\
| ARMOR VALUE DEFINES | - So armor makes sense. Basic arrow got 25 AP so less than 25 "bullet" does nothing vs arrows generally
| ARMOR VALUE DEFINES | - So armor makes sense. Basic arrow got 25 AP so less than 25 "piercing" does nothing vs arrows generally
\--------------------*/

// Light AC
#define ARMOR_MINIMAL list("melee" = 5, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 0)
#define ARMOR_WEAK list("melee" = 10, "bullet" = 5, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 0)
#define ARMOR_MINIMAL list("blunt" = 5, "slash" = 5, "stab" = 5, "piercing" = 0, "fire" = 0, "acid" = 0)
#define ARMOR_WEAK list("blunt" = 10, "slash" = 10, "stab" = 10, "piercing" = 5, "fire" = 0, "acid" = 0)

#define ARMOR_PADDED_BAD list("melee" = 15, "bullet" = 15, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 0)
#define ARMOR_PADDED list("melee" = 25, "bullet" = 30, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 0)
#define ARMOR_PADDED_GOOD list("melee" = 30, "bullet" = 35, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 0)
#define ARMOR_PADDED_BAD list("blunt" = 15, "slash" = 15, "stab" = 15, "piercing" = 15, "fire" = 0, "acid" = 0)
#define ARMOR_PADDED list("blunt" = 25, "slash" = 25, "stab" = 25, "piercing" = 30, "fire" = 0, "acid" = 0)
#define ARMOR_PADDED_GOOD list("blunt" = 30, "slash" = 30, "stab" = 30, "piercing" = 35, "fire" = 0, "acid" = 0)

#define ARMOR_LEATHER_BAD list("melee" = 30, "bullet" = 10, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 0)
#define ARMOR_LEATHER list("melee" = 35, "bullet" = 15, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 0)
#define ARMOR_LEATHER_GOOD list("melee" = 40, "bullet" = 20, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 0)
#define ARMOR_LEATHER_BAD list("blunt" = 30, "slash" = 30, "stab" = 30, "piercing" = 10, "fire" = 0, "acid" = 0)
#define ARMOR_LEATHER list("blunt" = 35, "slash" = 35, "stab" = 35, "piercing" = 15, "fire" = 0, "acid" = 0)
#define ARMOR_LEATHER_GOOD list("blunt" = 40, "slash" = 40, "stab" = 40, "piercing" = 20, "fire" = 0, "acid" = 0)

// Medium AC
#define ARMOR_MAILLE_IRON list("melee" = 50, "bullet" = 30, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 0)
#define ARMOR_MAILLE list("melee" = 55, "bullet" = 40, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 0)
#define ARMOR_MAILLE_GOOD list("melee" = 60, "bullet" = 45, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 0)
#define ARMOR_MAILLE_IRON list("blunt" = 5, "slash" = 5, "stab" = 50, "piercing" = 30, "fire" = 0, "acid" = 0)
#define ARMOR_MAILLE list("blunt" = 5, "slash" = 5, "stab" = 55, "piercing" = 40, "fire" = 0, "acid" = 0)
#define ARMOR_MAILLE_GOOD list("blunt" = 60, "slash" = 60, "stab" = 60, "piercing" = 45, "fire" = 0, "acid" = 0)

#define ARMOR_SCALE list("melee" = 65, "bullet" = 65, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 0)
#define ARMOR_SCALE list("blunt" = 65, "slash" = 65, "stab" = 65, "piercing" = 65, "fire" = 0, "acid" = 0)

// Heavy AC
#define ARMOR_PLATE_BAD list("melee" = 70, "bullet" = 50, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 0)
#define ARMOR_PLATE list("melee" = 85, "bullet" = 70, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 0)
#define ARMOR_PLATE_GOOD list("melee" = 90, "bullet" = 85, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 0)
#define ARMOR_PLATE_BAD list("blunt" = 70, "slash" = 70, "stab" = 70, "piercing" = 50, "fire" = 0, "acid" = 0)
#define ARMOR_PLATE list("blunt" = 85, "slash" = 85, "stab" = 85, "piercing" = 70, "fire" = 0, "acid" = 0)
#define ARMOR_PLATE_GOOD list("blunt" = 90, "slash" = 90, "stab" = 90, "piercing" = 85, "fire" = 0, "acid" = 0)


/*-----------------------\
Expand Down
8 changes: 4 additions & 4 deletions code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,9 @@
newforce = 1
else
user.visible_message("<span class='warning'>[user] [verbu] [src] with [I]!</span>")
take_damage(newforce, I.damtype, "melee", 1)
take_damage(newforce, I.damtype, I.damage_type, 1)
if(newforce > 1)
I.take_damage(1, BRUTE, "melee")
I.take_damage(1, BRUTE, "blunt")
return TRUE

/turf/proc/attacked_by(obj/item/I, mob/living/user)
Expand All @@ -403,9 +403,9 @@
else
user.visible_message("<span class='warning'>[user] [verbu] [src] with [I]!</span>")

take_damage(newforce, I.damtype, "melee", 1)
take_damage(newforce, I.damtype, I.damage_type, 1)
if(newforce > 1)
I.take_damage(1, BRUTE, "melee")
I.take_damage(1, BRUTE, "blunt")
return TRUE

/mob/living/proc/simple_limb_hit(zone)
Expand Down
64 changes: 31 additions & 33 deletions code/datums/armor.dm
Original file line number Diff line number Diff line change
@@ -1,54 +1,52 @@
#define ARMORID "armor-[melee]-[bullet]-[laser]-[energy]-[bomb]-[bio]-[rad]-[fire]-[acid]-[magic]"
#define ARMORID "armor-[blunt]-[slash]-[stab]-[piercing]-[fire]-[acid]-[magic]"

/proc/getArmor(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 0, acid = 0, magic = 0)
/proc/getArmor(blunt = 0, slash = 0, stab = 0, piercing = 0, fire = 0, acid = 0, magic = 0)
. = locate(ARMORID)
if (!.)
. = new /datum/armor(melee, bullet, laser, energy, bomb, bio, rad, fire, acid, magic)
. = new /datum/armor(blunt, slash, stab, piercing, fire, acid, magic)

/datum/armor
datum_flags = DF_USE_TAG
var/melee
var/bullet
var/laser
var/energy
var/bomb
var/bio
var/rad
/// better defined as area pressure melee
var/blunt
/// better defined as line pressure melee
var/slash
/// better defined as point pressure melee
var/stab
/// basically projectiles
var/piercing
/// protection against burning
var/fire
/// protection against pools of acid
var/acid
/// protection against magical attacks (make this adjustable via rune enchantments or something)
var/magic

/datum/armor/New(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 0, acid = 0, magic = 0)
src.melee = melee
src.bullet = bullet
src.laser = laser
src.energy = energy
src.bomb = bomb
src.bio = bio
src.rad = rad
/datum/armor/New(blunt = 0, slash = 0, stab = 0, piercing = 0, fire = 0, acid = 0, magic = 0)
src.blunt = blunt
src.slash = slash
src.stab = stab
src.piercing = piercing
src.fire = fire
src.acid = acid
src.magic = magic
tag = ARMORID

/datum/armor/proc/modifyRating(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 0, acid = 0, magic = 0)
return getArmor(src.melee+melee, src.bullet+bullet, src.laser+laser, src.energy+energy, src.bomb+bomb, src.bio+bio, src.rad+rad, src.fire+fire, src.acid+acid, src.magic+magic)
/datum/armor/proc/modifyRating(blunt = 0, slash = 0, stab = 0, piercing = 0, fire = 0, acid = 0, magic = 0)
return getArmor(src.blunt+blunt, src.slash+slash, src.stab+stab, src.piercing+piercing,src.fire+fire, src.acid+acid, src.magic+magic)

/datum/armor/proc/modifyAllRatings(modifier = 0)
return getArmor(melee+modifier, bullet+modifier, laser+modifier, energy+modifier, bomb+modifier, bio+modifier, rad+modifier, fire+modifier, acid+modifier, magic+modifier)
return getArmor(blunt+modifier, slash+modifier, stab+modifier, piercing+modifier,fire+modifier, acid+modifier, magic+modifier)

//TODO! PORT BLACKSTONE BLUNT/SLASH/STAB ARMOR DEFINES!!!!!!
/datum/armor/proc/multiplymodifyAllRatings(modifier = 0)
return getArmor(melee*modifier, bullet*modifier, laser*modifier, energy*modifier, bomb*modifier, bio*modifier, rad*modifier, fire*modifier, acid*modifier, magic*modifier)
return getArmor(blunt*modifier, slash*modifier, stab*modifier, piercing*modifier, fire*modifier, acid*modifier, magic*modifier)

/datum/armor/proc/setRating(melee, bullet, laser, energy, bomb, bio, rad, fire, acid, magic)
return getArmor((isnull(melee) ? src.melee : melee),\
(isnull(bullet) ? src.bullet : bullet),\
(isnull(laser) ? src.laser : laser),\
(isnull(energy) ? src.energy : energy),\
(isnull(bomb) ? src.bomb : bomb),\
(isnull(bio) ? src.bio : bio),\
(isnull(rad) ? src.rad : rad),\
/datum/armor/proc/setRating(blunt, slash, stab, piercing, fire, acid, magic)
return getArmor((isnull(blunt) ? src.blunt : blunt),\
(isnull(slash) ? src.slash : slash),\
(isnull(stab) ? src.stab : stab),\
(isnull(piercing) ? src.piercing : piercing),\
(isnull(fire) ? src.fire : fire),\
(isnull(acid) ? src.acid : acid),\
(isnull(magic) ? src.magic : magic))
Expand All @@ -57,13 +55,13 @@
return vars[rating]

/datum/armor/proc/getList()
return list("melee" = melee, "bullet" = bullet, "laser" = laser, "energy" = energy, "bomb" = bomb, "bio" = bio, "rad" = rad, "fire" = fire, "acid" = acid, "magic" = magic)
return list("blunt" = blunt, "slash" = slash, "stab" = stab, "piercing" = piercing, "fire" = fire, "acid" = acid, "magic" = magic)

/datum/armor/proc/attachArmor(datum/armor/AA)
return getArmor(melee+AA.melee, bullet+AA.bullet, laser+AA.laser, energy+AA.energy, bomb+AA.bomb, bio+AA.bio, rad+AA.rad, fire+AA.fire, acid+AA.acid, magic+AA.magic)
return getArmor(blunt+AA.blunt, slash+AA.slash, stab+AA.stab, piercing+AA.piercing, fire+AA.fire, acid+AA.acid, magic+AA.magic)

/datum/armor/proc/detachArmor(datum/armor/AA)
return getArmor(melee-AA.melee, bullet-AA.bullet, laser-AA.laser, energy-AA.energy, bomb-AA.bomb, bio-AA.bio, rad-AA.rad, fire-AA.fire, acid-AA.acid, magic-AA.magic)
return getArmor(blunt-AA.blunt, slash-AA.slash, stab-AA.stab, piercing-AA.piercing, fire-AA.fire, acid-AA.acid, magic-AA.magic)

/datum/armor/vv_edit_var(var_name, var_value)
if (var_name == NAMEOF(src, tag))
Expand Down
2 changes: 1 addition & 1 deletion code/datums/materials/_material.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Simple datum which is instanced once per type and is used for every object of sa
///This is the amount of value per 1 unit of the material
var/value_per_unit = 0
///Armor modifiers, multiplies an items normal armor vars by these amounts.
var/armor_modifiers = list("melee" = 1, "bullet" = 1, "laser" = 1, "energy" = 1, "bomb" = 1, "bio" = 1, "rad" = 1, "fire" = 1, "acid" = 1)
var/armor_modifiers = list("blunt" = 1, "slash" = 1, "stab" = 1, "piercing" = 1, "fire" = 1, "acid" = 1)
///How beautiful is this material per unit
var/beauty_modifier = 0

Expand Down
2 changes: 1 addition & 1 deletion code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@
* deleted shortly after hitting something (during explosions or other massive events that
* throw lots of items around - singularity being a notable example)
*/
/atom/proc/hitby(atom/movable/AM, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum)
/atom/proc/hitby(atom/movable/AM, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum, damage_type = "blunt")
if(density && !has_gravity(AM)) //thrown stuff bounces off dense stuff in no grav, unless the thrown stuff ends up inside what it hit(embedding, bola, etc...).
addtimer(CALLBACK(src, PROC_REF(hitby_react), AM), 2)

Expand Down
2 changes: 1 addition & 1 deletion code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@
SEND_SIGNAL(src, COMSIG_MOVABLE_IMPACT, hit_atom, throwingdatum)
return hit_atom.hitby(src, throwingdatum=throwingdatum)

/atom/movable/hitby(atom/movable/AM, skipcatch, hitpush = TRUE, blocked, datum/thrownthing/throwingdatum)
/atom/movable/hitby(atom/movable/AM, skipcatch, hitpush = TRUE, blocked, datum/thrownthing/throwingdatum, damage_type = "blunt")
if(!anchored && hitpush && (!throwingdatum || (throwingdatum.force >= (move_resist * MOVE_FORCE_PUSH_RATIO))))
step(src, AM.dir)
..()
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/_machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@

/obj/machinery/Initialize()
if(!armor)
armor = list("melee" = 25, "bullet" = 10, "laser" = 10, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 70)
armor = list("blunt" = 25, "slash" = 25, "stab" = 25, "piercing" = 10, "fire" = 50, "acid" = 70)
. = ..()
GLOB.machines += src

Expand Down
5 changes: 0 additions & 5 deletions code/game/machinery/trams_and_elevators/industrial_lift.dm
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ GLOBAL_LIST_INIT(all_radial_directions, list(
/// A lazylist of REFs to all mobs which have a radial open currently
var/list/current_operators

/datum/armor/structure_industrial_lift
melee = 50
fire = 80
acid = 50

/obj/structure/industrial_lift/Initialize(mapload)
. = ..()
GLOB.lifts.Add(src)
Expand Down
5 changes: 3 additions & 2 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/e
var/list/blocksound //played when an item that is equipped blocks a hit

var/list/onprop = list()
var/damage_type = "blunt"
var/force_reupdate_inhand = TRUE

// Boolean sanity var for smelteries to avoid runtimes. Is this is a bar smelted through ore for exp gain?
Expand Down Expand Up @@ -825,7 +826,7 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/e

else
playsound(src, drop_sound, YEET_SOUND_VOLUME, TRUE, ignore_walls = FALSE)
return hit_atom.hitby(src, 0, itempush, throwingdatum=throwingdatum)
return hit_atom.hitby(src, 0, itempush, throwingdatum=throwingdatum, damage_type = src.damage_type)

/obj/item/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback, force)
thrownby = thrower
Expand Down Expand Up @@ -962,7 +963,7 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/e
else
. = ""

/obj/item/hitby(atom/movable/AM, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum)
/obj/item/hitby(atom/movable/AM, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum, damage_type = "blunt")
return


Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/kitchen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
flags_1 = CONDUCT_1
attack_verb = list("attacked", "stabbed", "poked")
hitsound = 'sound/blank.ogg'
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 30)
armor = list("blunt" = 0, "slash" = 0, "stab" = 0, "piercing" = 0, "fire" = 50, "acid" = 30)
var/datum/reagent/forkload //used to eat omelette

/obj/item/kitchen/fork/suicide_act(mob/living/carbon/user)
Expand Down
Loading
Loading