From acba4c6cf6c746a5a41da7116fc6414c71e5b4b1 Mon Sep 17 00:00:00 2001 From: Cheridan Date: Sat, 11 Oct 2014 17:39:27 -0500 Subject: [PATCH] Adds construction permits Conflicts: code/game/gamemodes/objective_items.dm code/game/objects/items/blueprints.dm code/game/objects/items/weapons/storage/boxes.dm code/game/objects/structures/crates_lockers/closets/secure/engineering.dm code/modules/flufftext/Hallucination.dm code/modules/paperwork/photography.dm icons/obj/items.dmi --- code/game/objects/items/blueprints.dm | 220 ++++++++++-------- .../objects/items/weapons/storage/boxes.dm | 18 +- .../closets/secure/engineering.dm | 10 +- code/modules/flufftext/Hallucination.dm | 2 +- code/modules/paperwork/photography.dm | 5 +- 5 files changed, 142 insertions(+), 113 deletions(-) diff --git a/code/game/objects/items/blueprints.dm b/code/game/objects/items/blueprints.dm index 21330412b22..514ac336ea7 100644 --- a/code/game/objects/items/blueprints.dm +++ b/code/game/objects/items/blueprints.dm @@ -1,9 +1,10 @@ -/obj/item/blueprints - name = "station blueprints" - desc = "Blueprints of the station. There is a \"Classified\" stamp and several coffee stains on it." +/obj/item/areaeditor + name = "area modification item" icon = 'icons/obj/items.dmi' icon_state = "blueprints" attack_verb = list("attacked", "bapped", "hit") + var/fluffnotice = "Nobody's gonna read this stuff!" + var/const/AREA_ERRNONE = 0 var/const/AREA_STATION = 1 var/const/AREA_SPACE = 2 @@ -19,67 +20,94 @@ var/const/ROOM_ERR_SPACE = -1 var/const/ROOM_ERR_TOOLARGE = -2 -/obj/item/blueprints/attack_self(mob/M as mob) - if (!istype(M,/mob/living/carbon/human)) - M << "This stack of blue paper means nothing to you." //monkeys cannot into projecting - return - interact() - return -/obj/item/blueprints/Topic(href, href_list) - ..() - if ((usr.restrained() || usr.stat || usr.get_active_hand() != src)) +/obj/item/areaeditor/attack_self(mob/user as mob) + add_fingerprint(user) + var/text = "[src] \ +

[station_name()] [src.name]

\ + [fluffnotice]
" + switch(get_area_type()) + if(AREA_SPACE) + text += "

According to the [src.name], you are now in outer space. Hold your breath.

\ +

Mark this place as new area.

" + if(AREA_SPECIAL) + text += "

This place is not noted on the [src.name].

" + return text + + +/obj/item/areaeditor/Topic(href, href_list) + if(..()) return - if (!href_list["action"]) - return - switch(href_list["action"]) - if ("create_area") - if (get_area_type()!=AREA_SPACE) - interact() - return + if(href_list["create_area"]) + if(get_area_type()==AREA_SPACE) create_area() - if ("edit_area") - if (get_area_type()!=AREA_STATION) - interact() - return - edit_area() + updateUsrDialog() -/obj/item/blueprints/interact() + +//One-use area creation permits. +/obj/item/areaeditor/permit + name = "construction permit" + icon_state = "permit" + desc = "This is a one-use permit that allows the user to offically declare a built room as new addition to the station." + fluffnotice = "Nanotrasen Engineering requires all on-station construction projects to be approved by a head of staff, as detailed in Nanotrasen Company Regulation 512-C (Mid-Shift Modifications to Company Property). \ + By submitting this form, you accept any fines, fees, or personal injury/death that may occur during construction." + + +/obj/item/areaeditor/permit/attack_self(mob/user as mob) + . = ..() var/area/A = get_area() - var/text = {"[src] -

[station_name()] blueprints

-Property of Nanotrasen. For heads of staff only. Store in high-secure storage.
-"} - switch (get_area_type()) - if (AREA_SPACE) - text += {" -

According the blueprints, you are now in outer space. Hold your breath.

-

Mark this place as new area.

-"} - if (AREA_STATION) - text += {" -

According the blueprints, you are now in \"[A.name]\".

-

You may -move an amendment to the drawing.

