mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
* Part 1: fix tgui * Fix overdark layering * Vector code rework * misc. tgui things * final DM side fixes * TGUI try to fix #1 * Nuclear option. Bring all TGUI files. Will begin UNTGification in later commits. * Untgify: callback * untgify : config flags & config datums * Fixes GLOBAL_VAR_INIT * Purge HASTRAIT * .dme cleanup * file by file: status_alert.dm * file by file : preference datums + remove unused content * file by file : tgui_input/text.dm * file by file : fixes asset_cache_client.dm * file by file : tgui_panel / external.dm * file by file : tgui / external.dm * file by file : tgui / states.dm * file by file : subsystems/assets.dm [unused return type] * file by file : subsystems/tgui.dm [tg-macro for process()] * file by file : asset_cache_item.dm [minor proc call fix] * file by file : fixes a mistype for datum/asset_cache_item * file by file : removes bugs and unimplemented features in asset_list.dm * multifile : some more work on asset manager * File deleted : spirtesheet tg_assets. Don't need them * Remove unused TG content, fix asset_list.dm * Fixes a few issues with wrong type paths. * remove tgui_panel : this is for tgchat/stat2, which we don't use * fix thing * misc changes to tgui.dm. Defining QDELETED macro * final TGui fix * TGUI file convert : camera console and religion screen * Works * GPS fixed + fontAwesome fixed * Mecha console control * Fixes blurry icons * fixes iconbase64 regression * Misc bug/runtimes fixes * Fixes runtime funtime * Add merch computer TGUI * Fixes TGUI ticking interfaces + MSGS * PCMC * Power Monitor working * Power monitor * Bugfixes + robot console * Fixes mecha messages * Spess dot TV * TEG * Syndicate Uplink * Bump defines and connection warning * fix? * Fucking highscores * Fixes mistakes --------- Co-authored-by: west3436 <66280799+west3436@users.noreply.github.com>
88 lines
1.8 KiB
Plaintext
88 lines
1.8 KiB
Plaintext
// Basic geometry things.
|
|
/_vector
|
|
var/x = 0
|
|
var/y = 0
|
|
|
|
/_vector/New(var/x, var/y)
|
|
src.x = x
|
|
src.y = y
|
|
|
|
/_vector/proc/duplicate()
|
|
return new /_vector(x, y)
|
|
|
|
/_vector/proc/euclidian_norm()
|
|
return sqrt(x*x + y*y)
|
|
|
|
/_vector/proc/squared_norm()
|
|
return x*x + y*y
|
|
|
|
/_vector/proc/normalized()
|
|
var/norm = euclidian_norm()
|
|
return new /_vector(x/norm, y/norm)
|
|
|
|
/_vector/proc/floored()
|
|
return new /_vector(Floor(x), Floor(y))
|
|
|
|
//use this one
|
|
/_vector/proc/chebyshev_norm()
|
|
return max(abs(x), abs(y))
|
|
|
|
//use this one
|
|
/_vector/proc/chebyshev_normalized()
|
|
var/norm = chebyshev_norm()
|
|
return new /_vector(x/norm, y/norm)
|
|
|
|
/_vector/proc/is_integer()
|
|
return IS_INT(x) && IS_INT(y)
|
|
|
|
/_vector/proc/is_null()
|
|
return chebyshev_norm() == 0
|
|
|
|
/_vector/proc/toString()
|
|
return "\[Vector\]([x],[y])"
|
|
|
|
//returns angle from 0 to 360
|
|
//-1 if vector is (0,0)
|
|
//angle calculated on north
|
|
/_vector/proc/toAngle()
|
|
if(x == 0)
|
|
if(y == 0)
|
|
return -1
|
|
else if(y > 0)
|
|
return 0
|
|
else if(y < 0)
|
|
return 180
|
|
else if(y == 0)
|
|
if(x > 0)
|
|
return 90
|
|
else if(x < 0)
|
|
return 270
|
|
|
|
var/_vector/src_norm = src.chebyshev_normalized()
|
|
var/angle = arctan(src_norm.y,src_norm.x) - 360 * -1 //this is broken
|
|
return (angle >= 360) ? angle - 360 : angle
|
|
|
|
/_vector/proc/dot(var/_vector/B)
|
|
return src.x * B.x + src.y * B.y
|
|
|
|
/_vector/proc/mirrorWithNormal(var/_vector/N)
|
|
var/_vector/n_norm = N.normalized()
|
|
return src - n_norm * ( 2 * ( src * n_norm ))
|
|
|
|
//operator overloading
|
|
/_vector/proc/operator+(var/_vector/B)
|
|
return new /_vector(x + B.x, y + B.y)
|
|
|
|
/_vector/proc/operator-(var/_vector/B)
|
|
return new /_vector(x - B.x, y - B.y)
|
|
|
|
/_vector/proc/operator*(var/mult)
|
|
if(istype(mult, /_vector))
|
|
return dot(mult)
|
|
return new /_vector(x * mult, y * mult)
|
|
|
|
/_vector/proc/equals(var/_vector/vectorB)
|
|
return (x == vectorB.x && y == vectorB.y)
|
|
|
|
|