Massive changes.

- Changes how it mitigates damage.
- It now only affects external attacks (punches, mobs, items, guns, etc.)
- Now is PRE armor mitigation! https://i.imgur.com/CXx82J5.png
- Adds variants. Allows mobs to use the new variants, but not the pack itself.
- Adds an extended description and fluff text.
- Adds ability to have both min&max for each variable.

I still need to make them have specialized recharging batteries (especially for the belt unit), but currently the normal recharging batteries are fine.
This commit is contained in:
C.L
2022-09-11 04:24:26 -04:00
parent e4bb0438d0
commit 937026bd90
7 changed files with 372 additions and 62 deletions
+39
View File
@@ -64,11 +64,50 @@
var/siemens_coefficient = null // Similar to above two vars but 0 = full protection, to be consistant with siemens numbers everywhere else.
var/vision_flags // Vision flags to add to the mob. SEE_MOB, SEE_OBJ, etc.
// ENERGY CODE. Variables to allow for energy based modifiers.
var/energy_based // Sees if the modifier is based on something electronic based.
var/energy_cost // How much the modifier uses per action/special effect blocked. For base values.
var/energy_modifier // How much energy is used when numbers are involed. For values, such as taking damage. Ex: (Damage*energy_modifier)
var/obj/item/weapon/cell/energy_source = null // The source of the above.
// RESISTANCES CODE. Variable to enable external damage resistance modifiers. This is not unlike armor.
// 0 = immune || < 0 = heals || 1 = full damage || >1 = increased damage.
// It should never be below zero as it is not intended to do such, but you are free to experiment!
// Ex: Max_brute_resistance = 0. Min_brute resistance = 1. When started, provides 100% resistance to brute. When cell is dying, goes down to 0% resistance.
// Max is the MAXIMUM % multiplier that will be taken at a low charge. Min is the MINIMUM % multiplier that will be taken at a full charge.
// Think of it like this: Minimum = what happens at minimum charge. Max = what happens at maximum charge.
// Why do I mention this so much? Because even /I/ got confused, and I wrote this thing!
var/min_damage_resistance
var/max_damage_resistance
var/effective_damage_resistance
var/min_brute_resistance
var/max_brute_resistance
var/effective_brute_resistance
var/min_fire_resistance
var/max_fire_resistance
var/effective_fire_resistance
var/min_tox_resistance
var/max_tox_resistance
var/effective_tox_resistance
var/min_oxy_resistance
var/max_oxy_resistance
var/effective_oxy_resistance
var/min_clone_resistance
var/max_clone_resistance
var/effective_clone_resistance
var/min_hal_resistance
var/max_hal_resistance
var/effective_hal_resistance
// Resistances end
/datum/modifier/New(var/new_holder, var/new_origin)
holder = new_holder
if(new_origin)
+148 -14
View File
@@ -46,27 +46,51 @@
on_created_text = "<span class='notice'>Your shield generator buzzes on.</span>"
on_expired_text = "<span class='warning'>Your shield generator buzzes off.</span>"
mob_overlay_state = "repel_missiles" //Looks alright, I guess. Placeholder.
mob_overlay_state = "repel_missiles" //Looks actually pretty good. Could use a better sprite, but that'll work!
stacks = MODIFIER_STACK_FORBID //No stacking shields. If you put one one your belt and backpack it won't work.
siemens_coefficient = 2 //Stun weapons drain 100% charge per damage. They're good at blocking lasers and bullets but not good at blocking stun beams!
incoming_brute_damage_percent = 0
incoming_fire_damage_percent = 0
incoming_hal_damage_percent = 0
siemens_coefficient = 2 //Stun weapons drain 100% charge per point of damage. They're good at blocking lasers and bullets but not good at blocking stun beams!
energy_based = 1
energy_cost = 99999 //This is changed to the shield_genertor's energy_cost.
energy_cost = 99999 //This is changed to the shield_generator's energy_cost.
energy_modifier = 50 //This is how much battery is used per damage unit absorbed. Higher damage means higher charge use per damage absorbed. Changed below!
//Not actually in use until effective resistances are set. Just here so it doesn't have to be placed down for all the variants. Less lines.
max_damage_resistance = 1
max_brute_resistance = 1
max_fire_resistance = 1
max_tox_resistance = 1
max_oxy_resistance = 1
max_clone_resistance = 1
max_hal_resistance = 1
min_damage_resistance = 1
min_brute_resistance = 1
min_fire_resistance = 1
min_tox_resistance = 1
min_oxy_resistance = 1
min_clone_resistance = 1
min_hal_resistance = 1
/* // These are not set, but left here as an example. All three (min,max,effective) must be set or BAD THINGS will happen.
min_brute_resistance = 1 // Min = WHAT HAPPENS AT MINIMUM CHARGE
max_brute_resistance = 0 // MAX = WHAT HAPPENS AT MAXIMUM CHARGE
effective_brute_resistance = 1 //Just tells the game that it has vars. Done to use less checks.
min_fire_resistance = 1
max_fire_resistance = 0
effective_fire_resistance = 1
disable_duration_percent = 1 //THIS CAN ALSO BE USED! Don't be too afraid to use this one, but use it sparingly!
*/
var/obj/item/device/personal_shield_generator/shield_generator //This is the shield generator you're wearing!
/datum/modifier/shield_projection/on_applied()
/datum/modifier/shield_projection/on_applied() //Don't need to modify this!
return
/datum/modifier/shield_projection/on_expire()
/datum/modifier/shield_projection/on_expire() //Don't need to modify this!
return
/datum/modifier/shield_projection/check_if_valid() //Let's check to make sure you got the stuff and set the vars.
if(ishuman(holder)) //Only humans can use this!
/datum/modifier/shield_projection/check_if_valid() //Let's check to make sure you got the stuff and set the vars. Don't need to modify this for any subtypes!
if(ishuman(holder)) //Only humans can use this! Other things later down the line might use the same stuff this does, but the shield generator is human only!
var/mob/living/carbon/human/H = holder
if(istype(H.get_equipped_item(slot_back), /obj/item/device/personal_shield_generator))
shield_generator = H.get_equipped_item(slot_back) //Sets the var on the modifier that the shield gen is their back shield gen.
@@ -93,7 +117,117 @@
expire(silent = TRUE) //If you're dead the generator stops protecting you but keeps running.
if(!shield_generator || !shield_generator.slot_check()) //No shield to begin with/shield is not on them any longer.
expire(silent = FALSE)
var/shield_efficiency = 1-(energy_source.charge/energy_source.maxcharge) //0 = complete resistance. 1 = no resistance.
incoming_brute_damage_percent = shield_efficiency //Less charge means less resistance!
incoming_fire_damage_percent = shield_efficiency
incoming_hal_damage_percent = shield_efficiency
var/shield_efficiency = (energy_source.charge/energy_source.maxcharge) //1 = complete resistance. 0 = no resistance. Must be adjusted for subtypes!
if(!isnull(effective_damage_resistance))
effective_damage_resistance = min_damage_resistance + (max_damage_resistance - min_damage_resistance) * shield_efficiency
if(!isnull(effective_brute_resistance))
effective_brute_resistance = min_brute_resistance + (max_brute_resistance - min_brute_resistance) * shield_efficiency
if(!isnull(effective_fire_resistance))
effective_fire_resistance = min_fire_resistance + (max_fire_resistance - min_fire_resistance) * shield_efficiency
if(!isnull(effective_tox_resistance))
effective_tox_resistance = min_tox_resistance + (max_tox_resistance - min_tox_resistance) * shield_efficiency
if(!isnull(effective_oxy_resistance))
effective_oxy_resistance = min_oxy_resistance + (max_oxy_resistance - min_oxy_resistance) * shield_efficiency
if(!isnull(effective_clone_resistance))
effective_clone_resistance = min_clone_resistance + (max_clone_resistance - min_clone_resistance) * shield_efficiency
if(!isnull(effective_hal_resistance))
effective_hal_resistance = min_hal_resistance + (max_hal_resistance - min_hal_resistance) * shield_efficiency
//Shield variants.
//Simple. Goes from 100% resistance to 0% resistance depending on charge.
/datum/modifier/shield_projection/bruteburn
max_brute_resistance = 0
effective_brute_resistance = 1
max_fire_resistance = 0
effective_fire_resistance = 1
/datum/modifier/shield_projection/bruteburn/weak
max_brute_resistance = 0.5
max_fire_resistance = 0.5
/datum/modifier/shield_projection/security // Security backpack.
max_brute_resistance = 0.5
effective_brute_resistance = 1
max_fire_resistance = 0.5
effective_fire_resistance = 1
max_hal_resistance = 0.5
effective_hal_resistance = 1
/datum/modifier/shield_projection/security/weak // Security belt.
max_brute_resistance = 0.75
max_fire_resistance = 0.75
max_hal_resistance = 0.75
/datum/modifier/shield_projection/security/strong // Dunno. Upgraded variant of security backpack?
max_brute_resistance = 0.25
max_fire_resistance = 0.25
max_hal_resistance = 0.25
siemens_coefficient = 1.5 //Not as weak as normal, but still weak.
/datum/modifier/shield_projection/mining //Base mining belt. 25% resistance.
max_brute_resistance = 0.75
effective_brute_resistance = 1
max_fire_resistance = 0.75
effective_fire_resistance = 1
max_hal_resistance = 1.5 // No mobs should be shooting you with halloss. If this happens, it means you're using it wrong!!!
min_hal_resistance = 1.5
effective_hal_resistance = 1
disable_duration_percent = 0.75 //Miners often come into contact with things that can stun them.
/datum/modifier/shield_projection/mining/strong // Mining belt, but upgraded. Even weaker to halloss! Tasers WILL destroy you. Don't try to be superman.
max_brute_resistance = 0.5
max_fire_resistance = 0.5
disable_duration_percent = 0.5
max_hal_resistance = 2
min_hal_resistance = 2
/datum/modifier/shield_projection/admin // Adminbus.
on_created_text = "<span class='notice'>Your shield generator activates and you feel the power of the tesla buzzing around you.</span>"
on_expired_text = "<span class='warning'>Your shield generator deactivates, leaving you feeling weak and vulnerable.</span>"
siemens_coefficient = 0
disable_duration_percent = 0
min_damage_resistance = 0
max_damage_resistance = 0
effective_damage_resistance = 0
min_brute_resistance = 0
max_brute_resistance = 0
effective_brute_resistance = 0
min_fire_resistance = 0
max_fire_resistance = 0
effective_fire_resistance = 0
min_tox_resistance = 0
max_tox_resistance = 0
effective_tox_resistance = 0
min_oxy_resistance = 0
max_oxy_resistance = 0
effective_oxy_resistance = 0
min_clone_resistance = 0
max_clone_resistance = 0
effective_clone_resistance = 0
min_hal_resistance = 0
max_hal_resistance = 0
effective_hal_resistance = 0
/datum/modifier/shield_projection/broken //For broken variants. Good if possible randomization is included for packs spawned on PoIs.
max_brute_resistance = 2
min_brute_resistance = 2
effective_brute_resistance = 1
max_fire_resistance = 2
min_fire_resistance = 2
effective_fire_resistance = 1