ViewMods - Allows custom view ranges.

The primary function of this is a new button in the "Preferences" tab -
Set View Range. This functions similarly to the admin verb "Change View
Range", but it only allows you to set view ranges lower than the normal
world.view.

Full changelog:
 - Added ViewMods system to clients.
   - Everything that wants to change client.view should do it through
   this system.
   - Currently used by the Set View Range button and Marauders.
   - Stretch mode is set to stretch when active, but the original
   setting is preserved, as long as you set it with no ViewMods enabled.
   - The basic way this works is that it keeps track of /datum/viewmods
   on /clients, and whenever one is added or removed, it picks the
   highest view range out of all of them and sets the client's vision to
   that. This effectively means that, if you, say, set your view range
   to 5x5, and get into a Marauder and use the "zoom" button, it will
   always go to the marauder's zoom level.
   - The HUD is set to minimal mode for any view ranges below
   world.view, which means you only get absolutely critical buttons.
   	- It's set to invisible if you go down to view range 1 or 2,
	because the buttons can't fit on the screen at those view
	ranges.
 - Removed canvas examine option. Just zoom in yourself!
This commit is contained in:
tigercat2000
2017-06-07 19:39:33 -07:00
parent 4645b9e34d
commit 3652c3001a
9 changed files with 107 additions and 38 deletions
-23
View File
@@ -1,10 +1,3 @@
/////////////////
// NEW DEFINES //
/////////////////
/client
var/viewingCanvas = 0 //If this is 1, as soon as client /TRIES/ to move the view resets.
///////////
// EASEL //
///////////
@@ -140,20 +133,4 @@ var/global/list/globalBlankCanvases[AMT_OF_CANVASES]
icon = blank
user.visible_message("<span class='notice'>[user] cleans the canvas.</span>","<span class='notice'>You clean the canvas.</span>")
//Examine to enlarge
/obj/item/weapon/canvas/examine(mob/user)
..(user)
if(in_range(user, src) && get_turf(src) && user.client && ishuman(user)) //Let only humans be the robust zoominators. I'm too spooked other mobs trying to use it may get broken huds.
if(src.loc == user || get_turf(src) == get_turf(user))
to_chat(user, "<span class='notice'>[src] has to be on the ground to focus on it!</span>")
return
to_chat(user, "<span class='notice'>You focus on \the [src].</span>")
user.client.screen = list() //This is because screen objects go way past the view bounds we set, therefore not allowing stretch to fit to zoom in properly.
user.client.reset_stretch = winget(user.client, "mapwindow.map", "icon-size") //Remember previous icon-size
user.client.view = 3 //Decrease view
winset(user.client, "mapwindow.map", "icon-size=0") //Enable stretch-to-fit
user.client.viewingCanvas = 1 //Reset everything we just changed as soon as client tries to move
else
to_chat(user, "<span class='notice'>It is too far away.</span>")
#undef AMT_OF_CANVASES