Fixes Arachnophobia Exploit

This commit is contained in:
Neerti
2020-08-07 00:08:00 -04:00
committed by VirgoBot
parent dd7754514c
commit ee88ceb427
3 changed files with 74 additions and 49 deletions

View File

@@ -431,4 +431,10 @@
#define EXAMINE_SKIPLEGS 0x0080 #define EXAMINE_SKIPLEGS 0x0080
#define EXAMINE_SKIPFEET 0x0100 #define EXAMINE_SKIPFEET 0x0100
#define MAX_NUTRITION 5000 //VOREStation Edit <<<<<<< HEAD
#define MAX_NUTRITION 5000 //VOREStation Edit
=======
#define MAX_NUTRITION 500
#define FAKE_INVIS_ALPHA_THRESHOLD 127 // If something's alpha var is at or below this number, certain things will pretend it is invisible.
>>>>>>> e3d2490... Fixes Arachnophobia Exploit (#7410)

View File

@@ -12,7 +12,7 @@
var/vision_range = 7 // How far the targeting system will look for things to kill. Note that values higher than 7 are 'offscreen' and might be unsporting. var/vision_range = 7 // How far the targeting system will look for things to kill. Note that values higher than 7 are 'offscreen' and might be unsporting.
var/respect_alpha = TRUE // If true, mobs with a sufficently low alpha will be treated as invisible. var/respect_alpha = TRUE // If true, mobs with a sufficently low alpha will be treated as invisible.
var/alpha_vision_threshold = 127 // Targets with an alpha less or equal to this will be considered invisible. Requires above var to be true. var/alpha_vision_threshold = FAKE_INVIS_ALPHA_THRESHOLD // Targets with an alpha less or equal to this will be considered invisible. Requires above var to be true.
var/lose_target_time = 0 // world.time when a target was lost. var/lose_target_time = 0 // world.time when a target was lost.
var/lose_target_timeout = 5 SECONDS // How long until a mob 'times out' and stops trying to find the mob that disappeared. var/lose_target_timeout = 5 SECONDS // How long until a mob 'times out' and stops trying to find the mob that disappeared.

View File

@@ -120,27 +120,32 @@
// People covered in blood is also bad. // People covered in blood is also bad.
// Feel free to trim down if its too expensive CPU wise. // Feel free to trim down if its too expensive CPU wise.
if(istype(thing, /mob/living/carbon/human)) if(isliving(thing))
var/mob/living/carbon/human/H = thing var/mob/living/L = thing
var/self_multiplier = H == holder ? 2 : 1 if(L.alpha <= FAKE_INVIS_ALPHA_THRESHOLD) // Can't fear something you can't (easily) see.
var/human_blood_fear_amount = 0 continue
if(!H.gloves && H.bloody_hands && H.hand_blood_color != SYNTH_BLOOD_COLOUR)
human_blood_fear_amount += 1
if(!H.shoes && H.feet_blood_color && H.feet_blood_color != SYNTH_BLOOD_COLOUR)
human_blood_fear_amount += 1
// List of slots. Some slots like pockets are omitted due to not being visible, if H isn't the holder. if(istype(thing, /mob/living/carbon/human))
var/list/clothing_slots = list(H.back, H.wear_mask, H.l_hand, H.r_hand, H.wear_id, H.glasses, H.gloves, H.head, H.shoes, H.belt, H.wear_suit, H.w_uniform, H.s_store, H.l_ear, H.r_ear) var/mob/living/carbon/human/H = thing
if(H == holder) var/self_multiplier = H == holder ? 2 : 1
clothing_slots += list(H.l_store, H.r_store) var/human_blood_fear_amount = 0
if(!H.gloves && H.bloody_hands && H.hand_blood_color != SYNTH_BLOOD_COLOUR)
for(var/obj/item/clothing/C in clothing_slots) human_blood_fear_amount += 1
if(C.blood_DNA && C.blood_color && C.blood_color != SYNTH_BLOOD_COLOUR) if(!H.shoes && H.feet_blood_color && H.feet_blood_color != SYNTH_BLOOD_COLOUR)
human_blood_fear_amount += 1 human_blood_fear_amount += 1
// This is divided, since humans can wear so many items at once. // List of slots. Some slots like pockets are omitted due to not being visible, if H isn't the holder.
human_blood_fear_amount = round( (human_blood_fear_amount * self_multiplier) / 3, 1) var/list/clothing_slots = list(H.back, H.wear_mask, H.l_hand, H.r_hand, H.wear_id, H.glasses, H.gloves, H.head, H.shoes, H.belt, H.wear_suit, H.w_uniform, H.s_store, H.l_ear, H.r_ear)
fear_amount += human_blood_fear_amount if(H == holder)
clothing_slots += list(H.l_store, H.r_store)
for(var/obj/item/clothing/C in clothing_slots)
if(C.blood_DNA && C.blood_color && C.blood_color != SYNTH_BLOOD_COLOUR)
human_blood_fear_amount += 1
// This is divided, since humans can wear so many items at once.
human_blood_fear_amount = round( (human_blood_fear_amount * self_multiplier) / 3, 1)
fear_amount += human_blood_fear_amount
// Bloody objects are also bad. // Bloody objects are also bad.
if(istype(thing, /obj)) if(istype(thing, /obj))
@@ -207,12 +212,18 @@
if(istype(thing, /obj/structure/snowman/spider)) //Snow spiders are also spooky so people can be assholes with those too. if(istype(thing, /obj/structure/snowman/spider)) //Snow spiders are also spooky so people can be assholes with those too.
fear_amount += 1 fear_amount += 1
if(istype(thing, /mob/living/simple_mob/animal/giant_spider)) // Actual giant spiders are the scariest of them all. if(isliving(thing))
var/mob/living/simple_mob/animal/giant_spider/S = thing var/mob/living/L = thing
if(S.stat == DEAD) // Dead giant spiders are less scary than alive ones. if(L.alpha <= FAKE_INVIS_ALPHA_THRESHOLD) // Can't fear something you can't (easily) see.
fear_amount += 4 continue
else
fear_amount += 8 if(istype(L, /mob/living/simple_mob/animal/giant_spider)) // Actual giant spiders are the scariest of them all.
var/mob/living/simple_mob/animal/giant_spider/S = L
if(S.stat == DEAD) // Dead giant spiders are less scary than alive ones.
fear_amount += 4
else
fear_amount += 8
return fear_amount return fear_amount
@@ -425,25 +436,29 @@
if(istype(thing, /obj/item/clothing/head/collectable/slime)) // Some hats are spooky so people can be assholes with them. if(istype(thing, /obj/item/clothing/head/collectable/slime)) // Some hats are spooky so people can be assholes with them.
fear_amount += 1 fear_amount += 1
if(istype(thing, /mob/living/simple_mob/slime)) // An actual predatory specimen! if(isliving(thing))
var/mob/living/simple_mob/slime/S = thing var/mob/living/L = thing
if(S.stat == DEAD) // Dead slimes are somewhat less spook. if(L.alpha <= FAKE_INVIS_ALPHA_THRESHOLD) // Can't fear something you can't (easily) see.
fear_amount += 4 continue
if(istype(S, /mob/living/simple_mob/slime/xenobio)) if(istype(L, /mob/living/simple_mob/slime)) // An actual predatory specimen!
var/mob/living/simple_mob/slime/xenobio/X = S var/mob/living/simple_mob/slime/S = L
if(X.is_adult == TRUE) //big boy if(S.stat == DEAD) // Dead slimes are somewhat less spook.
fear_amount += 8 fear_amount += 4
if(istype(S, /mob/living/simple_mob/slime/xenobio))
var/mob/living/simple_mob/slime/xenobio/X = S
if(X.is_adult == TRUE) //big boy
fear_amount += 8
else
fear_amount += 6
else else
fear_amount += 6 fear_amount += 10 // It's huge and feral.
else
fear_amount += 10 // It's huge and feral.
if(istype(thing, /mob/living/carbon/human)) if(istype(L, /mob/living/carbon/human))
var/mob/living/carbon/human/S = thing var/mob/living/carbon/human/S = L
if(istype(S.species, /datum/species/skrell)) //Skrell ARE slimey. if(istype(S.species, /datum/species/skrell)) //Skrell ARE slimey.
fear_amount += 1 fear_amount += 1
if(istype(S.species, /datum/species/shapeshifter/promethean)) if(istype(S.species, /datum/species/shapeshifter/promethean))
fear_amount += 4 fear_amount += 4
return fear_amount return fear_amount
@@ -525,13 +540,17 @@
if(istype(thing, /obj/item/weapon/gun/launcher/syringe)) if(istype(thing, /obj/item/weapon/gun/launcher/syringe))
fear_amount += 6 fear_amount += 6
if(istype(thing, /mob/living/carbon/human)) if(isliving(thing))
var/mob/living/carbon/human/H = thing var/mob/living/L = thing
if(H.l_hand && istype(H.l_hand, /obj/item/weapon/reagent_containers/syringe) || H.r_hand && istype(H.r_hand, /obj/item/weapon/reagent_containers/syringe)) if(L.alpha <= FAKE_INVIS_ALPHA_THRESHOLD) // Can't fear something you can't (easily) see.
fear_amount += 10 continue
if(istype(L, /mob/living/carbon/human))
var/mob/living/carbon/human/H = L
if(H.l_hand && istype(H.l_hand, /obj/item/weapon/reagent_containers/syringe) || H.r_hand && istype(H.r_hand, /obj/item/weapon/reagent_containers/syringe))
fear_amount += 10
if(H.l_ear && istype(H.l_ear, /obj/item/weapon/reagent_containers/syringe) || H.r_ear && istype(H.r_ear, /obj/item/weapon/reagent_containers/syringe)) if(H.l_ear && istype(H.l_ear, /obj/item/weapon/reagent_containers/syringe) || H.r_ear && istype(H.r_ear, /obj/item/weapon/reagent_containers/syringe))
fear_amount +=10 fear_amount +=10
return fear_amount return fear_amount