Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Blueprints tgui #2825

Merged
merged 3 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _maps/RandomRuins/AnywhereRuins/golem_ship.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@
/area/ruin/powered/golem_ship)
"un" = (
/obj/structure/table/wood,
/obj/item/areaeditor/blueprints/golem{
/obj/item/blueprints/golem{
pixel_y = 3;
pixel_x = -2
},
Expand Down
4 changes: 2 additions & 2 deletions _maps/RandomRuins/SpaceRuins/nova/port_tarkon.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -5186,7 +5186,7 @@
/area/ruin/space/has_grav/port_tarkon/mining)
"Jg" = (
/obj/structure/safe/floor,
/obj/item/areaeditor/blueprints/tarkon,
/obj/item/blueprints/tarkon,
/obj/item/flatpacked_machine/ore_thumper,
/obj/item/flatpacked_machine/ore_thumper,
/obj/item/flatpacked_machine/ore_thumper,
Expand Down Expand Up @@ -7461,7 +7461,7 @@
/obj/effect/turf_decal/tile/purple/half{
dir = 1
},
/obj/item/areaeditor/blueprints/slime,
/obj/item/blueprints/slime,
/obj/item/slime_extract/grey,
/obj/item/slime_extract/grey,
/obj/item/slime_extract/grey,
Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/_flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
#define UNIQUE_AREA (1<<8)
/// If people are allowed to suicide in it. Mostly for OOC stuff like minigames
#define BLOCK_SUICIDE (1<<9)
/// Can the Xenobio management console transverse this area by default?
/// If set, this area will be innately traversable by Xenobiology camera consoles.
#define XENOBIOLOGY_COMPATIBLE (1<<10)
/// If Abductors are unable to teleport in with their observation console
#define ABDUCTOR_PROOF (1<<11)
Expand Down
5 changes: 0 additions & 5 deletions code/__DEFINES/area_editor.dm

This file was deleted.

48 changes: 48 additions & 0 deletions code/__HELPERS/areas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,51 @@ GLOBAL_LIST_INIT(typecache_powerfailure_safe_areas, typecacheof(list(
mobs_in_area += mob
break
return mobs_in_area

/**
* rename_area
* Renames an area to the given new name, updating all machines' names and firedoors
* to properly ensure alarms and machines are named correctly at all times.
* Args:
* - area_to_rename: The area that's being renamed.
* - new_name: The name we're changing said area to.
*/
/proc/rename_area(area/area_to_rename, new_name)
var/prevname = "[area_to_rename.name]"
set_area_machinery_title(area_to_rename, new_name, prevname)
area_to_rename.name = new_name
require_area_resort() //area renamed so resort the names

if(LAZYLEN(area_to_rename.firedoors))
for(var/obj/machinery/door/firedoor/area_firedoors as anything in area_to_rename.firedoors)
area_firedoors.CalculateAffectingAreas()
area_to_rename.update_areasize()
return TRUE

/**
* Renames all machines in a defined area from the old title to the new title.
* Used when renaming an area to ensure that all machiens are labeled the new area's machine.
* Args:
* - area_renaming: The area being renamed, which we'll check turfs from to rename machines in.
* - title: The new name of the area that we're swapping into.
* - oldtitle: The old name of the area that we're replacing text from.
*/
/proc/set_area_machinery_title(area/area_renaming, title, oldtitle)
if(!oldtitle) // or replacetext goes to infinite loop
return

//stuff tied to the area to rename
var/static/list/to_rename = typecacheof(list(
/obj/machinery/airalarm,
/obj/machinery/atmospherics/components/unary/vent_scrubber,
/obj/machinery/atmospherics/components/unary/vent_pump,
/obj/machinery/door,
/obj/machinery/firealarm,
/obj/machinery/light_switch,
/obj/machinery/power/apc,
/obj/machinery/camera,
))
for(var/list/zlevel_turfs as anything in area_renaming.get_zlevel_turf_lists())
for(var/turf/area_turf as anything in zlevel_turfs)
for(var/obj/machine as anything in typecache_filter_list(area_turf.contents, to_rename))
machine.name = replacetext(machine.name, oldtitle, title)
17 changes: 17 additions & 0 deletions code/__HELPERS/turfs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -413,3 +413,20 @@ Turf and target are separate in case you want to teleport some distance from a t
if(locate(type_to_find) in location)
return TRUE
return FALSE

/**
* get_blueprint_data
* Gets a list of turfs around a central turf and gets the blueprint data in a list
* Args:
* - central_turf: The center turf we're getting data from.
* - viewsize: The viewsize we're getting the turfs around central_turf of.
*/
/proc/get_blueprint_data(turf/central_turf, viewsize)
var/list/blueprint_data_returned = list()
var/list/dimensions = getviewsize(viewsize)
var/horizontal_radius = dimensions[1] / 2
var/vertical_radius = dimensions[2] / 2
for(var/turf/nearby_turf as anything in RECT_TURFS(horizontal_radius, vertical_radius, central_turf))
if(nearby_turf.blueprint_data)
blueprint_data_returned += nearby_turf.blueprint_data
return blueprint_data_returned
2 changes: 1 addition & 1 deletion code/datums/wires/_wires.dm
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
return TRUE

// Station blueprints do that too, but only if the wires are not randomized.
if(user.is_holding_item_of_type(/obj/item/areaeditor/blueprints) && !randomize)
if(user.is_holding_item_of_type(/obj/item/blueprints) && !randomize)
return TRUE

return FALSE
Expand Down
8 changes: 4 additions & 4 deletions code/game/gamemodes/objective_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -529,19 +529,19 @@

/datum/objective_item/steal/blueprints
name = "the station blueprints"
targetitem = /obj/item/areaeditor/blueprints
targetitem = /obj/item/blueprints
excludefromjob = list(JOB_CHIEF_ENGINEER)
item_owner = list(JOB_CHIEF_ENGINEER)
altitems = list(/obj/item/photo)
exists_on_map = TRUE
difficulty = 3
steal_hint = "The blueprints of the station, found in the Chief Engineer's locker, or on their person. A picture may suffice."

/obj/item/areaeditor/blueprints/add_stealing_item_objective()
return add_item_to_steal(src, /obj/item/areaeditor/blueprints)
/obj/item/blueprints/add_stealing_item_objective()
return add_item_to_steal(src, /obj/item/blueprints)

/datum/objective_item/steal/blueprints/check_special_completion(obj/item/I)
if(istype(I, /obj/item/areaeditor/blueprints))
if(istype(I, /obj/item/blueprints))
return TRUE
if(istype(I, /obj/item/photo))
var/obj/item/photo/P = I
Expand Down
5 changes: 3 additions & 2 deletions code/game/machinery/barsigns.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/barsign, 32)
if(!istype(sign))
return

var/area/bar_area = get_area(src)
if(change_area_name && sign.rename_area)
rename_area(src, sign.name)
rename_area(bar_area, sign.name)

chosen_sign = sign
update_appearance()
Expand Down Expand Up @@ -152,7 +153,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/barsign, 32)

/obj/machinery/barsign/attackby(obj/item/attacking_item, mob/user)

if(istype(attacking_item, /obj/item/areaeditor/blueprints) && !change_area_name)
if(istype(attacking_item, /obj/item/blueprints) && !change_area_name)
if(!panel_open)
balloon_alert(user, "open the panel first!")
return TRUE
Expand Down
Loading
Loading