Files
Bubberstation/code/datums/view.dm
SkyratBot 124ddd7cca [MIRROR] tgui Preferences Menu + total rewrite of the preferences backend (#8153)
* tgui Preferences Menu + total rewrite of the preferences backend

* nah, we dont need to ping those people

* trying to remove the funny stuff

* unmodularizing this

* prefs reset

* this may need to be reverted, who knows

* okay, this part

* perhaps

* EEEEEEEEE

* unsanitary

* E

* Stage 1 + loadout system

* more fixes

* E

* I mean, it launches?

* More fixes and reorganisation

* E

* customisation code is spaget.

* disable ERP prefs

* Update erp_preferences.dm

* Update erp_preferences.dm

* E

* Slowly getting there

* It may be time for help :)

* tri...colors... help

* preferences now pass preferences

* Update dna.dm

* Fuck this man

* missing savefile return, set_species works, removed dumb stuff from updateappearance

* https://github.com/Skyrat-SS13/Skyrat-tg/pull/8199

* https://github.com/Skyrat-SS13/Skyrat-tg/pull/8224

* https://github.com/tgstation/tgstation/pull/61519

* https://github.com/Skyrat-SS13/Skyrat-tg/pull/8278

* e

* le butonAZARAK HELLO

* hhh

* Proper recognition where it's due, MrMelbert!

* EEEE

* examine block

* Better gen hit sounds from whitedream

* final loadout touches, more bug fixes im sure to come

* i said there would be bugfixes

* Update LoadoutManager.js

* Missing preferences in the html menu

* LIVE TESTING PHASE BABY

* Update LoadoutManager.js

* EEE

* LAUNCH TEST FIRE

* Update job.dm

* Update new_player.dm

* 50gb DAY ONE PATCH

* EEE

* Update preferences.dm

* buggle fixes

* Update examine.dm

* >LOOC starts on

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
Co-authored-by: jjpark-kb <55967837+jjpark-kb@users.noreply.github.com>
Co-authored-by: Gandalf <jzo123@hotmail.com>
Co-authored-by: Azarak <azarak10@gmail.com>
2021-09-23 00:40:37 +01:00

123 lines
2.8 KiB
Plaintext

//This is intended to be a full wrapper. DO NOT directly modify its values
///Container for client viewsize
/datum/view_data
var/width = 0
var/height = 0
var/default = ""
var/is_suppressed = FALSE
var/client/chief = null
/datum/view_data/New(client/owner, view_string)
default = view_string
chief = owner
apply()
/datum/view_data/proc/setDefault(string)
default = string
apply()
/datum/view_data/proc/safeApplyFormat()
if(isZooming())
assertFormat()
return
resetFormat()
/datum/view_data/proc/assertFormat()//T-Pose
winset(chief, "mapwindow.map", "zoom=0")
/datum/view_data/proc/resetFormat()//Cuck
winset(chief, "mapwindow.map", "zoom=[chief.prefs.read_preference(/datum/preference/numeric/pixel_size)]")
/datum/view_data/proc/setZoomMode()
winset(chief, "mapwindow.map", "zoom-mode=[chief.prefs.read_preference(/datum/preference/choiced/scaling_method)]")
/datum/view_data/proc/isZooming()
return (width || height)
/datum/view_data/proc/resetToDefault()
width = 0
height = 0
apply()
/datum/view_data/proc/add(toAdd)
width += toAdd
height += toAdd
apply()
/datum/view_data/proc/addTo(toAdd)
var/list/shitcode = getviewsize(toAdd)
width += shitcode[1]
height += shitcode[2]
apply()
/datum/view_data/proc/setTo(toAdd)
var/list/shitcode = getviewsize(toAdd) //Backward compatability to account
width = shitcode[1] //for a change in how sizes get calculated. we used to include world.view in
height = shitcode[2] //this, but it was jank, so I had to move it
apply()
/datum/view_data/proc/setBoth(wid, hei)
width = wid
height = hei
apply()
/datum/view_data/proc/setWidth(wid)
width = wid
apply()
/datum/view_data/proc/setHeight(hei)
width = hei
apply()
/datum/view_data/proc/addToWidth(toAdd)
width += toAdd
apply()
/datum/view_data/proc/addToHeight(screen, toAdd)
height += toAdd
apply()
/datum/view_data/proc/apply()
chief.change_view(getView())
safeApplyFormat()
/datum/view_data/proc/supress()
is_suppressed = TRUE
apply()
/datum/view_data/proc/unsupress()
is_suppressed = FALSE
apply()
/datum/view_data/proc/getView()
var/list/temp = getviewsize(default)
if(is_suppressed)
return "[temp[1]]x[temp[2]]"
return "[width + temp[1]]x[height + temp[2]]"
/datum/view_data/proc/zoomIn()
resetToDefault()
animate(chief, pixel_x = 0, pixel_y = 0, 0, FALSE, LINEAR_EASING, ANIMATION_END_NOW)
/datum/view_data/proc/zoomOut(radius = 0, offset = 0, direction = FALSE)
if(direction)
var/_x = 0
var/_y = 0
switch(direction)
if(NORTH)
_y = offset
if(EAST)
_x = offset
if(SOUTH)
_y = -offset
if(WEST)
_x = -offset
animate(chief, pixel_x = world.icon_size*_x, pixel_y = world.icon_size*_y, 0, FALSE, LINEAR_EASING, ANIMATION_END_NOW)
//Ready for this one?
setTo(radius)
/proc/getScreenSize(widescreen)
if(widescreen)
return CONFIG_GET(string/default_view)
return CONFIG_GET(string/default_view_square)