* Fixes floating point inaccuracies in numeric preferences (#74384)
## About The Pull Request
Floating point inaccuracy fun.
Since it's possible to have a `minimum`,`maximum`, and `step` that are
floats we need to round everything to `step` to ensure the comparison
operations work.
If we do not do this, there is no guarantee that `if(min <= number &&
number <= max)` will work correctly.
For example, in the linked issues, this manifested as the minimum value
(0.8) being considered invalid when the input was also 0.8.
Fixes https://github.com/Skyrat-SS13/Skyrat-tg/issues/9507
Fixes https://github.com/Skyrat-SS13/Skyrat-tg/issues/14394
## Why It's Good For The Game
Fixes an obscure bug that has gone unnoticed for a couple years.
## Changelog
🆑
fix: fixes floating point inaccuracies in numeric prefs
/🆑
* Fixes floating point inaccuracies in numeric preferences
---------
Co-authored-by: Bloop <vinylspiders@gmail.com>
* 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>
* Makes mutant bodyparts and mutcolors into editable genetic traits (plus a whole shitload of otherwise out of scope code improvements because I just HAD to touch old code)
* Mirror
* genetically-editable mutant bodyparts and colors - skyrat edition
Co-authored-by: Funce <funce.973@gmail.com>
* I hate TGUI even if its better than what we had before
* this is why linters exist
* you need to be a Head or the Warden to get items
* does this please you linter?
* foundation
* basic interactions
* yea I can spell okay?
* linters please leave me alone
* begone debug code
* if you are dead, no interacting
* linters leave me alone
* linters are stealing my soul
* forgot to do this
* sound framework, probably wont work though
* max length, and interaction cooldowns
* message can now be a list and minor code improve
* I am a slave and linters are my master
* fix improper static reference
* add json loading/saving functionality
* default for message is now a list
* jsonize def interactions; implement requirements
* bad
* bug fix; CtrlShiftClick to interact
* minor qol fix
* fix CtrlShiftClick and remove debug code
* haha docker has security measures
* this was painful
* why are you in this branch
* begone
* bruh
* begone
Co-authored-by: Matthew <matthew@tfaluc.com>
Co-authored-by: Matthew J <GoldenKeyboard@users.noreply.github.com>
* sanitize_hexcolor can now convert inputs between 12-bit and 24-bit RGB formats plus alpha channel. (#55560)
* sanitize_hexcolor can now convert inputs to 3, 4, 6 and 8 characters RGB formats.
* update
* Fine, no repeating decimals.
* Update sanitize_values.dm
* Update sanitize_values.dm
* sanitize_hexcolor can now convert inputs between 12-bit and 24-bit RGB formats plus alpha channel.
Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
* Properly sanitizes the pixel scaling pref (#54592)
It was being rounded to 1, which breaks one of the options.
I've added a float sanitize proc that accepts a degree to round to, I've set it to 0.5 in this case.
* Properly sanitizes the pixel scaling pref
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
* Converts A && A.B into A?.B (#54342)
Implements the ?. operator, replacing code like A && A.B with A?.B
BYOND Ref:
When reading A?.B, it's equivalent to A && A.B except that A is only evaluated once, even if it's a complex expression like a proc call.
* Converts all A && A.B into A?.B
Co-authored-by: ZeWaka <zewakagamer@gmail.com>
* Unicode support Part 2 -- copytext()
This is the transition of all copytext() calls to be unicode aware and also some nearby calls in the same functions. Most things are just replacing copytext() with copytext_char() as a terrible character limiter but a few others were slightly more involved.
I replaced a ton of
````
var/something = sanitize(input())
something = copytext(something, 1, MAX_MESSAGE_LEN)
````
with a single stripped_input() call. stripped_input() already calls html_encode(), trim(), and some other sanitization so there shouldn't be any major issues there.
This is still VERY rough btw; DNA is a mess, the status displays are complete ass, there's a copytext() in code\datums\shuttles.dm that I'm not sure what to do with, and I didn't touch anything in the tools folder. I haven't tested this much at all yet, I only got it to compile earlier this morning. There's also likely to be weird bugs until I get around to fixing length(), findtext(), and the rest of the string procs.
* Makes the code functional
* Assume color hex strings are always # followed by ascii.
Properly encodes and decodes the stuff in mob_helpers.dm which fixes some issues there.
* Removes ninjaspeak since it's unused
* Unicode support Part 1
Makes all calls to ascii2text() and text2ascii() unicode aware as well as all calls in code/__HELPERS/text.dm.
Adds defines for the footext_char() procs to maintain 512 support.
I did some cleanup on the text helpers since a lot of them were really, really bad.
reject_bad_text() and reject_bad_name() have an arg to reject non-ascii chars which defaults to TRUE.
* Give travis a more recent beta
* Ultimate compat
Added the _char procs I was missing
Test the build instead of the version because Lummox is a goddamn moron
* Suggested fixes, removes the last of the dd_ helpers
* Reading the reference is very important!
* Minor code improvements and a comment
* Typo
* custom keybindings
* Update _lists.dm
* Update robot.dm
* modify weights and clean up some vars
* Update say.dm
* Apply suggestions from code review
Co-Authored-By: Emmett Gaines <ninjanomnom@gmail.com>
* some review changes
* formatting
* include focus hack, remove me_wrapper, give default keybinds to new characters, misc fixes
* revert hack and more reviews
* remove another focus hack
this was causing issues with the keydown proc returning early
Several of the greps were missing the `-P` switch which caused them to
fail to match things. The EOL grep also wasn't working right so I
replaced it with the one I added to TGMC.
Changed all the hair/facial_hair/eye sprites to use a white base.
Changed the preview screen, in the preference menu, to use ICON_MULTIPLY to be able to use the new white sprites.
Removed the unused and broken cloaking item.
Ninjas now use the alpha variable, removed most of the checks for it.
Updated the documentation a bit.
Added some helper procs for later.
ghost_form is now saved with other preferences.
Public visibility of memberships is toggable and saved with other preferences.
ooc-colors for admins and members are now sanitized. Bright colours like Yellow, white and baby-blue will be darkened for the sake of legibility.
Related to above - added helper procs to convert between RGB and HSL colour models.
Admins cannot modify var/unlock_content without +DEBUG rights. unlock_content moved from client into prefs.
Player savefile version number updated - this will trigger savefile updates, no data should be lost.
Resolves an issue where whitespace in names could cause a saveslot button to wrap to the next line.
Byond members:
can colour their name using the admin ooc-colour feature.
get a icon next to their name in ooc chat.
can choose their icon_state as a ghost.
get 8 saveslots
unlock_content tracks the return of IsByondMember(). This is to allow for easier testing/debug.
DNA modification uses normally distributed random numbers. Radiation strength dictates the standard deviation of the change in the hex character which is hit (higher output means greater chance for a large change) . Similarly, radiation duration dictates how likely we are to hit the hex-character we clicked on (longer duration means more likely to hit). Irradiation is strength*duration. All balancing is done via multiplier defines so you can rebalance it easily.
DNA blocks and structuring all use defines. Making modification/expansion easier. I'll likely expand this into a datum-based system to allow more interesting features, reduce code further and allow admins to interact with the way dna strings behave.
DNA strings can be spliced together using merge_text().
e.g. string 1: "Hello World"
string 2: "Seeya______"
result: "Seeya World"
This isn't used except for admin-spawnable SE injectors at the moment.
r_hair, g_hair, b_hair, r_facial, g_facial, b_facial, r_eyes, g_eyes, b_eyes were removed and made into 3 short hex-colors.
Skin tones now support colours other than shades of brown. I've had to restrict it heavily until other stuff is done. Skin tones include Albino Caucasian, Oriental, Mediterranean, etc.
Data disks and DNA injectors were reworked to use associative lists so transferring data is just a matter of doing list.Copy()
var/dna is now defined at /mob/living/carbon level. Only monkeys and humans may have dna currently. Support is there for all carbon-based lifeforms to have dna.
DNA modifier console has almost all controls on one screen.
UIs and UEs can be injected separately (appearance and name, respectively)
dna helper procs like ready_dna() and such were changed to make them more versatile. There is now a hardset_dna() proc as an alternative to ready_dna which can initialize dna with properties passed into it or update an existing dna string (useful for cloning and antag spawning)
Every block of SEs are in randomised positions.
Disabled automatic logging of world.log, as it produced undesirable behaviour.
Mr Muggles and God Emperor of Mankind disks removed.
Floor() removed. (it was completely uneccesary, that is what round() is).
Fixed spelling mistakes in modularchangling.dm (thanks tenebrosity)
Tanning removed from beaches (again)
Experimental: monkeys and humans do not have dna until first attempt to read dna (using check_dna_integrity(mob))
This is mainly due to the way everything is hardcoded into New().
Changelog.html updated
Signed-off-by: carnie <elly1989@rocketmail.com>
People may select any underwear (regardless of gender) at a dresser, but not in preferences.
random_underwear(gender) will return a random pair of underwear suitable for your gender.
Removed an unused variable in sprite_accessory
The new_player preferences screen now randomizes character slots for which there is no data (so no more bald, fat, white guys in diapers greeting new players)
datum/preferences character settings are randomised at New().
replaced /datum/preferences/proc/randomize_appearance_for(human/H) with /datum/preferences/proc/random_character(), it does the same stuff without the copying to a mob. Basically, now when you want to make a random character you just do var/datum/preferences/A = new(); A.copy_to(human_mob), randomisation of appearance and name will already be done. Easy.
Reworked the savefile updating/versioning code to make it easier to work with. I've used it to update underwear preferences to the new system as an example.
Signed-off-by: carnie <elly1989@rocketmail.com>
Removed var/constant/Pi It's already defined in setup.dm
Moved a bunch of global_lists to global_lists.dm
Fixed hair randomisation. (still bits to do)
Moved a lot of preferences_setup.dm stuff into __HELPERS/mobs.dm They'll be FAR more helpful as generic procs, rather than something tied to preferences.
Merged mob/var/nopush into status_flags with the CANPUSH flag
Merged mob/var/nodamage into status_flags with the GODMODE flag
Removed mob/var/be_syndicate and mob/var/be_random_name as they are not used.
Added /proc/ui_style2icon(ui_style) proc. It converts a string like "Midnight" into its corresponding dmi file. The code fore creating a new hud uses it.
git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5164 316c924e-a436-60f5-8080-3fe189b3f50e
They include such procs as sanitize_integer(num, min, max, default) which will check num is a number, round num to make it an integer, then check if it is between min and max (inclusive). If it fails the bound-checks it will return default. There are others, have a look.
PERSISTENT PREFERENCES: Every ckey which connects to the game gets its own persistent /datum/preferences datum.
It is archived in var/list/preferences_datums = list("ckey" = datum)
At connect it is automatically associated with the client defines.dm (or a new one is created if it can't find an archived prefs datum). This means clients will ALWAYS have a var/datum/preferences/prefs which references this datum. So you can use it without checking if(client.prefs)
This has simplified only a few bits of code. It will however, allow us to make preferences like see_deadchat ghost_ears etc, persistent. So they will not reset when you DC.
SAVEFILES: Changed the player savefile code a lot. Hopefully I've not fucked it up too much. Every single variable loaded from saves is now sanity checked using the new sanity procs. This should help prevent savefiles becomming obsolete by sanitizing input to meet current requirements, without deleting all the ok variables and making you start from scratch >_> NOTE: I still need to sort out the savefile version stuff. I'll probably figure it out before the server updates anyway. It sees to be fine without it.
You can no longer choose your blood type. It is randomised (with each bloodtype having a realistic probability of occuring). This is to make blood analysis (detective/medical) less pointless. It is chosen as soon as you connect. It remains persistent throughout each round so you won't be able to change it by logging in/out over and over.
Replaces some copypasta code with is_afk() (still a fair bit to do)
There are new hyperlink shortcut things. _src_=vars will direct your hyperlink to viewvars. _src_=prefs to your preferences datum. (These are the only way to access those bits of code via links). This means that the overall amount of operations in almost every Topic has pretty much halved and is much prettier.
Replaced and removed adminplayervars from datum/admins/Topic. It was superfluous. They now all point directly to the viewvars code using _src_=vars
Removed the changelog popup at round start. Instead a button on your game-window will glow white if there are new updates. To peruse at your convenience. This will speed up connect times.
Removed the AFK_THRESHOLD define. It is integrated into is_afk() now.
TODO: remove the prefs stuff from mobs and clients and update code to use client.prefs to access that info.
git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5121 316c924e-a436-60f5-8080-3fe189b3f50e