-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for machinery to be bigger than 1x1 (#26531)
* Adds big machinery * Remove debug stuff * Even less debug stuff * Contra review * Complete refactor + BSH * Reverts `/big` * Adds missing * * initial * Removes unneeded shit * Adds edge of world edgecases * Whoops * Fix * Lewc review * Make the grav gen better * Render passes fix * Extra comment in the toml * Extra deconstruct just in case * One less loop --------- Co-authored-by: BeagleGaming1 <[email protected]>
- Loading branch information
1 parent
33b2dc3
commit 35740a2
Showing
11 changed files
with
100 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
///Lets multitile objects have dense walls around them based on the coordinate map | ||
/datum/component/multitile | ||
///Reference to all fillers | ||
var/list/all_fillers = list() | ||
|
||
/* | ||
* These should all be done in this style. It represents a coordinate map of the grid around `src`. | ||
* The src itself should always have no density, as the density should be set on the atom and not with a filler | ||
* list( | ||
list(0, 0, 0, 0, 0), | ||
list(0, 0, 0, 0, 0), | ||
list(0, 0, MACH_CENTER, 0, 0), | ||
list(0, 0, 0, 0, 0), | ||
list(0, 0, 0, 0, 0) | ||
) | ||
*/ | ||
|
||
//distance_from_center does not include src itself | ||
/datum/component/multitile/Initialize(distance_from_center, new_filler_map) | ||
if(!distance_from_center || !length(new_filler_map)) | ||
return COMPONENT_INCOMPATIBLE | ||
|
||
if(!isatom(parent)) | ||
return COMPONENT_INCOMPATIBLE | ||
|
||
var/atom/owner = parent | ||
if(owner.x + distance_from_center > world.maxx || owner.x - distance_from_center < 1) | ||
var/obj/machinery/machine = parent | ||
machine.deconstruct() | ||
return COMPONENT_INCOMPATIBLE | ||
|
||
if(owner.y + distance_from_center > world.maxy || owner.y - distance_from_center < 1) | ||
var/obj/machinery/machine = parent | ||
machine.deconstruct() | ||
return COMPONENT_INCOMPATIBLE | ||
|
||
var/max_height = length(new_filler_map) | ||
var/max_width = length(new_filler_map[1]) //it should have the same length on every row | ||
for(var/i in 2 to length(new_filler_map)) | ||
var/length = length(new_filler_map[i]) | ||
if(length != max_width) | ||
stack_trace("A multitile component was passed a list wich did not have the same length every row. Atom parent is: [parent]") | ||
var/obj/machinery/machine = parent | ||
machine.deconstruct() | ||
return COMPONENT_INCOMPATIBLE | ||
|
||
var/current_height = 0 | ||
var/current_width = 0 | ||
|
||
for(var/turf/filler_turf as anything in RANGE_TURFS(distance_from_center, owner)) | ||
if(new_filler_map[max_height - current_height][max_width - current_width]) // Because the `block()` proc always works from the bottom left to the top right, we have to loop through our nested lists in reverse | ||
var/obj/structure/filler/new_filler = new(filler_turf) | ||
all_fillers += new_filler | ||
current_width += 1 | ||
if(current_width == max_width) | ||
current_height += 1 | ||
current_width = 0 | ||
|
||
/datum/component/multitile/Destroy(force, silent) | ||
QDEL_LIST_CONTENTS(all_fillers) | ||
return ..() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters