Merge pull request #8195 from mwerezak/rigfix

Fixes a suit breach issue and hardsuit emp handling
This commit is contained in:
Chinsky
2015-02-23 16:52:07 +03:00
4 changed files with 23 additions and 14 deletions

View File

@@ -3,7 +3,7 @@
//They can be healed with plastic or metal sheeting.
/datum/breach
var/class = 0 // Size. Lower is smaller.
var/class = 0 // Size. Lower is smaller. Uses floating point values!
var/descriptor // 'gaping hole' etc.
var/damtype = BURN // Punctured or melted
var/obj/item/clothing/suit/space/holder // Suit containing the list of breaches holding this instance.
@@ -12,8 +12,8 @@
var/can_breach = 1 // Set to 0 to disregard all breaching.
var/list/breaches = list() // Breach datum container.
var/resilience = 0.2 // Multiplier that turns damage into breach class. 1 is 100% of damage to breach, 0.1 is 10%.
var/breach_threshold = 3 // Min damage before a breach is possible.
var/resilience = 0.2 // Multiplier that turns damage into breach class. 1 is 100% of damage to breach, 0.1 is 10%. 0.2 -> 50 brute/burn damage to cause 10 breach damage
var/breach_threshold = 3 // Min damage before a breach is possible. Damage is subtracted by this amount, it determines the "hardness" of the suit.
var/damage = 0 // Current total damage
var/brute_damage = 0 // Specifically brute damage.
var/burn_damage = 0 // Specifically burn damage.
@@ -44,7 +44,7 @@ var/global/list/breach_burn_descriptors = list(
/datum/breach/proc/update_descriptor()
//Sanity...
class = max(1,min(class,5))
class = between(1, round(class), 5)
//Apply the correct descriptor.
if(damtype == BURN)
descriptor = breach_burn_descriptors[class]
@@ -86,7 +86,10 @@ var/global/list/breach_burn_descriptors = list(
/obj/item/clothing/suit/space/proc/create_breaches(var/damtype, var/amount)
if(!can_breach || !amount)
amount -= src.breach_threshold
amount *= src.resilience
if(!can_breach || amount <= 0)
return
if(!breaches)
@@ -98,14 +101,14 @@ var/global/list/breach_burn_descriptors = list(
var/turf/T = get_turf(src)
if(!T) return
amount = amount * src.resilience
//Increase existing breaches.
for(var/datum/breach/existing in breaches)
if(existing.damtype != damtype)
continue
//keep in mind that 10 breach damage == full pressure loss.
//a breach can have at most 5 breach damage
if (existing.class < 5)
var/needs = 5 - existing.class
if(amount < needs)

View File

@@ -686,11 +686,12 @@
/obj/item/weapon/rig/proc/malfunction()
return 0
/obj/item/weapon/rig/emp_act(severity)
malfunctioning += severity*10
/obj/item/weapon/rig/emp_act(severity_class)
//class 1 severity is the most severe, not least.
malfunctioning += round(30/severity_class)
if(malfunction_delay <= 0)
malfunction_delay = 20
take_hit(severity*10,"electrical pulse")
take_hit(round(30/severity_class),"electrical pulse")
/obj/item/weapon/rig/proc/shock(mob/user)
if (electrocute_mob(user, cell, src))
@@ -699,12 +700,14 @@
return 0
/obj/item/weapon/rig/proc/take_hit(damage,source)
if(!installed_modules.len)
return
if(!prob(max(0,(damage-(chest ? chest.breach_threshold : 0)))))
return
//given that module damage is spread out across all modules, even this is probably not enough for emp to affect rigs much.
if(source != "electrical pulse")
var/protection = chest? chest.breach_threshold : 0
if(!prob(max(0, damage - protection)))
return
var/list/valid_modules = list()
for(var/obj/item/rig_module/module in installed_modules)

View File

@@ -38,7 +38,9 @@
flags_inv = HIDEJUMPSUIT|HIDETAIL
flags = STOPSPRESSUREDMAGE | THICKMATERIAL | AIRTIGHT
slowdown = 0
breach_threshold = 35
//With 0.2 resiliance, will reach 10 breach damage after 9 laser carbine blasts. Completely immune to smg hits.
breach_threshold = 28
resilience = 0.1
can_breach = 1
supporting_limbs = list()

View File

@@ -48,6 +48,7 @@
)
//Breach thresholds, should ideally be inherited by most (if not all) voidsuits.
//With 0.2 resiliance, will reach 10 breach damage after 3 laser carbine blasts or 8 smg hits.
breach_threshold = 18
can_breach = 1