mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-09 16:14:13 +00:00
Buildmode update 2 (#16526)
* Buildmode update * Allow spawn to spawn areas * Fixes click-dragging functionality * Fully fixes click-drag
This commit is contained in:
committed by
Pieter-Jan Briers
parent
0c189b733c
commit
d33e6637ad
@@ -97,6 +97,7 @@
|
|||||||
to_chat(usr, "<span class='notice'>Left Mouse Button on turf/obj = Place objects</span>")
|
to_chat(usr, "<span class='notice'>Left Mouse Button on turf/obj = Place objects</span>")
|
||||||
to_chat(usr, "<span class='notice'>Right Mouse Button = Delete objects</span>")
|
to_chat(usr, "<span class='notice'>Right Mouse Button = Delete objects</span>")
|
||||||
to_chat(usr, "<span class='notice'>Middle Mouse Button = Copy atom</span>")
|
to_chat(usr, "<span class='notice'>Middle Mouse Button = Copy atom</span>")
|
||||||
|
to_chat(usr, "<span class='notice'>Middle Mouse Button twice on a turf = Area editing mode</span>")
|
||||||
to_chat(usr, "")
|
to_chat(usr, "")
|
||||||
to_chat(usr, "<span class='notice'>Ctrl+Shift+Left Mouse Button = Sets bottom left corner for fill mode</span>")
|
to_chat(usr, "<span class='notice'>Ctrl+Shift+Left Mouse Button = Sets bottom left corner for fill mode</span>")
|
||||||
to_chat(usr, "<span class='notice'>Ctrl+Shift+Right Mouse Button = Sets top right corner for fill mode</span>")
|
to_chat(usr, "<span class='notice'>Ctrl+Shift+Right Mouse Button = Sets top right corner for fill mode</span>")
|
||||||
@@ -153,6 +154,7 @@ obj/effect/bmode/buildholder/New()
|
|||||||
..()
|
..()
|
||||||
cl.screen -= list(builddir,buildhelp,buildmode,buildquit)
|
cl.screen -= list(builddir,buildhelp,buildmode,buildquit)
|
||||||
cl.buildmode_objs &= ~list(builddir,buildhelp,buildmode,buildquit,src)
|
cl.buildmode_objs &= ~list(builddir,buildhelp,buildmode,buildquit,src)
|
||||||
|
cl.images -= buildmode.area_overlay
|
||||||
buildmodeholders -= src
|
buildmodeholders -= src
|
||||||
|
|
||||||
/obj/effect/bmode/buildmode
|
/obj/effect/bmode/buildmode
|
||||||
@@ -162,6 +164,12 @@ obj/effect/bmode/buildholder/New()
|
|||||||
var/valueholder = "derp"
|
var/valueholder = "derp"
|
||||||
var/objholder = /obj/structure/closet
|
var/objholder = /obj/structure/closet
|
||||||
var/atom/copycat
|
var/atom/copycat
|
||||||
|
var/image/area_overlay
|
||||||
|
|
||||||
|
/obj/effect/bmode/buildmode/New()
|
||||||
|
..()
|
||||||
|
|
||||||
|
area_overlay = image('icons/turf/areas.dmi', "yellow")
|
||||||
|
|
||||||
/obj/effect/bmode/buildmode/Click(location, control, params)
|
/obj/effect/bmode/buildmode/Click(location, control, params)
|
||||||
var/list/pa = params2list(params)
|
var/list/pa = params2list(params)
|
||||||
@@ -271,7 +279,6 @@ obj/effect/bmode/buildholder/New()
|
|||||||
message_admins(msglog)
|
message_admins(msglog)
|
||||||
log_admin(msglog)
|
log_admin(msglog)
|
||||||
to_chat(usr, "<span class='notice'>If the server is lagging the operation will periodically sleep so the fill may take longer than typical.</span>")
|
to_chat(usr, "<span class='notice'>If the server is lagging the operation will periodically sleep so the fill may take longer than typical.</span>")
|
||||||
var/turf_op = ispath(whatfill, /turf)
|
|
||||||
var/deletions = 0
|
var/deletions = 0
|
||||||
for(var/turf/T in fillturfs)
|
for(var/turf/T in fillturfs)
|
||||||
if(areaAction == MASS_DELETE || areaAction == SELECTIVE_DELETE)
|
if(areaAction == MASS_DELETE || areaAction == SELECTIVE_DELETE)
|
||||||
@@ -289,7 +296,8 @@ obj/effect/bmode/buildholder/New()
|
|||||||
if(areaAction == MASS_DELETE)
|
if(areaAction == MASS_DELETE)
|
||||||
T.ChangeTurf(get_base_turf(T.z))
|
T.ChangeTurf(get_base_turf(T.z))
|
||||||
else
|
else
|
||||||
if(turf_op)
|
if(ispath(whatfill, /area) || istype(holder.buildmode.copycat, /area))
|
||||||
|
//In case of a selective fill, make sure the turf fits into the criteria before changing it
|
||||||
if(areaAction == SELECTIVE_FILL)
|
if(areaAction == SELECTIVE_FILL)
|
||||||
if(strict)
|
if(strict)
|
||||||
if(T.type != chosen)
|
if(T.type != chosen)
|
||||||
@@ -297,6 +305,23 @@ obj/effect/bmode/buildholder/New()
|
|||||||
else
|
else
|
||||||
if(!istype(T, chosen))
|
if(!istype(T, chosen))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
var/area/A
|
||||||
|
if(istype(holder.buildmode.copycat, /area))
|
||||||
|
A = holder.buildmode.copycat
|
||||||
|
else
|
||||||
|
A = locate(whatfill)
|
||||||
|
|
||||||
|
T.set_area(A)
|
||||||
|
else if(ispath(whatfill, /turf))
|
||||||
|
if(areaAction == SELECTIVE_FILL)
|
||||||
|
if(strict)
|
||||||
|
if(T.type != chosen)
|
||||||
|
continue
|
||||||
|
else
|
||||||
|
if(!istype(T, chosen))
|
||||||
|
continue
|
||||||
|
|
||||||
T.ChangeTurf(whatfill)
|
T.ChangeTurf(whatfill)
|
||||||
else
|
else
|
||||||
if(areaAction == SELECTIVE_FILL)
|
if(areaAction == SELECTIVE_FILL)
|
||||||
@@ -495,7 +520,7 @@ obj/effect/bmode/buildholder/New()
|
|||||||
message_admins(msglog)
|
message_admins(msglog)
|
||||||
log_admin(msglog)
|
log_admin(msglog)
|
||||||
to_chat(usr, "<span class='notice'>If the server is lagging the operation will periodically sleep so the fill may take longer than typical.</span>")
|
to_chat(usr, "<span class='notice'>If the server is lagging the operation will periodically sleep so the fill may take longer than typical.</span>")
|
||||||
var/turf_op = ispath(holder.buildmode.objholder,/turf)
|
|
||||||
var/deletions = 0
|
var/deletions = 0
|
||||||
for(var/turf/T in fillturfs)
|
for(var/turf/T in fillturfs)
|
||||||
if(areaAction == MASS_DELETE || areaAction == SELECTIVE_DELETE)
|
if(areaAction == MASS_DELETE || areaAction == SELECTIVE_DELETE)
|
||||||
@@ -513,7 +538,8 @@ obj/effect/bmode/buildholder/New()
|
|||||||
if(areaAction == MASS_DELETE)
|
if(areaAction == MASS_DELETE)
|
||||||
T.ChangeTurf(get_base_turf(T.z))
|
T.ChangeTurf(get_base_turf(T.z))
|
||||||
else
|
else
|
||||||
if(turf_op)
|
if(ispath(holder.buildmode.objholder, /area) || istype(holder.buildmode.copycat, /area))
|
||||||
|
//In case of a selective fill, make sure the turf fits into the criteria before changing it
|
||||||
if(areaAction == SELECTIVE_FILL)
|
if(areaAction == SELECTIVE_FILL)
|
||||||
if(strict)
|
if(strict)
|
||||||
if(T.type != chosen)
|
if(T.type != chosen)
|
||||||
@@ -521,6 +547,23 @@ obj/effect/bmode/buildholder/New()
|
|||||||
else
|
else
|
||||||
if(!istype(T, chosen))
|
if(!istype(T, chosen))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
var/area/A
|
||||||
|
if(istype(holder.buildmode.copycat, /area))
|
||||||
|
A = holder.buildmode.copycat
|
||||||
|
else
|
||||||
|
A = locate(holder.buildmode.objholder)
|
||||||
|
|
||||||
|
T.set_area(A)
|
||||||
|
else if(ispath(holder.buildmode.objholder, /turf))
|
||||||
|
if(areaAction == SELECTIVE_FILL)
|
||||||
|
if(strict)
|
||||||
|
if(T.type != chosen)
|
||||||
|
continue
|
||||||
|
else
|
||||||
|
if(!istype(T, chosen))
|
||||||
|
continue
|
||||||
|
|
||||||
T.ChangeTurf(holder.buildmode.objholder)
|
T.ChangeTurf(holder.buildmode.objholder)
|
||||||
else
|
else
|
||||||
if(areaAction == SELECTIVE_FILL)
|
if(areaAction == SELECTIVE_FILL)
|
||||||
@@ -552,6 +595,10 @@ obj/effect/bmode/buildholder/New()
|
|||||||
T.ChangeTurf(holder.buildmode.copycat.type)
|
T.ChangeTurf(holder.buildmode.copycat.type)
|
||||||
spawn(1)
|
spawn(1)
|
||||||
T.appearance = holder.buildmode.copycat.appearance
|
T.appearance = holder.buildmode.copycat.appearance
|
||||||
|
else if(isarea(holder.buildmode.copycat))
|
||||||
|
var/turf/T = get_turf(object)
|
||||||
|
T.set_area(holder.buildmode.copycat)
|
||||||
|
return
|
||||||
else
|
else
|
||||||
var/atom/movable/A = new holder.buildmode.copycat.type(get_turf(object))
|
var/atom/movable/A = new holder.buildmode.copycat.type(get_turf(object))
|
||||||
if(istype(A))
|
if(istype(A))
|
||||||
@@ -559,10 +606,14 @@ obj/effect/bmode/buildholder/New()
|
|||||||
A.dir = holder.builddir.dir
|
A.dir = holder.builddir.dir
|
||||||
log_admin("[key_name(usr)] made a [holder.buildmode.copycat.type] at [formatJumpTo(RT)]")
|
log_admin("[key_name(usr)] made a [holder.buildmode.copycat.type] at [formatJumpTo(RT)]")
|
||||||
else
|
else
|
||||||
if(ispath(holder.buildmode.objholder,/turf))
|
if(ispath(holder.buildmode.objholder,/turf)) //Handle turf changing
|
||||||
var/turf/T = get_turf(object)
|
var/turf/T = get_turf(object)
|
||||||
T.ChangeTurf(holder.buildmode.objholder)
|
T.ChangeTurf(holder.buildmode.objholder)
|
||||||
else
|
else if(ispath(holder.buildmode.objholder,/area)) //Handle area changing
|
||||||
|
var/area/A = locate(holder.buildmode.objholder)
|
||||||
|
var/turf/T = get_turf(object)
|
||||||
|
T.set_area(A)
|
||||||
|
else //Handle object spawning
|
||||||
var/obj/A = new holder.buildmode.objholder (get_turf(object))
|
var/obj/A = new holder.buildmode.objholder (get_turf(object))
|
||||||
if(istype(A))
|
if(istype(A))
|
||||||
A.dir = holder.builddir.dir
|
A.dir = holder.builddir.dir
|
||||||
@@ -579,6 +630,35 @@ obj/effect/bmode/buildholder/New()
|
|||||||
holder.buildmode.copycat = object
|
holder.buildmode.copycat = object
|
||||||
to_chat(usr, "<span class='info'>You will now build a lookalike of [object] when clicking.</span>")
|
to_chat(usr, "<span class='info'>You will now build a lookalike of [object] when clicking.</span>")
|
||||||
else
|
else
|
||||||
|
//Handle leaving area editing mode
|
||||||
|
if(istype(holder.buildmode.copycat, /area))
|
||||||
|
var/area/A = holder.buildmode.copycat
|
||||||
|
if(get_area(object) == A) //Leave area editing mode by copying an object from a different area
|
||||||
|
//Note: it would be much better to do this on any middle mouse button click
|
||||||
|
//I tried it, and it made this too sensitive, since after a double click, a THIRD mouse click was registered,
|
||||||
|
//so it would immediately leave area editing mode if you clicked on a turf too quickly
|
||||||
|
|
||||||
|
//Blame the old coders
|
||||||
|
return
|
||||||
|
|
||||||
|
holder.buildmode.copycat = null
|
||||||
|
user.client.images.Remove(holder.buildmode.area_overlay)
|
||||||
|
to_chat(usr, "<span class='info'>No longer editing area.</span>")
|
||||||
|
return
|
||||||
|
|
||||||
|
//Handle entering area editing mode
|
||||||
|
if(isturf(object))
|
||||||
|
//Middle mouse buttoning a turf twice will enter area editing mode for its area. Use the build-adv function to modify the area
|
||||||
|
if(holder.buildmode.copycat == object)
|
||||||
|
to_chat(usr, "<span class='info'>Modifying area of [object] ([formatJumpTo(object)]). Use the build-adv function to add tiles. Middle-click anywhere outside of the area to stop.</span>")
|
||||||
|
var/area/A = get_area(object)
|
||||||
|
holder.buildmode.copycat = A
|
||||||
|
holder.buildmode.area_overlay.loc = A
|
||||||
|
user.client.images.Add(holder.buildmode.area_overlay) //Enable area visualisation
|
||||||
|
return
|
||||||
|
else
|
||||||
|
holder.buildmode.copycat = object
|
||||||
|
|
||||||
holder.buildmode.objholder = object.type
|
holder.buildmode.objholder = object.type
|
||||||
to_chat(usr, "<span class='info'>You will now build [object.type] when clicking.</span>")
|
to_chat(usr, "<span class='info'>You will now build [object.type] when clicking.</span>")
|
||||||
|
|
||||||
|
|||||||
@@ -49,9 +49,11 @@ var/list/ladders = list()
|
|||||||
|
|
||||||
if(L.id == id)
|
if(L.id == id)
|
||||||
if(L.height == (height - 1))
|
if(L.height == (height - 1))
|
||||||
down = L
|
src.down = L
|
||||||
|
L.up = src
|
||||||
else if(L.height == (height + 1))
|
else if(L.height == (height + 1))
|
||||||
up = L
|
src.up = L
|
||||||
|
L.down = src
|
||||||
|
|
||||||
if(up && down) //if both our connections are filled
|
if(up && down) //if both our connections are filled
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -1309,6 +1309,11 @@ var/global/floorIsLava = 0
|
|||||||
if(ispath(chosen,/turf))
|
if(ispath(chosen,/turf))
|
||||||
var/turf/T = get_turf(usr.loc)
|
var/turf/T = get_turf(usr.loc)
|
||||||
T.ChangeTurf(chosen)
|
T.ChangeTurf(chosen)
|
||||||
|
else if(ispath(chosen, /area))
|
||||||
|
var/area/A = locate(chosen)
|
||||||
|
var/turf/T = get_turf(usr.loc)
|
||||||
|
|
||||||
|
T.set_area(A)
|
||||||
else
|
else
|
||||||
new chosen(usr.loc)
|
new chosen(usr.loc)
|
||||||
|
|
||||||
|
|||||||
@@ -194,14 +194,15 @@ var/list/forbidden_varedit_object_types = list(
|
|||||||
to_chat(user, "Unknown type: [selected_type]")
|
to_chat(user, "Unknown type: [selected_type]")
|
||||||
|
|
||||||
if(edited_datum && edited_variable)
|
if(edited_datum && edited_variable)
|
||||||
|
if(edited_datum.variable_edited(edited_variable, old_value, new_value))
|
||||||
|
//variable_edited() can block the edit in case there's special behavior for a variable (for example, updating lights after they're changed)
|
||||||
|
new_value = edited_datum.vars[edited_variable]
|
||||||
|
else
|
||||||
|
edited_datum.vars[edited_variable] = new_value
|
||||||
|
|
||||||
if(logging)
|
if(logging)
|
||||||
log_admin("[key_name(usr)] modified [edited_datum]'s [edited_variable] to [new_value]")
|
log_admin("[key_name(usr)] modified [edited_datum]'s [edited_variable] to [new_value]")
|
||||||
|
|
||||||
if(edited_datum.variable_edited(edited_variable, old_value, new_value))
|
|
||||||
new_value = old_value //Return the old value if the variable_edited proc blocked the edit
|
|
||||||
|
|
||||||
edited_datum.vars[edited_variable] = new_value
|
|
||||||
|
|
||||||
return new_value
|
return new_value
|
||||||
|
|
||||||
#undef V_MARKED_DATUM
|
#undef V_MARKED_DATUM
|
||||||
|
|||||||
Reference in New Issue
Block a user