Updated bundle

This commit is contained in:
ItsSelis
2022-10-03 23:05:38 +02:00
69 changed files with 1570 additions and 123 deletions
+125 -9
View File
@@ -128,7 +128,7 @@
to_chat(usr, "<span class='notice'>***********************************************************<br>\
Left Mouse Button on turf = Select as point A<br>\
Right Mouse Button on turf = Select as point B<br>\
Right Mouse Button on buildmode button = Change floor/wall type<br>\
Right Mouse Button on buildmode button = Change floor/wall type/area name<br>\
***********************************************************</span>")
if(BUILDMODE_LADDER)
@@ -189,6 +189,7 @@
var/atom/movable/throw_atom = null
var/list/selected_mobs = list()
var/copied_faction = null
var/warned = 0
/obj/effect/bmode/buildholder/Destroy()
qdel(builddir)
@@ -219,13 +220,15 @@
screen_loc = "NORTH,WEST+2"
var/varholder = "name"
var/valueholder = "derp"
var/objholder = /obj/structure/closet
var/objholder = null
var/objsay = 1
var/wall_holder = /turf/simulated/wall
var/floor_holder = /turf/simulated/floor/plating
var/turf/coordA = null
var/turf/coordB = null
var/area_enabled = 0
var/area_name = "New Area"
var/new_light_color = "#FFFFFF"
var/new_light_range = 3
@@ -252,7 +255,7 @@
return 1
if(BUILDMODE_ADVANCED)
objholder = get_path_from_partial_text(/obj/structure/closet)
objholder = get_path_from_partial_text()
if(BUILDMODE_EDIT)
var/list/locked = list("vars", "key", "ckey", "client", "firemut", "ishulk", "telekinesis", "xray", "virus", "viruses", "cuffed", "ka", "last_eaten", "urine")
@@ -275,6 +278,18 @@
master.buildmode.valueholder = tgui_input_list(usr,"Enter variable value:", "Value", world)
if(BUILDMODE_ROOM)
var/area_choice = tgui_alert(usr, "Would you like to generate a new area as well?","Room Builder", list("No", "Yes"))
switch(area_choice)
if("No")
area_enabled = 0
if("Yes")
area_enabled = 1
area_name = tgui_input_text(usr, "New area name", "Room Buildmode", max_length = MAX_NAME_LEN)
if(isnull(area_name))
to_chat(usr, "<span class='notice'>You must enter a non-null name.</span>")
area_enabled = 0
return
area_name = sanitize(area_name,MAX_NAME_LEN)
var/choice = tgui_alert(usr, "Would you like to change the floor or wall holders?","Room Builder", list("Floor", "Wall"))
switch(choice)
if("Floor")
@@ -330,7 +345,13 @@
return
else if(istype(object,/turf/simulated/floor))
var/turf/T = object
T.ChangeTurf(/turf/space)
if(!holder.warned)
var/warning = tgui_alert(user, "Are you -sure- you want to delete this turf and make it the base turf for this Z level?", "GRIEF ALERT", list("No", "Yes"))
if(warning == "Yes")
holder.warned = 1
else
return
T.ChangeTurf(get_base_turf_by_area(T)) //Defaults to Z if area does not have a special base turf.
return
else if(istype(object,/turf/simulated/wall/r_wall))
var/turf/T = object
@@ -358,6 +379,13 @@
if(NORTHWEST)
var/obj/structure/window/reinforced/WIN = new/obj/structure/window/reinforced(get_turf(object))
WIN.set_dir(NORTHWEST)
else if(istype(object,/turf) && pa.Find("ctrl") && pa.Find("alt") && pa.Find("middle"))
var/turf/T = object
var/obj/item/toy/plushie/teshari/easter_egg = new /obj/item/toy/plushie/teshari(T)
easter_egg.name = "coding teshari plushie"
easter_egg.desc = "A small purple teshari with a plush keyboard attached to it. Where did this come from?"
easter_egg.color = "#a418c7"
if(BUILDMODE_ADVANCED)
if(pa.Find("left") && !pa.Find("ctrl"))
@@ -411,13 +439,19 @@
to_chat(user, "<span class='notice'>Defined [object] ([object.type]) as point B.</span>")
if(holder.buildmode.coordA && holder.buildmode.coordB)
if(isnull(holder.buildmode.area_name))
to_chat(user, "<span class='notice'>ERROR: Insert area name before use.</span>")
holder.buildmode.coordA = null
holder.buildmode.coordB = null
return
to_chat(user, "<span class='notice'>A and B set, creating rectangle.</span>")
holder.buildmode.make_rectangle(
holder.buildmode.coordA,
holder.buildmode.coordB,
holder.buildmode.wall_holder,
holder.buildmode.floor_holder
)
holder.buildmode.floor_holder,
holder.buildmode.area_enabled,
holder.buildmode.area_name)
holder.buildmode.coordA = null
holder.buildmode.coordB = null
@@ -647,11 +681,9 @@
result = matches[1]
else
result = tgui_input_list(usr, "Select an atom type", "Spawn Atom", matches, strict_modern = TRUE)
if(!objholder)
result = default_path
return result
/obj/effect/bmode/buildmode/proc/make_rectangle(var/turf/A, var/turf/B, var/turf/wall_type, var/turf/floor_type)
/obj/effect/bmode/buildmode/proc/make_rectangle(var/turf/A, var/turf/B, var/turf/wall_type, var/turf/floor_type, var/area_enabled, var/area_name)
if(!A || !B) // No coords
return
if(A.z != B.z) // Not same z-level
@@ -685,6 +717,10 @@
var/high_bound_x = lower_left_corner.x + abs(width)
var/high_bound_y = lower_left_corner.y + abs(height)
var/origin_x = lower_left_corner.x + round((abs(width)/2))
var/origin_y = lower_left_corner.y + round((abs(height)/2))
var/turf/origin
for(var/i = low_bound_x, i <= high_bound_x, i++)
for(var/j = low_bound_y, j <= high_bound_y, j++)
var/turf/T = locate(i, j, z_level)
@@ -693,11 +729,91 @@
T.ChangeTurf(wall_type)
else
new wall_type(T)
else
if(T.x == origin_x && T.y == origin_y) //Get the middle of the square.
origin = T
if(isturf(floor_type))
T.ChangeTurf(floor_type)
else
new floor_type(T)
if(area_enabled) //Let's try not to make a new area unless you got walls and a floor.
create_buildmode_area(area_name, origin) //Generates a new area.
/proc/create_buildmode_area(var/area_name, var/turf/origin)
var/turfs = detect_room_buildmode(origin)
var/area/newA
var/area/oldA = get_area(origin)
var/str = area_name
str = sanitize(str,MAX_NAME_LEN)
if(!str || !length(str)) //cancel
return
newA = new /area/buildmode
newA.dynamic_lighting = FALSE // Without this it's pitch black if you build anywhere but space.
newA.luminosity = TRUE // Without this it's pitch black if you build anywhere but space.
newA.setup(str)
newA.has_gravity = oldA.has_gravity
for(var/i in 1 to length(turfs)) //Fix lighting. Praise the lord.
var/turf/thing = turfs[i]
newA.contents += thing
thing.change_area(oldA, newA)
set_area_machinery(newA, newA.name, oldA.name)// Change the name and area defines of all the machinery to the correct area.
oldA.power_check() //Simply makes the area turn the power off if you nicked an APC from it.
return TRUE
/proc/detect_room_buildmode(var/turf/first, var/allowedAreas = AREA_SPACE)
if(!istype(first))
return
var/list/turf/found = new
var/list/turf/pending = list(first)
while(pending.len)
var/turf/T = pending[1]
pending -= T
for (var/dir in cardinal)
var/turf/NT = get_step(T,dir)
if (!isturf(NT) || (NT in found) || (NT in pending))
continue
// We ask ZAS to determine if its airtight. Thats what matters anyway right?
if(air_master.air_blocked(T, NT))
// Okay thats the edge of the room
if(get_area_type_buildmode(NT.loc) == AREA_SPACE && air_master.air_blocked(NT, NT))
found += NT // So we include walls/doors not already in any area
continue
if (istype(NT, /turf/space))
return //omg hull breach we all going to die here
if (istype(NT, /turf/simulated/shuttle))
return // Unsure why this, but was in old code. Trusting for now.
if (NT.loc != first.loc && !(get_area_type_buildmode(NT.loc) & allowedAreas))
// Edge of a protected area. Lets stop here...
continue
if (!istype(NT, /turf/simulated))
// Great, unsimulated... eh, just stop searching here
continue
// Okay, NT looks promising, lets continue the search there!
pending += NT
found += T
// end while
return found
/proc/get_area_type_buildmode(area/A)
if(A.outdoors)
return AREA_SPACE
for (var/type in BUILDABLE_AREA_TYPES)
if ( istype(A,type) )
return AREA_SPACE
for (var/type in SPECIALS)
if ( istype(A,type) )
return AREA_SPECIAL
return AREA_STATION
/area/buildmode
dynamic_lighting = FALSE
luminosity = FALSE
#undef BUILDMODE_BASIC
#undef BUILDMODE_ADVANCED
+5 -1
View File
@@ -86,10 +86,14 @@
if (!holder)
return
var/msg = sanitize(tgui_input_text(usr, "Message:", text("Subtle PM to [M.key]")))
var/msg = tgui_input_text(usr, "Message:", text("Subtle PM to [M.key]"))
if (!msg)
return
if(!(msg[1] == "<" && msg[length(msg)] == ">")) //You can use HTML but only if the whole thing is HTML. Tries to prevent admin 'accidents'.
msg = sanitize(msg)
if(usr)
if (usr.client)
if(usr.client.holder)