View vars and game panel spawning updated:

- You can now edit variables for clients. You however can't mass-edit them.
- Common variables are displayed on top of the view variables menu. Screenshot shows examples of mobs, objects and datums.
Screenthot: http://www.kamletos.si/view_var_lost_count1.PNG
- Fixed the problem where long type paths ruined everything forever in view vars.
Screenshot: http://www.kamletos.si/view_var_lost_count2.PNG
- Added an option to the spawn object/mob/turf screens which lets you pick whether you want the item to spawn under your mob or in the object you have marked. You can only spawn stuff in objects of type /atom.
Screenshot: http://www.kamletos.si/spawn_objects.PNG

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2280 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
baloh.matevz
2011-09-28 18:58:53 +00:00
parent 2105904072
commit 4768bab71c
3 changed files with 125 additions and 38 deletions

View File

@@ -20,6 +20,15 @@ client
if (A.icon)
body += debug_variable("icon", new/icon(A.icon, A.icon_state, A.dir), 0)
#endif
var/icon/sprite
if(istype(D,/atom))
var/atom/AT = D
if(AT.icon && AT.icon_state)
sprite = new /icon(AT.icon, AT.icon_state)
usr << browse_rsc(sprite, "view_vars_sprite.png")
title = "[D] (\ref[D]) = [D.type]"
body += {"<script type="text/javascript">
@@ -140,18 +149,46 @@ client
body += "<body onload='selectTextField(); updateSearch()' onkeyup='updateSearch()'>"
body += "<div align='center'><table width='100%'><tr><td width='50%'><div align='center'><b>"
body += "<div align='center'><table width='100%'><tr><td width='50%'>"
if(sprite)
body += "<table align='center' width='100%'><tr><td><img src='view_vars_sprite.png'></td><td>"
else
body += "<table align='center' width='100%'><tr><td>"
body += "<div align='center'>"
if(istype(D,/atom))
body += "<a href='byond://?src=\ref[src];datumedit=\ref[D];varnameedit=name'>[D]</a>"
var/atom/A = D
body += "<a href='byond://?src=\ref[src];datumedit=\ref[D];varnameedit=name'><b>[D]</b></a>"
if(A.dir)
body += "<br><font size='1'><a href='byond://?src=\ref[src];rotatedatum=\ref[D];rotatedir=left'><<</a> <a href='byond://?src=\ref[src];datumedit=\ref[D];varnameedit=dir'>[dir2text(A.dir)]</a> <a href='byond://?src=\ref[src];rotatedatum=\ref[D];rotatedir=right'>>></a></font>"
if(istype(A,/mob))
var/mob/M = A
body += "<br><font size='1'><a href='byond://?src=\ref[src];datumedit=\ref[D];varnameedit=ckey'>[M.ckey ? M.ckey : "No ckey"]</a> / <a href='byond://?src=\ref[src];datumedit=\ref[D];varnameedit=real_name'>[M.real_name ? M.real_name : "No real name"]</a></font>"
else
body += "[D]"
body += "<b>[D]</b>"
body += "<br><font size='1'>[D.type]</font></b>"
body += "</div>"
body += "</tr></td></table>"
var/formatted_type = text("[D.type]")
if(length(formatted_type) > 25)
var/middle_point = length(formatted_type) / 2
var/splitpoint = findtext(formatted_type,"/",middle_point)
if(splitpoint)
formatted_type = "[copytext(formatted_type,1,splitpoint)]<br>[copytext(formatted_type,splitpoint)]"
else
formatted_type = "Type too long" //No suitable splitpoint (/) found.
body += "<div align='center'><b><font size='1'>[formatted_type]</font></b>"
if(src.holder && src.holder.marked_datum && src.holder.marked_datum == D)
body += "<br><font size='1' color='red'><b>Marked Object</b></font>"
body += "</div>"
body += "</div></td>"
body += "<td width='50%'><div align='center'><a href='byond://?src=\ref[src];datumrefresh=\ref[D]'>Refresh</a>"
@@ -315,24 +352,24 @@ client
if(!href_list["datumedit"] || !href_list["varnameedit"])
usr << "Varedit error: Not all information has been sent Contact a coder."
return
var/datum/DAT = locate(href_list["datumedit"])
var/DAT = locate(href_list["datumedit"])
if(!DAT)
usr << "Item not found"
return
if(!istype(DAT,/datum))
usr << "Can't edit an item of this type. Type must be /datum, so anything except simple variables. [DAT]"
if(!istype(DAT,/datum) && !istype(DAT,/client))
usr << "Can't edit an item of this type. Type must be /datum or /client, so anything except simple variables."
return
modify_variables(DAT, href_list["varnameedit"], 1)
else if (href_list["varnamechange"])
if(!href_list["datumchange"] || !href_list["varnamechange"])
usr << "Varedit error: Not all information has been sent. Contact a coder."
return
var/datum/DAT = locate(href_list["datumchange"])
var/DAT = locate(href_list["datumchange"])
if(!DAT)
usr << "Item not found"
return
if(!istype(DAT,/datum))
usr << "Can't edit an item of this type. Type must be /datum, so anything except simple variables. [DAT]"
if(!istype(DAT,/datum) && !istype(DAT,/client))
usr << "Can't edit an item of this type. Type must be /datum or /client, so anything except simple variables."
return
modify_variables(DAT, href_list["varnamechange"], 0)
else if (href_list["varnamemass"])
@@ -344,7 +381,7 @@ client
usr << "Item not found"
return
if(!istype(A,/atom))
usr << "Can't edit an item of this type. Type must be /atom, so an object, turf, mob or area. [A]"
usr << "Can't mass edit an item of this type. Type must be /atom, so an object, turf, mob or area. You cannot mass edit clients!"
return
cmd_mass_modify_object_variables(A, href_list["varnamemass"])
else if (href_list["mob_player_panel"])
@@ -490,6 +527,23 @@ client
return
src.holder.marked_datum = D
href_list["datumrefresh"] = href_list["mark_object"]
else if (href_list["rotatedatum"])
if(!href_list["rotatedir"])
return
var/atom/A = locate(href_list["rotatedatum"])
if(!A)
return
if(!istype(A,/atom))
usr << "This can only be done to objects of type /atom"
return
if(!src.holder)
return
switch(href_list["rotatedir"])
if("right")
A.dir = turn(A.dir, -45)
if("left")
A.dir = turn(A.dir, 45)
href_list["datumrefresh"] = href_list["rotatedatum"]
else
..()

View File

@@ -967,33 +967,59 @@
if(!obj_dir || !(obj_dir in list(1,2,4,8,5,6,9,10)))
obj_dir = 2
var/obj_name = sanitize(href_list["object_name"])
var/where = href_list["object_where"]
if (!( where in list("onfloor","inhand","inmarked") ))
where = "onfloor"
//TODO ERRORAGE
if( where == "inhand" )
usr << "Support for inhand not available yet. Will spawn on floor."
where = "onfloor"
//END TODO ERRORAGE
if ( where == "inhand" ) //Can only give when human or monkey
if ( !( ishuman(usr) || ismonkey(usr) ) )
usr << "Can only spawn in hand when you're a human or a monkey."
where = "onfloor"
else if ( usr.get_active_hand() )
usr << "Your active hand is full. Spawning on floor."
where = "onfloor"
if ( where == "inmarked" )
if ( !marked_datum )
usr << "You don't have any object marked. Abandoning spawn."
return
else
if ( !istype(marked_datum,/atom) )
usr << "The object you have marked cannot be used as a target. Target must be of type /atom. Abandoning spawn."
return
var/atom/target //Where the object will be spawned
switch ( where )
if ( "onfloor" )
switch (href_list["offset_type"])
if ("absolute")
target = locate(0 + X,0 + Y,0 + Z)
if ("relative")
target = locate(loc.x + X,loc.y + Y,loc.z + Z)
if ( "inmarked" )
target = marked_datum
//TODO ERRORAGE - Give support for "inhand"
if(target)
for (var/path in paths)
for (var/i = 0; i < number; i++)
var/atom/O = new path(target)
if(O)
O.dir = obj_dir
if(obj_name)
O.name = obj_name
if(istype(O,/mob))
var/mob/M = O
M.real_name = obj_name
for (var/i = 1 to number)
switch (href_list["offset_type"])
if ("absolute")
for (var/path in paths)
var/atom/O = new path(locate(0 + X,0 + Y,0 + Z))
if(O)
O.dir = obj_dir
if(obj_name)
O.name = obj_name
if(istype(O,/mob))
var/mob/M = O
M.real_name = obj_name
if ("relative")
if (loc)
for (var/path in paths)
var/atom/O = new path(locate(loc.x + X,loc.y + Y,loc.z + Z))
if(O)
O.dir = obj_dir
if(obj_name)
O.name = obj_name
if(istype(O,/mob))
var/mob/M = O
M.real_name = obj_name
else
return
if (number == 1)
log_admin("[key_name(usr)] created a [english_list(paths)]")

View File

@@ -35,8 +35,15 @@
Number: <input type="text" name="object_count" value="1" style="width:30px">
Dir: <input type="text" name="object_dir" value="2" style="width:30px">
Name: <input type="text" name="object_name" value="" style="width:180px"><br><br>
<select name="object_list" id="object_list" size="20" multiple style="width:400px"></select><br>
Name: <input type="text" name="object_name" value="" style="width:180px"><br>
Where:
<select name='object_where' style="width:300px">
<option value='onfloor'>On floor below own mob</option>
<!-- <option value='inhand'>In own mob's hand</option> -->
<option value='inmarked'>In marked object</option>
</select>
<br><br>
<select name="object_list" id="object_list" size="18" multiple style="width:400px"></select><br>
<input type="submit" value="spawn">
</form>