-"} - if (AREA_SPECIAL) - text += {" -

This place isn't noted on the blueprint.

-"} - else - return - text += "" - usr << browse(text, "window=blueprints") + if(get_area_type() == AREA_STATION) + . += "

According to the [src], you are now in \"[A.name]\".

" + var/datum/browser/popup = new(user, "blueprints", "[src]", 700, 500) + popup.set_content(.) + popup.open() onclose(usr, "blueprints") -/obj/item/blueprints/proc/get_area() - var/turf/T = get_turf_loc(usr) - var/area/A = get_area_master(T) +/obj/item/areaeditor/permit/create_area() + ..() + qdel(src) + + +//Station blueprints!!! +/obj/item/areaeditor/blueprints + name = "station blueprints" + desc = "Blueprints of the station. There is a \"Classified\" stamp and several coffee stains on it." + icon = 'icons/obj/items.dmi' + icon_state = "blueprints" + fluffnotice = "Property of Nanotrasen. For heads of staff only. Store in high-secure storage." + + +/obj/item/areaeditor/blueprints/attack_self(mob/user as mob) + . = ..() + var/area/A = get_area() + if(get_area_type() == AREA_STATION) + . += "

According to the [src], you are now in \"[A.name]\".

" + . += "

You may move an amendment to the drawing.

" + var/datum/browser/popup = new(user, "blueprints", "[src]", 700, 500) + popup.set_content(.) + popup.open() + onclose(user, "blueprints") + + +/obj/item/areaeditor/blueprints/Topic(href, href_list) + ..() + if(href_list["edit_area"]) + if(get_area_type()!=AREA_STATION) + return + edit_area() + updateUsrDialog() + + +/obj/item/areaeditor/proc/get_area() + var/turf/T = get_turf(usr) + var/area/A = T.loc + A = A.master return A -/obj/item/blueprints/proc/get_area_type(var/area/A = get_area()) - if (A.name == "Space") + +/obj/item/areaeditor/proc/get_area_type(var/area/A = get_area()) + if (istype(A,/area/space)) return AREA_SPACE var/list/SPECIALS = list( /area/shuttle, @@ -91,37 +119,36 @@ move an amendment to the drawing.

/area/syndicate_station, /area/wizard_station, /area/prison - // /area/derelict //commented out, all hail derelict-rebuilders! ) for (var/type in SPECIALS) if ( istype(A,type) ) return AREA_SPECIAL return AREA_STATION -/obj/item/blueprints/proc/create_area() - //world << "DEBUG: create_area" - var/res = detect_room(get_turf_loc(usr)) + +/obj/item/areaeditor/proc/create_area() + var/res = detect_room(get_turf(usr)) if(!istype(res,/list)) switch(res) if(ROOM_ERR_SPACE) - usr << "\red The new area must be completely airtight!" + usr << "The new area must be completely airtight." return if(ROOM_ERR_TOOLARGE) - usr << "\red The new area too large!" + usr << "The new area is too large." return else - usr << "\red Error! Please notify administration!" + usr << "Error! Please notify administration." return var/list/turf/turfs = res - var/str = trim(stripped_input(usr,"New area name:","Blueprint Editing", "", MAX_NAME_LEN)) + var/str = trim(stripped_input(usr,"New area name:", "Blueprint Editing", "", MAX_NAME_LEN)) if(!str || !length(str)) //cancel return if(length(str) > 50) - usr << "\red Name too long." + usr << "The given name is too long. The area remains undefined." return var/area/A = new A.name = str - A.tagbase="[A.type]_[md5(str)]" // without this dynamic light system ruins everything + A.tagbase="[A.type]_[md5(str)]" // without this dynamic light system ruin everithing //var/ma //ma = A.master ? "[A.master]" : "(null)" //world << "DEBUG: create_area:
A.name=[A.name]
A.tag=[A.tag]
A.master=[ma]" @@ -130,45 +157,34 @@ move an amendment to the drawing.

