mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-01-03 22:13:24 +00:00
Adds hats to dionaea.
This commit is contained in:
@@ -276,15 +276,39 @@ BLIND // can't see anything
|
||||
user.update_action_buttons()
|
||||
|
||||
/obj/item/clothing/head/attack_ai(var/mob/user)
|
||||
if(Adjacent(user) && istype(user, /mob/living/silicon/robot/drone))
|
||||
if(!mob_wear_hat(user))
|
||||
return ..()
|
||||
|
||||
/obj/item/clothing/head/attack_generic(var/mob/user)
|
||||
if(!mob_wear_hat(user))
|
||||
return ..()
|
||||
|
||||
/obj/item/clothing/head/proc/mob_wear_hat(var/mob/user)
|
||||
if(!Adjacent(user))
|
||||
return 0
|
||||
var/success
|
||||
if(istype(user, /mob/living/silicon/robot/drone))
|
||||
var/mob/living/silicon/robot/drone/D = user
|
||||
if(!D.hat)
|
||||
D.wear_hat(src)
|
||||
D << "<span class='notice'>You crawl under \the [src].</span>"
|
||||
if(D.hat)
|
||||
success = 2
|
||||
else
|
||||
D << "<span class='warning'>You are already wearing \the [D.hat].</span>"
|
||||
return
|
||||
return ..()
|
||||
D.wear_hat(src)
|
||||
success = 1
|
||||
else if(istype(user, /mob/living/carbon/alien/diona))
|
||||
var/mob/living/carbon/alien/diona/D = user
|
||||
if(D.hat)
|
||||
success = 2
|
||||
else
|
||||
D.wear_hat(src)
|
||||
success = 1
|
||||
|
||||
if(!success)
|
||||
return 0
|
||||
else if(success == 2)
|
||||
user << "<span class='warning'>You are already wearing a hat.</span>"
|
||||
else if(success == 1)
|
||||
user << "<span class='notice'>You crawl under \the [src].</span>"
|
||||
return 1
|
||||
|
||||
/obj/item/clothing/head/update_icon(var/mob/user)
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
universal_understand = 1
|
||||
universal_speak = 0 // Dionaea do not need to speak to people other than other dionaea.
|
||||
holder_type = /obj/item/weapon/holder/diona
|
||||
var/obj/item/hat
|
||||
|
||||
/mob/living/carbon/alien/diona/New()
|
||||
|
||||
@@ -32,3 +33,10 @@
|
||||
/mob/living/carbon/alien/diona/put_in_hands(var/obj/item/W) // No hands.
|
||||
W.loc = get_turf(src)
|
||||
return 1
|
||||
|
||||
/mob/living/carbon/alien/diona/proc/wear_hat(var/obj/item/new_hat)
|
||||
if(hat)
|
||||
return
|
||||
hat = new_hat
|
||||
new_hat.loc = src
|
||||
update_icons()
|
||||
@@ -6,5 +6,22 @@
|
||||
return
|
||||
get_scooped(H)
|
||||
return
|
||||
else if(H.a_intent == "grab" && hat && !(H.l_hand && H.r_hand))
|
||||
hat.loc = get_turf(src)
|
||||
H.put_in_hands(hat)
|
||||
H.visible_message("<span class='danger'>\The [H] removes \the [src]'s [hat].</span>")
|
||||
hat = null
|
||||
update_icons()
|
||||
else
|
||||
return ..()
|
||||
|
||||
/mob/living/carbon/alien/diona/attackby(var/obj/item/weapon/W, var/mob/user)
|
||||
if(user.a_intent == "help" && istype(W, /obj/item/clothing/head))
|
||||
if(hat)
|
||||
user << "<span class='warning'>\The [src] is already wearing \the [hat].</span>"
|
||||
return
|
||||
user.unEquip(W)
|
||||
wear_hat(W)
|
||||
user.visible_message("<span class='notice'>\The [user] puts \the [W] on \the [src].</span>")
|
||||
return
|
||||
return ..()
|
||||
@@ -6,3 +6,7 @@
|
||||
icon_state = "[initial(icon_state)]_sleep"
|
||||
else
|
||||
icon_state = "[initial(icon_state)]"
|
||||
|
||||
overlays.Cut()
|
||||
if(hat)
|
||||
overlays |= get_hat_icon(hat, 0, -8)
|
||||
@@ -1,4 +1,22 @@
|
||||
var/list/drone_hat_cache = list()
|
||||
var/list/mob_hat_cache = list()
|
||||
/proc/get_hat_icon(var/obj/item/hat, var/offset_x = 0, var/offset_y = 0)
|
||||
var/t_state = hat.icon_state
|
||||
if(hat.item_state_slots && hat.item_state_slots[slot_head_str])
|
||||
t_state = hat.item_state_slots[slot_head_str]
|
||||
else if(hat.item_state)
|
||||
t_state = hat.item_state
|
||||
var/key = "[t_state]_[offset_x]_[offset_y]"
|
||||
if(!mob_hat_cache[key]) // Not ideal as there's no guarantee all hat icon_states
|
||||
var/t_icon = INV_HEAD_DEF_ICON // are unique across multiple dmis, but whatever.
|
||||
if(hat.icon_override)
|
||||
t_icon = hat.icon_override
|
||||
else if(hat.item_icons && (slot_head_str in hat.item_icons))
|
||||
t_icon = hat.item_icons[slot_head_str]
|
||||
var/image/I = image(icon = t_icon, icon_state = t_state)
|
||||
I.pixel_x = offset_x
|
||||
I.pixel_y = offset_y
|
||||
mob_hat_cache[key] = I
|
||||
return mob_hat_cache[key]
|
||||
|
||||
/mob/living/silicon/robot/drone
|
||||
name = "drone"
|
||||
@@ -101,26 +119,8 @@ var/list/drone_hat_cache = list()
|
||||
overlays += "eyes-[icon_state]"
|
||||
else
|
||||
overlays -= "eyes"
|
||||
|
||||
if(hat)
|
||||
// Copied from human inventory.
|
||||
// Let the drones wear hats.
|
||||
var/t_state = hat.icon_state
|
||||
if(hat.item_state_slots && hat.item_state_slots[slot_head_str])
|
||||
t_state = hat.item_state_slots[slot_head_str]
|
||||
else if(hat.item_state)
|
||||
t_state = hat.item_state
|
||||
if(!drone_hat_cache["[t_state]-[icon_state]"]) // Not ideal as there's no guarantee all hat icon_states
|
||||
var/t_icon = INV_HEAD_DEF_ICON // are unique across multiple dmis, but whatever.
|
||||
if(hat.icon_override)
|
||||
t_icon = hat.icon_override
|
||||
else if(hat.item_icons && (slot_head_str in hat.item_icons))
|
||||
t_icon = hat.item_icons[slot_head_str]
|
||||
var/image/I = image(icon = t_icon, icon_state = t_state)
|
||||
I.pixel_x = hat_x_offset
|
||||
I.pixel_y = hat_y_offset
|
||||
drone_hat_cache[t_state] = I
|
||||
overlays |= drone_hat_cache[t_state]
|
||||
if(hat) // Let the drones wear hats.
|
||||
overlays |= get_hat_icon(hat, hat_x_offset, hat_y_offset)
|
||||
|
||||
/mob/living/silicon/robot/drone/choose_icon()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user