Construction Stuff (#9379)

This commit is contained in:
Geeves
2020-07-30 11:33:18 +02:00
committed by GitHub
parent 70bd14e30b
commit e8102248c3
10 changed files with 221 additions and 131 deletions
+43
View File
@@ -0,0 +1,43 @@
/obj/effect/overlay/burnt_wall
name = "burnt wall"
desc = "A wall that had a hole burnt into it. Nasty."
icon = 'icons/turf/flooring/plating.dmi'
icon_state = "wall_thermite"
var/material/material
var/material/reinf_material
/obj/effect/overlay/burnt_wall/Initialize(mapload, var/new_name, var/material/new_mat, var/material/new_reinf_mat)
. = ..()
name = "burnt [new_name]"
material = new_mat
if(new_reinf_mat)
reinf_material = new_reinf_mat
color = material.icon_colour
if(material.opacity < 0.5)
alpha = 125
/obj/effect/overlay/burnt_wall/attackby(obj/item/I, mob/user)
if(I.iswelder())
var/obj/item/weldingtool/WT = I
if(!WT.isOn())
return
if(WT.remove_fuel(0,user))
user.visible_message("<b>[user]</b> starts slicing \the [src] apart.", SPAN_NOTICE("You start slicing \the [src] apart."))
playsound(src, 'sound/items/Welder.ogg', 100, 1)
var/slice_time = reinf_material ? 100 : 30
if(do_after(user, slice_time, TRUE))
user.visible_message("<b>[user]</b> slices \the [src] apart.", SPAN_NOTICE("You slice \the [src] apart."))
material.place_sheet(get_turf(src))
if(reinf_material)
reinf_material.place_sheet(get_turf(src))
qdel(src)
return
..()
/obj/effect/overlay/thermite
name = "burning thermite"
desc = "It's flaming ball of thermite!"
icon = 'icons/effects/fire.dmi'
icon_state = "2"
anchored = TRUE
layer = 5
+86 -51
View File
@@ -1,3 +1,8 @@
#define RFD_FLOORS_AND_WALL 1
#define RFD_WINDOWS_AND_GRILLE 2
#define RFD_AIRLOCK 3
#define RFD_DECONSTRUCT 4
//Contains the rapid construction device.
/obj/item/rfd
name = "\improper Rapid-Fabrication-Device"
@@ -24,14 +29,15 @@
pickup_sound = 'sound/items/pickup/gun.ogg'
var/stored_matter = 30 // Starts off full.
var/working = FALSE
var/mode = 1
var/mode = RFD_FLOORS_AND_WALL
var/number_of_modes = 1
var/list/modes
var/crafting = FALSE
var/list/valid_atoms = list(/obj/machinery/door/airlock) // a list of atoms that will be sent to the alter_atom proc if we click on them, rather than their turf
var/build_cost = 0
var/build_type
var/build_turf
var/build_atom
var/build_delay
/obj/item/rfd/Initialize()
@@ -52,7 +58,7 @@
/obj/item/rfd/attack_self(mob/user)
//Change the mode
if(++mode > number_of_modes)
mode = 1
mode = RFD_FLOORS_AND_WALL
to_chat(user, SPAN_NOTICE("The mode selection dial is now at [modes[mode]]."))
playsound(src.loc, 'sound/effects/pop.ogg', 50, 0)
if(prob(20))
@@ -62,22 +68,22 @@
if(istype(W, /obj/item/rfd_ammo))
if((stored_matter + 10) > 30)
to_chat(user, "<span class='notice'>The RFD can't hold any more matter-units.</span>")
to_chat(user, SPAN_NOTICE("The RFD can't hold any more matter-units."))
return
user.drop_from_inventory(W,src)
qdel(W)
stored_matter += 10
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
to_chat(user, "<span class='notice'>The RFD now holds [stored_matter]/30 matter-units.</span>")
to_chat(user, SPAN_NOTICE("The RFD now holds [stored_matter]/30 matter-units."))
update_icon()
return
if(W.isscrewdriver()) // Turning it into a crossbow
crafting = !crafting
if(!crafting)
to_chat(user, "<span class='notice'>You reassemble the RFD</span>")
to_chat(user, SPAN_NOTICE("You reassemble the RFD"))
else
to_chat(user, "<span class='notice'>The RFD can now be modified.</span>")
to_chat(user, SPAN_NOTICE("The RFD can now be modified."))
src.add_fingerprint(user)
return
@@ -93,7 +99,7 @@
add_fingerprint(user)
return
else
to_chat(user, "<span class='notice'>You need to fully assemble the crossbow frame first!</span>")
to_chat(user, SPAN_NOTICE("You need to fully assemble the crossbow frame first!"))
return
..()
@@ -139,6 +145,7 @@ RFD Construction-Class
. = ..()
radial_modes = list(
"Floors and Walls" = image(icon = 'icons/mob/screen/radial.dmi', icon_state = "wallfloor"),
"Windows and Grille" = image(icon = 'icons/mob/screen/radial.dmi', icon_state = "grillewindow"),
"Airlock" = image(icon = 'icons/mob/screen/radial.dmi', icon_state = "airlock"),
"Deconstruct" = image(icon = 'icons/mob/screen/radial.dmi', icon_state = "delete")
)
@@ -147,13 +154,15 @@ RFD Construction-Class
var/current_mode = show_radial_menu(user, src, radial_modes, radius = 42, require_near = TRUE, tooltips = TRUE)
switch(current_mode)
if("Floors and Walls")
mode = 1
mode = RFD_FLOORS_AND_WALL
if("Windows and Grille")
mode = RFD_WINDOWS_AND_GRILLE
if("Airlock")
mode = 2
mode = RFD_AIRLOCK
if("Deconstruct")
mode = 3
mode = RFD_DECONSTRUCT
else
mode = 1
mode = RFD_FLOORS_AND_WALL
if(current_mode)
to_chat(user, SPAN_NOTICE("You switch the selection dial to <i>\"[current_mode]\"</i>."))
playsound(src.loc, 'sound/effects/pop.ogg', 50, 0)
@@ -163,53 +172,69 @@ RFD Construction-Class
/obj/item/rfd/construction/afterattack(atom/A, mob/user, proximity)
if(!proximity)
return
if((!isturf(A) && !isturf(A.loc)) || istype(A, /obj/structure/table))
return
if(disabled && !isrobot(user))
return FALSE
if(istype(get_area(A),/area/shuttle)||istype(get_area(A),/turf/space/transit))
return FALSE
var/turf/t = get_turf(A)
if (isNotStationLevel(t.z))
if(isNotStationLevel(t.z))
return FALSE
return alter_turf(A, user, (mode == 3))
/obj/item/rfd/construction/proc/alter_turf(var/turf/T,var/mob/user,var/deconstruct)
if(is_type_in_list(A, valid_atoms))
return alter_atom(A, user, (mode == RFD_DECONSTRUCT))
return alter_atom(t, user, (mode == RFD_DECONSTRUCT))
/obj/item/rfd/construction/proc/alter_atom(var/atom/A, var/mob/user, var/deconstruct)
if(working)
return FALSE
if(mode == 3 && istype(T,/obj/machinery/door/airlock))
build_cost = 10
build_delay = 50
build_type = "airlock"
else if(mode == 2 && !deconstruct && istype(T,/turf/simulated/floor))
build_cost = 3
build_delay = 20
build_type = "airlock"
build_turf = /obj/machinery/door/airlock
else if(!deconstruct && (istype(T,/turf/space) || istype(T,T.baseturf)))
build_cost = 1
build_type = "floor"
build_turf = /turf/simulated/floor/airless
else if(deconstruct && istype(T,/turf/simulated/wall))
var/turf/simulated/wall/W = T
build_delay = deconstruct ? 50 : 40
build_cost = 5
build_type = (!canRwall && W.reinf_material) ? null : "wall"
build_turf = /turf/simulated/floor
else if(istype(T,/turf/simulated/floor))
build_delay = deconstruct ? 50 : 20
build_cost = deconstruct ? 10 : 3
build_type = deconstruct ? "floor" : "wall"
build_turf = deconstruct ? T.baseturf : /turf/simulated/wall
else
return FALSE
var/turf/T = isturf(A) ? A : null // the lower istypes will return false if T is null, which means we don't have to check whether it's an atom or a turf
if(mode == RFD_FLOORS_AND_WALL)
if(istype(T, /turf/space) || istype(T, T.baseturf))
build_cost = 1
build_type = "floor"
build_atom = /turf/simulated/floor/airless
else if(istype(T, /turf/simulated/floor))
build_delay = 20
build_cost = 3
build_type = "wall"
build_atom = /turf/simulated/wall
else if(mode == RFD_WINDOWS_AND_GRILLE)
if(istype(T, /turf/simulated/floor))
build_cost = 3
build_delay = 20
build_type = "window and grille section"
build_atom = /obj/effect/wingrille_spawn/reinforced
else if(mode == RFD_AIRLOCK)
if(istype(T, /turf/simulated/floor))
build_cost = 3
build_delay = 20
build_type = "airlock"
build_atom = /obj/machinery/door/airlock
else if(mode == RFD_DECONSTRUCT)
if(istype(A, /obj/machinery/door/airlock))
build_cost = 10
build_delay = 50
build_type = "airlock"
else if(istype(T, /turf/simulated/wall))
var/turf/simulated/wall/W = T
build_delay = 50
build_cost = 5
build_type = (!canRwall && W.reinf_material) ? null : "wall"
build_atom = W.under_turf
else if(istype(T, /turf/simulated/floor))
build_delay = 50
build_cost = 10
build_type = "floor"
build_atom = T.baseturf
if(!build_type)
working = FALSE
return FALSE
if(mode == 3 && !T.density && !istype(T,/turf/simulated/floor))
to_chat(user, "<span class='warning'>\The [build_type] must be closed before you can deconstruct it.</span>")
if(mode == RFD_DECONSTRUCT && istype(A, /obj/machinery/door) && !A.density)
to_chat(user, SPAN_WARNING("\The [build_type] must be closed before you can deconstruct it."))
return FALSE
if(stored_matter < build_cost)
@@ -220,8 +245,8 @@ RFD Construction-Class
playsound(get_turf(src), 'sound/machines/hydraulic_short.ogg', 50, 1)
working = TRUE
user.visible_message(SPAN_NOTICE("[user] holds \the [src] towards \the [T]."), SPAN_NOTICE("You start [deconstruct ? "deconstructing" : "constructing"] \a [build_type]..."))
var/obj/effect/constructing_effect/rfd_effect = new(get_turf(T), src.build_delay, src.mode)
user.visible_message(SPAN_NOTICE("[user] holds \the [src] towards \the [A]."), SPAN_NOTICE("You start [deconstruct ? "deconstructing" : "constructing"] \a [build_type]..."))
var/obj/effect/constructing_effect/rfd_effect = new(get_turf(A), src.build_delay, src.mode)
if((build_delay && !do_after(user, build_delay)) || (!useResource(build_cost, user)))
working = FALSE
@@ -229,20 +254,26 @@ RFD Construction-Class
return FALSE
working = FALSE
if(build_delay && !can_use(user,T))
if(build_delay && !can_use(user, A))
return FALSE
if(build_turf)
T.ChangeTurf(build_turf)
if(ispath(build_atom, /turf))
var/original_type = T.type
T.ChangeTurf(build_atom)
if(istype(T, /turf/simulated/wall))
var/turf/simulated/wall/W = T
W.under_turf = original_type
else if(ispath(build_atom, /obj))
new build_atom(A)
else
qdel(T)
qdel(A)
rfd_effect.end_animation()
playsound(get_turf(src), 'sound/effects/magnetclamp.ogg', 50, 1)
build_cost = null
build_delay = null
build_type = null
build_turf = null // So it resets and any fuckery is avoided
build_atom = null // So it resets and any fuckery is avoided
return TRUE
/obj/item/rfd/construction/borg
@@ -604,3 +635,7 @@ RFD Piping-Class
#undef SUPPLY_PIPE
#undef SCRUBBER_PIPE
#undef DEVICES
#undef RFD_FLOORS_AND_WALL
#undef RFD_AIRLOCK
#undef RFD_DECONSTRUCT
+3 -1
View File
@@ -224,8 +224,10 @@
wall_fake = 1
var/turf/Tsrc = get_turf(src)
var/original_type = Tsrc.type
Tsrc.ChangeTurf(/turf/simulated/wall)
var/turf/simulated/wall/T = get_turf(src)
var/turf/simulated/wall/T = Tsrc
T.under_turf = original_type
T.set_material(M, reinf_material)
if(wall_fake)
T.can_open = 1