mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-22 12:47:16 +01:00
Updating stools/stool padding.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
density = 1
|
||||
anchored = 1
|
||||
|
||||
icon = 'icons/obj/doors/mineral_doors.dmi'
|
||||
icon = 'icons/obj/doors/material_doors.dmi'
|
||||
icon_state = "metal"
|
||||
|
||||
var/material/material
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
can_buckle = 1
|
||||
buckle_lying = 1
|
||||
var/material/material
|
||||
var/apply_colour = 1
|
||||
var/apply_strings = 1
|
||||
var/apply_cosmentics = 1
|
||||
|
||||
/obj/structure/bed/New(var/newloc, var/new_material)
|
||||
..(newloc)
|
||||
@@ -29,9 +28,8 @@
|
||||
if(!istype(material))
|
||||
qdel(src)
|
||||
return
|
||||
if(apply_colour)
|
||||
if(apply_cosmentics)
|
||||
color = material.icon_colour
|
||||
if(apply_strings)
|
||||
name = "[material.display_name] [initial(name)]"
|
||||
desc = "[initial(desc)] It's made of [material.display_name]."
|
||||
|
||||
@@ -75,8 +73,7 @@
|
||||
name = "psychiatrist's couch"
|
||||
desc = "For prime comfort during psychiatric evaluations."
|
||||
icon_state = "psychbed"
|
||||
apply_colour = 0
|
||||
apply_strings = 0
|
||||
apply_cosmentics = 0
|
||||
|
||||
/obj/structure/bed/psych/New(var/newloc)
|
||||
..(newloc,"leather")
|
||||
@@ -85,8 +82,8 @@
|
||||
name = "resting contraption"
|
||||
desc = "This looks similar to contraptions from earth. Could aliens be stealing our technology?"
|
||||
icon_state = "abed"
|
||||
apply_colour = 0
|
||||
apply_strings = 0
|
||||
apply_cosmentics = 0
|
||||
|
||||
|
||||
/obj/structure/bed/alien/New(var/newloc)
|
||||
..(newloc,"resin")
|
||||
@@ -99,8 +96,7 @@
|
||||
icon = 'icons/obj/rollerbed.dmi'
|
||||
icon_state = "down"
|
||||
anchored = 0
|
||||
apply_colour = 0
|
||||
apply_strings = 0
|
||||
apply_cosmentics = 0
|
||||
|
||||
/obj/structure/bed/roller/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(istype(W,/obj/item/roller_holder))
|
||||
|
||||
@@ -70,8 +70,7 @@
|
||||
icon_state = "wooden_chair"
|
||||
name = "wooden chair"
|
||||
desc = "Old is never too old to not be in fashion."
|
||||
apply_colour = 0
|
||||
apply_strings = 0
|
||||
apply_cosmentics = 0
|
||||
|
||||
/obj/structure/bed/chair/wood/New(var/newloc)
|
||||
..(newloc, "wood")
|
||||
@@ -85,8 +84,7 @@
|
||||
icon_state = "comfychair"
|
||||
color = rgb(255,255,255)
|
||||
var/image/armrest = null
|
||||
apply_colour = 0
|
||||
apply_strings = 0
|
||||
apply_cosmentics = 0
|
||||
|
||||
/obj/structure/bed/chair/comfy/New()
|
||||
armrest = image("icons/obj/objects.dmi", "comfychair_armrest")
|
||||
@@ -127,8 +125,7 @@
|
||||
/obj/structure/bed/chair/office
|
||||
anchored = 0
|
||||
buckle_movable = 1
|
||||
apply_colour = 0
|
||||
apply_strings = 0
|
||||
apply_cosmentics = 0
|
||||
|
||||
/obj/structure/bed/chair/comfy/lime
|
||||
color = rgb(255,251,0)
|
||||
|
||||
@@ -1,31 +1,83 @@
|
||||
//Todo: add leather and cloth for arbitrary coloured stools.
|
||||
var/global/list/stool_cache = list() //haha stool
|
||||
|
||||
/obj/item/weapon/stool
|
||||
name = "stool"
|
||||
desc = "Apply butt."
|
||||
icon = 'icons/obj/objects.dmi'
|
||||
icon_state = "stool"
|
||||
icon_state = "stool_preview" //set for the map
|
||||
force = 10
|
||||
throwforce = 10
|
||||
w_class = 5
|
||||
var/base_icon = "stool_base"
|
||||
var/material/material
|
||||
var/material/padding_material
|
||||
|
||||
/obj/item/weapon/stool/New(var/newloc, var/new_material)
|
||||
/obj/item/weapon/stool/padded
|
||||
name = "padded stool"
|
||||
icon_state = "stool_padded_preview" //set for the map
|
||||
|
||||
/obj/item/weapon/stool/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(new_padding_material)
|
||||
padding_material = get_material_by_name(new_padding_material)
|
||||
if(!istype(material))
|
||||
qdel(src)
|
||||
return
|
||||
force = round(material.get_blunt_damage()*0.4)
|
||||
color = material.icon_colour
|
||||
name = "[material.display_name] [initial(name)]"
|
||||
desc = "[initial(desc)] It's made of [material.display_name]."
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/stool/padded/New(var/newloc, var/new_material)
|
||||
..(newloc, "steel", "leather")
|
||||
|
||||
/obj/item/weapon/stool/update_icon()
|
||||
// Prep icon.
|
||||
icon_state = "stool"
|
||||
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]
|
||||
// Padding overlay.
|
||||
if(padding_material)
|
||||
var/padding_cache_key = "stool-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.
|
||||
if(padding_material)
|
||||
name = "[padding_material.display_name] [initial(name)]" //this is not perfect but it will do for now.
|
||||
desc = "A stool. Apply butt. It's made of [material.display_name] and covered with [padding_material.display_name]."
|
||||
else
|
||||
name = "[material.display_name] [initial(name)]"
|
||||
desc = "A stool. Apply butt. It's made of [material.display_name]."
|
||||
|
||||
/obj/item/weapon/stool/proc/add_padding(var/padding_type)
|
||||
padding_material = get_material_by_name(padding_type)
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/stool/proc/remove_padding()
|
||||
if(padding_material)
|
||||
padding_material.place_sheet(get_turf(src))
|
||||
padding_material = null
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/stool/attack(mob/M as mob, mob/user as mob)
|
||||
if (prob(5) && istype(M,/mob/living))
|
||||
user.visible_message("\red [user] breaks [src] over [M]'s back!")
|
||||
user.remove_from_mob(src)
|
||||
material.place_sheet(get_turf(src))
|
||||
if(padding_material)
|
||||
padding_material.place_sheet(get_turf(src))
|
||||
qdel(src)
|
||||
var/mob/living/T = M
|
||||
T.Weaken(10)
|
||||
@@ -52,9 +104,51 @@
|
||||
material.place_sheet(get_turf(src))
|
||||
qdel(src)
|
||||
|
||||
/obj/item/weapon/stool/proc/dismantle()
|
||||
if(material)
|
||||
material.place_sheet(get_turf(src))
|
||||
if(padding_material)
|
||||
padding_material.place_sheet(get_turf(src))
|
||||
qdel(src)
|
||||
|
||||
/obj/item/weapon/stool/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()
|
||||
return
|
||||
else if (istype(W, /obj/item/weapon/wirecutters))
|
||||
if(!padding_material)
|
||||
user << "\The [src] has no padding to remove."
|
||||
return
|
||||
new /obj/item/stack/tile/carpet(get_turf(src),1)
|
||||
user << "You remove the padding from \the [src]."
|
||||
playsound(src, 'sound/items/Wirecutter.ogg', 100, 1)
|
||||
remove_padding()
|
||||
else
|
||||
..()
|
||||
|
||||
Reference in New Issue
Block a user