Merge pull request #4865 from Atermonera/umbrella

Adds umbrellas
This commit is contained in:
Anewbe
2018-02-21 23:06:44 -06:00
committed by GitHub
6 changed files with 105 additions and 0 deletions

View File

@@ -14,3 +14,34 @@
var/datum/gender/T = gender_datums[user.get_visible_gender()]
user.visible_message(span("danger", "\The [user] [T.is] strangling [T.himself] with \the [src]! It looks like [T.he] [T.is] trying to commit suicide."), span("danger", "You start to strangle yourself with \the [src]!"), span("danger", "You hear the sound of someone choking!"))
return (OXYLOSS)
/obj/item/weapon/melee/umbrella
name = "umbrella"
desc = "To keep the rain off you. Use with caution on windy days."
icon = 'icons/obj/items.dmi'
icon_state = "umbrella_closed"
flags = CONDUCT
slot_flags = SLOT_BELT
force = 5
throwforce = 5
w_class = ITEMSIZE_NORMAL
var/open = FALSE
/obj/item/weapon/melee/umbrella/New()
..()
color = "#"+get_random_colour()
update_icon()
/obj/item/weapon/melee/umbrella/attack_self()
src.toggle_umbrella()
/obj/item/weapon/melee/umbrella/proc/toggle_umbrella()
open = !open
icon_state = "umbrella_[open ? "open" : "closed"]"
item_state = icon_state
update_icon()
if(ishuman(src.loc))
var/mob/living/carbon/human/H = src.loc
H.update_inv_l_hand(0)
H.update_inv_r_hand()
..()

View File

@@ -234,6 +234,18 @@ datum/weather/sif
if(!T.outdoors)
continue // They're indoors, so no need to rain on them.
// If they have an open umbrella, it'll guard from rain
if(istype(L.get_active_hand(), /obj/item/weapon/melee/umbrella))
var/obj/item/weapon/melee/umbrella/U = L.get_active_hand()
if(U.open)
to_chat(L, "<span class='notice'>Rain patters softly onto your umbrella</span>")
continue
else if(istype(L.get_inactive_hand(), /obj/item/weapon/melee/umbrella))
var/obj/item/weapon/melee/umbrella/U = L.get_inactive_hand()
if(U.open)
to_chat(L, "<span class='notice'>Rain patters softly onto your umbrella</span>")
continue
L.water_act(1)
to_chat(L, "<span class='warning'>Rain falls on you.</span>")
@@ -258,6 +270,20 @@ datum/weather/sif
if(!T.outdoors)
continue // They're indoors, so no need to rain on them.
// If they have an open umbrella, it'll get stolen by the wind
if(istype(L.get_active_hand(), /obj/item/weapon/melee/umbrella))
var/obj/item/weapon/melee/umbrella/U = L.get_active_hand()
if(U.open)
to_chat(L, "<span class='warning'>A gust of wind yanks the umbrella from your hand!</span>")
L.drop_from_inventory(U)
U.throw_at(get_edge_target_turf(U, pick(alldirs)), 8, 1, L)
else if(istype(L.get_inactive_hand(), /obj/item/weapon/melee/umbrella))
var/obj/item/weapon/melee/umbrella/U = L.get_inactive_hand()
if(U.open)
to_chat(L, "<span class='warning'>A gust of wind yanks the umbrella from your hand!</span>")
L.drop_from_inventory(U)
U.throw_at(get_edge_target_turf(U, pick(alldirs)), 8, 1, L)
L.water_act(2)
to_chat(L, "<span class='warning'>Rain falls on you, drenching you in water.</span>")
@@ -282,6 +308,18 @@ datum/weather/sif
if(!T.outdoors)
continue // They're indoors, so no need to pelt them with ice.
// If they have an open umbrella, it'll guard from rain
if(istype(L.get_active_hand(), /obj/item/weapon/melee/umbrella))
var/obj/item/weapon/melee/umbrella/U = L.get_active_hand()
if(U.open)
to_chat(L, "<span class='notice'>Hail patters gently onto your umbrella.</span>")
continue
else if(istype(L.get_inactive_hand(), /obj/item/weapon/melee/umbrella))
var/obj/item/weapon/melee/umbrella/U = L.get_inactive_hand()
if(U.open)
to_chat(L, "<span class='notice'>Hail patters gently onto your umbrella.</span>")
continue
var/target_zone = pick(BP_ALL)
var/amount_blocked = L.run_armor_check(target_zone, "melee")
var/amount_soaked = L.get_armor_soak(target_zone, "melee")