A.power_environ = 0 A.always_unpowered = 0 move_turfs_to_area(turfs, A) + A.SetDynamicLighting() - A.always_unpowered = 0 - for(var/turf/T in A.contents) - T.lighting_changed = 1 - lighting_controller.changed_turfs += T - - spawn(5) - //ma = A.master ? "[A.master]" : "(null)" - //world << "DEBUG: create_area(5):
A.name=[A.name]
A.tag=[A.tag]
A.master=[ma]" - interact() - return - - -/obj/item/blueprints/proc/move_turfs_to_area(var/list/turf/turfs, var/area/A) - A.contents.Add(turfs) - //oldarea.contents.Remove(usr.loc) // not needed - //T.loc = A //error: cannot change constant value - - -/obj/item/blueprints/proc/edit_area() - var/area/A = get_area() - //world << "DEBUG: edit_area" - var/prevname = "[A.name]" - var/str = trim(stripped_input(usr,"New area name:","Blueprint Editing", prevname, MAX_NAME_LEN)) - if(!str || !length(str) || str==prevname) //cancel - return - if(length(str) > 50) - usr << "\red Text too long." - return - set_area_machinery_title(A,str,prevname) - for(var/area/RA in A.related) - RA.name = str - usr << "\blue You set the area '[prevname]' title to '[str]'." interact() return +/obj/item/areaeditor/proc/move_turfs_to_area(var/list/turf/turfs, var/area/A) + A.contents.Add(turfs) -/obj/item/blueprints/proc/set_area_machinery_title(var/area/A,var/title,var/oldtitle) + +/obj/item/areaeditor/proc/edit_area() + var/area/A = get_area() + var/prevname = "[A.name]" + var/str = trim(stripped_input(usr,"New area name:", "Blueprint Editing", prevname, MAX_NAME_LEN)) + if(!str || !length(str) || str==prevname) //cancel + return + if(length(str) > 50) + usr << "The given name is too long. The area's name is unchanged." + return + set_area_machinery_title(A,str,prevname) + for(var/area/RA in A.related) + RA.name = str + usr << "You rename the '[prevname]' to '[str]'." + interact() + return + + +/obj/item/areaeditor/proc/set_area_machinery_title(var/area/A,var/title,var/oldtitle) if (!oldtitle) // or replacetext goes to infinite loop return for(var/area/RA in A.related) @@ -184,7 +200,8 @@ move an amendment to the drawing.

M.name = replacetext(M.name,oldtitle,title) //TODO: much much more. Unnamed airlocks, cameras, etc. -/obj/item/blueprints/proc/check_tile_is_border(var/turf/T2,var/dir) + +/obj/item/areaeditor/proc/check_tile_is_border(var/turf/T2,var/dir) if (istype(T2, /turf/space)) return BORDER_SPACE //omg hull breach we all going to die here if (istype(T2, /turf/simulated/shuttle)) @@ -199,7 +216,7 @@ move an amendment to the drawing.

for (var/obj/structure/window/W in T2) if(turn(dir,180) == W.dir) return BORDER_BETWEEN - if (W.is_fulltile()) + if (W.dir in list(NORTHEAST,SOUTHEAST,NORTHWEST,SOUTHWEST)) return BORDER_2NDTILE for(var/obj/machinery/door/window/D in T2) if(turn(dir,180) == D.dir) @@ -211,7 +228,8 @@ move an amendment to the drawing.

return BORDER_NONE -/obj/item/blueprints/proc/detect_room(var/turf/first) + +/obj/item/areaeditor/proc/detect_room(var/turf/first) var/list/turf/found = new var/list/turf/pending = list(first) while(pending.len) @@ -222,7 +240,7 @@ move an amendment to the drawing.

