mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-15 00:53:23 +01:00
Merge pull request #5316 from Crazylemon64/map_writer
Adds a "Save" buildmode
This commit is contained in:
@@ -8,7 +8,8 @@
|
||||
#define FILL_BUILDMODE 8
|
||||
#define LINK_BUILDMODE 9
|
||||
#define BOOM_BUILDMODE 10
|
||||
#define NUM_BUILDMODES 10
|
||||
#define SAVE_BUILDMODE 11
|
||||
#define NUM_BUILDMODES 11
|
||||
|
||||
/obj/screen/buildmode
|
||||
icon = 'icons/misc/buildmode.dmi'
|
||||
@@ -81,8 +82,11 @@
|
||||
/obj/effect/buildmode_reticule/New(var/turf/t, var/client/c)
|
||||
loc = t
|
||||
I = image('icons/mob/blob.dmi', t, "marker",19.0,2) // Sprite reuse wooo
|
||||
cl = c
|
||||
cl.images += I
|
||||
if(c)
|
||||
cl = c
|
||||
cl.images += I
|
||||
else
|
||||
log_debug("Buildmode reticule created without a client!")
|
||||
|
||||
/obj/effect/buildmode_reticule/proc/deselect()
|
||||
qdel(src)
|
||||
@@ -174,6 +178,8 @@
|
||||
var/light = -1
|
||||
var/flash = -1
|
||||
var/flames = -1
|
||||
// Saving mode
|
||||
var/use_json = TRUE
|
||||
|
||||
/datum/click_intercept/buildmode/New(client/c)
|
||||
..()
|
||||
@@ -261,6 +267,13 @@
|
||||
to_chat(user, "<span class='notice'>***********************************************************</span>")
|
||||
to_chat(user, "<span class='notice'>Mouse Button on obj = Kaboom</span>")
|
||||
to_chat(user, "<span class='notice'>***********************************************************</span>")
|
||||
if(SAVE_BUILDMODE)
|
||||
to_chat(user, "<span class='notice'>***********************************************************</span>")
|
||||
to_chat(user, "<span class='notice'>Left Mouse Button on turf/obj/mob = Select corner</span>")
|
||||
to_chat(user, "<span class='notice'>***********************************************************</span>")
|
||||
|
||||
|
||||
|
||||
|
||||
/datum/click_intercept/buildmode/proc/change_settings(mob/user)
|
||||
switch(mode)
|
||||
@@ -345,6 +358,9 @@
|
||||
var/flames = input("Range of flames. -1 to none", text("Input")) as num|null
|
||||
if(flames == null) flames = -1
|
||||
|
||||
if(SAVE_BUILDMODE)
|
||||
use_json = (alert("Would you like to use json (Default is \"Yes\")?",,"Yes","No") == "Yes")
|
||||
|
||||
/datum/click_intercept/buildmode/proc/change_dir()
|
||||
switch(build_dir)
|
||||
if(NORTH)
|
||||
@@ -625,3 +641,27 @@
|
||||
link_lines += L2
|
||||
if(BOOM_BUILDMODE)
|
||||
explosion(object, devastation, heavy, light, flash, null, null,flames)
|
||||
if(SAVE_BUILDMODE)
|
||||
if(!cornerA)
|
||||
cornerA = select_tile(get_turf(object))
|
||||
return
|
||||
if(!cornerB)
|
||||
cornerB = select_tile(get_turf(object))
|
||||
if(left_click)
|
||||
if(cornerA && cornerB)
|
||||
var/turf/A = get_turf(cornerA)
|
||||
var/turf/B = get_turf(cornerB)
|
||||
deselect_region() // So we don't read our own reticules
|
||||
var/map_name = input(holder, "Please select a name for your map", "Buildmode", "")
|
||||
if(map_name == "")
|
||||
return
|
||||
var/map_flags = 0
|
||||
if(use_json)
|
||||
map_flags = 32 // Magic number defined in `writer.dm` that I can't use directly
|
||||
// because #defines are for some reason our coding standard
|
||||
var/our_map = maploader.save_map(A,B,map_name,map_flags)
|
||||
holder << ftp(our_map) // send the map they've made! Or are stealing, whatever
|
||||
to_chat(holder, "Map saving complete! [our_map]")
|
||||
return
|
||||
|
||||
deselect_region()
|
||||
|
||||
Reference in New Issue
Block a user