priority
This commit is contained in:
@@ -243,3 +243,11 @@ GLOBAL_LIST_INIT(shove_disarming_types, typecacheof(list(
|
||||
|
||||
/// Default if the above isn't set in the list.
|
||||
#define DEFAULT_REDIRECT_METHOD_PROJECTILE REDIRECT_METHOD_REFLECT
|
||||
|
||||
/// Block priorities
|
||||
#define BLOCK_PRIORITY_HELD_ITEM 100
|
||||
#define BLOCK_PRIORITY_CLOTHING 50
|
||||
#define BLOCK_PRIORITY_WEAR_SUIT 75
|
||||
#define BLOCK_PRIORITY_UNIFORM 25
|
||||
|
||||
#define BLOCK_PRIORITY_DEFAULT BLOCK_PRIORITY_HELD_ITEM
|
||||
|
||||
@@ -116,4 +116,7 @@ GLOBAL_VAR_INIT(cmp_field, "name")
|
||||
if(a_sign != b_sign)
|
||||
return a_sign - b_sign
|
||||
else
|
||||
return sorttext(b_name, a_name)
|
||||
return sorttext(b_name, a_name)
|
||||
|
||||
/proc/cmp_item_block_priority_asc(obj/item/A, obj/item/B)
|
||||
return A.block_priority - B.block_priority
|
||||
|
||||
@@ -807,7 +807,7 @@
|
||||
starting_sword = /obj/item/melee/rapier
|
||||
|
||||
/obj/item/storage/belt/sabre/rapier/run_block(mob/living/owner, real_attack, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance, list/block_return)
|
||||
if(attack_type & PROJECTILE_ATTACK) // No blocking bullets.
|
||||
if(attack_type & ATTACK_TYPE_PROJECTILE) // No blocking bullets.
|
||||
return BLOCK_NONE
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
resistance_flags = FLAMMABLE
|
||||
max_integrity = 200
|
||||
integrity_failure = 0.4
|
||||
block_priority = BLOCK_PRIORITY_CLOTHING
|
||||
var/damaged_clothes = 0 //similar to machine's BROKEN stat and structure's broken var
|
||||
var/flash_protect = 0 //What level of bright light protection item has. 1 = Flashers, Flashes, & Flashbangs | 2 = Welding | -1 = OH GOD WELDING BURNT OUT MY RETINAS
|
||||
var/tint = 0 //Sets the item's level of visual impairment tint, normally set to the same as flash_protect
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/obj/item/clothing/suit
|
||||
icon = 'icons/obj/clothing/suits.dmi'
|
||||
name = "suit"
|
||||
block_priority = BLOCK_PRIORITY_WEAR_SUIT
|
||||
var/fire_resist = T0C+100
|
||||
allowed = list(/obj/item/tank/internals/emergency_oxygen, /obj/item/tank/internals/plasmaman)
|
||||
armor = list("melee" = 0, "bullet" = 0, "laser" = 0,"energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 0)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
name = "under"
|
||||
body_parts_covered = CHEST|GROIN|LEGS|ARMS
|
||||
permeability_coefficient = 0.9
|
||||
block_priority = BLOCK_PRIORITY_UNIFORM
|
||||
slot_flags = ITEM_SLOT_ICLOTHING
|
||||
armor = list("melee" = 0, "bullet" = 0, "laser" = 0,"energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 0)
|
||||
var/fitted = FEMALE_UNIFORM_FULL // For use in alternate clothing styles for women
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/mob/living/carbon/human/get_blocking_items()
|
||||
. = ..()
|
||||
if(wear_suit)
|
||||
. += wear_suit)
|
||||
. += wear_suit
|
||||
if(w_uniform)
|
||||
. += w_uniform
|
||||
if(wear_neck)
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
if((. & BLOCK_SUCCESS) && !(. & BLOCK_CONTINUE_CHAIN))
|
||||
return
|
||||
var/list/obj/item/tocheck = get_blocking_items()
|
||||
sortTim(tocheck, /proc/cmp_item_block_priority_asc)
|
||||
// i don't like this
|
||||
var/block_chance_modifier = round(damage / -3)
|
||||
for(var/obj/item/I in tocheck)
|
||||
@@ -72,6 +73,8 @@
|
||||
/obj/item
|
||||
/// The 0% to 100% chance for the default implementation of random block rolls.
|
||||
var/block_chance = 0
|
||||
/// Block priority, higher means we check this higher in the "chain".
|
||||
var/block_priority = BLOCK_PRIORITY_DEFAULT
|
||||
|
||||
/obj/item/proc/run_block(mob/living/owner, real_attack, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance, list/block_return)
|
||||
SEND_SIGNAL(src, COMSIG_ITEM_RUN_BLOCK, args)
|
||||
|
||||
Reference in New Issue
Block a user