mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-19 10:59:39 +01:00
For a robust crafting system, I need a new materials framework. For a new materials framework, I need to clean up reagents. To clean up reagents, I need to pare down foods from reagent holders. To pare down foods from reagent holders, I need to port edibility components. To port edibility components, I need to port processing components. To port processing components, I need to port tool behaviors. This is all back-end code, no new features or functionality from this.
156 lines
6.0 KiB
Plaintext
156 lines
6.0 KiB
Plaintext
/turf/simulated/floor/attackby(obj/item/attacking_item, mob/user)
|
|
|
|
if(!attacking_item || !user)
|
|
return 0
|
|
|
|
if(flooring && (!ismob(user) || user.a_intent != I_HURT))
|
|
if(attacking_item.tool_behaviour == TOOL_CROWBAR)
|
|
if(broken || burnt)
|
|
to_chat(user, SPAN_NOTICE("You remove the broken [flooring.descriptor]."))
|
|
make_plating()
|
|
else if(flooring.flags & TURF_IS_FRAGILE)
|
|
to_chat(user, SPAN_DANGER("You forcefully pry off the [flooring.descriptor], destroying them in the process."))
|
|
make_plating()
|
|
else if(flooring.flags & TURF_REMOVE_CROWBAR)
|
|
to_chat(user, SPAN_NOTICE("You lever off the [flooring.descriptor]."))
|
|
make_plating(1)
|
|
else
|
|
return
|
|
playsound(src, 'sound/items/crowbar_tile.ogg', 80, 1)
|
|
return
|
|
else if(attacking_item.tool_behaviour == TOOL_SCREWDRIVER && (flooring.flags & TURF_REMOVE_SCREWDRIVER))
|
|
if(broken || burnt)
|
|
return
|
|
to_chat(user, SPAN_NOTICE("You unscrew and remove the [flooring.descriptor]."))
|
|
make_plating(1)
|
|
attacking_item.play_tool_sound(get_turf(src), 80)
|
|
return
|
|
else if(attacking_item.tool_behaviour == TOOL_WRENCH && (flooring.flags & TURF_REMOVE_WRENCH))
|
|
to_chat(user, SPAN_NOTICE("You unwrench and remove the [flooring.descriptor]."))
|
|
make_plating(1)
|
|
attacking_item.play_tool_sound(get_turf(src), 80)
|
|
return
|
|
else if(istype(attacking_item, /obj/item/shovel) && (flooring.flags & TURF_REMOVE_SHOVEL))
|
|
to_chat(user, SPAN_NOTICE("You shovel off the [flooring.descriptor]."))
|
|
make_plating(1)
|
|
attacking_item.play_tool_sound(get_turf(src), 80)
|
|
return
|
|
else if(attacking_item.tool_behaviour == TOOL_WELDER && (flooring.flags & TURF_REMOVE_WELDER))
|
|
var/obj/item/weldingtool/WT = attacking_item
|
|
if(!WT.isOn())
|
|
to_chat(user, SPAN_WARNING("\The [WT] isn't turned on."))
|
|
return
|
|
if(WT.use(0, user))
|
|
to_chat(user, SPAN_NOTICE("You use \the [WT] to remove \the [src]."))
|
|
make_plating(1)
|
|
attacking_item.play_tool_sound(get_turf(src), 80)
|
|
return
|
|
else if(attacking_item.tool_behaviour == TOOL_CABLECOIL)
|
|
to_chat(user, SPAN_WARNING("You must remove the [flooring.descriptor] first."))
|
|
return
|
|
else
|
|
|
|
if(attacking_item.tool_behaviour == TOOL_CABLECOIL)
|
|
if(broken || burnt)
|
|
to_chat(user, SPAN_WARNING("This section is too damaged to support anything. Use a welder to fix the damage."))
|
|
return
|
|
var/obj/item/stack/cable_coil/coil = attacking_item
|
|
coil.turf_place(src, user)
|
|
return
|
|
else if(istype(attacking_item, /obj/item/stack))
|
|
if(broken || burnt)
|
|
to_chat(user, SPAN_WARNING("This section is too damaged to support anything. Use a welder to fix the damage."))
|
|
return
|
|
var/obj/item/stack/S = attacking_item
|
|
var/singleton/flooring/use_flooring
|
|
var/list/decls = GET_SINGLETON_SUBTYPE_MAP(/singleton/flooring)
|
|
for(var/flooring_type in decls)
|
|
var/singleton/flooring/F = decls[flooring_type]
|
|
if(!F.build_type)
|
|
continue
|
|
if((ispath(S.type, F.build_type) && (S.type == F.build_type)) || (ispath(S.build_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.get_amount() < use_flooring.build_cost)
|
|
to_chat(user, SPAN_WARNING("You require at least [use_flooring.build_cost] [S.name] to complete the [use_flooring.descriptor]."))
|
|
return
|
|
// Stay still and focus...
|
|
if(use_flooring.build_time && !do_after(user, use_flooring.build_time, flooring, DO_REPAIR_CONSTRUCT))
|
|
return
|
|
if(flooring || !S || !user || !use_flooring)
|
|
return
|
|
if(S.use(use_flooring.build_cost))
|
|
set_flooring(use_flooring)
|
|
update_icon(TRUE)
|
|
playsound(src, 'sound/items/Deconstruct.ogg', 80, 1)
|
|
return
|
|
// Repairs and deconstruction
|
|
else if(attacking_item.tool_behaviour == TOOL_CROWBAR)
|
|
var/area/A = get_area(src)
|
|
if(A && (A.area_flags & AREA_FLAG_INDESTRUCTIBLE_TURFS))
|
|
return
|
|
if(broken || burnt)
|
|
playsound(src, 'sound/items/crowbar_tile.ogg', 80, 1)
|
|
visible_message(SPAN_NOTICE("[user] has begun prying off the damaged plating."))
|
|
var/turf/T = GET_TURF_BELOW(src)
|
|
if(T)
|
|
T.visible_message(SPAN_WARNING("The ceiling above looks as if it's being pried off."))
|
|
if(do_after(user, 10 SECONDS))
|
|
if(!istype(src, /turf/simulated/floor))
|
|
return
|
|
if(broken || burnt && !(is_plating()))
|
|
return
|
|
visible_message(SPAN_WARNING("[user] has pried off the damaged plating."))
|
|
new /obj/item/stack/tile/floor(src)
|
|
src.ReplaceWithLattice()
|
|
playsound(src, 'sound/items/Deconstruct.ogg', 80, 1)
|
|
if(T)
|
|
T.visible_message(SPAN_DANGER("The ceiling above has been pried off!"))
|
|
return
|
|
return
|
|
else if(attacking_item.tool_behaviour == TOOL_WELDER)
|
|
var/obj/item/weldingtool/welder = attacking_item
|
|
if(welder.isOn() && (is_plating()))
|
|
if(broken || burnt)
|
|
if(do_after(user, 5 SECONDS))
|
|
if(welder.use(0, user))
|
|
to_chat(user, SPAN_NOTICE("You fix some dents on the broken plating."))
|
|
playsound(src, 'sound/items/Welder.ogg', 80, 1)
|
|
icon_state = "plating"
|
|
burnt = null
|
|
broken = null
|
|
else
|
|
to_chat(user, SPAN_WARNING("You need more welding fuel to complete this task."))
|
|
return
|
|
else
|
|
if(welder.use(0, user))
|
|
playsound(src, 'sound/items/Welder.ogg', 80, 1)
|
|
visible_message(SPAN_NOTICE("[user] has started melting the plating's reinforcements!"))
|
|
if(welder.use_tool(src, user, 100, volume = 80) && welder.isOn() && welder_melt())
|
|
visible_message(SPAN_WARNING("[user] has melted the plating's reinforcements! It should be possible to pry it off."))
|
|
playsound(src, 'sound/items/Welder.ogg', 80, 1)
|
|
return
|
|
|
|
if(istype(attacking_item,/obj/item/floor_frame))
|
|
var/obj/item/floor_frame/F = attacking_item
|
|
F.try_build(src, user)
|
|
return
|
|
|
|
return ..()
|
|
|
|
/turf/simulated/floor/proc/welder_melt()
|
|
if(!(is_plating()) || broken || burnt)
|
|
return 0
|
|
burnt = 1
|
|
update_icon()
|
|
return 1
|
|
|
|
/turf/simulated/floor/can_lay_cable()
|
|
return !flooring
|
|
|
|
/turf/simulated/can_have_cabling()
|
|
return TRUE
|