mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-30 12:03:11 +00:00
Converted comfy chairs to material system, cleaned up colours/icons.
This commit is contained in:
@@ -8,6 +8,9 @@
|
||||
icon_state = "nest"
|
||||
var/health = 100
|
||||
|
||||
/obj/structure/bed/nest/update_icon()
|
||||
return
|
||||
|
||||
/obj/structure/bed/nest/user_unbuckle_mob(mob/user as mob)
|
||||
if(buckled_mob)
|
||||
if(buckled_mob.buckled == src)
|
||||
|
||||
@@ -10,28 +10,56 @@
|
||||
/obj/structure/bed
|
||||
name = "bed"
|
||||
desc = "This is used to lie in, sleep in or strap on."
|
||||
icon = 'icons/obj/objects.dmi'
|
||||
icon = 'icons/obj/furniture.dmi'
|
||||
icon_state = "bed"
|
||||
pressure_resistance = 15
|
||||
anchored = 1
|
||||
can_buckle = 1
|
||||
buckle_lying = 1
|
||||
var/material/material
|
||||
var/apply_cosmetics = 1
|
||||
var/material/padding_material
|
||||
var/base_icon = "bed"
|
||||
|
||||
/obj/structure/bed/New(var/newloc, var/new_material)
|
||||
/obj/structure/bed/New(var/newloc, var/new_material, var/new_padding_material)
|
||||
..(newloc)
|
||||
if(!new_material)
|
||||
new_material = DEFAULT_WALL_MATERIAL
|
||||
|
||||
material = get_material_by_name(new_material)
|
||||
if(!istype(material))
|
||||
qdel(src)
|
||||
return
|
||||
if(apply_cosmetics)
|
||||
color = material.icon_colour
|
||||
if(new_padding_material)
|
||||
padding_material = get_material_by_name(new_padding_material)
|
||||
update_icon()
|
||||
|
||||
// Reuse the cache/code from stools, todo maybe unify.
|
||||
/obj/structure/bed/update_icon()
|
||||
// Prep icon.
|
||||
icon_state = ""
|
||||
overlays.Cut()
|
||||
// Base icon.
|
||||
var/cache_key = "[base_icon]-[material.name]"
|
||||
if(isnull(stool_cache[cache_key]))
|
||||
var/image/I = image('icons/obj/furniture.dmi', base_icon)
|
||||
I.color = material.icon_colour
|
||||
stool_cache[cache_key] = I
|
||||
overlays |= stool_cache[cache_key]
|
||||
// Padding overlay.
|
||||
if(padding_material)
|
||||
var/padding_cache_key = "[base_icon]-padding-[padding_material.name]"
|
||||
if(isnull(stool_cache[padding_cache_key]))
|
||||
var/image/I = image('icons/obj/objects.dmi', "stool_padding")
|
||||
I.color = padding_material.icon_colour
|
||||
stool_cache[padding_cache_key] = I
|
||||
overlays |= stool_cache[padding_cache_key]
|
||||
// Strings.
|
||||
desc = initial(desc)
|
||||
if(padding_material)
|
||||
name = "[padding_material.display_name] [initial(name)]" //this is not perfect but it will do for now.
|
||||
desc += " It's made of [material.display_name] and covered with [padding_material.display_name]."
|
||||
else
|
||||
name = "[material.display_name] [initial(name)]"
|
||||
desc = "[initial(desc)] It's made of [material.display_name]."
|
||||
desc += " It's made of [material.display_name]."
|
||||
|
||||
/obj/structure/bed/ex_act(severity)
|
||||
switch(severity)
|
||||
@@ -55,8 +83,43 @@
|
||||
/obj/structure/bed/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/weapon/wrench))
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
material.place_sheet(get_turf(src))
|
||||
dismantle()
|
||||
qdel(src)
|
||||
else if(istype(W,/obj/item/stack))
|
||||
if(padding_material)
|
||||
user << "\The [src] is already padded."
|
||||
return
|
||||
var/obj/item/stack/C = W
|
||||
if(C.get_amount() < 1) // How??
|
||||
user.drop_from_inventory(C)
|
||||
qdel(C)
|
||||
return
|
||||
var/padding_type //This is awful but it needs to be like this until tiles are given a material var.
|
||||
if(istype(W,/obj/item/stack/tile/carpet))
|
||||
padding_type = "carpet"
|
||||
else if(istype(W,/obj/item/stack/material))
|
||||
var/obj/item/stack/material/M = W
|
||||
if(M.material && (M.material.name in list("leather", "cloth")))
|
||||
padding_type = "[M.material.name]"
|
||||
if(!padding_type)
|
||||
user << "You cannot pad \the [src] with that."
|
||||
return
|
||||
C.use(1)
|
||||
if(!istype(src.loc, /turf))
|
||||
user.drop_from_inventory(src)
|
||||
src.loc = get_turf(src)
|
||||
user << "You add padding to \the [src]."
|
||||
add_padding(padding_type)
|
||||
return
|
||||
|
||||
else if (istype(W, /obj/item/weapon/wirecutters))
|
||||
if(!padding_material)
|
||||
user << "\The [src] has no padding to remove."
|
||||
return
|
||||
user << "You remove the padding from \the [src]."
|
||||
playsound(src, 'sound/items/Wirecutter.ogg', 100, 1)
|
||||
remove_padding()
|
||||
|
||||
else if(istype(W, /obj/item/weapon/grab))
|
||||
user.visible_message("<span class='notice'>[user] attempts to buckle [W:affecting] into \the [src]!</span>")
|
||||
if(do_after(user, 20))
|
||||
@@ -69,11 +132,26 @@
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/structure/bed/proc/remove_padding()
|
||||
if(padding_material)
|
||||
padding_material.place_sheet(get_turf(src))
|
||||
padding_material = null
|
||||
update_icon()
|
||||
|
||||
/obj/structure/bed/proc/add_padding(var/padding_type)
|
||||
padding_material = get_material_by_name(padding_type)
|
||||
update_icon()
|
||||
|
||||
/obj/structure/bed/proc/dismantle()
|
||||
material.place_sheet(get_turf(src))
|
||||
if(padding_material)
|
||||
padding_material.place_sheet(get_turf(src))
|
||||
|
||||
/obj/structure/bed/psych
|
||||
name = "psychiatrist's couch"
|
||||
desc = "For prime comfort during psychiatric evaluations."
|
||||
icon_state = "psychbed"
|
||||
apply_cosmetics = 0
|
||||
base_icon = "psychbed"
|
||||
|
||||
/obj/structure/bed/psych/New(var/newloc)
|
||||
..(newloc,"leather")
|
||||
@@ -81,9 +159,6 @@
|
||||
/obj/structure/bed/alien
|
||||
name = "resting contraption"
|
||||
desc = "This looks similar to contraptions from earth. Could aliens be stealing our technology?"
|
||||
icon_state = "abed"
|
||||
apply_cosmetics = 0
|
||||
|
||||
|
||||
/obj/structure/bed/alien/New(var/newloc)
|
||||
..(newloc,"resin")
|
||||
@@ -96,10 +171,14 @@
|
||||
icon = 'icons/obj/rollerbed.dmi'
|
||||
icon_state = "down"
|
||||
anchored = 0
|
||||
apply_cosmetics = 0
|
||||
|
||||
/obj/structure/bed/roller/update_icon()
|
||||
return // Doesn't care about material or anything else.
|
||||
|
||||
/obj/structure/bed/roller/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(istype(W,/obj/item/roller_holder))
|
||||
if(istype(W, /obj/item/weapon/wrench) || istype(W,/obj/item/stack) || istype(W, /obj/item/weapon/wirecutters))
|
||||
return
|
||||
else if(istype(W,/obj/item/roller_holder))
|
||||
if(buckled_mob)
|
||||
user_unbuckle_mob(user)
|
||||
else
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
/obj/structure/bed/chair //YES, chairs are a type of bed, which are a type of stool. This works, believe me. -Pete
|
||||
name = "chair"
|
||||
desc = "You sit in this. Either by will or force."
|
||||
icon_state = "chair"
|
||||
icon_state = "chair_preview"
|
||||
base_icon = "chair"
|
||||
buckle_lying = 0 //force people to sit up in chairs when buckled
|
||||
var/propelled = 0 // Check for fire-extinguisher-driven chairs
|
||||
|
||||
/obj/structure/bed/chair/New(var/newloc, var/material)
|
||||
..(newloc, material) //Todo make metal/stone chairs display as thrones
|
||||
/obj/structure/bed/chair/New()
|
||||
..() //Todo make metal/stone chairs display as thrones
|
||||
spawn(3) //sorry. i don't think there's a better way to do this.
|
||||
update_layer()
|
||||
return
|
||||
|
||||
/obj/structure/bed/chair/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
..()
|
||||
if(istype(W, /obj/item/assembly/shock_kit))
|
||||
if(!padding_material && istype(W, /obj/item/assembly/shock_kit))
|
||||
var/obj/item/assembly/shock_kit/SK = W
|
||||
if(!SK.status)
|
||||
user << "<span class='notice'>[SK] is not ready to be attached!</span>"
|
||||
user << "<span class='notice'>\The [SK] is not ready to be attached!</span>"
|
||||
return
|
||||
user.drop_item()
|
||||
var/obj/structure/bed/chair/e_chair/E = new (src.loc, material.name)
|
||||
@@ -34,6 +35,19 @@
|
||||
rotate()
|
||||
return
|
||||
|
||||
/obj/structure/bed/chair/post_buckle_mob()
|
||||
update_icon()
|
||||
|
||||
/obj/structure/bed/chair/update_icon()
|
||||
..()
|
||||
if(buckled_mob && padding_material)
|
||||
var/cache_key = "[base_icon]-armrest-[padding_material.name]"
|
||||
if(isnull(stool_cache[cache_key]))
|
||||
var/image/I = image('icons/obj/furniture.dmi', "[base_icon]_armrest")
|
||||
I.color = padding_material.icon_colour
|
||||
stool_cache[cache_key] = I
|
||||
overlays |= stool_cache[cache_key]
|
||||
|
||||
/obj/structure/bed/chair/proc/update_layer()
|
||||
if(src.dir == NORTH)
|
||||
src.layer = FLY_LAYER
|
||||
@@ -65,70 +79,49 @@
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
return
|
||||
|
||||
// Chair types
|
||||
/obj/structure/bed/chair/wood
|
||||
icon_state = "wooden_chair"
|
||||
name = "wooden chair"
|
||||
desc = "Old is never too old to not be in fashion."
|
||||
apply_cosmetics = 0
|
||||
|
||||
/obj/structure/bed/chair/wood/New(var/newloc)
|
||||
..(newloc, "wood")
|
||||
|
||||
/obj/structure/bed/chair/wood/wings
|
||||
icon_state = "wooden_chair_wings"
|
||||
|
||||
// Leaving this in for the sake of compilation.
|
||||
/obj/structure/bed/chair/comfy
|
||||
name = "comfy chair"
|
||||
desc = "It looks comfy."
|
||||
icon_state = "comfychair"
|
||||
color = rgb(255,255,255)
|
||||
var/image/armrest = null
|
||||
apply_cosmetics = 0
|
||||
desc = "It's a chair. It looks comfy."
|
||||
icon_state = "comfychair_preview"
|
||||
|
||||
/obj/structure/bed/chair/comfy/New()
|
||||
armrest = image("icons/obj/objects.dmi", "comfychair_armrest")
|
||||
armrest.layer = MOB_LAYER + 0.1
|
||||
/obj/structure/bed/chair/comfy/brown/New(var/newloc,var/newmaterial)
|
||||
..(newloc,"steel","leather")
|
||||
|
||||
return ..()
|
||||
/obj/structure/bed/chair/comfy/red/New(var/newloc,var/newmaterial)
|
||||
..(newloc,"steel","carpet")
|
||||
|
||||
/obj/structure/bed/chair/comfy/post_buckle_mob()
|
||||
if(buckled_mob)
|
||||
overlays += armrest
|
||||
else
|
||||
overlays -= armrest
|
||||
/obj/structure/bed/chair/comfy/teal/New(var/newloc,var/newmaterial)
|
||||
..(newloc,"steel","teal")
|
||||
|
||||
/obj/structure/bed/chair/comfy/brown
|
||||
color = rgb(141,70,0)
|
||||
/obj/structure/bed/chair/comfy/black/New(var/newloc,var/newmaterial)
|
||||
..(newloc,"steel","black")
|
||||
|
||||
/obj/structure/bed/chair/comfy/red
|
||||
color = rgb(218,2,10)
|
||||
/obj/structure/bed/chair/comfy/green/New(var/newloc,var/newmaterial)
|
||||
..(newloc,"steel","green")
|
||||
|
||||
/obj/structure/bed/chair/comfy/teal
|
||||
color = rgb(0,234,250)
|
||||
/obj/structure/bed/chair/comfy/purp/New(var/newloc,var/newmaterial)
|
||||
..(newloc,"steel","purple")
|
||||
|
||||
/obj/structure/bed/chair/comfy/black
|
||||
color = rgb(60,60,60)
|
||||
/obj/structure/bed/chair/comfy/blue/New(var/newloc,var/newmaterial)
|
||||
..(newloc,"steel","blue")
|
||||
|
||||
/obj/structure/bed/chair/comfy/green
|
||||
color = rgb(1,196,8)
|
||||
/obj/structure/bed/chair/comfy/beige/New(var/newloc,var/newmaterial)
|
||||
..(newloc,"steel","beige")
|
||||
|
||||
/obj/structure/bed/chair/comfy/purp
|
||||
color = rgb(112,2,176)
|
||||
|
||||
/obj/structure/bed/chair/comfy/blue
|
||||
color = rgb(2,9,210)
|
||||
|
||||
/obj/structure/bed/chair/comfy/beige
|
||||
color = rgb(255,253,195)
|
||||
/obj/structure/bed/chair/comfy/lime/New(var/newloc,var/newmaterial)
|
||||
..(newloc,"steel","lime")
|
||||
|
||||
/obj/structure/bed/chair/office
|
||||
anchored = 0
|
||||
buckle_movable = 1
|
||||
apply_cosmetics = 0
|
||||
|
||||
/obj/structure/bed/chair/comfy/lime
|
||||
color = rgb(255,251,0)
|
||||
/obj/structure/bed/chair/office/update_icon()
|
||||
return
|
||||
|
||||
/obj/structure/bed/chair/office/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(istype(W,/obj/item/stack) || istype(W, /obj/item/weapon/wirecutters))
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/structure/bed/chair/office/Move()
|
||||
..()
|
||||
@@ -175,3 +168,23 @@
|
||||
|
||||
/obj/structure/bed/chair/office/dark
|
||||
icon_state = "officechair_dark"
|
||||
|
||||
// Chair types
|
||||
/obj/structure/bed/chair/wood
|
||||
name = "wooden chair"
|
||||
desc = "Old is never too old to not be in fashion."
|
||||
icon_state = "wooden_chair"
|
||||
|
||||
/obj/structure/bed/chair/wood/update_icon()
|
||||
return
|
||||
|
||||
/obj/structure/bed/chair/wood/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(istype(W,/obj/item/stack) || istype(W, /obj/item/weapon/wirecutters))
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/structure/bed/chair/wood/New(var/newloc)
|
||||
..(newloc, "wood")
|
||||
|
||||
/obj/structure/bed/chair/wood/wings
|
||||
icon_state = "wooden_chair_wings"
|
||||
|
||||
@@ -4,7 +4,7 @@ var/global/list/stool_cache = list() //haha stool
|
||||
/obj/item/weapon/stool
|
||||
name = "stool"
|
||||
desc = "Apply butt."
|
||||
icon = 'icons/obj/objects.dmi'
|
||||
icon = 'icons/obj/furniture.dmi'
|
||||
icon_state = "stool_preview" //set for the map
|
||||
force = 10
|
||||
throwforce = 10
|
||||
@@ -34,13 +34,12 @@ var/global/list/stool_cache = list() //haha stool
|
||||
|
||||
/obj/item/weapon/stool/update_icon()
|
||||
// Prep icon.
|
||||
icon_state = "stool"
|
||||
icon_state = ""
|
||||
overlays.Cut()
|
||||
// Base icon.
|
||||
var/cache_key = "stool-[material.name]"
|
||||
if(isnull(stool_cache[cache_key]))
|
||||
var/image/I = image('icons/obj/objects.dmi', base_icon)
|
||||
color = material.icon_colour
|
||||
I.color = material.icon_colour
|
||||
stool_cache[cache_key] = I
|
||||
overlays |= stool_cache[cache_key]
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
var/mob/living/pulling = null
|
||||
var/bloodiness
|
||||
|
||||
/obj/structure/bed/chair/wheelchair/update_icon()
|
||||
return
|
||||
|
||||
/obj/structure/bed/chair/wheelchair/set_dir()
|
||||
..()
|
||||
@@ -18,6 +20,11 @@
|
||||
if(buckled_mob)
|
||||
buckled_mob.set_dir(dir)
|
||||
|
||||
/obj/structure/bed/chair/wheelchair/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/weapon/wrench) || istype(W,/obj/item/stack) || istype(W, /obj/item/weapon/wirecutters))
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/structure/bed/chair/wheelchair/relaymove(mob/user, direction)
|
||||
// Redundant check?
|
||||
if(user.stat || user.stunned || user.weakened || user.paralysis || user.lying || user.restrained())
|
||||
|
||||
Reference in New Issue
Block a user