Files
VOREStation/code/game/turfs/simulated/floor_attackby.dm

90 lines
3.5 KiB
Plaintext

/turf/simulated/floor/attackby(obj/item/C as obj, mob/user as mob)
if(!C || !user)
return 0
if(flooring)
if(istype(C, /obj/item/weapon/crowbar))
if(broken || burnt)
user << "<span class='notice'>You remove the broken [flooring.descriptor].</span>"
make_plating()
else if(flooring.flags & TURF_IS_FRAGILE)
user << "<span class='danger'>You forcefully pry off the [flooring.descriptor], destroying them in the process.</span>"
make_plating()
else if(flooring.flags & TURF_REMOVE_CROWBAR)
user << "<span class='notice'>You lever off the [flooring.descriptor].</span>"
make_plating(1)
else
return
playsound(src, 'sound/items/Crowbar.ogg', 80, 1)
return
else if(istype(C, /obj/item/weapon/screwdriver) && (flooring.flags & TURF_REMOVE_SCREWDRIVER))
if(broken || burnt)
return
user << "<span class='notice'>You unscrew and remove the [flooring.descriptor].</span>"
make_plating(1)
playsound(src, 'sound/items/Screwdriver.ogg', 80, 1)
return
else if(istype(C, /obj/item/weapon/wrench) && (flooring.flags & TURF_REMOVE_WRENCH))
user << "<span class='notice'>You unwrench and remove the [flooring.descriptor].</span>"
make_plating(1)
playsound(src, 'sound/items/Ratchet.ogg', 80, 1)
return
else if(istype(C, /obj/item/weapon/shovel) && (flooring.flags & TURF_REMOVE_SHOVEL))
user << "<span class='notice'>You shovel off the [flooring.descriptor].</span>"
make_plating(1)
playsound(src, 'sound/items/Deconstruct.ogg', 80, 1)
return
else if(istype(C, /obj/item/stack/cable_coil))
user << "<span class='warning'>You must remove the [flooring.descriptor] first.</span>"
return
else
if(istype(C, /obj/item/stack/cable_coil))
if(broken || burnt)
user << "<span class='warning'>This section is too damaged to support anything. Use a welder to fix the damage.</span>"
return
var/obj/item/stack/cable_coil/coil = C
coil.turf_place(src, user)
return
else if(istype(C, /obj/item/stack))
if(broken || burnt)
user << "<span class='warning'>This section is too damaged to support anything. Use a welder to fix the damage.</span>"
return
var/obj/item/stack/S = C
var/decl/flooring/use_flooring
for(var/flooring_type in flooring_types)
var/decl/flooring/F = flooring_types[flooring_type]
if(!F.build_type)
continue
if((S.type == F.build_type) || (S.build_type == F.build_type))
use_flooring = F
break
if(!use_flooring)
return
// Do we have enough?
if(use_flooring.build_cost && S.amount < use_flooring.build_cost)
user << "<span class='warning'>You require at least [use_flooring.build_cost] [S.name] to complete the [use_flooring.descriptor].</span>"
return
// Stay still and focus...
if(use_flooring.build_time && !do_after(user, use_flooring.build_time))
return
if(flooring || !S || !user || !use_flooring)
return
if(S.use(use_flooring.build_cost))
set_flooring(use_flooring)
playsound(src, 'sound/items/Deconstruct.ogg', 80, 1)
return
// Repairs.
else if(istype(C, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/welder = C
if(welder.isOn() && (is_plating()))
if(broken || burnt)
if(welder.remove_fuel(0,user))
user << "<span class='notice'>You fix some dents on the broken plating.</span>"
playsound(src, 'sound/items/Welder.ogg', 80, 1)
icon_state = "plating"
burnt = null
broken = null
else
user << "<span class='warning'>You need more welding fuel to complete this task.</span>"