for (var/dir in cardinal) var/skip = 0 for (var/obj/structure/window/W in T) - if(dir == W.dir || (W.is_fulltile())) + if(dir == W.dir || (W.dir in list(NORTHEAST,SOUTHEAST,NORTHWEST,SOUTHWEST))) skip = 1; break if (skip) continue for(var/obj/machinery/door/window/D in T) diff --git a/code/game/objects/items/weapons/storage/boxes.dm b/code/game/objects/items/weapons/storage/boxes.dm index d025d7a217d..b0e0029057a 100644 --- a/code/game/objects/items/weapons/storage/boxes.dm +++ b/code/game/objects/items/weapons/storage/boxes.dm @@ -125,7 +125,7 @@ /obj/item/weapon/storage/box/injectors name = "\improper DNA injectors" desc = "This box contains injectors it seems." - + New() ..() new /obj/item/weapon/dnainjector/h2m(src) @@ -148,8 +148,7 @@ new /obj/item/ammo_casing/shotgun(src) new /obj/item/ammo_casing/shotgun(src) new /obj/item/ammo_casing/shotgun(src) - new /obj/item/ammo_casing/shotgun(src) - + new /obj/item/ammo_casing/shotgun(src) /obj/item/weapon/storage/box/flashbangs name = "box of flashbangs (WARNING)" @@ -403,6 +402,19 @@ for(var/i = 1; i <= 5; i++) new /obj/item/weapon/reagent_containers/food/snacks/monkeycube/wrapped/neaeracube(src) + +/obj/item/weapon/storage/box/permits + name = "box of construction permits" + desc = "A box for containing construction permits, used to officially declare built rooms as additions to the station." + icon_state = "id" + +/obj/item/weapon/storage/box/permits/New() //There's only a few, so blueprints are still useful beyond setting every room's name to PRIMARY FART STORAGE + ..() + new /obj/item/areaeditor/permit(src) + new /obj/item/areaeditor/permit(src) + new /obj/item/areaeditor/permit(src) + + /obj/item/weapon/storage/box/ids name = "spare IDs" desc = "Has so many empty IDs." diff --git a/code/game/objects/structures/crates_lockers/closets/secure/engineering.dm b/code/game/objects/structures/crates_lockers/closets/secure/engineering.dm index a5a082b0364..74967aebc56 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/engineering.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/engineering.dm @@ -7,8 +7,7 @@ icon_opened = "secureceopen" icon_broken = "securecebroken" icon_off = "secureceoff" - - + New() ..() sleep(2) @@ -17,7 +16,8 @@ else new /obj/item/weapon/storage/backpack/satchel_eng(src) new /obj/item/weapon/storage/backpack/duffel/engineering(src) - new /obj/item/blueprints(src) + new /obj/item/areaeditor/blueprints(src) + new /obj/item/weapon/storage/box/permits(src) new /obj/item/clothing/under/rank/chief_engineer(src) new /obj/item/clothing/head/hardhat/white(src) new /obj/item/clothing/glasses/welding/superior(src) @@ -31,9 +31,7 @@ new /obj/item/device/multitool(src) new /obj/item/device/flash(src) new /obj/item/taperoll/engineering(src) - return - - + return /obj/structure/closet/secure_closet/engineering_electrical name = "Electrical Supplies" diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index 85be9cbe361..226658e7830 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -354,5 +354,5 @@ var/list/non_fakeattack_weapons = list(/obj/item/weapon/gun/projectile, /obj/ite /obj/item/toy/syndicateballoon, /obj/item/weapon/gun/energy/laser/captain,\ /obj/item/weapon/hand_tele, /obj/item/weapon/rcd, /obj/item/weapon/tank/jetpack,\ /obj/item/clothing/under/rank/captain, /obj/item/device/aicard,\ - /obj/item/clothing/shoes/magboots, /obj/item/blueprints, /obj/item/weapon/disk/nuclear,\ + /obj/item/clothing/shoes/magboots, /obj/item/areaeditor/blueprints, /obj/item/weapon/disk/nuclear,\ /obj/item/clothing/suit/space/nasavoid, /obj/item/weapon/tank) diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm index 412d132a9ff..a10372b8be8 100644 --- a/code/modules/paperwork/photography.dm +++ b/code/modules/paperwork/photography.dm @@ -201,7 +201,7 @@ for(var/atom/A in the_turf) if(A.invisibility) continue atoms.Add(A) - + // Sort the atoms into their layers var/list/sorted = sort_atoms_by_layer(atoms) var/center_offset = (size-1)/2 * 32 + 1 @@ -229,7 +229,7 @@ // Calculate where we are relative to the center of the photo var/xoff = (the_turf.x - center.x) * 32 + center_offset var/yoff = (the_turf.y - center.y) * 32 + center_offset - res.Blend(getFlatIcon(the_turf.loc), blendMode2iconMode(the_turf.blend_mode),xoff,yoff) + res.Blend(getFlatIcon(the_turf.loc), blendMode2iconMode(the_turf.blend_mode),xoff,yoff) return res @@ -384,6 +384,7 @@ camera.network = list("news") camera.c_tag = user.name else + src.icon_state = icon_on camera = new /obj/machinery/camera(src) camera.network = list("news")