mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-27 15:01:04 +01:00
BAPI - mapmanip directional submap insert marker (#23080)
``` changes: - rscadd: "Directional submap insert marker." ``` <img width="1691" height="585" alt="image" src="https://github.com/user-attachments/assets/b3d734f8-d23d-449a-bd17-9397f5b81139" /> --------- Signed-off-by: DreamySkrell <107256943+DreamySkrell@users.noreply.github.com> Co-authored-by: DreamySkrell <> Co-authored-by: AuroraBuildBot <action@github.com> Co-authored-by: FabianK3 <21039694+FabianK3@users.noreply.github.com>
This commit is contained in:
co-authored by
DreamySkrell <>
AuroraBuildBot
FabianK3
parent
b03dfab8f6
commit
6cd7332292
@@ -28,6 +28,14 @@
|
||||
icon_state = "mapmanip_insert"
|
||||
pixel_x = -32
|
||||
pixel_y = -32
|
||||
/// Direction of submap insertion.
|
||||
/// Default is NORTHEAST, meaning the marker is the bottom-left corner,
|
||||
/// and the submap is inserted to the north-east starting from the marker.
|
||||
/// Directions such as NORTH means the marker is bottom-center,
|
||||
/// and the submap is inserted to the north starting from the marker.
|
||||
///
|
||||
/// Must be set in map (if anything other than NORTHEAST), as mapmanip does not read code.
|
||||
dir = NORTHEAST
|
||||
|
||||
/obj/effect/map_effect/marker_helper/mapmanip/submap/edge
|
||||
name = "mapmanip helper marker, edge of submap"
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
author: DreamySkrell
|
||||
|
||||
delete-after: True
|
||||
|
||||
changes:
|
||||
- rscadd: "Submap insert markers now support different directions."
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 4.3 KiB |
@@ -169,8 +169,49 @@ fn mapmanip_submap_extract_insert(
|
||||
|
||||
// find all the insert markers
|
||||
let mut marker_insert_coords = vec![];
|
||||
for (coord, tile) in map.grid.iter() {
|
||||
if tile.prefabs.iter().any(|p| p.path == *marker_insert) {
|
||||
for (mut coord, tile) in map.grid.iter() {
|
||||
if let Some(p) = tile.prefabs.iter().find(|p| p.path == *marker_insert) {
|
||||
let dir = p
|
||||
.vars
|
||||
.get("dir")
|
||||
.and_then(Constant::to_float)
|
||||
.and_then(|f| Dir::from_int(f as i32))
|
||||
.unwrap_or(Dir::Northeast);
|
||||
|
||||
// Adjust for direction of submap insertion.
|
||||
// Default is NORTHEAST, meaning the marker is the bottom-left corner,
|
||||
// and the submap is inserted to the north-east starting from the marker.
|
||||
// Directions such as NORTH means the marker is bottom-center,
|
||||
// and the submap is inserted to the north starting from the marker.
|
||||
match dir {
|
||||
Dir::North => {
|
||||
coord.x -= submap_size.x / 2;
|
||||
}
|
||||
Dir::South => {
|
||||
coord.x -= submap_size.x / 2;
|
||||
coord.y -= submap_size.y - 1;
|
||||
}
|
||||
Dir::East => {
|
||||
coord.y -= submap_size.y / 2;
|
||||
}
|
||||
Dir::West => {
|
||||
coord.x -= submap_size.x - 1;
|
||||
coord.y -= submap_size.y / 2;
|
||||
}
|
||||
Dir::Northeast => {
|
||||
// default, no offset needed
|
||||
}
|
||||
Dir::Northwest => {
|
||||
coord.x -= submap_size.x - 1;
|
||||
}
|
||||
Dir::Southeast => {
|
||||
coord.y -= submap_size.y - 1;
|
||||
}
|
||||
Dir::Southwest => {
|
||||
coord.x -= submap_size.x - 1;
|
||||
coord.y -= submap_size.y - 1;
|
||||
}
|
||||
}
|
||||
marker_insert_coords.push(coord);
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user