mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-27 23:29:10 +01:00
Adds support for overriding what happens when a tile is destroyed in most cases.
This commit is contained in:
@@ -64,6 +64,13 @@ proc/isemptylist(list/list)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
//Checks for specific paths in a list
|
||||
/proc/is_path_in_list(var/atom/A, var/list/L)
|
||||
for(var/path in L)
|
||||
if(ispath(A, path))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
//Empties the list by setting the length to 0. Hopefully the elements get garbage collected
|
||||
proc/clearlist(list/list)
|
||||
if(istype(list))
|
||||
|
||||
@@ -99,16 +99,24 @@
|
||||
build_cost = 1
|
||||
build_type = "floor"
|
||||
build_turf = /turf/simulated/floor/plating/airless
|
||||
else if(!deconstruct && istype(T,/turf/simulated/floor/plating/asteroid))
|
||||
build_cost = 1
|
||||
build_type = "floor"
|
||||
build_turf = /turf/simulated/floor/plating
|
||||
else if(deconstruct && istype(T,/turf/simulated/wall))
|
||||
build_delay = deconstruct ? 50 : 40
|
||||
build_cost = 5
|
||||
build_type = (!canRwall && istype(T,/turf/simulated/wall/r_wall)) ? null : "wall"
|
||||
build_turf = /turf/simulated/floor
|
||||
else if(istype(T,/turf/simulated/floor))
|
||||
var/turf/simulated/floor/F = T
|
||||
build_delay = deconstruct ? 50 : 20
|
||||
build_cost = deconstruct ? 10 : 3
|
||||
build_type = deconstruct ? "floor" : "wall"
|
||||
build_turf = deconstruct ? /turf/space : /turf/simulated/wall
|
||||
if(F.check_destroy_override(F))
|
||||
build_turf = deconstruct ? destroy_floor_override_path : /turf/simulated/wall
|
||||
else
|
||||
build_turf = deconstruct ? /turf/space : /turf/simulated/wall
|
||||
else
|
||||
return 0
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
/obj/structure/lattice/New()
|
||||
..()
|
||||
///// Z-Level Stuff
|
||||
if(!(istype(src.loc, /turf/space) || istype(src.loc, /turf/simulated/floor/open)))
|
||||
// if(!(istype(src.loc, /turf/space) || istype(src.loc, /turf/simulated/floor/open)))
|
||||
///// Z-Level Stuff
|
||||
del(src)
|
||||
// del(src)
|
||||
for(var/obj/structure/lattice/LAT in src.loc)
|
||||
if(LAT != src)
|
||||
del(LAT)
|
||||
|
||||
@@ -14,6 +14,16 @@
|
||||
..()
|
||||
levelupdate()
|
||||
|
||||
/turf/simulated/proc/check_destroy_override()
|
||||
if(destroy_floor_override) //Don't bother doing the additional checks if we don't have to.
|
||||
var/area/my_area = get_area(src)
|
||||
my_area = my_area.master
|
||||
if(is_type_in_list(my_area, destroy_floor_override_ignore_areas))
|
||||
return 0
|
||||
if(z in destroy_floor_override_z_levels)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/turf/simulated/proc/AddTracks(var/typepath,var/bloodDNA,var/comingdir,var/goingdir,var/bloodcolor="#A10808")
|
||||
var/obj/effect/decal/cleanable/blood/tracks/tracks = locate(typepath) in src
|
||||
if(!tracks)
|
||||
|
||||
@@ -70,6 +70,8 @@ var/list/wood_icons = list("wood","wood-broken")
|
||||
else
|
||||
icon_regular_floor = icon_state
|
||||
|
||||
|
||||
|
||||
//turf/simulated/floor/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
|
||||
// if ((istype(mover, /obj/machinery/vehicle) && !(src.burnt)))
|
||||
// if (!( locate(/obj/machinery/mass_driver, src) ))
|
||||
@@ -80,14 +82,23 @@ var/list/wood_icons = list("wood","wood-broken")
|
||||
//set src in oview(1)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
src.ChangeTurf(/turf/space)
|
||||
if(check_destroy_override())
|
||||
src.ChangeTurf(destroy_floor_override_path)
|
||||
else
|
||||
src.ChangeTurf(/turf/space)
|
||||
if(2.0)
|
||||
switch(pick(1,2;75,3))
|
||||
if (1)
|
||||
src.ReplaceWithLattice()
|
||||
if(check_destroy_override())
|
||||
src.ChangeTurf(destroy_floor_override_path)
|
||||
else
|
||||
src.ReplaceWithLattice()
|
||||
if(prob(33)) new /obj/item/stack/sheet/metal(src)
|
||||
if(2)
|
||||
src.ChangeTurf(/turf/space)
|
||||
if(check_destroy_override())
|
||||
src.ChangeTurf(destroy_floor_override_path)
|
||||
else
|
||||
src.ChangeTurf(/turf/space)
|
||||
if(3)
|
||||
if(prob(80))
|
||||
src.break_tile_to_plating()
|
||||
|
||||
@@ -216,4 +216,48 @@
|
||||
icon_state = "snow"
|
||||
|
||||
/turf/simulated/floor/plating/snow/ex_act(severity)
|
||||
return
|
||||
return
|
||||
|
||||
/turf/simulated/floor/plating/asteroid //underfloor for the station
|
||||
name = "asteroid"
|
||||
icon = 'icons/turf/floors.dmi'
|
||||
icon_state = "asteroid"
|
||||
icon_plating = "asteroid"
|
||||
|
||||
/turf/simulated/floor/plating/asteroid/ex_act(severity)
|
||||
return
|
||||
|
||||
/turf/simulated/floor/plating/asteroid/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
|
||||
if(!W || !user)
|
||||
return 0
|
||||
|
||||
if(istype(W, /obj/item/weapon/shovel) || istype(W, /obj/item/weapon/pickaxe))
|
||||
user << "<span class='warning'>This area is unsuitable for digging.</span>"
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/stack/rods))
|
||||
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
|
||||
if(L)
|
||||
return
|
||||
var/obj/item/stack/rods/R = W
|
||||
if (R.use(1))
|
||||
user << "<span class='notice'>Constructing support lattice ...</span>"
|
||||
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
|
||||
new /obj/structure/lattice(get_turf(src))
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/stack/tile/plasteel))
|
||||
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
|
||||
if(L)
|
||||
var/obj/item/stack/tile/plasteel/S = W
|
||||
if (S.get_amount() < 1)
|
||||
return
|
||||
del(L)
|
||||
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
|
||||
S.build(src)
|
||||
S.use(1)
|
||||
return
|
||||
else
|
||||
user << "<span class='warning'>The plating is going to need some support.</span>"
|
||||
return
|
||||
@@ -183,7 +183,10 @@
|
||||
/turf/simulated/wall/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
src.ChangeTurf(/turf/space)
|
||||
if(check_destroy_override())
|
||||
src.ChangeTurf(destroy_floor_override_path)
|
||||
else
|
||||
src.ChangeTurf(/turf/space)
|
||||
return
|
||||
if(2.0)
|
||||
if(prob(75))
|
||||
|
||||
+15
-2
@@ -86,11 +86,24 @@ var/blobevent = 0
|
||||
|
||||
var/diary = null
|
||||
var/href_logfile = null
|
||||
var/station_name = "NSS Exodus"
|
||||
var/game_version = "Baystation12"
|
||||
var/station_name = "Northern Star"
|
||||
var/game_version = "Polaris"
|
||||
var/changelog_hash = ""
|
||||
var/game_year = (text2num(time2text(world.realtime, "YYYY")) + 544)
|
||||
|
||||
|
||||
//On some maps, it does not make sense for space turf to appear when something blows up (e.g. on an asteroid colony, or planetside)
|
||||
//The turf listed here is what is created after ex_act() and other tile-destroying procs are called on a turf that
|
||||
//is not already in a blacklisted area.
|
||||
//Set to 1 to enable it.
|
||||
var/destroy_floor_override = 1
|
||||
//Below is the path of turf used in place of space tiles.
|
||||
var/destroy_floor_override_path = /turf/simulated/floor/plating/asteroid
|
||||
//A list of z-levels to apply the override to. This is so z-levels like tcomms work as they did before.
|
||||
var/list/destroy_floor_override_z_levels = list(1)
|
||||
//Some areas you may want to not turn into the override path you made above, like space or the solars.
|
||||
var/list/destroy_floor_override_ignore_areas = list(/area/space,/area/solar,/area/shuttle)
|
||||
|
||||
var/going = 1.0
|
||||
var/master_mode = "extended" // "extended"
|
||||
var/secret_force_mode = "secret" // if this is anything but "secret", the secret rotation will forceably choose this mode.
|
||||
|
||||
@@ -463,6 +463,32 @@
|
||||
F.attackby(W,user)
|
||||
return
|
||||
|
||||
else if(istype(W, /obj/item/stack/rods))
|
||||
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
|
||||
if(L)
|
||||
return
|
||||
var/obj/item/stack/rods/R = W
|
||||
if (R.use(1))
|
||||
user << "<span class='notice'>Constructing support lattice ...</span>"
|
||||
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
|
||||
new /obj/structure/lattice(get_turf(src))
|
||||
return
|
||||
|
||||
else if(istype(W, /obj/item/stack/tile/plasteel))
|
||||
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
|
||||
if(L)
|
||||
var/obj/item/stack/tile/plasteel/S = W
|
||||
if (S.get_amount() < 1)
|
||||
return
|
||||
del(L)
|
||||
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
|
||||
S.build(src)
|
||||
S.use(1)
|
||||
return
|
||||
else
|
||||
user << "<span class='warning'>The plating is going to need some support.</span>"
|
||||
return
|
||||
|
||||
else
|
||||
..(W,user)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user