Merge pull request #914 from ArchieBeepBoop/hatfix

To the town of agua fria rode a stranger one fine day (Fixes hat throwing)
This commit is contained in:
QuoteFox
2021-01-21 14:20:12 +00:00
committed by GitHub
7 changed files with 37 additions and 3 deletions
+1 -1
View File
@@ -145,7 +145,7 @@ GLOBAL_LIST_INIT(bitfields, list(
"VOICEBOX_TOGGLABLE" = VOICEBOX_TOGGLABLE,
"VOICEBOX_DISABLED" = VOICEBOX_DISABLED,
"IGNORE_HAT_TOSS" = IGNORE_HAT_TOSS,
"SCAN_REAGENTS" = SCAN_REAGENTS
"SCAN_REAGENTS" = SCAN_REAGENTS,
),
"tesla_flags" = list(
"TESLA_MOB_DAMAGE" = TESLA_MOB_DAMAGE,
+1
View File
@@ -43,6 +43,7 @@ SUBSYSTEM_DEF(throwing)
var/atom/movable/thrownthing
var/atom/target
var/turf/target_turf
var/target_zone
var/init_dir
var/maxrange
var/speed
+2
View File
@@ -627,6 +627,8 @@
TT.diagonals_first = diagonals_first
TT.force = force
TT.callback = callback
if(!QDELETED(thrower))
TT.target_zone = thrower.zone_selected
var/dist_x = abs(target.x - src.x)
var/dist_y = abs(target.y - src.y)
+31
View File
@@ -40,6 +40,37 @@
muzzle_var = NORMAL_STYLE
H.update_inv_head()
///Special throw_impact for hats to frisbee hats at people to place them on their heads.
/obj/item/clothing/head/throw_impact(atom/hit_atom, datum/thrownthing/thrownthing)
. = ..()
///if the thrown object's target zone isn't the head
if(thrownthing.target_zone != BODY_ZONE_HEAD)
return
///ignore any hats with downsides when worn
if(clothing_flags & IGNORE_HAT_TOSS)
return
///if the hat happens to be capable of holding contents and has something in it. mostly to prevent super cheesy stuff like stuffing a mini-bomb in a hat and throwing it
if(LAZYLEN(contents))
return
if(iscarbon(hit_atom))
var/mob/living/carbon/H = hit_atom
if(istype(H.head, /obj/item))
var/obj/item/WH = H.head
H.visible_message("<span class='warning'>[src] bounces off [H]'s [WH.name]!", "<span class='warning'>[src] bounces off your [WH.name], falling to the floor.</span>")
return
if(H.equip_to_slot_if_possible(src, SLOT_HEAD, FALSE, TRUE))
H.visible_message("<span class='notice'>[src] lands neatly on [H]'s head!", "<span class='notice'>[src] lands perfectly onto your head!</span>")
return
if(iscyborg(hit_atom))
var/mob/living/silicon/robot/R = hit_atom
///hats in the borg's blacklist bounce off
if(!is_type_in_typecache(src, R.equippable_hats) || R.hat_offset == INFINITY)
R.visible_message("<span class='warning'>[src] bounces off [R]!", "<span class='warning'>[src] bounces off you, falling to the floor.</span>")
return
else
R.visible_message("<span class='notice'>[src] lands neatly on top of [R].", "<span class='notice'>[src] lands perfectly on top of you.</span>")
R.place_on_head(src) //hats aren't designed to snugly fit borg heads or w/e so they'll always manage to knock eachother off
/obj/item/clothing/head/worn_overlays(isinhands = FALSE)
. = list()
+1 -1
View File
@@ -158,4 +158,4 @@
/obj/item/clothing/head/hardhat/weldhat/dblue
icon_state = "hardhat0_dblue"
item_state = "hardhat0_dblue"
item_color = "dblue"
item_color = "dblue"
-1
View File
@@ -13,7 +13,6 @@
resistance_flags = NONE
flags_cover = HEADCOVERSEYES
flags_inv = HIDEHAIR
dog_fashion = /datum/dog_fashion/head/helmet
/obj/item/clothing/head/helmet/ComponentInitialize()
@@ -238,6 +238,7 @@
armor = list("melee" = 0, "bullet" = 0, "laser" = -5,"energy" = 0, "bomb" = 0, "bio" = 0, "rad" = -5, "fire" = 0, "acid" = 0)
equip_delay_other = 140
var/datum/brain_trauma/mild/phobia/paranoia
clothing_flags = IGNORE_HAT_TOSS
/obj/item/clothing/head/foilhat/equipped(mob/living/carbon/human/user, slot)
..()