mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-13 11:12:14 +00:00
About The Pull Request Alternative to #65354 Ok so like, there was a lot of not floor types on /floor. They didn't actually want any of their parent type's functionality, except maybe reacting to breaking (which was easy to move down) and some other minor stuff. Part of what we don't want them to have is "plateable" logic. I should not be able to put floor tiles on the snow and be fine. It's dumb. Instead, I've moved all non floor types down to a new type, called /misc. It holds very little logic. Mostly allowing pipes and wires and preventing blob stuff. It also supports lattice based construction, which is one of the major changes here. I think it makes more sense, and it fixes an assumption in shuttle code that assumed you couldn't place "a new tile" by just hitting some snow with a floor tile. Oh and lattices don't smooth with asteroid tiles anymore, this looks nicer I think. Moving on to commits, and minor changes Changes clf3 to try and burn any turfs it's exposed to, instead of just floors Moves break_tile down to the turf definition, alongside burn_tile If you're in basic buildmode and click on anything that's not handled in a targeted way, you just build plating FUNCTION CHANGE: you can't use cult pylons to convert misc tiles over anymore Generalizes building floors on top of something into two helper procs on /turf/open, reducing copypasta Adds a new turf flag, IS_SOLID, that describes if a turf is tangible or not. Uses this alongside a carpet and open check to replace plating and floor checks in carpet code. This does mean that non iron tiles can be carpeted, but I think that's fine Moves the /floor update_icon -> update_visuals call to /open This change is horrificly old, dating back to8e112f6but that commit describes nothing about why it was done. Choosing to believe it was a newfriend mistake. Uncomfortable nuking it though, because of just how old it is. Moving down instead Create a buildable "misc" type off open, moves /dirt onto it Basically, we want a type we can use to make something support construction, since that can be a messy bit of logic. Also enough structure to set things up sanely. I'm planning on moving most misc turfs onto it, if only because constructing on a dirt tile with rods should be possible, and the same applies to most things Murders captain planet, disentangles /turf/open/floor/grass/snow/basalt Adds a diggable component that applies the behavior of "digging" something out from a turf. Uses it to free the above pain typepath into something a bit more sensible The typepaths that aren't actually used by floor tiles are moved onto /misc The others are given names that better describe them, and kept in fancy_floor Oh and snowshoes don't work on basalt anymore, sorry Snowed over platings now actually have broken/burned icon states, fixing black holes to nowhere Misc turfs no longer smooth as floors, so lattices will ignore them Placing a lattice will no longer scrape the tile it's on Ok this is a really old one. I believe this logic is a holdover from kor's baseturf pr (97990c9) It used to be that turfs didn't have a concept of "beneath" and instead just decided what should be under them by induction. This logic of "if it's being latticed scapeaway to space" made sense then, but has since been somewhat distorted We do want to scape away on lattice spawn sometimes, mostly when we're being destroyed, but not always. We especially don't want to scape away if someone is just placing a rod, that's dumb. Adds a path updating script for this change I've done my best to find all the errors this repathing will pull out, but I may have missed some. I'm sorry. Why It's Good For The Game Very old code made better, more consistent turfs for lavaland and icebox, better visuals, minor fix to snowed plating, demon banishment in lattice placement, fixes the icebox mining shuttle not being repairable Changelog cl add: Rather then being tileable with just floor tiles, lavaland turfs, asteroid and snow (among other things) now support lattice -> floor tile construction fix: Because of the above, you can now properly fix the icebox mining shuttle refactor: Non floor turfs are no longer typed as floor. This may break things, please yell at me if it does /cl
97 lines
2.4 KiB
Plaintext
97 lines
2.4 KiB
Plaintext
// Very Simple Cellular Automata generators
|
|
// Mostly for better caves
|
|
// Should probably move these up and refactor modules so these can be mixed with other ones
|
|
|
|
/datum/map_generator/ca
|
|
var/list/b_rule = list() // 0 -> 1, 1 -> 1
|
|
var/list/s_rule = list() // 0 -> 0, 1 -> 1
|
|
var/iterations = 1
|
|
var/loop_edges = 0
|
|
var/edge_value = 1 //if loop_edges = 0
|
|
var/list/old_state
|
|
var/list/current_state
|
|
var/width = 10
|
|
var/height = 10
|
|
var/list/type_map = list(/turf/open/floor/plating, /turf/closed/wall)
|
|
var/turf/start = null
|
|
|
|
/datum/map_generator/ca/defineRegion(turf/Start, turf/End, replace = 0)
|
|
. = ..()
|
|
|
|
var/min_x = min(Start.x,End.x)
|
|
var/max_x = max(Start.x,End.x)
|
|
var/min_y = min(Start.y,End.y)
|
|
var/max_y = max(Start.y,End.y)
|
|
width = max_x - min_x
|
|
height = max_y - min_y
|
|
|
|
//We assume 2D everywhere anyway
|
|
start = locate(min_x,min_y,Start.z)
|
|
|
|
/datum/map_generator/ca/proc/initialize()
|
|
old_state = new/list(width)
|
|
for(var/x in 1 to width)
|
|
old_state[x] = new/list(height)
|
|
for(var/y in 1 to height)
|
|
old_state[x][y] = rand(0,1)
|
|
|
|
current_state = old_state.Copy()
|
|
|
|
/datum/map_generator/ca/generate()
|
|
//Abandon all hope for efficency all who enter here
|
|
//Maybe some less basic implemetation later, but this is just simple admin tool
|
|
initialize()
|
|
|
|
for(var/generation in 1 to iterations)
|
|
for(var/x in 1 to width)
|
|
for(var/y in 1 to height)
|
|
current_state[x][y] = apply_rule(x, y)
|
|
//copy state over
|
|
old_state = current_state.Copy()
|
|
|
|
for(var/x in 1 to width)
|
|
for(var/y in 1 to height)
|
|
var/turf/T = locate(start.x+x-1,start.y+y-1,start.z)
|
|
if(T)
|
|
T.ChangeTurf(type_map[current_state[x][y]+1])
|
|
|
|
/datum/map_generator/ca/proc/apply_rule(x, y)
|
|
var/value = 0
|
|
for(var/dist_x in -1 to 1)
|
|
for(var/dist_y in -1 to 1)
|
|
var/n_x = x+dist_x
|
|
var/n_y = y+dist_y
|
|
if(n_x < 1 || n_x > width || n_y <1 || n_y > height)
|
|
if(loop_edges)
|
|
if(n_x < 1)
|
|
n_x = width
|
|
else if(n_x > width)
|
|
n_x = 1
|
|
if(n_y < 1)
|
|
n_y = height
|
|
else if(n_y > height)
|
|
n_y = 1
|
|
else
|
|
value += edge_value
|
|
continue
|
|
value += old_state[n_x][n_y]
|
|
value -= old_state[x][y]
|
|
|
|
if(value in b_rule)
|
|
return 1
|
|
if(value in s_rule)
|
|
return old_state[x][y]
|
|
return 0
|
|
|
|
/datum/map_generator/ca/caves
|
|
b_rule = list(5,6,7,8)
|
|
s_rule = list(4)
|
|
type_map = list(/turf/open/misc/asteroid/basalt, /turf/closed/mineral/volcanic)
|
|
iterations = 5
|
|
|
|
/datum/map_generator/ca/maze
|
|
b_rule = list(3)
|
|
s_rule = list(1,2,3,4,5)
|
|
iterations = 20
|
|
edge_value = 0
|