Implements Maim / Maiming projectiles. (#3750)

This commit is contained in:
chaoko99
2017-11-25 16:24:16 -08:00
committed by Lohikar
parent 13af7990ee
commit adf21c24e8
9 changed files with 125 additions and 35 deletions

View File

@@ -66,6 +66,8 @@
#define ismanipulator(A) istype(A, /obj/item/weapon/stock_parts/manipulator)
#define isprojectile(A) istype(A, /obj/item/projectile)
#define to_chat(target, message) target << message
#define to_world(message) world << message
#define sound_to(target, sound) target << sound

View File

@@ -63,6 +63,8 @@
var/list/genetic_markings // Markings (body_markings) to apply to the icon
var/list/temporary_markings // Same as above, but not preserved when cloning
var/list/cached_markings // The two above lists cached for perf. reasons.
var/maim_bonus = 0.75 //For special projectile gibbing calculation, dubbed "maiming"
var/can_be_maimed = TRUE //Can this limb be 'maimed'?
/obj/item/organ/external/proc/invalidate_marking_cache()
cached_markings = null
@@ -301,22 +303,31 @@
//Check edge eligibility
var/edge_eligible = 0
var/gibs_traditionally = TRUE
if(edge)
if(istype(used_weapon,/obj/item))
var/obj/item/W = used_weapon
if(W.w_class >= w_class)
edge_eligible = 1
if(isprojectile(W)) //Maiming projectiles use a different method to calcualate gibbing.
var/obj/item/projectile/P = used_weapon
if(P.maiming)
gibs_traditionally = FALSE
else
if(W.w_class >= w_class)
edge_eligible = 1
else
edge_eligible = 1
if(edge_eligible && brute >= max_damage / DROPLIMB_THRESHOLD_EDGE && prob(brute))
droplimb(0, DROPLIMB_EDGE)
else if(burn >= max_damage / DROPLIMB_THRESHOLD_DESTROY && prob(burn/3))
droplimb(0, DROPLIMB_BURN)
else if(brute >= max_damage / DROPLIMB_THRESHOLD_DESTROY && prob(brute))
droplimb(0, DROPLIMB_BLUNT)
else if(brute >= max_damage / DROPLIMB_THRESHOLD_TEAROFF && prob(brute/3))
droplimb(0, DROPLIMB_EDGE)
if(gibs_traditionally)
if(edge_eligible && brute >= max_damage / DROPLIMB_THRESHOLD_EDGE && prob(brute))
droplimb(0, DROPLIMB_EDGE)
else if(burn >= max_damage / DROPLIMB_THRESHOLD_DESTROY && prob(burn/3))
droplimb(0, DROPLIMB_BURN)
else if(brute >= max_damage / DROPLIMB_THRESHOLD_DESTROY && prob(brute))
droplimb(0, DROPLIMB_BLUNT)
else if(brute >= max_damage / DROPLIMB_THRESHOLD_TEAROFF && prob(brute/3))
droplimb(0, DROPLIMB_EDGE)
return update_icon()

View File

@@ -2,6 +2,7 @@
name = "limb stump"
icon_name = ""
dislocated = -1
can_be_maimed = FALSE
/obj/item/organ/external/stump/Initialize(mapload, var/internal, var/obj/item/organ/external/limb)
if(istype(limb))

View File

@@ -18,6 +18,7 @@
cannot_amputate = 1
parent_organ = null
encased = "ribcage"
can_be_maimed = FALSE
/obj/item/organ/external/groin
name = "lower body"
@@ -33,6 +34,7 @@
joint = "hip"
dislocated = -1
gendered_icon = 1
maim_bonus = 0.25
/obj/item/organ/external/arm
limb_name = "l_arm"
@@ -91,6 +93,7 @@
joint = "left ankle"
amputation_point = "left ankle"
can_stand = 1
maim_bonus = 1
/obj/item/organ/external/foot/removed()
if(owner) owner.drop_from_inventory(owner.shoes)
@@ -118,6 +121,7 @@
joint = "left wrist"
amputation_point = "left wrist"
can_grasp = 1
maim_bonus = 1
/obj/item/organ/external/hand/removed()
owner.drop_from_inventory(owner.gloves)
@@ -147,6 +151,7 @@
gendered_icon = 1
encased = "skull"
var/can_intake_reagents = 1
maim_bonus = 0.33
/obj/item/organ/external/head/removed()
if(owner)

View File

@@ -6,39 +6,49 @@
/obj/item/organ/external/groin/unbreakable
cannot_break = 1
dislocated = -1
can_be_maimed = FALSE
/obj/item/organ/external/arm/unbreakable
cannot_break = 1
dislocated = -1
can_be_maimed = FALSE
/obj/item/organ/external/arm/right/unbreakable
cannot_break = 1
dislocated = -1
can_be_maimed = FALSE
/obj/item/organ/external/leg/unbreakable
cannot_break = 1
dislocated = -1
can_be_maimed = FALSE
/obj/item/organ/external/leg/right/unbreakable
cannot_break = 1
dislocated = -1
can_be_maimed = FALSE
/obj/item/organ/external/foot/unbreakable
cannot_break = 1
dislocated = -1
can_be_maimed = FALSE
/obj/item/organ/external/foot/right/unbreakable
cannot_break = 1
dislocated = -1
can_be_maimed = FALSE
/obj/item/organ/external/hand/unbreakable
cannot_break = 1
dislocated = -1
can_be_maimed = FALSE
/obj/item/organ/external/hand/right/unbreakable
cannot_break = 1
dislocated = -1
can_be_maimed = FALSE
/obj/item/organ/external/head/unbreakable
cannot_break = 1
dislocated = -1
can_be_maimed = FALSE

View File

@@ -320,12 +320,9 @@
muzzle_type = /obj/effect/projectile/trilaser/muzzle
tracer_type = /obj/effect/projectile/trilaser/tracer
impact_type = /obj/effect/projectile/trilaser/impact
maiming = 1
maim_rate = 3
/obj/item/projectile/beam/plasmacutter/on_impact(var/atom/A)
strike_thing(A)
. = ..()
/obj/item/projectile/beam/plasmacutter/proc/strike_thing(var/atom/A)
if(istype(A, /turf/simulated/mineral))
var/turf/simulated/mineral/M = A
if(prob(33))
@@ -334,14 +331,4 @@
else if(prob(88))
M.emitter_blasts_taken += 2
M.emitter_blasts_taken += 1
else if(istype(A, /mob/living))
var/mob/living/L = A
L.apply_damage(damage, BRUTE, def_zone)
if(istype(A, /mob/living/carbon/human))
var/mob/living/carbon/human/H = L
var/ultimate_def_zone = check_zone(def_zone)
if(H.has_organ(ultimate_def_zone))
var/obj/item/organ/external/E = H.get_organ(ultimate_def_zone)
if(E.damage > 15 && prob((3*E.damage)))
E.droplimb(0,DROPLIMB_EDGE)
. = ..()

View File

@@ -63,6 +63,17 @@
var/hitscan = 0 // whether the projectile should be hitscan
var/step_delay = 1 // the delay between iterations if not a hitscan projectile
//For Maim / Maiming.
var/maiming = 0 //Enables special limb dismemberment calculation; used primarily for ranged weapons that can maim, but do not do brute damage.
var/maim_rate = 0 //Factor that the recipiant will be maimed by the projectile (NOT OUT OF 100%.)
var/clean_cut = 0 //Is the delimbning painful and unclean? Probably. Can be a function or proc, if you're doing something odd.
var/maim_type = DROPLIMB_EDGE
/*Does the projectile simply lop/tear the limb off, or does it vaporize it?
Set maim_type to DROPLIMB_EDGE to chop off the limb
set maim_type to DROPLIMB_BURN to vaporize it.
set maim_type to DROPLIMB_BLUNT to gib (Explode/Hamburger) the limb.
*/
// effect types to be used
var/muzzle_type
var/tracer_type
@@ -75,24 +86,37 @@
//TODO: make it so this is called more reliably, instead of sometimes by bullet_act() and sometimes not
/obj/item/projectile/proc/on_hit(var/atom/target, var/blocked = 0, var/def_zone = null)
if(blocked >= 100) return 0//Full block
if(!isliving(target)) return 0
if(isanimal(target)) return 0
if(blocked >= 100)
return 0//Full block
if(!isliving(target))
return 0
if(isanimal(target))
return 0
var/mob/living/L = target
if (agony && ishuman(target))
if (ishuman(target))
var/mob/living/carbon/human/H = target
var/obj/item/organ/external/organ = H.get_organ(def_zone)
var/armor = H.getarmor_organ(organ, check_armour)
agony = max(0, agony - armor)
if(agony)
agony = max(0, agony - armor)
L.apply_effects(stun, weaken, paralyze, 0, stutter, eyeblur, drowsy, agony, incinerate, blocked) // add in AGONY!
//radiation protection is handled separately from other armour types.
L.apply_effect(irradiate, IRRADIATE, L.getarmor(null, "rad"))
/*
Maim / Maiming check. Disembody a limb depending on several factors.
can_be_maimed and maim_bonus are defined on 'obj/item/organ/external'.
*/
if(organ.can_be_maimed && maiming)
if(prob(maim_rate * (organ.get_damage() * organ.maim_bonus)))
organ.droplimb(clean_cut,maim_type)
L.apply_effects(stun, weaken, paralyze, 0, stutter, eyeblur, drowsy, agony, incinerate, blocked)
L.apply_effect(irradiate, IRRADIATE, L.getarmor(null, "rad")) //radiation protection is handled separately from other armour types.
return 1
//called when the projectile stops flying because it collided with something
/obj/item/projectile/proc/on_impact(var/atom/A)
impact_effect(effect_transform) // generate impact effect
impact_effect(effect_transform) // generate an impact effect
return
//Checks if the projectile is eligible for embedding. Not that it necessarily will.

View File

@@ -135,6 +135,9 @@
/obj/item/projectile/bullet/pistol/strong //revolvers and matebas
damage = 60
maiming = 1
maim_rate = 25
maim_type = DROPLIMB_BLUNT
/obj/item/projectile/bullet/pistol/rubber //"rubber" bullets
name = "rubber bullet"
@@ -149,6 +152,8 @@
/obj/item/projectile/bullet/shotgun
name = "slug"
damage = 60
maiming = 1 //To prevent rando headgibbing, it uses the special headgib damage model. Don't get me wrong, it'll still kill the man, but could be cloned.
maim_rate = 25
/obj/item/projectile/bullet/shotgun/beanbag //because beanbags are not bullets
name = "beanbag"
@@ -175,6 +180,9 @@
pellets = 6
range_step = 1
spread_step = 10
maiming = 1
maim_rate = 1 //6% base chance of gib if all pellets hit. Likely to blow limbs at point blank. (As it should be.)
maim_type = DROPLIMB_BLUNT
/* "Rifle" rounds */
@@ -199,6 +207,9 @@
penetrating = 5
armor_penetration = 80
hitscan = 1 //so the PTR isn't useless as a sniper weapon
maiming = 1
maim_rate = 60
maim_type = DROPLIMB_BLUNT
/obj/item/projectile/bullet/rifle/vintage
name = "vintage bullet"

View File

@@ -0,0 +1,39 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
# balance
#################################
# Your name.
author: Chaoko99
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- rscadd: "Added SUPER MAIM: A unified system for dice-roll gibbing per limb, rather than a flat chance without respect to body part."
- bugfix: "Fixed the plasma cutter's inability to dismember."
- experiment: "Changed the following weapons and their ammo to use SUPER MAIM: Desert Eagle (.50), Anti-Material Sniper Rifle (a145), Mateba (.357), Plasma Cutter. Buckshot."