mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-30 00:35:45 +01:00
Tooling updates and removal of corrupt maps [MDB IGNORE] (#7620)
This commit is contained in:
@@ -1,423 +1,423 @@
|
||||
/obj/structure/girder
|
||||
name = "girder"
|
||||
icon_state = "girder"
|
||||
anchored = TRUE
|
||||
density = TRUE
|
||||
layer = TABLE_LAYER //CHOMPEdit - moved so that they render above catwalks.
|
||||
w_class = ITEMSIZE_HUGE
|
||||
var/state = 0
|
||||
var/health = 200
|
||||
var/max_health = 200
|
||||
var/displaced_health = 50
|
||||
var/current_damage = 0
|
||||
var/cover = 50 //how much cover the girder provides against projectiles.
|
||||
var/default_material = MAT_STEEL
|
||||
var/datum/material/girder_material
|
||||
var/datum/material/reinf_material
|
||||
var/reinforcing = 0
|
||||
var/applies_material_colour = 1
|
||||
var/wall_type = /turf/simulated/wall
|
||||
|
||||
/obj/structure/girder/New(var/newloc, var/material_key)
|
||||
..(newloc)
|
||||
if(!material_key)
|
||||
material_key = default_material
|
||||
set_material(material_key)
|
||||
update_icon()
|
||||
|
||||
/obj/structure/girder/Destroy()
|
||||
if(girder_material.products_need_process())
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
. = ..()
|
||||
|
||||
/obj/structure/girder/process()
|
||||
if(!radiate())
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
return
|
||||
|
||||
/obj/structure/girder/proc/radiate()
|
||||
var/total_radiation = girder_material.radioactivity + (reinf_material ? reinf_material.radioactivity / 2 : 0)
|
||||
if(!total_radiation)
|
||||
return
|
||||
|
||||
SSradiation.radiate(src, total_radiation)
|
||||
return total_radiation
|
||||
|
||||
|
||||
/obj/structure/girder/proc/set_material(var/new_material)
|
||||
girder_material = get_material_by_name(new_material)
|
||||
if(!girder_material)
|
||||
qdel(src)
|
||||
name = "[girder_material.display_name] [initial(name)]"
|
||||
max_health = round(girder_material.integrity) //Should be 150 with default integrity (steel). Weaker than ye-olden Girders now.
|
||||
health = max_health
|
||||
displaced_health = round(max_health/4)
|
||||
if(applies_material_colour)
|
||||
color = girder_material.icon_colour
|
||||
if(girder_material.products_need_process()) //Am I radioactive or some other? Process me!
|
||||
START_PROCESSING(SSobj, src)
|
||||
else if(datum_flags & DF_ISPROCESSING) //If I happened to be radioactive or s.o. previously, and am not now, stop processing.
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
|
||||
/obj/structure/girder/get_material()
|
||||
return girder_material
|
||||
|
||||
/obj/structure/girder/update_icon()
|
||||
if(anchored)
|
||||
icon_state = initial(icon_state)
|
||||
else
|
||||
icon_state = "displaced"
|
||||
|
||||
/obj/structure/girder/displaced
|
||||
icon_state = "displaced"
|
||||
anchored = FALSE
|
||||
health = 50
|
||||
cover = 25
|
||||
|
||||
/obj/structure/girder/displaced/New(var/newloc, var/material_key)
|
||||
..(newloc, material_key)
|
||||
displace()
|
||||
|
||||
/obj/structure/girder/proc/displace()
|
||||
name = "displaced [girder_material.display_name] [initial(name)]"
|
||||
icon_state = "displaced"
|
||||
anchored = FALSE
|
||||
health = (displaced_health - round(current_damage / 4))
|
||||
cover = 25
|
||||
|
||||
/obj/structure/girder/attack_generic(var/mob/user, var/damage, var/attack_message = "smashes apart")
|
||||
if(damage < STRUCTURE_MIN_DAMAGE_THRESHOLD)
|
||||
return 0
|
||||
user.do_attack_animation(src)
|
||||
visible_message("<span class='danger'>[user] [attack_message] the [src]!</span>")
|
||||
spawn(1) dismantle()
|
||||
return 1
|
||||
|
||||
/obj/structure/girder/bullet_act(var/obj/item/projectile/Proj)
|
||||
//Girders only provide partial cover. There's a chance that the projectiles will just pass through. (unless you are trying to shoot the girder)
|
||||
if(Proj.original != src && !prob(cover))
|
||||
return PROJECTILE_CONTINUE //pass through
|
||||
|
||||
var/damage = Proj.get_structure_damage()
|
||||
if(!damage)
|
||||
return
|
||||
|
||||
if(!istype(Proj, /obj/item/projectile/beam))
|
||||
damage *= 0.4 //non beams do reduced damage
|
||||
|
||||
else if(girder_material && girder_material.reflectivity >= 0.5) // Reflect lasers.
|
||||
var/new_damage = damage * girder_material.reflectivity
|
||||
var/outgoing_damage = damage - new_damage
|
||||
damage = round(new_damage)
|
||||
Proj.damage = outgoing_damage
|
||||
|
||||
visible_message("<span class='danger'>\The [src] reflects \the [Proj]!</span>")
|
||||
|
||||
// Find a turf near or on the original location to bounce to
|
||||
var/new_x = Proj.starting.x + pick(0, 0, 0, -1, 1, -2, 2)
|
||||
var/new_y = Proj.starting.y + pick(0, 0, 0, -1, 1, -2, 2)
|
||||
//var/turf/curloc = get_turf(src)
|
||||
var/turf/curloc = get_step(src, get_dir(src, Proj.starting))
|
||||
|
||||
Proj.penetrating += 1 // Needed for the beam to get out of the girder.
|
||||
|
||||
// redirect the projectile
|
||||
Proj.redirect(new_x, new_y, curloc, null)
|
||||
|
||||
health -= damage
|
||||
..()
|
||||
if(health <= 0)
|
||||
dismantle()
|
||||
|
||||
return
|
||||
|
||||
/obj/structure/girder/blob_act()
|
||||
dismantle()
|
||||
|
||||
/obj/structure/girder/proc/reset_girder()
|
||||
name = "[girder_material.display_name] [initial(name)]"
|
||||
anchored = TRUE
|
||||
cover = initial(cover)
|
||||
health = min(max_health - current_damage,max_health)
|
||||
state = 0
|
||||
icon_state = initial(icon_state)
|
||||
reinforcing = 0
|
||||
if(reinf_material)
|
||||
reinforce_girder()
|
||||
|
||||
/obj/structure/girder/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(W.has_tool_quality(TOOL_WRENCH) && state == 0)
|
||||
if(anchored && !reinf_material)
|
||||
playsound(src, W.usesound, 100, 1)
|
||||
to_chat(user, "<span class='notice'>Now disassembling the girder...</span>")
|
||||
if(do_after(user,(35 + round(max_health/50)) * W.toolspeed))
|
||||
if(!src) return
|
||||
to_chat(user, "<span class='notice'>You dissasembled the girder!</span>")
|
||||
dismantle()
|
||||
else if(!anchored)
|
||||
playsound(src, W.usesound, 100, 1)
|
||||
to_chat(user, "<span class='notice'>Now securing the girder...</span>")
|
||||
if(do_after(user, 40 * W.toolspeed, src))
|
||||
to_chat(user, "<span class='notice'>You secured the girder!</span>")
|
||||
reset_girder()
|
||||
|
||||
else if(istype(W, /obj/item/weapon/pickaxe/plasmacutter))
|
||||
to_chat(user, "<span class='notice'>Now slicing apart the girder...</span>")
|
||||
if(do_after(user,30 * W.toolspeed))
|
||||
if(!src) return
|
||||
to_chat(user, "<span class='notice'>You slice apart the girder!</span>")
|
||||
dismantle()
|
||||
|
||||
else if(istype(W, /obj/item/weapon/pickaxe/diamonddrill))
|
||||
to_chat(user, "<span class='notice'>You drill through the girder!</span>")
|
||||
dismantle()
|
||||
|
||||
else if(W.has_tool_quality(TOOL_SCREWDRIVER))
|
||||
if(state == 2)
|
||||
playsound(src, W.usesound, 100, 1)
|
||||
to_chat(user, "<span class='notice'>Now unsecuring support struts...</span>")
|
||||
if(do_after(user,40 * W.toolspeed))
|
||||
if(!src) return
|
||||
to_chat(user, "<span class='notice'>You unsecured the support struts!</span>")
|
||||
state = 1
|
||||
else if(anchored && !reinf_material)
|
||||
playsound(src, W.usesound, 100, 1)
|
||||
reinforcing = !reinforcing
|
||||
to_chat(user, "<span class='notice'>\The [src] can now be [reinforcing? "reinforced" : "constructed"]!</span>")
|
||||
|
||||
else if(W.has_tool_quality(TOOL_WIRECUTTER) && state == 1)
|
||||
playsound(src, W.usesound, 100, 1)
|
||||
to_chat(user, "<span class='notice'>Now removing support struts...</span>")
|
||||
if(do_after(user,40 * W.toolspeed))
|
||||
if(!src) return
|
||||
to_chat(user, "<span class='notice'>You removed the support struts!</span>")
|
||||
reinf_material.place_dismantled_product(get_turf(src))
|
||||
reinf_material = null
|
||||
reset_girder()
|
||||
|
||||
else if(W.has_tool_quality(TOOL_CROWBAR) && state == 0 && anchored)
|
||||
playsound(src, W.usesound, 100, 1)
|
||||
to_chat(user, "<span class='notice'>Now dislodging the girder...</span>")
|
||||
if(do_after(user, 40 * W.toolspeed))
|
||||
if(!src) return
|
||||
to_chat(user, "<span class='notice'>You dislodged the girder!</span>")
|
||||
displace()
|
||||
|
||||
else if(istype(W, /obj/item/stack/material))
|
||||
if(reinforcing && !reinf_material)
|
||||
if(!reinforce_with_material(W, user))
|
||||
return ..()
|
||||
else
|
||||
if(!construct_wall(W, user))
|
||||
return ..()
|
||||
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/structure/girder/take_damage(var/damage)
|
||||
health -= damage
|
||||
if(health <= 0)
|
||||
dismantle()
|
||||
else
|
||||
current_damage = current_damage + damage //Rather than calculate this every time we need to use it, just calculate it here and save it.
|
||||
|
||||
|
||||
/obj/structure/girder/proc/construct_wall(obj/item/stack/material/S, mob/user)
|
||||
var/amount_to_use = reinf_material ? 1 : 2
|
||||
if(S.get_amount() < amount_to_use)
|
||||
to_chat(user, "<span class='notice'>There isn't enough material here to construct a wall.</span>")
|
||||
return 0
|
||||
|
||||
var/datum/material/M = name_to_material[S.default_type]
|
||||
if(!istype(M))
|
||||
return 0
|
||||
|
||||
var/wall_fake
|
||||
add_hiddenprint(usr)
|
||||
|
||||
if(M.integrity < 50)
|
||||
to_chat(user, "<span class='notice'>This material is too soft for use in wall construction.</span>")
|
||||
return 0
|
||||
|
||||
to_chat(user, "<span class='notice'>You begin adding the plating...</span>")
|
||||
|
||||
if(!do_after(user,40) || !S.use(amount_to_use))
|
||||
return 1 //once we've gotten this far don't call parent attackby()
|
||||
|
||||
if(anchored)
|
||||
to_chat(user, "<span class='notice'>You added the plating!</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You create a false wall! Push on it to open or close the passage.</span>")
|
||||
wall_fake = 1
|
||||
|
||||
var/turf/Tsrc = get_turf(src)
|
||||
Tsrc.ChangeTurf(wall_type)
|
||||
var/turf/simulated/wall/T = get_turf(src)
|
||||
T.set_material(M, reinf_material, girder_material)
|
||||
if(wall_fake)
|
||||
T.can_open = 1
|
||||
T.add_hiddenprint(usr)
|
||||
qdel(src)
|
||||
return 1
|
||||
|
||||
/obj/structure/girder/proc/reinforce_with_material(obj/item/stack/material/S, mob/user) //if the verb is removed this can be renamed.
|
||||
if(reinf_material)
|
||||
to_chat(user, "<span class='notice'>\The [src] is already reinforced.</span>")
|
||||
return 0
|
||||
|
||||
if(S.get_amount() < 1)
|
||||
to_chat(user, "<span class='notice'>There isn't enough material here to reinforce the girder.</span>")
|
||||
return 0
|
||||
|
||||
var/datum/material/M = name_to_material[S.default_type]
|
||||
if(!istype(M) || M.integrity < 50)
|
||||
to_chat(user, "You cannot reinforce \the [src] with that; it is too soft.")
|
||||
return 0
|
||||
|
||||
to_chat(user, "<span class='notice'>Now reinforcing...</span>")
|
||||
if (!do_after(user,40) || !S.use(1))
|
||||
return 1 //don't call parent attackby() past this point
|
||||
to_chat(user, "<span class='notice'>You added reinforcement!</span>")
|
||||
|
||||
reinf_material = M
|
||||
reinforce_girder()
|
||||
return 1
|
||||
|
||||
/obj/structure/girder/proc/reinforce_girder()
|
||||
cover = reinf_material.hardness
|
||||
health = health + round(reinf_material.integrity/2)
|
||||
state = 2
|
||||
icon_state = "reinforced"
|
||||
reinforcing = 0
|
||||
|
||||
/obj/structure/girder/proc/dismantle()
|
||||
girder_material.place_dismantled_product(get_turf(src), 2) // CHOMPEdit
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/girder/attack_hand(mob/user as mob)
|
||||
if (HULK in user.mutations)
|
||||
visible_message("<span class='danger'>[user] smashes [src] apart!</span>")
|
||||
dismantle()
|
||||
return
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/structure/girder/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
qdel(src)
|
||||
return
|
||||
if(2.0)
|
||||
if (prob(30))
|
||||
dismantle()
|
||||
return
|
||||
if(3.0)
|
||||
if (prob(5))
|
||||
dismantle()
|
||||
return
|
||||
else
|
||||
return
|
||||
|
||||
/obj/structure/girder/cult
|
||||
name = "column"
|
||||
icon= 'icons/obj/cult.dmi'
|
||||
icon_state= "cultgirder"
|
||||
max_health = 250
|
||||
health = 250
|
||||
cover = 70
|
||||
girder_material = "cult"
|
||||
applies_material_colour = 0
|
||||
|
||||
/obj/structure/girder/cult/update_icon()
|
||||
if(anchored)
|
||||
icon_state = "cultgirder"
|
||||
else
|
||||
icon_state = "displaced"
|
||||
|
||||
/obj/structure/girder/cult/dismantle()
|
||||
new /obj/effect/decal/remains/human(get_turf(src))
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/girder/cult/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(W.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, W.usesound, 100, 1)
|
||||
to_chat(user, "<span class='notice'>Now disassembling the girder...</span>")
|
||||
if(do_after(user,40 * W.toolspeed))
|
||||
to_chat(user, "<span class='notice'>You dissasembled the girder!</span>")
|
||||
dismantle()
|
||||
|
||||
else if(istype(W, /obj/item/weapon/pickaxe/plasmacutter))
|
||||
to_chat(user, "<span class='notice'>Now slicing apart the girder...</span>")
|
||||
if(do_after(user,30 * W.toolspeed))
|
||||
to_chat(user, "<span class='notice'>You slice apart the girder!</span>")
|
||||
dismantle()
|
||||
|
||||
else if(istype(W, /obj/item/weapon/pickaxe/diamonddrill))
|
||||
to_chat(user, "<span class='notice'>You drill through the girder!</span>")
|
||||
new /obj/effect/decal/remains/human(get_turf(src))
|
||||
dismantle()
|
||||
|
||||
/obj/structure/girder/resin
|
||||
name = "soft girder"
|
||||
icon_state = "girder_resin"
|
||||
max_health = 225
|
||||
health = 225
|
||||
cover = 60
|
||||
girder_material = "resin"
|
||||
|
||||
/* CHOMPEdit - moved this block to modular_chomp\code\game\objects\items\weapons\rcd.dm
|
||||
/obj/structure/girder/rcd_values(mob/living/user, obj/item/weapon/rcd/the_rcd, passed_mode)
|
||||
var/turf/simulated/T = get_turf(src)
|
||||
if(!istype(T) || T.density)
|
||||
return FALSE
|
||||
|
||||
switch(passed_mode)
|
||||
if(RCD_FLOORWALL)
|
||||
// Finishing a wall costs two sheets.
|
||||
var/cost = RCD_SHEETS_PER_MATTER_UNIT * 2
|
||||
// Rwalls cost three to finish.
|
||||
if(the_rcd.make_rwalls)
|
||||
cost += RCD_SHEETS_PER_MATTER_UNIT * 1
|
||||
return list(
|
||||
RCD_VALUE_MODE = RCD_FLOORWALL,
|
||||
RCD_VALUE_DELAY = 2 SECONDS,
|
||||
RCD_VALUE_COST = cost
|
||||
)
|
||||
if(RCD_DECONSTRUCT)
|
||||
return list(
|
||||
RCD_VALUE_MODE = RCD_DECONSTRUCT,
|
||||
RCD_VALUE_DELAY = 2 SECONDS,
|
||||
RCD_VALUE_COST = RCD_SHEETS_PER_MATTER_UNIT * 5
|
||||
)
|
||||
return FALSE
|
||||
|
||||
/obj/structure/girder/rcd_act(mob/living/user, obj/item/weapon/rcd/the_rcd, passed_mode)
|
||||
var/turf/simulated/T = get_turf(src)
|
||||
if(!istype(T) || T.density) // Should stop future bugs of people bringing girders to centcom and RCDing them, or somehow putting a girder on a durasteel wall and deconning it.
|
||||
return FALSE
|
||||
|
||||
switch(passed_mode)
|
||||
if(RCD_FLOORWALL)
|
||||
to_chat(user, span("notice", "You finish a wall."))
|
||||
// This is mostly the same as using on a floor. The girder's material is preserved, however.
|
||||
T.ChangeTurf(wall_type)
|
||||
var/turf/simulated/wall/new_T = get_turf(src) // Ref to the wall we just built.
|
||||
// Apparently set_material(...) for walls requires refs to the material singletons and not strings.
|
||||
// This is different from how other material objects with their own set_material(...) do it, but whatever.
|
||||
var/datum/material/M = name_to_material[the_rcd.material_to_use]
|
||||
new_T.set_material(M, the_rcd.make_rwalls ? M : null, girder_material)
|
||||
new_T.add_hiddenprint(user)
|
||||
qdel(src)
|
||||
return TRUE
|
||||
|
||||
if(RCD_DECONSTRUCT)
|
||||
to_chat(user, span("notice", "You deconstruct \the [src]."))
|
||||
qdel(src)
|
||||
return TRUE
|
||||
*/
|
||||
|
||||
/obj/structure/girder/bay
|
||||
wall_type = /turf/simulated/wall/bay
|
||||
|
||||
/obj/structure/girder/eris
|
||||
wall_type = /turf/simulated/wall/eris
|
||||
/obj/structure/girder
|
||||
name = "girder"
|
||||
icon_state = "girder"
|
||||
anchored = TRUE
|
||||
density = TRUE
|
||||
layer = TABLE_LAYER //CHOMPEdit - moved so that they render above catwalks.
|
||||
w_class = ITEMSIZE_HUGE
|
||||
var/state = 0
|
||||
var/health = 200
|
||||
var/max_health = 200
|
||||
var/displaced_health = 50
|
||||
var/current_damage = 0
|
||||
var/cover = 50 //how much cover the girder provides against projectiles.
|
||||
var/default_material = MAT_STEEL
|
||||
var/datum/material/girder_material
|
||||
var/datum/material/reinf_material
|
||||
var/reinforcing = 0
|
||||
var/applies_material_colour = 1
|
||||
var/wall_type = /turf/simulated/wall
|
||||
|
||||
/obj/structure/girder/New(var/newloc, var/material_key)
|
||||
..(newloc)
|
||||
if(!material_key)
|
||||
material_key = default_material
|
||||
set_material(material_key)
|
||||
update_icon()
|
||||
|
||||
/obj/structure/girder/Destroy()
|
||||
if(girder_material.products_need_process())
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
. = ..()
|
||||
|
||||
/obj/structure/girder/process()
|
||||
if(!radiate())
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
return
|
||||
|
||||
/obj/structure/girder/proc/radiate()
|
||||
var/total_radiation = girder_material.radioactivity + (reinf_material ? reinf_material.radioactivity / 2 : 0)
|
||||
if(!total_radiation)
|
||||
return
|
||||
|
||||
SSradiation.radiate(src, total_radiation)
|
||||
return total_radiation
|
||||
|
||||
|
||||
/obj/structure/girder/proc/set_material(var/new_material)
|
||||
girder_material = get_material_by_name(new_material)
|
||||
if(!girder_material)
|
||||
qdel(src)
|
||||
name = "[girder_material.display_name] [initial(name)]"
|
||||
max_health = round(girder_material.integrity) //Should be 150 with default integrity (steel). Weaker than ye-olden Girders now.
|
||||
health = max_health
|
||||
displaced_health = round(max_health/4)
|
||||
if(applies_material_colour)
|
||||
color = girder_material.icon_colour
|
||||
if(girder_material.products_need_process()) //Am I radioactive or some other? Process me!
|
||||
START_PROCESSING(SSobj, src)
|
||||
else if(datum_flags & DF_ISPROCESSING) //If I happened to be radioactive or s.o. previously, and am not now, stop processing.
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
|
||||
/obj/structure/girder/get_material()
|
||||
return girder_material
|
||||
|
||||
/obj/structure/girder/update_icon()
|
||||
if(anchored)
|
||||
icon_state = initial(icon_state)
|
||||
else
|
||||
icon_state = "displaced"
|
||||
|
||||
/obj/structure/girder/displaced
|
||||
icon_state = "displaced"
|
||||
anchored = FALSE
|
||||
health = 50
|
||||
cover = 25
|
||||
|
||||
/obj/structure/girder/displaced/New(var/newloc, var/material_key)
|
||||
..(newloc, material_key)
|
||||
displace()
|
||||
|
||||
/obj/structure/girder/proc/displace()
|
||||
name = "displaced [girder_material.display_name] [initial(name)]"
|
||||
icon_state = "displaced"
|
||||
anchored = FALSE
|
||||
health = (displaced_health - round(current_damage / 4))
|
||||
cover = 25
|
||||
|
||||
/obj/structure/girder/attack_generic(var/mob/user, var/damage, var/attack_message = "smashes apart")
|
||||
if(damage < STRUCTURE_MIN_DAMAGE_THRESHOLD)
|
||||
return 0
|
||||
user.do_attack_animation(src)
|
||||
visible_message("<span class='danger'>[user] [attack_message] the [src]!</span>")
|
||||
spawn(1) dismantle()
|
||||
return 1
|
||||
|
||||
/obj/structure/girder/bullet_act(var/obj/item/projectile/Proj)
|
||||
//Girders only provide partial cover. There's a chance that the projectiles will just pass through. (unless you are trying to shoot the girder)
|
||||
if(Proj.original != src && !prob(cover))
|
||||
return PROJECTILE_CONTINUE //pass through
|
||||
|
||||
var/damage = Proj.get_structure_damage()
|
||||
if(!damage)
|
||||
return
|
||||
|
||||
if(!istype(Proj, /obj/item/projectile/beam))
|
||||
damage *= 0.4 //non beams do reduced damage
|
||||
|
||||
else if(girder_material && girder_material.reflectivity >= 0.5) // Reflect lasers.
|
||||
var/new_damage = damage * girder_material.reflectivity
|
||||
var/outgoing_damage = damage - new_damage
|
||||
damage = round(new_damage)
|
||||
Proj.damage = outgoing_damage
|
||||
|
||||
visible_message("<span class='danger'>\The [src] reflects \the [Proj]!</span>")
|
||||
|
||||
// Find a turf near or on the original location to bounce to
|
||||
var/new_x = Proj.starting.x + pick(0, 0, 0, -1, 1, -2, 2)
|
||||
var/new_y = Proj.starting.y + pick(0, 0, 0, -1, 1, -2, 2)
|
||||
//var/turf/curloc = get_turf(src)
|
||||
var/turf/curloc = get_step(src, get_dir(src, Proj.starting))
|
||||
|
||||
Proj.penetrating += 1 // Needed for the beam to get out of the girder.
|
||||
|
||||
// redirect the projectile
|
||||
Proj.redirect(new_x, new_y, curloc, null)
|
||||
|
||||
health -= damage
|
||||
..()
|
||||
if(health <= 0)
|
||||
dismantle()
|
||||
|
||||
return
|
||||
|
||||
/obj/structure/girder/blob_act()
|
||||
dismantle()
|
||||
|
||||
/obj/structure/girder/proc/reset_girder()
|
||||
name = "[girder_material.display_name] [initial(name)]"
|
||||
anchored = TRUE
|
||||
cover = initial(cover)
|
||||
health = min(max_health - current_damage,max_health)
|
||||
state = 0
|
||||
icon_state = initial(icon_state)
|
||||
reinforcing = 0
|
||||
if(reinf_material)
|
||||
reinforce_girder()
|
||||
|
||||
/obj/structure/girder/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(W.has_tool_quality(TOOL_WRENCH) && state == 0)
|
||||
if(anchored && !reinf_material)
|
||||
playsound(src, W.usesound, 100, 1)
|
||||
to_chat(user, "<span class='notice'>Now disassembling the girder...</span>")
|
||||
if(do_after(user,(35 + round(max_health/50)) * W.toolspeed))
|
||||
if(!src) return
|
||||
to_chat(user, "<span class='notice'>You dissasembled the girder!</span>")
|
||||
dismantle()
|
||||
else if(!anchored)
|
||||
playsound(src, W.usesound, 100, 1)
|
||||
to_chat(user, "<span class='notice'>Now securing the girder...</span>")
|
||||
if(do_after(user, 40 * W.toolspeed, src))
|
||||
to_chat(user, "<span class='notice'>You secured the girder!</span>")
|
||||
reset_girder()
|
||||
|
||||
else if(istype(W, /obj/item/weapon/pickaxe/plasmacutter))
|
||||
to_chat(user, "<span class='notice'>Now slicing apart the girder...</span>")
|
||||
if(do_after(user,30 * W.toolspeed))
|
||||
if(!src) return
|
||||
to_chat(user, "<span class='notice'>You slice apart the girder!</span>")
|
||||
dismantle()
|
||||
|
||||
else if(istype(W, /obj/item/weapon/pickaxe/diamonddrill))
|
||||
to_chat(user, "<span class='notice'>You drill through the girder!</span>")
|
||||
dismantle()
|
||||
|
||||
else if(W.has_tool_quality(TOOL_SCREWDRIVER))
|
||||
if(state == 2)
|
||||
playsound(src, W.usesound, 100, 1)
|
||||
to_chat(user, "<span class='notice'>Now unsecuring support struts...</span>")
|
||||
if(do_after(user,40 * W.toolspeed))
|
||||
if(!src) return
|
||||
to_chat(user, "<span class='notice'>You unsecured the support struts!</span>")
|
||||
state = 1
|
||||
else if(anchored && !reinf_material)
|
||||
playsound(src, W.usesound, 100, 1)
|
||||
reinforcing = !reinforcing
|
||||
to_chat(user, "<span class='notice'>\The [src] can now be [reinforcing? "reinforced" : "constructed"]!</span>")
|
||||
|
||||
else if(W.has_tool_quality(TOOL_WIRECUTTER) && state == 1)
|
||||
playsound(src, W.usesound, 100, 1)
|
||||
to_chat(user, "<span class='notice'>Now removing support struts...</span>")
|
||||
if(do_after(user,40 * W.toolspeed))
|
||||
if(!src) return
|
||||
to_chat(user, "<span class='notice'>You removed the support struts!</span>")
|
||||
reinf_material.place_dismantled_product(get_turf(src))
|
||||
reinf_material = null
|
||||
reset_girder()
|
||||
|
||||
else if(W.has_tool_quality(TOOL_CROWBAR) && state == 0 && anchored)
|
||||
playsound(src, W.usesound, 100, 1)
|
||||
to_chat(user, "<span class='notice'>Now dislodging the girder...</span>")
|
||||
if(do_after(user, 40 * W.toolspeed))
|
||||
if(!src) return
|
||||
to_chat(user, "<span class='notice'>You dislodged the girder!</span>")
|
||||
displace()
|
||||
|
||||
else if(istype(W, /obj/item/stack/material))
|
||||
if(reinforcing && !reinf_material)
|
||||
if(!reinforce_with_material(W, user))
|
||||
return ..()
|
||||
else
|
||||
if(!construct_wall(W, user))
|
||||
return ..()
|
||||
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/structure/girder/take_damage(var/damage)
|
||||
health -= damage
|
||||
if(health <= 0)
|
||||
dismantle()
|
||||
else
|
||||
current_damage = current_damage + damage //Rather than calculate this every time we need to use it, just calculate it here and save it.
|
||||
|
||||
|
||||
/obj/structure/girder/proc/construct_wall(obj/item/stack/material/S, mob/user)
|
||||
var/amount_to_use = reinf_material ? 1 : 2
|
||||
if(S.get_amount() < amount_to_use)
|
||||
to_chat(user, "<span class='notice'>There isn't enough material here to construct a wall.</span>")
|
||||
return 0
|
||||
|
||||
var/datum/material/M = name_to_material[S.default_type]
|
||||
if(!istype(M))
|
||||
return 0
|
||||
|
||||
var/wall_fake
|
||||
add_hiddenprint(usr)
|
||||
|
||||
if(M.integrity < 50)
|
||||
to_chat(user, "<span class='notice'>This material is too soft for use in wall construction.</span>")
|
||||
return 0
|
||||
|
||||
to_chat(user, "<span class='notice'>You begin adding the plating...</span>")
|
||||
|
||||
if(!do_after(user,40) || !S.use(amount_to_use))
|
||||
return 1 //once we've gotten this far don't call parent attackby()
|
||||
|
||||
if(anchored)
|
||||
to_chat(user, "<span class='notice'>You added the plating!</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You create a false wall! Push on it to open or close the passage.</span>")
|
||||
wall_fake = 1
|
||||
|
||||
var/turf/Tsrc = get_turf(src)
|
||||
Tsrc.ChangeTurf(wall_type)
|
||||
var/turf/simulated/wall/T = get_turf(src)
|
||||
T.set_material(M, reinf_material, girder_material)
|
||||
if(wall_fake)
|
||||
T.can_open = 1
|
||||
T.add_hiddenprint(usr)
|
||||
qdel(src)
|
||||
return 1
|
||||
|
||||
/obj/structure/girder/proc/reinforce_with_material(obj/item/stack/material/S, mob/user) //if the verb is removed this can be renamed.
|
||||
if(reinf_material)
|
||||
to_chat(user, "<span class='notice'>\The [src] is already reinforced.</span>")
|
||||
return 0
|
||||
|
||||
if(S.get_amount() < 1)
|
||||
to_chat(user, "<span class='notice'>There isn't enough material here to reinforce the girder.</span>")
|
||||
return 0
|
||||
|
||||
var/datum/material/M = name_to_material[S.default_type]
|
||||
if(!istype(M) || M.integrity < 50)
|
||||
to_chat(user, "You cannot reinforce \the [src] with that; it is too soft.")
|
||||
return 0
|
||||
|
||||
to_chat(user, "<span class='notice'>Now reinforcing...</span>")
|
||||
if (!do_after(user,40) || !S.use(1))
|
||||
return 1 //don't call parent attackby() past this point
|
||||
to_chat(user, "<span class='notice'>You added reinforcement!</span>")
|
||||
|
||||
reinf_material = M
|
||||
reinforce_girder()
|
||||
return 1
|
||||
|
||||
/obj/structure/girder/proc/reinforce_girder()
|
||||
cover = reinf_material.hardness
|
||||
health = health + round(reinf_material.integrity/2)
|
||||
state = 2
|
||||
icon_state = "reinforced"
|
||||
reinforcing = 0
|
||||
|
||||
/obj/structure/girder/proc/dismantle()
|
||||
girder_material.place_dismantled_product(get_turf(src), 2) // CHOMPEdit
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/girder/attack_hand(mob/user as mob)
|
||||
if (HULK in user.mutations)
|
||||
visible_message("<span class='danger'>[user] smashes [src] apart!</span>")
|
||||
dismantle()
|
||||
return
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/structure/girder/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
qdel(src)
|
||||
return
|
||||
if(2.0)
|
||||
if (prob(30))
|
||||
dismantle()
|
||||
return
|
||||
if(3.0)
|
||||
if (prob(5))
|
||||
dismantle()
|
||||
return
|
||||
else
|
||||
return
|
||||
|
||||
/obj/structure/girder/cult
|
||||
name = "column"
|
||||
icon= 'icons/obj/cult.dmi'
|
||||
icon_state= "cultgirder"
|
||||
max_health = 250
|
||||
health = 250
|
||||
cover = 70
|
||||
girder_material = "cult"
|
||||
applies_material_colour = 0
|
||||
|
||||
/obj/structure/girder/cult/update_icon()
|
||||
if(anchored)
|
||||
icon_state = "cultgirder"
|
||||
else
|
||||
icon_state = "displaced"
|
||||
|
||||
/obj/structure/girder/cult/dismantle()
|
||||
new /obj/effect/decal/remains/human(get_turf(src))
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/girder/cult/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(W.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, W.usesound, 100, 1)
|
||||
to_chat(user, "<span class='notice'>Now disassembling the girder...</span>")
|
||||
if(do_after(user,40 * W.toolspeed))
|
||||
to_chat(user, "<span class='notice'>You dissasembled the girder!</span>")
|
||||
dismantle()
|
||||
|
||||
else if(istype(W, /obj/item/weapon/pickaxe/plasmacutter))
|
||||
to_chat(user, "<span class='notice'>Now slicing apart the girder...</span>")
|
||||
if(do_after(user,30 * W.toolspeed))
|
||||
to_chat(user, "<span class='notice'>You slice apart the girder!</span>")
|
||||
dismantle()
|
||||
|
||||
else if(istype(W, /obj/item/weapon/pickaxe/diamonddrill))
|
||||
to_chat(user, "<span class='notice'>You drill through the girder!</span>")
|
||||
new /obj/effect/decal/remains/human(get_turf(src))
|
||||
dismantle()
|
||||
|
||||
/obj/structure/girder/resin
|
||||
name = "soft girder"
|
||||
icon_state = "girder_resin"
|
||||
max_health = 225
|
||||
health = 225
|
||||
cover = 60
|
||||
girder_material = "resin"
|
||||
|
||||
/* CHOMPEdit - moved this block to modular_chomp\code\game\objects\items\weapons\rcd.dm
|
||||
/obj/structure/girder/rcd_values(mob/living/user, obj/item/weapon/rcd/the_rcd, passed_mode)
|
||||
var/turf/simulated/T = get_turf(src)
|
||||
if(!istype(T) || T.density)
|
||||
return FALSE
|
||||
|
||||
switch(passed_mode)
|
||||
if(RCD_FLOORWALL)
|
||||
// Finishing a wall costs two sheets.
|
||||
var/cost = RCD_SHEETS_PER_MATTER_UNIT * 2
|
||||
// Rwalls cost three to finish.
|
||||
if(the_rcd.make_rwalls)
|
||||
cost += RCD_SHEETS_PER_MATTER_UNIT * 1
|
||||
return list(
|
||||
RCD_VALUE_MODE = RCD_FLOORWALL,
|
||||
RCD_VALUE_DELAY = 2 SECONDS,
|
||||
RCD_VALUE_COST = cost
|
||||
)
|
||||
if(RCD_DECONSTRUCT)
|
||||
return list(
|
||||
RCD_VALUE_MODE = RCD_DECONSTRUCT,
|
||||
RCD_VALUE_DELAY = 2 SECONDS,
|
||||
RCD_VALUE_COST = RCD_SHEETS_PER_MATTER_UNIT * 5
|
||||
)
|
||||
return FALSE
|
||||
|
||||
/obj/structure/girder/rcd_act(mob/living/user, obj/item/weapon/rcd/the_rcd, passed_mode)
|
||||
var/turf/simulated/T = get_turf(src)
|
||||
if(!istype(T) || T.density) // Should stop future bugs of people bringing girders to centcom and RCDing them, or somehow putting a girder on a durasteel wall and deconning it.
|
||||
return FALSE
|
||||
|
||||
switch(passed_mode)
|
||||
if(RCD_FLOORWALL)
|
||||
to_chat(user, span("notice", "You finish a wall."))
|
||||
// This is mostly the same as using on a floor. The girder's material is preserved, however.
|
||||
T.ChangeTurf(wall_type)
|
||||
var/turf/simulated/wall/new_T = get_turf(src) // Ref to the wall we just built.
|
||||
// Apparently set_material(...) for walls requires refs to the material singletons and not strings.
|
||||
// This is different from how other material objects with their own set_material(...) do it, but whatever.
|
||||
var/datum/material/M = name_to_material[the_rcd.material_to_use]
|
||||
new_T.set_material(M, the_rcd.make_rwalls ? M : null, girder_material)
|
||||
new_T.add_hiddenprint(user)
|
||||
qdel(src)
|
||||
return TRUE
|
||||
|
||||
if(RCD_DECONSTRUCT)
|
||||
to_chat(user, span("notice", "You deconstruct \the [src]."))
|
||||
qdel(src)
|
||||
return TRUE
|
||||
*/
|
||||
|
||||
/obj/structure/girder/bay
|
||||
wall_type = /turf/simulated/wall/bay
|
||||
|
||||
/obj/structure/girder/eris
|
||||
wall_type = /turf/simulated/wall/eris
|
||||
|
||||
@@ -1,391 +1,391 @@
|
||||
/* Beds... get your mind out of the gutter, they're for sleeping!
|
||||
* Contains:
|
||||
* Beds
|
||||
* Roller beds
|
||||
*/
|
||||
|
||||
/*
|
||||
* Beds
|
||||
*/
|
||||
/obj/structure/bed
|
||||
name = "bed"
|
||||
desc = "This is used to lie in, sleep in or strap on."
|
||||
icon = 'icons/obj/furniture.dmi'
|
||||
icon_state = "bed"
|
||||
pressure_resistance = 15
|
||||
anchored = TRUE
|
||||
can_buckle = TRUE
|
||||
buckle_dir = SOUTH
|
||||
buckle_lying = 1
|
||||
var/datum/material/material
|
||||
var/datum/material/padding_material
|
||||
var/base_icon = "bed"
|
||||
var/applies_material_colour = 1
|
||||
|
||||
/obj/structure/bed/New(var/newloc, var/new_material, var/new_padding_material)
|
||||
..(newloc)
|
||||
color = null
|
||||
if(!new_material)
|
||||
new_material = MAT_STEEL
|
||||
material = get_material_by_name(new_material)
|
||||
if(!istype(material))
|
||||
qdel(src)
|
||||
return
|
||||
if(new_padding_material)
|
||||
padding_material = get_material_by_name(new_padding_material)
|
||||
update_icon()
|
||||
|
||||
/obj/structure/bed/get_material()
|
||||
return material
|
||||
|
||||
// Reuse the cache/code from stools, todo maybe unify.
|
||||
/obj/structure/bed/update_icon()
|
||||
// Prep icon.
|
||||
icon_state = ""
|
||||
cut_overlays()
|
||||
// Base icon.
|
||||
var/cache_key = "[base_icon]-[material.name]"
|
||||
if(isnull(stool_cache[cache_key]))
|
||||
var/image/I = image(icon, base_icon)
|
||||
if(applies_material_colour) //VOREStation Add - Goes with added var
|
||||
I.color = material.icon_colour
|
||||
stool_cache[cache_key] = I
|
||||
add_overlay(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(icon, "[base_icon]_padding")
|
||||
I.color = padding_material.icon_colour
|
||||
stool_cache[padding_cache_key] = I
|
||||
add_overlay(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.use_name] and covered with [padding_material.use_name]."
|
||||
else
|
||||
name = "[material.display_name] [initial(name)]"
|
||||
desc += " It's made of [material.use_name]."
|
||||
|
||||
/obj/structure/bed/CanPass(atom/movable/mover, turf/target)
|
||||
if(istype(mover) && mover.checkpass(PASSTABLE))
|
||||
return TRUE
|
||||
return ..()
|
||||
|
||||
/obj/structure/bed/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
qdel(src)
|
||||
return
|
||||
if(2.0)
|
||||
if (prob(50))
|
||||
qdel(src)
|
||||
return
|
||||
if(3.0)
|
||||
if (prob(5))
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/obj/structure/bed/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(W.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, W.usesound, 50, 1)
|
||||
dismantle()
|
||||
qdel(src)
|
||||
else if(istype(W,/obj/item/stack))
|
||||
if(padding_material)
|
||||
to_chat(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
|
||||
//CHOMPEDIT START: making carpets different and not just the boring basic red no matter carpet type, consider merging material variables at stack level in future - Jack
|
||||
if(istype(W,/obj/item/stack/tile/carpet))
|
||||
var/obj/item/stack/tile/carpet/M = W
|
||||
if(M.material && (M.material.flags & MATERIAL_PADDING))
|
||||
padding_type = "[M.material.name]"
|
||||
//CHOMPEDIT END
|
||||
else if(istype(W,/obj/item/stack/material))
|
||||
var/obj/item/stack/material/M = W
|
||||
if(M.material && (M.material.flags & MATERIAL_PADDING))
|
||||
padding_type = "[M.material.name]"
|
||||
if(!padding_type)
|
||||
to_chat(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)
|
||||
to_chat(user, "You add padding to \the [src].")
|
||||
add_padding(padding_type)
|
||||
return
|
||||
|
||||
else if(W.has_tool_quality(TOOL_WIRECUTTER))
|
||||
if(!padding_material)
|
||||
to_chat(user, "\The [src] has no padding to remove.")
|
||||
return
|
||||
to_chat(user, "You remove the padding from \the [src].")
|
||||
playsound(src, W.usesound, 100, 1)
|
||||
remove_padding()
|
||||
|
||||
else if(istype(W, /obj/item/weapon/disk) || (istype(W, /obj/item/toy/plushie)))
|
||||
user.drop_from_inventory(W, get_turf(src))
|
||||
W.pixel_x = 10 //make sure they reach the pillow
|
||||
W.pixel_y = -6
|
||||
if(istype(W, /obj/item/weapon/disk))
|
||||
user.visible_message("<span class='notice'>[src] sleeps soundly. Sleep tight, disky.</span>")
|
||||
|
||||
else if(istype(W, /obj/item/weapon/grab))
|
||||
var/obj/item/weapon/grab/G = W
|
||||
var/mob/living/affecting = G.affecting
|
||||
if(has_buckled_mobs()) //Handles trying to buckle someone else to a chair when someone else is on it
|
||||
to_chat(user, "<span class='notice'>\The [src] already has someone buckled to it.</span>")
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] attempts to buckle [affecting] into \the [src]!</span>")
|
||||
if(do_after(user, 20, G.affecting))
|
||||
affecting.loc = loc
|
||||
spawn(0)
|
||||
if(buckle_mob(affecting))
|
||||
affecting.visible_message(\
|
||||
"<span class='danger'>[affecting.name] is buckled to [src] by [user.name]!</span>",\
|
||||
"<span class='danger'>You are buckled to [src] by [user.name]!</span>",\
|
||||
"<span class='notice'>You hear metal clanking.</span>")
|
||||
qdel(W)
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/structure/bed/proc/remove_padding()
|
||||
if(padding_material)
|
||||
padding_material.place_sheet(get_turf(src), 1)
|
||||
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), 1)
|
||||
if(padding_material)
|
||||
padding_material.place_sheet(get_turf(src), 1)
|
||||
|
||||
/obj/structure/bed/psych
|
||||
name = "psychiatrist's couch"
|
||||
desc = "For prime comfort during psychiatric evaluations."
|
||||
icon_state = "psychbed"
|
||||
base_icon = "psychbed"
|
||||
|
||||
/obj/structure/bed/psych/New(var/newloc)
|
||||
..(newloc,"wood","leather")
|
||||
|
||||
/obj/structure/bed/padded/New(var/newloc)
|
||||
..(newloc,"plastic","cotton")
|
||||
|
||||
/obj/structure/bed/double
|
||||
name = "double bed"
|
||||
icon_state = "doublebed"
|
||||
base_icon = "doublebed"
|
||||
|
||||
/obj/structure/bed/double/padded/New(var/newloc)
|
||||
..(newloc,"wood","cotton")
|
||||
|
||||
/obj/structure/bed/double/post_buckle_mob(mob/living/M as mob)
|
||||
if(M.buckled == src)
|
||||
M.pixel_y = 13
|
||||
M.old_y = 13
|
||||
else
|
||||
M.pixel_y = 0
|
||||
M.old_y = 0
|
||||
|
||||
/*
|
||||
* Roller beds
|
||||
*/
|
||||
/obj/structure/bed/roller
|
||||
name = "roller bed"
|
||||
desc = "A portable bed-on-wheels made for transporting medical patients."
|
||||
icon = 'icons/obj/rollerbed.dmi'
|
||||
icon_state = "rollerbed"
|
||||
anchored = FALSE
|
||||
surgery_odds = 50 //VOREStation Edit
|
||||
var/bedtype = /obj/structure/bed/roller
|
||||
var/rollertype = /obj/item/roller
|
||||
|
||||
/obj/structure/bed/roller/adv
|
||||
name = "advanced roller bed"
|
||||
icon_state = "rollerbedadv"
|
||||
bedtype = /obj/structure/bed/roller/adv
|
||||
rollertype = /obj/item/roller/adv
|
||||
|
||||
/obj/structure/bed/roller/update_icon()
|
||||
return
|
||||
|
||||
/obj/structure/bed/roller/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(W.has_tool_quality(TOOL_WRENCH) || istype(W,/obj/item/stack) || W.has_tool_quality(TOOL_WIRECUTTER))
|
||||
return
|
||||
else if(istype(W,/obj/item/roller_holder))
|
||||
if(has_buckled_mobs())
|
||||
for(var/A in buckled_mobs)
|
||||
user_unbuckle_mob(A, user)
|
||||
else
|
||||
visible_message("[user] collapses \the [src.name].")
|
||||
new rollertype(get_turf(src))
|
||||
spawn(0)
|
||||
qdel(src)
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/roller
|
||||
name = "roller bed"
|
||||
desc = "A collapsed roller bed that can be carried around."
|
||||
icon = 'icons/obj/rollerbed.dmi'
|
||||
icon_state = "folded_rollerbed"
|
||||
center_of_mass = list("x" = 17,"y" = 7)
|
||||
slot_flags = SLOT_BACK
|
||||
w_class = ITEMSIZE_LARGE
|
||||
var/rollertype = /obj/item/roller
|
||||
var/bedtype = /obj/structure/bed/roller
|
||||
drop_sound = 'sound/items/drop/axe.ogg'
|
||||
pickup_sound = 'sound/items/pickup/axe.ogg'
|
||||
|
||||
/obj/item/roller/attack_self(mob/user)
|
||||
var/obj/structure/bed/roller/R = new bedtype(user.loc)
|
||||
R.add_fingerprint(user)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/roller/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
|
||||
if(istype(W,/obj/item/roller_holder))
|
||||
var/obj/item/roller_holder/RH = W
|
||||
if(!RH.held)
|
||||
to_chat(user, "<span class='notice'>You collect the roller bed.</span>")
|
||||
src.loc = RH
|
||||
RH.held = src
|
||||
return
|
||||
|
||||
..()
|
||||
|
||||
/obj/item/roller/adv
|
||||
name = "advanced roller bed"
|
||||
desc = "A high-tech, compact version of the regular roller bed."
|
||||
icon_state = "folded_rollerbedadv"
|
||||
w_class = ITEMSIZE_NORMAL
|
||||
rollertype = /obj/item/roller/adv
|
||||
bedtype = /obj/structure/bed/roller/adv
|
||||
|
||||
/obj/item/roller_holder
|
||||
name = "roller bed rack"
|
||||
desc = "A rack for carrying a collapsed roller bed."
|
||||
icon = 'icons/obj/rollerbed.dmi'
|
||||
icon_state = "rollerbed"
|
||||
var/obj/item/roller/held
|
||||
|
||||
/obj/item/roller_holder/New()
|
||||
..()
|
||||
held = new /obj/item/roller(src)
|
||||
|
||||
/obj/item/roller_holder/attack_self(mob/user as mob)
|
||||
|
||||
if(!held)
|
||||
to_chat(user, "<span class='notice'>The rack is empty.</span>")
|
||||
return
|
||||
|
||||
to_chat(user, "<span class='notice'>You deploy the roller bed.</span>")
|
||||
var/obj/structure/bed/roller/R = new held.bedtype(user.loc)
|
||||
R.add_fingerprint(user)
|
||||
qdel(held)
|
||||
held = null
|
||||
|
||||
|
||||
/obj/structure/bed/roller/Moved(atom/old_loc, direction, forced = FALSE)
|
||||
. = ..()
|
||||
|
||||
playsound(src, 'sound/effects/roll.ogg', 100, 1)
|
||||
|
||||
/obj/structure/bed/roller/post_buckle_mob(mob/living/M as mob)
|
||||
if(M.buckled == src)
|
||||
M.pixel_y = 6
|
||||
M.old_y = 6
|
||||
density = TRUE
|
||||
icon_state = "[initial(icon_state)]_up"
|
||||
else
|
||||
M.pixel_y = 0
|
||||
M.old_y = 0
|
||||
density = FALSE
|
||||
icon_state = "[initial(icon_state)]"
|
||||
update_icon()
|
||||
return ..()
|
||||
|
||||
/obj/structure/bed/roller/MouseDrop(over_object, src_location, over_location)
|
||||
..()
|
||||
if((over_object == usr && (in_range(src, usr) || usr.contents.Find(src))))
|
||||
if(!ishuman(usr)) return
|
||||
if(has_buckled_mobs()) return 0
|
||||
visible_message("[usr] collapses \the [src.name].")
|
||||
new rollertype(get_turf(src))
|
||||
spawn(0)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/datum/category_item/catalogue/anomalous/precursor_a/alien_bed
|
||||
name = "Precursor Alpha Object - Resting Contraption"
|
||||
desc = "This appears to be a relatively long and flat object, with the top side being made of \
|
||||
an soft material, giving it very similar characteristics to an ordinary bed. If this object was \
|
||||
designed to act as a bed, this carries several implications for whatever species had built it, such as;\
|
||||
<br><br>\
|
||||
Being capable of experiencing comfort, or at least being able to suffer from some form of fatigue.<br>\
|
||||
Developing while under the influence of gravitational forces, to be able to 'lie' on the object.<br>\
|
||||
Being within a range of sizes in order for the object to function as a bed. Too small, and the species \
|
||||
would be unable to reach the top of the object. Too large, and they would have little room to contact \
|
||||
the top side of the object.<br>\
|
||||
<br><br>\
|
||||
As a note, the size of this object appears to be within the bounds for an average human to be able to \
|
||||
rest comfortably on top of it."
|
||||
value = CATALOGUER_REWARD_EASY
|
||||
|
||||
/obj/structure/bed/alien
|
||||
name = "resting contraption"
|
||||
desc = "Whatever species designed this must've enjoyed relaxation as well. Looks vaguely comfy."
|
||||
catalogue_data = list(/datum/category_item/catalogue/anomalous/precursor_a/alien_bed)
|
||||
icon = 'icons/obj/abductor.dmi'
|
||||
icon_state = "bed"
|
||||
|
||||
/obj/structure/bed/alien/update_icon()
|
||||
return // Doesn't care about material or anything else.
|
||||
|
||||
/obj/structure/bed/alien/attackby(obj/item/weapon/W, mob/user)
|
||||
return // No deconning.
|
||||
|
||||
/*
|
||||
* Dirty Mattress
|
||||
*/
|
||||
/obj/structure/dirtybed
|
||||
name = "dirty mattress"
|
||||
desc = "A stained matress. Guess it's better than sleeping on the floor."
|
||||
icon = 'icons/obj/furniture.dmi'
|
||||
icon_state = "dirtybed"
|
||||
pressure_resistance = 15
|
||||
anchored = TRUE
|
||||
can_buckle = TRUE
|
||||
buckle_dir = SOUTH
|
||||
buckle_lying = 1
|
||||
|
||||
/obj/structure/dirtybed/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(W.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, W.usesound, 100, 1)
|
||||
if(anchored)
|
||||
user.visible_message("[user] begins unsecuring \the [src] from the floor.", "You start unsecuring \the [src] from the floor.")
|
||||
else
|
||||
user.visible_message("[user] begins securing \the [src] to the floor.", "You start securing \the [src] to the floor.")
|
||||
|
||||
if(do_after(user, 20 * W.toolspeed))
|
||||
if(!src) return
|
||||
to_chat(user, "<span class='notice'>You [anchored? "un" : ""]secured \the [src]!</span>")
|
||||
anchored = !anchored
|
||||
return
|
||||
|
||||
if(!anchored)
|
||||
to_chat(user,"<span class='notice'> The bed isn't secured.</span>")
|
||||
return
|
||||
/* Beds... get your mind out of the gutter, they're for sleeping!
|
||||
* Contains:
|
||||
* Beds
|
||||
* Roller beds
|
||||
*/
|
||||
|
||||
/*
|
||||
* Beds
|
||||
*/
|
||||
/obj/structure/bed
|
||||
name = "bed"
|
||||
desc = "This is used to lie in, sleep in or strap on."
|
||||
icon = 'icons/obj/furniture.dmi'
|
||||
icon_state = "bed"
|
||||
pressure_resistance = 15
|
||||
anchored = TRUE
|
||||
can_buckle = TRUE
|
||||
buckle_dir = SOUTH
|
||||
buckle_lying = 1
|
||||
var/datum/material/material
|
||||
var/datum/material/padding_material
|
||||
var/base_icon = "bed"
|
||||
var/applies_material_colour = 1
|
||||
|
||||
/obj/structure/bed/New(var/newloc, var/new_material, var/new_padding_material)
|
||||
..(newloc)
|
||||
color = null
|
||||
if(!new_material)
|
||||
new_material = MAT_STEEL
|
||||
material = get_material_by_name(new_material)
|
||||
if(!istype(material))
|
||||
qdel(src)
|
||||
return
|
||||
if(new_padding_material)
|
||||
padding_material = get_material_by_name(new_padding_material)
|
||||
update_icon()
|
||||
|
||||
/obj/structure/bed/get_material()
|
||||
return material
|
||||
|
||||
// Reuse the cache/code from stools, todo maybe unify.
|
||||
/obj/structure/bed/update_icon()
|
||||
// Prep icon.
|
||||
icon_state = ""
|
||||
cut_overlays()
|
||||
// Base icon.
|
||||
var/cache_key = "[base_icon]-[material.name]"
|
||||
if(isnull(stool_cache[cache_key]))
|
||||
var/image/I = image(icon, base_icon)
|
||||
if(applies_material_colour) //VOREStation Add - Goes with added var
|
||||
I.color = material.icon_colour
|
||||
stool_cache[cache_key] = I
|
||||
add_overlay(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(icon, "[base_icon]_padding")
|
||||
I.color = padding_material.icon_colour
|
||||
stool_cache[padding_cache_key] = I
|
||||
add_overlay(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.use_name] and covered with [padding_material.use_name]."
|
||||
else
|
||||
name = "[material.display_name] [initial(name)]"
|
||||
desc += " It's made of [material.use_name]."
|
||||
|
||||
/obj/structure/bed/CanPass(atom/movable/mover, turf/target)
|
||||
if(istype(mover) && mover.checkpass(PASSTABLE))
|
||||
return TRUE
|
||||
return ..()
|
||||
|
||||
/obj/structure/bed/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
qdel(src)
|
||||
return
|
||||
if(2.0)
|
||||
if (prob(50))
|
||||
qdel(src)
|
||||
return
|
||||
if(3.0)
|
||||
if (prob(5))
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/obj/structure/bed/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(W.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, W.usesound, 50, 1)
|
||||
dismantle()
|
||||
qdel(src)
|
||||
else if(istype(W,/obj/item/stack))
|
||||
if(padding_material)
|
||||
to_chat(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
|
||||
//CHOMPEDIT START: making carpets different and not just the boring basic red no matter carpet type, consider merging material variables at stack level in future - Jack
|
||||
if(istype(W,/obj/item/stack/tile/carpet))
|
||||
var/obj/item/stack/tile/carpet/M = W
|
||||
if(M.material && (M.material.flags & MATERIAL_PADDING))
|
||||
padding_type = "[M.material.name]"
|
||||
//CHOMPEDIT END
|
||||
else if(istype(W,/obj/item/stack/material))
|
||||
var/obj/item/stack/material/M = W
|
||||
if(M.material && (M.material.flags & MATERIAL_PADDING))
|
||||
padding_type = "[M.material.name]"
|
||||
if(!padding_type)
|
||||
to_chat(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)
|
||||
to_chat(user, "You add padding to \the [src].")
|
||||
add_padding(padding_type)
|
||||
return
|
||||
|
||||
else if(W.has_tool_quality(TOOL_WIRECUTTER))
|
||||
if(!padding_material)
|
||||
to_chat(user, "\The [src] has no padding to remove.")
|
||||
return
|
||||
to_chat(user, "You remove the padding from \the [src].")
|
||||
playsound(src, W.usesound, 100, 1)
|
||||
remove_padding()
|
||||
|
||||
else if(istype(W, /obj/item/weapon/disk) || (istype(W, /obj/item/toy/plushie)))
|
||||
user.drop_from_inventory(W, get_turf(src))
|
||||
W.pixel_x = 10 //make sure they reach the pillow
|
||||
W.pixel_y = -6
|
||||
if(istype(W, /obj/item/weapon/disk))
|
||||
user.visible_message("<span class='notice'>[src] sleeps soundly. Sleep tight, disky.</span>")
|
||||
|
||||
else if(istype(W, /obj/item/weapon/grab))
|
||||
var/obj/item/weapon/grab/G = W
|
||||
var/mob/living/affecting = G.affecting
|
||||
if(has_buckled_mobs()) //Handles trying to buckle someone else to a chair when someone else is on it
|
||||
to_chat(user, "<span class='notice'>\The [src] already has someone buckled to it.</span>")
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] attempts to buckle [affecting] into \the [src]!</span>")
|
||||
if(do_after(user, 20, G.affecting))
|
||||
affecting.loc = loc
|
||||
spawn(0)
|
||||
if(buckle_mob(affecting))
|
||||
affecting.visible_message(\
|
||||
"<span class='danger'>[affecting.name] is buckled to [src] by [user.name]!</span>",\
|
||||
"<span class='danger'>You are buckled to [src] by [user.name]!</span>",\
|
||||
"<span class='notice'>You hear metal clanking.</span>")
|
||||
qdel(W)
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/structure/bed/proc/remove_padding()
|
||||
if(padding_material)
|
||||
padding_material.place_sheet(get_turf(src), 1)
|
||||
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), 1)
|
||||
if(padding_material)
|
||||
padding_material.place_sheet(get_turf(src), 1)
|
||||
|
||||
/obj/structure/bed/psych
|
||||
name = "psychiatrist's couch"
|
||||
desc = "For prime comfort during psychiatric evaluations."
|
||||
icon_state = "psychbed"
|
||||
base_icon = "psychbed"
|
||||
|
||||
/obj/structure/bed/psych/New(var/newloc)
|
||||
..(newloc,"wood","leather")
|
||||
|
||||
/obj/structure/bed/padded/New(var/newloc)
|
||||
..(newloc,"plastic","cotton")
|
||||
|
||||
/obj/structure/bed/double
|
||||
name = "double bed"
|
||||
icon_state = "doublebed"
|
||||
base_icon = "doublebed"
|
||||
|
||||
/obj/structure/bed/double/padded/New(var/newloc)
|
||||
..(newloc,"wood","cotton")
|
||||
|
||||
/obj/structure/bed/double/post_buckle_mob(mob/living/M as mob)
|
||||
if(M.buckled == src)
|
||||
M.pixel_y = 13
|
||||
M.old_y = 13
|
||||
else
|
||||
M.pixel_y = 0
|
||||
M.old_y = 0
|
||||
|
||||
/*
|
||||
* Roller beds
|
||||
*/
|
||||
/obj/structure/bed/roller
|
||||
name = "roller bed"
|
||||
desc = "A portable bed-on-wheels made for transporting medical patients."
|
||||
icon = 'icons/obj/rollerbed.dmi'
|
||||
icon_state = "rollerbed"
|
||||
anchored = FALSE
|
||||
surgery_odds = 50 //VOREStation Edit
|
||||
var/bedtype = /obj/structure/bed/roller
|
||||
var/rollertype = /obj/item/roller
|
||||
|
||||
/obj/structure/bed/roller/adv
|
||||
name = "advanced roller bed"
|
||||
icon_state = "rollerbedadv"
|
||||
bedtype = /obj/structure/bed/roller/adv
|
||||
rollertype = /obj/item/roller/adv
|
||||
|
||||
/obj/structure/bed/roller/update_icon()
|
||||
return
|
||||
|
||||
/obj/structure/bed/roller/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(W.has_tool_quality(TOOL_WRENCH) || istype(W,/obj/item/stack) || W.has_tool_quality(TOOL_WIRECUTTER))
|
||||
return
|
||||
else if(istype(W,/obj/item/roller_holder))
|
||||
if(has_buckled_mobs())
|
||||
for(var/A in buckled_mobs)
|
||||
user_unbuckle_mob(A, user)
|
||||
else
|
||||
visible_message("[user] collapses \the [src.name].")
|
||||
new rollertype(get_turf(src))
|
||||
spawn(0)
|
||||
qdel(src)
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/roller
|
||||
name = "roller bed"
|
||||
desc = "A collapsed roller bed that can be carried around."
|
||||
icon = 'icons/obj/rollerbed.dmi'
|
||||
icon_state = "folded_rollerbed"
|
||||
center_of_mass = list("x" = 17,"y" = 7)
|
||||
slot_flags = SLOT_BACK
|
||||
w_class = ITEMSIZE_LARGE
|
||||
var/rollertype = /obj/item/roller
|
||||
var/bedtype = /obj/structure/bed/roller
|
||||
drop_sound = 'sound/items/drop/axe.ogg'
|
||||
pickup_sound = 'sound/items/pickup/axe.ogg'
|
||||
|
||||
/obj/item/roller/attack_self(mob/user)
|
||||
var/obj/structure/bed/roller/R = new bedtype(user.loc)
|
||||
R.add_fingerprint(user)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/roller/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
|
||||
if(istype(W,/obj/item/roller_holder))
|
||||
var/obj/item/roller_holder/RH = W
|
||||
if(!RH.held)
|
||||
to_chat(user, "<span class='notice'>You collect the roller bed.</span>")
|
||||
src.loc = RH
|
||||
RH.held = src
|
||||
return
|
||||
|
||||
..()
|
||||
|
||||
/obj/item/roller/adv
|
||||
name = "advanced roller bed"
|
||||
desc = "A high-tech, compact version of the regular roller bed."
|
||||
icon_state = "folded_rollerbedadv"
|
||||
w_class = ITEMSIZE_NORMAL
|
||||
rollertype = /obj/item/roller/adv
|
||||
bedtype = /obj/structure/bed/roller/adv
|
||||
|
||||
/obj/item/roller_holder
|
||||
name = "roller bed rack"
|
||||
desc = "A rack for carrying a collapsed roller bed."
|
||||
icon = 'icons/obj/rollerbed.dmi'
|
||||
icon_state = "rollerbed"
|
||||
var/obj/item/roller/held
|
||||
|
||||
/obj/item/roller_holder/New()
|
||||
..()
|
||||
held = new /obj/item/roller(src)
|
||||
|
||||
/obj/item/roller_holder/attack_self(mob/user as mob)
|
||||
|
||||
if(!held)
|
||||
to_chat(user, "<span class='notice'>The rack is empty.</span>")
|
||||
return
|
||||
|
||||
to_chat(user, "<span class='notice'>You deploy the roller bed.</span>")
|
||||
var/obj/structure/bed/roller/R = new held.bedtype(user.loc)
|
||||
R.add_fingerprint(user)
|
||||
qdel(held)
|
||||
held = null
|
||||
|
||||
|
||||
/obj/structure/bed/roller/Moved(atom/old_loc, direction, forced = FALSE)
|
||||
. = ..()
|
||||
|
||||
playsound(src, 'sound/effects/roll.ogg', 100, 1)
|
||||
|
||||
/obj/structure/bed/roller/post_buckle_mob(mob/living/M as mob)
|
||||
if(M.buckled == src)
|
||||
M.pixel_y = 6
|
||||
M.old_y = 6
|
||||
density = TRUE
|
||||
icon_state = "[initial(icon_state)]_up"
|
||||
else
|
||||
M.pixel_y = 0
|
||||
M.old_y = 0
|
||||
density = FALSE
|
||||
icon_state = "[initial(icon_state)]"
|
||||
update_icon()
|
||||
return ..()
|
||||
|
||||
/obj/structure/bed/roller/MouseDrop(over_object, src_location, over_location)
|
||||
..()
|
||||
if((over_object == usr && (in_range(src, usr) || usr.contents.Find(src))))
|
||||
if(!ishuman(usr)) return
|
||||
if(has_buckled_mobs()) return 0
|
||||
visible_message("[usr] collapses \the [src.name].")
|
||||
new rollertype(get_turf(src))
|
||||
spawn(0)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/datum/category_item/catalogue/anomalous/precursor_a/alien_bed
|
||||
name = "Precursor Alpha Object - Resting Contraption"
|
||||
desc = "This appears to be a relatively long and flat object, with the top side being made of \
|
||||
an soft material, giving it very similar characteristics to an ordinary bed. If this object was \
|
||||
designed to act as a bed, this carries several implications for whatever species had built it, such as;\
|
||||
<br><br>\
|
||||
Being capable of experiencing comfort, or at least being able to suffer from some form of fatigue.<br>\
|
||||
Developing while under the influence of gravitational forces, to be able to 'lie' on the object.<br>\
|
||||
Being within a range of sizes in order for the object to function as a bed. Too small, and the species \
|
||||
would be unable to reach the top of the object. Too large, and they would have little room to contact \
|
||||
the top side of the object.<br>\
|
||||
<br><br>\
|
||||
As a note, the size of this object appears to be within the bounds for an average human to be able to \
|
||||
rest comfortably on top of it."
|
||||
value = CATALOGUER_REWARD_EASY
|
||||
|
||||
/obj/structure/bed/alien
|
||||
name = "resting contraption"
|
||||
desc = "Whatever species designed this must've enjoyed relaxation as well. Looks vaguely comfy."
|
||||
catalogue_data = list(/datum/category_item/catalogue/anomalous/precursor_a/alien_bed)
|
||||
icon = 'icons/obj/abductor.dmi'
|
||||
icon_state = "bed"
|
||||
|
||||
/obj/structure/bed/alien/update_icon()
|
||||
return // Doesn't care about material or anything else.
|
||||
|
||||
/obj/structure/bed/alien/attackby(obj/item/weapon/W, mob/user)
|
||||
return // No deconning.
|
||||
|
||||
/*
|
||||
* Dirty Mattress
|
||||
*/
|
||||
/obj/structure/dirtybed
|
||||
name = "dirty mattress"
|
||||
desc = "A stained matress. Guess it's better than sleeping on the floor."
|
||||
icon = 'icons/obj/furniture.dmi'
|
||||
icon_state = "dirtybed"
|
||||
pressure_resistance = 15
|
||||
anchored = TRUE
|
||||
can_buckle = TRUE
|
||||
buckle_dir = SOUTH
|
||||
buckle_lying = 1
|
||||
|
||||
/obj/structure/dirtybed/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(W.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, W.usesound, 100, 1)
|
||||
if(anchored)
|
||||
user.visible_message("[user] begins unsecuring \the [src] from the floor.", "You start unsecuring \the [src] from the floor.")
|
||||
else
|
||||
user.visible_message("[user] begins securing \the [src] to the floor.", "You start securing \the [src] to the floor.")
|
||||
|
||||
if(do_after(user, 20 * W.toolspeed))
|
||||
if(!src) return
|
||||
to_chat(user, "<span class='notice'>You [anchored? "un" : ""]secured \the [src]!</span>")
|
||||
anchored = !anchored
|
||||
return
|
||||
|
||||
if(!anchored)
|
||||
to_chat(user,"<span class='notice'> The bed isn't secured.</span>")
|
||||
return
|
||||
|
||||
@@ -1,155 +1,155 @@
|
||||
//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/furniture_vr.dmi' //VOREStation Edit - new Icons
|
||||
icon_state = "stool_preview" //set for the map
|
||||
randpixel = 0
|
||||
center_of_mass = null
|
||||
force = 10
|
||||
throwforce = 10
|
||||
w_class = ITEMSIZE_HUGE
|
||||
var/base_icon = "stool_base"
|
||||
var/datum/material/material
|
||||
var/datum/material/padding_material
|
||||
|
||||
/obj/item/weapon/stool/padded
|
||||
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 = MAT_STEEL
|
||||
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)
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/stool/padded/New(var/newloc, var/new_material)
|
||||
..(newloc,"steel",MAT_CARPET) //CHOMPstation edit: New tile material system
|
||||
|
||||
/obj/item/weapon/stool/update_icon()
|
||||
// Prep icon.
|
||||
icon_state = ""
|
||||
cut_overlays()
|
||||
// Base icon.
|
||||
var/cache_key = "[base_icon]-[material.name]"
|
||||
if(isnull(stool_cache[cache_key]))
|
||||
var/image/I = image(icon, base_icon)
|
||||
I.color = material.icon_colour
|
||||
stool_cache[cache_key] = I
|
||||
add_overlay(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(icon, "[base_icon]_padding") //VOREStation Edit
|
||||
I.color = padding_material.icon_colour
|
||||
stool_cache[padding_cache_key] = I
|
||||
add_overlay(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 padded stool. Apply butt. It's made of [material.use_name] and covered with [padding_material.use_name]."
|
||||
else
|
||||
name = "[material.display_name] [initial(name)]"
|
||||
desc = "A stool. Apply butt with care. It's made of [material.use_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), 1)
|
||||
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("<span class='danger'>[user] breaks [src] over [M]'s back!</span>")
|
||||
user.setClickCooldown(user.get_attack_speed())
|
||||
user.do_attack_animation(M)
|
||||
|
||||
user.drop_from_inventory(src)
|
||||
|
||||
user.remove_from_mob(src)
|
||||
dismantle()
|
||||
qdel(src)
|
||||
var/mob/living/T = M
|
||||
T.Weaken(10)
|
||||
T.apply_damage(20)
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/weapon/stool/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
qdel(src)
|
||||
return
|
||||
if(2.0)
|
||||
if (prob(50))
|
||||
qdel(src)
|
||||
return
|
||||
if(3.0)
|
||||
if (prob(5))
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/obj/item/weapon/stool/proc/dismantle()
|
||||
if(material)
|
||||
material.place_sheet(get_turf(src), 1)
|
||||
if(padding_material)
|
||||
padding_material.place_sheet(get_turf(src), 1)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/weapon/stool/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(W.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, W.usesound, 50, 1)
|
||||
dismantle()
|
||||
qdel(src)
|
||||
else if(istype(W,/obj/item/stack))
|
||||
if(padding_material)
|
||||
to_chat(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
|
||||
//CHOMPstation Start: making carpets different and not just the boring basic red no matter carpet type, consider merging material variables at stack level in future - Jack
|
||||
if(istype(W,/obj/item/stack/tile/carpet))
|
||||
var/obj/item/stack/tile/carpet/M = W
|
||||
if(M.material && (M.material.flags & MATERIAL_PADDING))
|
||||
padding_type = "[M.material.name]"
|
||||
//CHOMPstation END
|
||||
else if(istype(W,/obj/item/stack/material))
|
||||
var/obj/item/stack/material/M = W
|
||||
if(M.material && (M.material.flags & MATERIAL_PADDING))
|
||||
padding_type = "[M.material.name]"
|
||||
if(!padding_type)
|
||||
to_chat(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)
|
||||
to_chat(user, "You add padding to \the [src].")
|
||||
add_padding(padding_type)
|
||||
return
|
||||
else if (W.has_tool_quality(TOOL_WIRECUTTER))
|
||||
if(!padding_material)
|
||||
to_chat(user, "\The [src] has no padding to remove.")
|
||||
return
|
||||
to_chat(user, "You remove the padding from \the [src].")
|
||||
playsound(src, W.usesound, 50, 1)
|
||||
remove_padding()
|
||||
else
|
||||
..()
|
||||
//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/furniture_vr.dmi' //VOREStation Edit - new Icons
|
||||
icon_state = "stool_preview" //set for the map
|
||||
randpixel = 0
|
||||
center_of_mass = null
|
||||
force = 10
|
||||
throwforce = 10
|
||||
w_class = ITEMSIZE_HUGE
|
||||
var/base_icon = "stool_base"
|
||||
var/datum/material/material
|
||||
var/datum/material/padding_material
|
||||
|
||||
/obj/item/weapon/stool/padded
|
||||
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 = MAT_STEEL
|
||||
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)
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/stool/padded/New(var/newloc, var/new_material)
|
||||
..(newloc,"steel",MAT_CARPET) //CHOMPstation edit: New tile material system
|
||||
|
||||
/obj/item/weapon/stool/update_icon()
|
||||
// Prep icon.
|
||||
icon_state = ""
|
||||
cut_overlays()
|
||||
// Base icon.
|
||||
var/cache_key = "[base_icon]-[material.name]"
|
||||
if(isnull(stool_cache[cache_key]))
|
||||
var/image/I = image(icon, base_icon)
|
||||
I.color = material.icon_colour
|
||||
stool_cache[cache_key] = I
|
||||
add_overlay(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(icon, "[base_icon]_padding") //VOREStation Edit
|
||||
I.color = padding_material.icon_colour
|
||||
stool_cache[padding_cache_key] = I
|
||||
add_overlay(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 padded stool. Apply butt. It's made of [material.use_name] and covered with [padding_material.use_name]."
|
||||
else
|
||||
name = "[material.display_name] [initial(name)]"
|
||||
desc = "A stool. Apply butt with care. It's made of [material.use_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), 1)
|
||||
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("<span class='danger'>[user] breaks [src] over [M]'s back!</span>")
|
||||
user.setClickCooldown(user.get_attack_speed())
|
||||
user.do_attack_animation(M)
|
||||
|
||||
user.drop_from_inventory(src)
|
||||
|
||||
user.remove_from_mob(src)
|
||||
dismantle()
|
||||
qdel(src)
|
||||
var/mob/living/T = M
|
||||
T.Weaken(10)
|
||||
T.apply_damage(20)
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/weapon/stool/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
qdel(src)
|
||||
return
|
||||
if(2.0)
|
||||
if (prob(50))
|
||||
qdel(src)
|
||||
return
|
||||
if(3.0)
|
||||
if (prob(5))
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/obj/item/weapon/stool/proc/dismantle()
|
||||
if(material)
|
||||
material.place_sheet(get_turf(src), 1)
|
||||
if(padding_material)
|
||||
padding_material.place_sheet(get_turf(src), 1)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/weapon/stool/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(W.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, W.usesound, 50, 1)
|
||||
dismantle()
|
||||
qdel(src)
|
||||
else if(istype(W,/obj/item/stack))
|
||||
if(padding_material)
|
||||
to_chat(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
|
||||
//CHOMPstation Start: making carpets different and not just the boring basic red no matter carpet type, consider merging material variables at stack level in future - Jack
|
||||
if(istype(W,/obj/item/stack/tile/carpet))
|
||||
var/obj/item/stack/tile/carpet/M = W
|
||||
if(M.material && (M.material.flags & MATERIAL_PADDING))
|
||||
padding_type = "[M.material.name]"
|
||||
//CHOMPstation END
|
||||
else if(istype(W,/obj/item/stack/material))
|
||||
var/obj/item/stack/material/M = W
|
||||
if(M.material && (M.material.flags & MATERIAL_PADDING))
|
||||
padding_type = "[M.material.name]"
|
||||
if(!padding_type)
|
||||
to_chat(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)
|
||||
to_chat(user, "You add padding to \the [src].")
|
||||
add_padding(padding_type)
|
||||
return
|
||||
else if (W.has_tool_quality(TOOL_WIRECUTTER))
|
||||
if(!padding_material)
|
||||
to_chat(user, "\The [src] has no padding to remove.")
|
||||
return
|
||||
to_chat(user, "You remove the padding from \the [src].")
|
||||
playsound(src, W.usesound, 50, 1)
|
||||
remove_padding()
|
||||
else
|
||||
..()
|
||||
|
||||
Reference in New Issue
Block a user