mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 19:47:22 +01:00
Touches up buildmode code (#28506)
* Initial commit * Forgot to use my brain * Should actually be -1 by default
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/datum/buildmode_mode/advanced
|
||||
key = "advanced"
|
||||
var/objholder = null
|
||||
var/obj_holder = null
|
||||
|
||||
// FIXME: add logic which adds a button displaying the icon
|
||||
// of the currently selected path
|
||||
@@ -16,16 +16,16 @@
|
||||
to_chat(user, "<span class='notice'>***********************************************************</span>")
|
||||
|
||||
/datum/buildmode_mode/advanced/change_settings(mob/user)
|
||||
var/target_path = input(user,"Enter typepath:" ,"Typepath","/obj/structure/closet")
|
||||
objholder = text2path(target_path)
|
||||
if(!ispath(objholder))
|
||||
objholder = pick_closest_path(target_path)
|
||||
if(!objholder)
|
||||
alert("No path was selected")
|
||||
var/target_path = tgui_input_text(user, "Enter typepath:" , "Typepath", "/obj/structure/closet")
|
||||
obj_holder = text2path(target_path)
|
||||
if(!ispath(obj_holder))
|
||||
obj_holder = pick_closest_path(target_path)
|
||||
if(!obj_holder)
|
||||
tgui_alert(user, "No path was selected")
|
||||
return
|
||||
else if(ispath(objholder, /area))
|
||||
objholder = null
|
||||
alert("That path is not allowed.")
|
||||
else if(ispath(obj_holder, /area))
|
||||
obj_holder = null
|
||||
tgui_alert(user,"That path is not allowed")
|
||||
return
|
||||
|
||||
/datum/buildmode_mode/advanced/handle_click(user, params, obj/object)
|
||||
@@ -36,18 +36,18 @@
|
||||
|
||||
if(left_click && alt_click)
|
||||
if(isturf(object) || isobj(object) || ismob(object))
|
||||
objholder = object.type
|
||||
obj_holder = object.type
|
||||
to_chat(user, "<span class='notice'>[initial(object.name)] ([object.type]) selected.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>[initial(object.name)] is not a turf, object, or mob! Please select again.</span>")
|
||||
else if(left_click)
|
||||
if(ispath(objholder,/turf))
|
||||
if(ispath(obj_holder,/turf))
|
||||
var/turf/T = get_turf(object)
|
||||
log_admin("Build Mode: [key_name(user)] modified [T] ([T.x],[T.y],[T.z]) to [objholder]")
|
||||
T.ChangeTurf(objholder)
|
||||
else if(!isnull(objholder))
|
||||
log_admin("Build Mode: [key_name(user)] modified [T] ([T.x],[T.y],[T.z]) to [obj_holder]")
|
||||
T.ChangeTurf(obj_holder)
|
||||
else if(!isnull(obj_holder))
|
||||
//we only want to set the direction of mobs or objects, not turfs or areas.
|
||||
var/atom/movable/A = new objholder(get_turf(object))
|
||||
var/atom/movable/A = new obj_holder(get_turf(object))
|
||||
if(istype(A))
|
||||
A.setDir(BM.build_dir)
|
||||
log_admin("Build Mode: [key_name(user)] modified [A]'s ([A.x],[A.y],[A.z]) dir to [BM.build_dir]")
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
/datum/buildmode_mode/area_edit
|
||||
key = "areaedit"
|
||||
var/area/storedarea
|
||||
var/image/areaimage
|
||||
var/area/stored_area
|
||||
var/image/area_image
|
||||
|
||||
/datum/buildmode_mode/area_edit/New()
|
||||
areaimage = image('icons/turf/areas.dmi', null, "yellow")
|
||||
area_image = image('icons/turf/areas.dmi', null, "yellow")
|
||||
..()
|
||||
|
||||
/datum/buildmode_mode/area_edit/enter_mode(datum/click_intercept/buildmode/BM)
|
||||
BM.holder.images += areaimage
|
||||
BM.holder.images += area_image
|
||||
|
||||
/datum/buildmode_mode/area_edit/exit_mode(datum/click_intercept/buildmode/BM)
|
||||
areaimage.loc = null // de-color the area
|
||||
BM.holder.images -= areaimage
|
||||
area_image.loc = null // de-color the area
|
||||
BM.holder.images -= area_image
|
||||
return ..()
|
||||
|
||||
/datum/buildmode_mode/area_edit/Destroy()
|
||||
QDEL_NULL(areaimage)
|
||||
QDEL_NULL(area_image)
|
||||
return ..()
|
||||
|
||||
/datum/buildmode_mode/area_edit/show_help(mob/user)
|
||||
@@ -27,19 +27,19 @@
|
||||
to_chat(user, "<span class='notice'>***********************************************************</span>")
|
||||
|
||||
/datum/buildmode_mode/area_edit/change_settings(mob/user)
|
||||
var/target_path = input(user,"Enter typepath:", "Typepath", "/area")
|
||||
var/areatype = text2path(target_path)
|
||||
if(ispath(areatype,/area))
|
||||
var/areaname = input(user,"Enter area name:", "Area name", "Area")
|
||||
if(!areaname || !length(areaname))
|
||||
var/target_path = tgui_input_text(user, "Enter typepath:", "Typepath", "/area")
|
||||
var/area_type = text2path(target_path)
|
||||
if(ispath(area_type,/area))
|
||||
var/area_name = tgui_input_text(user,"Enter area name:", "Area name", "Area")
|
||||
if(!area_name || !length(area_name))
|
||||
return
|
||||
storedarea = new areatype
|
||||
storedarea.powernet.equipment_powered = FALSE
|
||||
storedarea.powernet.lighting_powered = FALSE
|
||||
storedarea.powernet.environment_powered = FALSE
|
||||
storedarea.always_unpowered = FALSE
|
||||
storedarea.name = areaname
|
||||
areaimage.loc = storedarea // color our area
|
||||
stored_area = new area_type
|
||||
stored_area.powernet.equipment_powered = FALSE
|
||||
stored_area.powernet.lighting_powered = FALSE
|
||||
stored_area.powernet.environment_powered = FALSE
|
||||
stored_area.always_unpowered = FALSE
|
||||
stored_area.name = area_name
|
||||
area_image.loc = stored_area // color our area
|
||||
|
||||
/datum/buildmode_mode/area_edit/handle_click(user, params, object)
|
||||
var/list/pa = params2list(params)
|
||||
@@ -47,13 +47,13 @@
|
||||
var/right_click = pa.Find("right")
|
||||
|
||||
if(left_click)
|
||||
if(!storedarea)
|
||||
if(!stored_area)
|
||||
to_chat(user, "<span class='warning'>Configure or select the area you want to paint first!</span>")
|
||||
return
|
||||
var/turf/T = get_turf(object)
|
||||
if(get_area(T) != storedarea)
|
||||
storedarea.contents.Add(T)
|
||||
if(get_area(T) != stored_area)
|
||||
stored_area.contents.Add(T)
|
||||
else if(right_click)
|
||||
var/turf/T = get_turf(object)
|
||||
storedarea = get_area(T)
|
||||
areaimage.loc = storedarea // color our area
|
||||
stored_area = get_area(T)
|
||||
area_image.loc = stored_area // color our area
|
||||
|
||||
@@ -23,14 +23,14 @@
|
||||
// FIXME this is a little tedious, something where you don't have to fill in each field would be cooler
|
||||
// maybe some kind of stat panel thing?
|
||||
/datum/buildmode_mode/atmos/change_settings(mob/user)
|
||||
pressure = input(user, "Atmospheric Pressure", "Input", ONE_ATMOSPHERE) as num|null
|
||||
temperature = input(user, "Temperature", "Input", T20C) as num|null
|
||||
oxygen = input(user, "Oxygen ratio", "Input", O2STANDARD) as num|null
|
||||
nitrogen = input(user, "Nitrogen ratio", "Input", N2STANDARD) as num|null
|
||||
plasma = input(user, "Plasma ratio", "Input", 0) as num|null
|
||||
cdiox = input(user, "CO2 ratio", "Input", 0) as num|null
|
||||
nitrox = input(user, "N2O ratio", "Input", 0) as num|null
|
||||
agentbx = input(user, "Agent B ratio", "Input", 0) as num|null
|
||||
pressure = tgui_input_number(user, "Atmospheric Pressure", "Input", ONE_ATMOSPHERE)
|
||||
temperature = tgui_input_number(user, "Temperature", "Input", T20C)
|
||||
oxygen = tgui_input_number(user, "Oxygen ratio", "Input", O2STANDARD)
|
||||
nitrogen = tgui_input_number(user, "Nitrogen ratio", "Input", N2STANDARD)
|
||||
plasma = tgui_input_number(user, "Plasma ratio", "Input", 0)
|
||||
cdiox = tgui_input_number(user, "CO2 ratio", "Input", 0)
|
||||
nitrox = tgui_input_number(user, "N2O ratio", "Input", 0)
|
||||
agentbx = tgui_input_number(user, "Agent B ratio", "Input", 0)
|
||||
|
||||
/datum/buildmode_mode/atmos/proc/ppratio_to_moles(ppratio)
|
||||
// ideal gas equation: Pressure * Volume = Moles * r * Temperature
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
/datum/buildmode_mode/boom
|
||||
key = "boom"
|
||||
|
||||
// Range of Total Devastation
|
||||
var/devastation = -1
|
||||
// Ramge of Heavy Impact
|
||||
var/heavy = -1
|
||||
// Range of Light Impact
|
||||
var/light = -1
|
||||
// Range of Flash
|
||||
var/flash = -1
|
||||
// Range of Flames
|
||||
var/flames = -1
|
||||
|
||||
/datum/buildmode_mode/boom/show_help(mob/user)
|
||||
@@ -13,16 +18,11 @@
|
||||
to_chat(user, "<span class='notice'>***********************************************************</span>")
|
||||
|
||||
/datum/buildmode_mode/boom/change_settings(mob/user)
|
||||
devastation = input("Range of total devastation. -1 to none", "Input") as num|null
|
||||
if(devastation == null) devastation = -1
|
||||
heavy = input("Range of heavy impact. -1 to none", "Input") as num|null
|
||||
if(heavy == null) heavy = -1
|
||||
light = input("Range of light impact. -1 to none", "Input") as num|null
|
||||
if(light == null) light = -1
|
||||
flash = input("Range of flash. -1 to none", "Input") as num|null
|
||||
if(flash == null) flash = -1
|
||||
flames = input("Range of flames. -1 to none", "Input") as num|null
|
||||
if(flames == null) flames = -1
|
||||
devastation = tgui_input_number(user, "Range of Total Devasation", "Devastation", -1, min_value = -1)
|
||||
heavy = tgui_input_number(user, "Range of Heavy Impact", "Heavy Impact", -1, min_value = -1)
|
||||
light = tgui_input_number(user, "Range of Light Impact", "Light Impact", -1, min_value = -1)
|
||||
flash = tgui_input_number(user, "Range of Flash", "Flash", -1, min_value = -1)
|
||||
flames = tgui_input_number(user, "Range of Flames", "Flames", -1, min_value = -1)
|
||||
|
||||
/datum/buildmode_mode/boom/handle_click(user, params, obj/object)
|
||||
var/list/pa = params2list(params)
|
||||
|
||||
@@ -13,16 +13,16 @@
|
||||
to_chat(user, "<span class='notice'>***********************************************************</span>")
|
||||
|
||||
/datum/buildmode_mode/fill/change_settings(mob/user)
|
||||
var/target_path = input(user,"Enter typepath:" ,"Typepath","/obj/structure/closet")
|
||||
var/target_path = tgui_input_text(user, "Enter typepath:" , "Typepath", "/obj/structure/closet")
|
||||
objholder = text2path(target_path)
|
||||
if(!ispath(objholder))
|
||||
objholder = pick_closest_path(target_path)
|
||||
if(!objholder)
|
||||
alert("No path has been selected.")
|
||||
tgui_alert(user, "No path has been selected")
|
||||
return
|
||||
else if(ispath(objholder, /area))
|
||||
objholder = null
|
||||
alert("Area paths are not supported for this mode, use the area edit mode instead.")
|
||||
tgui_alert(user, "Area paths are not supported for this mode, use the area edit mode instead")
|
||||
return
|
||||
deselect_region()
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
/datum/buildmode_mode/mapgen/change_settings(mob/user)
|
||||
var/list/gen_paths = subtypesof(/datum/map_generator)
|
||||
|
||||
var/type = input(user,"Select Generator Type","Type") as null|anything in gen_paths
|
||||
var/type = tgui_input_list(user, "Select Generator Type", "Type", gen_paths)
|
||||
if(!type) return
|
||||
|
||||
generator_path = type
|
||||
@@ -35,6 +35,6 @@
|
||||
var/datum/map_generator/G = new generator_path
|
||||
G.defineRegion(cornerA, cornerB, 1)
|
||||
highlight_region(G.map)
|
||||
var/confirm = alert("Are you sure you want run the map generator?", "Run generator", "Yes", "No")
|
||||
var/confirm = tgui_alert(user, "Are you sure you want run the map generator?", "Run generator", list("Yes", "No"))
|
||||
if(confirm == "Yes")
|
||||
G.generate()
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
to_chat(user, "<span class='notice'>***********************************************************</span>")
|
||||
|
||||
/datum/buildmode_mode/offer/change_settings(mob/user)
|
||||
hours = input(user, "Playtime required", "Input", 20) as num|null
|
||||
if(alert("Do you want to show the mob's special role?", null, "Yes", "No") == "Yes")
|
||||
hours = tgui_input_number(user, "Playtime required", "Input", 20)
|
||||
if(tgui_alert(user, "Do you want to show the mob's special role?", "Role Status", list("Yes", "No")) == "Yes")
|
||||
hide_role = FALSE
|
||||
else
|
||||
hide_role = TRUE
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
to_chat(user, "<span class='notice'>***********************************************************</span>")
|
||||
|
||||
/datum/buildmode_mode/save/change_settings(mob/user)
|
||||
use_json = (alert("Would you like to use json (Default is \"Yes\")?", null,"Yes","No") == "Yes")
|
||||
use_json = (tgui_alert("Would you like to use json (Default is \"Yes\")?", list("Yes", "No")) == "Yes")
|
||||
|
||||
/datum/buildmode_mode/save/handle_selected_region(mob/user, params)
|
||||
var/list/pa = params2list(params)
|
||||
var/left_click = pa.Find("left")
|
||||
if(left_click)
|
||||
var/map_name = input(user, "Please select a name for your map", "Buildmode", "")
|
||||
var/map_name = tgui_input_text(user, "Please select a name for your map", "Map Name", "")
|
||||
if(map_name == "")
|
||||
return
|
||||
var/map_flags = 0
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
if(ismob(object))
|
||||
var/mob/target = object
|
||||
if(!isnull(target.ckey))
|
||||
alert("This cannot be used on mobs with a ckey. Use Forcesay in player panel instead.")
|
||||
tgui_alert(user, "This cannot be used on mobs with a ckey. Use Forcesay in player panel instead.")
|
||||
return
|
||||
|
||||
var/list/pa = params2list(params)
|
||||
|
||||
@@ -25,23 +25,23 @@
|
||||
to_chat(user, "<span class='notice'>***********************************************************</span>")
|
||||
|
||||
/datum/buildmode_mode/tilting/change_settings(mob/user)
|
||||
crush_damage = input(user, "Crush Damage", "Damage", initial(crush_damage)) as num|null
|
||||
crit_chance = input(user, "Crit Chance (out of 100)", "Crit chance", 0) as num|null
|
||||
crush_damage = tgui_input_number(user, "Crush Damage", "Damage", initial(crush_damage))
|
||||
crit_chance = tgui_input_number(user, "Crit Chance (out of 100)", "Crit chance", 0)
|
||||
if(crit_chance > 0)
|
||||
var/forced_crit_path = input(user, "Force a specific crit?", "Forced Crit", null) as null|anything in GLOB.tilt_crits
|
||||
var/forced_crit_path = tgui_input_list(user, "Force a specific crit?", "Forced Crit", list(GLOB.tilt_crits))
|
||||
if(forced_crit_path)
|
||||
forced_crit = GLOB.tilt_crits[forced_crit_path]
|
||||
weaken_time = input(user, "How long to weaken (in seconds)?", "Weaken Time", 4) as num|null
|
||||
weaken_time = tgui_input_number(user, "How long to weaken (in seconds)?", "Weaken Time", 4)
|
||||
weaken_time = weaken_time SECONDS
|
||||
knockdown_time = input(user, "How long to knockdown (in seconds)?", "Knockdown Time", 12) as num|null
|
||||
knockdown_time = tgui_input_number(user, "How long to knockdown (in seconds)?", "Knockdown Time", 12)
|
||||
knockdown_time = knockdown_time SECONDS
|
||||
ignore_gravity = alert(user, "Ignore gravity?", "Ignore gravity", "Yes", "No") == "Yes"
|
||||
should_rotate = alert(user, "Should it rotate on falling?", "Should rotate", "Yes", "No") == "Yes"
|
||||
ignore_gravity = tgui_alert(user, "Ignore gravity?", "Ignore gravity", "Yes", "No") == "Yes"
|
||||
should_rotate = tgui_alert(user, "Should it rotate on falling?", "Should rotate", "Yes", "No") == "Yes"
|
||||
if(should_rotate)
|
||||
rotation_angle = input(user, "Which angle to rotate at? (if empty, defaults to 90 degrees in either direction)", "Rotation angle", 0) as num|null
|
||||
rightable = alert(user, "Should it be rightable with alt-click?", "Rightable", "Yes", "No") == "Yes"
|
||||
rotation_angle = tgui_input_number(user, "Which angle to rotate at? (if empty, defaults to 90 degrees in either direction)", "Rotation angle", 0)
|
||||
rightable = tgui_alert(user, "Should it be rightable with alt-click?", "Rightable", "Yes", "No") == "Yes"
|
||||
if(rightable)
|
||||
block_interactions_until_righted = alert(user, "Should it block interactions until righted (by alt-clicking)?", "Block interactions", "Yes", "No") == "Yes"
|
||||
block_interactions_until_righted = tgui_alert(user, "Should it block interactions until righted (by alt-clicking)?", "Block interactions", "Yes", "No") == "Yes"
|
||||
|
||||
/datum/buildmode_mode/tilting/handle_click(mob/user, params, atom/movable/object)
|
||||
var/list/pa = params2list(params)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// FIXME: This needs to use a standard var-editing interface instead of
|
||||
// doing its own thing here
|
||||
/datum/buildmode_mode/varedit/change_settings(mob/user)
|
||||
var/temp_varname = input(user,"Enter variable name:", "Name", "name")
|
||||
var/temp_varname = tgui_input_text(user, "Enter variable name:", "Name", "name")
|
||||
if(!vv_varname_lockcheck(temp_varname))
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user