Commit Graph

104 Commits

Author SHA1 Message Date
Mothblocks
21b90e9d47 Micro-optimize TGUI_CREATE_MESSAGE (#59142) 2021-05-17 11:13:34 +03:00
LemonInTheDark
cfc75f5a84 Fixes some more holes in the ref tracker (#58972)
* Fixes some more holes in the ref tracker

The reference tracker was failing to check null keyed assoc list entries, along with being unable to check both
lists in a list(list() = list()) pair
This resolves that, and adds some new logic to the unit test to check for this sort of thing

* Seperates the ref tracking unit test into 6 subtasks as requested
2021-05-14 16:32:13 -07:00
LemonInTheDark
356afaa40d Fixes footprint stacking (#58918)
* Fixes footprint stacking, replace_decal needed to return parent, and just, didn't. I'm not sure where the fuck
this came from, or even how to test for it, but here you are

* Adds a unit test to prevent regressions on this error in future

* Uses TEST_ASSERT_EQUAL instead of TEST_ASSERT

Thank you moth man

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>

* Updates a comment to more accurately describe my pain

* maybe fixes it?

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
2021-05-14 16:58:19 -04:00
Timberpoes
b516771420 Fix Wizard Loadouts from the Wizard Spellbook crashing the server. (#58939) 2021-05-08 16:15:15 -07:00
Kylerace
08df8798ce (code bounty) refactors all uses of Crossed() and Uncrossed() into signals sent to loc, tracked by connect_loc (#58340)
Co-authored-by: Jared-Fogle <35135081+Mothblocks@users.noreply.github.com>
Co-authored-by: Emmett Gaines <ninjanomnom@gmail.com>
2021-05-07 03:54:03 -07:00
Mothblocks
1c78768c4e Fixes connect_loc not reconnecting turf changes (#58507) 2021-04-20 02:43:53 -04:00
Mothblocks
e82a4972cc Fixes edge cases revolving who can strip and who can't (#58445)
Fixes all simple mobs being able to strip, as well as being able to strip when your hands are blocked (e.g. cuffed).

Fixes #58260.
2021-04-16 05:18:07 +01:00
LemonInTheDark
54f0b0ceb9 Some more harddel fixes (#58305) 2021-04-11 19:37:20 -07:00
Emmett Gaines
1c81adac8d Allows the connect_loc element to have a listener different from the tracked object (#58276) 2021-04-10 18:19:57 -07:00
Mothblocks
4fbed65071 Fix connect_loc runtiming for multiple turfs (#58269) 2021-04-10 15:11:39 -04:00
Mothblocks
0d24cdea3c Remove Uncross() and CheckExit(), add connect_loc element to cover the cases we used it for (#58188)
* Remove Uncross(), add create_loc element

* Update on ChangeTurf

* Explicit return

* Hold onto elements and remove TEST_FOCUS

* Remove UNIT_TESTS compile flag

* Follow my own advice.

* Comment about Uncross + CRASH

* Remove /atom/Exit ..()

* Apply suggestions from code review

Co-authored-by: Emmett Gaines <ninjanomnom@gmail.com>

* Use keyed locs

* Re-add Bump()

* Superfluous check

* Correct change turf signal, remove old continue check

* Fix compile failure

* Fix tests

* Don't create element for fulltile windows

* Correctly unregister old location

Co-authored-by: Emmett Gaines <ninjanomnom@gmail.com>
2021-04-08 15:52:00 -04:00
Mothblocks
5d56382323 Xenomorphs can now strip humans again (#58007) 2021-03-29 10:27:25 +03:00
LemonInTheDark
1aa42a3188 Ref Tracking: Revengance (#57728)
* Ref Tracking: Revengance

Fixes reference tracking ignoring self references due to a poorly thought out tick checking system.
Fixes reference tracking ignoring the contents of assoc lists
Makes the reference tracking printouts actually describe what list the ref is in, rather then just saying "list"

Adds REFERENCE_TRACKING_DEBUG, a define which toggles tracking info for the ref tracking procs, which allows for
oversight on how the proc is working

Allows for direct calls of qdel_and_find_ref_if_fail(), makes it use ref rather then REF(), fixing it breaking
for mobs. (Ditto for the qdel hint which does the same thing)

Moves REAGENTS_TESTING out of the reftracking define block
Makes unit tests define REFERENCE_TRACKING, REFERENCE_TRACKING_DEBUG, and FIND_REF_NO_CHECK_TICK

Adds a unit test that sanity checks the reference finder proc
2021-03-25 22:01:23 -07:00
Ghilker
5625e51196 Thermomachine rework (#57831)
* heat pump rework

* f

* efficiency

* powe

* powermess

* better math

* math and enviroment equation

* freezers connected to waste pipenet and co2 recircled in waste

* smol

* rotate danger

* upgrades

* minor tweaks

* requested changes
2021-03-22 10:42:01 -04:00
Mothblocks
f44c20cdf4 Departmental officers are now put together, rather than separate, if possible (#57685)
Security officers will now be paired up together in the same department, across departments. This means that, instead of 4 officers being split across 4 departments, there'll now be 2 groups of 2.

Late-join officers will be put into any department with only 1 officer. If none exist, the least populous department will be chosen, with their preference having priority.

Updates the maps to have more spawns for departmental officers. Delta previously had none, and now has some. Fixed a bug where MetaStation's security departmental officer was a supply one instead.

Removes the "random" departmental preference. All security officers are now given a department. The "none" preference still exists, but just to show that you don't care which department you're put into.

Updates the config to comment out SEC_START_BRIG. This is what the configuration was already on live servers.

This is something that should likely be test merged, but it mucks with savefiles. Luckily, the only damage it does is changing random departments to none, so if a TM is reverted, only that will have to be changed.
2021-03-20 20:11:11 -04:00
LemonInTheDark
99cd00f5fe Makes gas actually dissipate (#57634)
* Raises the quantize threshold from 1E-7 to 1E-4.

This makes gas dissipate as expected, and should help with the amount of useless gas floating around the station
at highpop

Adds a garbage_collect() call to the portion of pipeline code where all gasmixes are in one place, this should
clean things up properly.

Changes BREATH_VOLUME from 2 to 1.99. This is imperative
Documents a FUCKING HELLBUG in quantize/breathcode that can lead to breaths just not working sometimes. I'm not
sure how to fix this totally, so I'll document it and pray.
See <https://www.desmos.com/calculator/5icdlnktus>
Adds a unit test to check for this sort of failure.

Addendum for people tweaking this value in the future.
Because o2 tank release values/human o2 requirements are very strictly set to the same pressure, small errors
can cause breakage
This comes from QUANTIZE being used in /datum/gas_mixture.remove(), forming a slight sawtooth pattern of the
added/removed gas, centered on the actual pressure
Changing BREATH_VOLUME can set us on the lower half of this sawtooth, making humans unable to breath at standard
pressure.
There's no good way I can come up with to hardcode a fix for this. So if you're going to change this variable
graph the functions that describe how it is used/how it interacts with breath code, and pick something on the
upper half of the sawtooth
NOTE: I've made this change with a focus on o2 requirements. Changing this will effect other settings, but most
all of them can be ignored, as none will notice.

* Thank you moth man

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>

* Docs the purpose of the breath unit test, and better explains partial pressure

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
2021-03-13 14:49:50 +13:00
Mothblocks
04efb69dd4 Fix 2.4 damage test bug, with proof (#57560)
I tracked down every source of damage, and just ran the test 100 times until it failed.

It was shrapnel.

I made the victim pierce immune, meaning they'll never take embeds.
2021-03-09 06:58:00 +00:00
Mothblocks
a5010312d9 Put unit tests in a box, fixes sporradic gun test failure (#57408)
* Initial commit

* Fix removing old objects

* Remove define

* TGM
2021-03-05 12:59:57 +01:00
Ryll Ryll
3feb8c959b Fixes runtimes from firing projectiles, adds unit test for firing guns (#57345) 2021-03-03 16:27:36 -08:00
cacogen
74d29d5c2d Adds unit test for spawned food edibility (#57232)
* Adds unit test for spawned food having reagents

- Adds stack trace for biting food failing due to a lack of reagents
- Adds checks for seed var being set under food/grown's initialize() in grown.dm
- Fixes issue with gondola meat code duplicated for penguin meat slabs resulting in a runtime and being unable to slice penguin meat
- Adds seeds for bombananas

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
2021-02-27 16:50:09 -08:00
Thalpy
5bfab4a84b Fermichem 2.4 - C2 medicine recipe adaptations and atunements to the new mechanics (#57104)
Co-authored-by: Rohesie <rohesie@gmail.com>
Co-authored-by: Mothblocks <35135081+Jared-Fogle@users.noreply.github.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
2021-02-27 14:10:53 -08:00
cacogen
d379fb9555 Crafting menu tells you which colour of crayon is needed (#56950)
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
2021-02-19 15:10:06 -08:00
Thalpy
864d6ca09b Fermichem part 2.1: Adds a reaction/reagent lookup GUI! (#56868)
Adds a new GUI that can be opened from the chem dispenser that will let you look up all reactions and reagents presently in the game (except secret recipes).

For the colours:
purple - clicking this will give you a recipe
blue - clicking this will give you a reagent
green - clicking this will turn it off (or it's also green if the reagent is present in the associated beaker the UI is linked to)
red - clicking this will turn it on

Co-authored-by: Rohesie <rohesie@gmail.com>
Co-authored-by: Mothblocks <35135081+Jared-Fogle@users.noreply.github.com>
Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
2021-02-19 20:41:59 +02:00
TemporalOroboros
e2e7ccdbdc /mob/living/proc/Life(delta_time) (#55534)
- Makes `/mob/living/proc/Life` and most related procs use `delta_time`
- Procs that had snowflaked timing systems, such as breathing, addiction, and advanced diseases were left unchanged.
2021-02-19 10:24:20 -05:00
Qustinnus
ef80ed1935 Addiction rework (#56923)
Co-authored-by: Krysonism <49783092+Krysonism@users.noreply.github.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
2021-02-16 18:20:16 -08:00
Mothblocks
0f435d5dff Remove hideous inline tab indentation, and bans it in contributing guidelines (#56912)
Done using this command sed -Ei 's/(\s*\S+)\s*\t+/\1 /g' code/**/*.dm

We have countless examples in the codebase with this style gone wrong, and defines and such being on hideously different levels of indentation. Fixing this to keep the alignment involves tainting the blames of code your PR doesn't need to be touching at all. And ultimately, it's hideous.

There are some files that this sed makes uglier. I can fix these when they are pointed out, but I believe this is ultimately for the greater good of readability. I'm more concerned with if any strings relied on this.

Hi codeowners!

Co-authored-by: Jared-Fogle <35135081+Jared-Fogle@users.noreply.github.com>
2021-02-14 16:53:29 -08:00
Mothblocks
cb35cba7d5 Syringe toggle has been replaced with left-click to inject, right-click to draw. You can also now change transfer amount. (#56865) 2021-02-13 04:24:42 -03:00
LemonInTheDark
f4160f26db Converts all uses of modifiers to lazy access to avoid memes in future (#56846) 2021-02-12 15:25:31 -08:00
Sparkezel
f8044754eb Refactors sharpness to use a bitfield (#56817)
Refactors sharpness to use bitfield instead of bitflags in case someone wants to add more types of sharp things, or unique behaviour with them
2021-02-11 15:53:29 -03:00
Fikou
f6dfc68360 repaths plasteel tiles to iron (#56644)
Repaths plasteel tiles and turfs to iron. We're in too deep to back out now
2021-02-06 13:53:08 -08:00
MrMelbert
a4237475af Unit tests harvesting plants from hydroponics trays (#56335) 2021-02-04 19:40:36 -08:00
Mothblocks
de442458ba Dynamic 2021 (#56221)
About The Pull Request

Dynamic 2021, among much other things, splits the threat level into two separate budgets, one for round start and one for midround/latejoin. You can read the design doc, plus methodology and charts here: https://hackmd.io/@tgstation/S1C4dYJkO.

To server owners: this is incompatible with current dynamic.json configurations. This is not just because some fields have different values now, but because the older values are not balanced towards this system.

Inidividual list of changes (as I remember them):

    Threat level is now split into two separate budgets, one for round start and one for midround/latejoin.
    In TESTING, you can now run dynamic simulations to see the roundstart picks.
    antag_cap is now based on an equation rather than a fixed list of antags per indice--the old system is not scalable. You can now pass it either a number for a fixed constant, or a list with "denominator" and an optional "offset" to fit the equation ceil(x / denominator) + offset, with x being population.
    Midround/latejoin timers are now vars on /datum/game_mode/dynamic itself, and thus can be configured by head admins per server.
    Removes some older, as far as I can tell completely unused admin tools relating to dynamic.
    autotraitor_cooldown is now properly respected from config, and is based on an exact time rather than on ticks (450 used to be 15 minutes, now it's just 15 MINUTES).
    The rulesets dynamic chooses are now in a dynamic.json file in round logs. Relies on tgstation/tgstation13.org#64 to be public.
    Adds more logging to the autotraitor ruleset for admins.
    Midround/latejoin chance modifiers are now configurable.

Labelled "Do Not Merge", as the design doc outlines the specific playtesting schedule I would like to perform.

    Note to self: Remove the custom MOTD before merge.

Why It's Good For The Game

(Copied from design doc)

Dynamic currently dumps as much threat as it can into round start threats. This means that rounds at ~50 threat can have an absurd amount of antagonists round start, while leaving very little threat for midround/latejoin antagonists. What inevitably happens is just one of those picked decides to murderbone, leading to the inevitable 20 minute shuttle call. Furthermore, once those antagonists are dead, Dynamic doesn’t have any threat left to spend on new antagonists that keep the round flowing, promoting the mentality of “antags dead, I’m bored, let’s leave”.

The proposed solution of Dynamic 2021 is to split threat level into two separate budgets, one for round start and one for midround/latejoin. This split, like threat level, will also be done on a lorentz curve–meaning that while most rounds will have them evenly split, there is still the possibility of chaotic high antagonist round start rounds, or the possibility of a midround onslaught.
2021-02-04 10:06:11 +01:00
Qustinnus
707fc287b4 Replaces intents with combat mode (#56601)
About The Pull Request

This PR removes intents and replaces them with a combat mode. An explanation of what this means can be found below
Major changes:

    Disarm and Grab intents have been removed.
    Harm/Help is now combat mode, toggled by F or 4 by default
    The context/verb/popup menu now only works when you do shift+right-click
    Right click is now disarm, both in and out of combat mode.
    Grabbing is now on ctrl-click.
    If you're in combat mode, and are currently grabbing/pulling someone, and ctrl-click somewhere else, it will not release the grab (To prevent misclicks)

Minor interaction changes:

Right click to dissasemble tables, racks, filing cabinets (When holding the right tool to do so)
Left click to stunbaton, right click to harmbaton
Right click to tip cows
Right click to malpractice surgery
Right click to hold people at gunpoint (if youre holding a gun)
Why It's Good For The Game

Intents heavily cripple both the code and the UI design of interactions. While I understand that a lot of people will dislike this PR as they are used to intents, they are one of our weakest links in terms of explaining to players how to do specific things, and require a lot more keypresses to do compared to this.

As an example, martial arts can now be done without having to juggle 1 2 3 and 4 to switch intents quickly.

As some of you who saw the first combat mode PR, the context menu used to be disabled in combat mode. In this version it is instead on shift-right click ensuring that you can always use it in the same way.

In this version, combat mode also no longer prevents you from attacking with items when you would so before, as this was something that was commonly complained about.

The full intention of this shift in control scheme is that right click will become "secondary interaction" for items, which prevents some of the awkward juggling we have now with item modes etcetera.
Changelog

cl Qustinnus
add: Intents have been replaced with a combat mode. For more info find the PR here: #56601
/cl
2021-02-04 16:37:32 +13:00
LemonInTheDark
dd6cea82d9 Reverts the recent config changes (#56606)
* Revert "Fixes included config files not loading (#56602)"

This reverts commit 0749b322f6.

* Revert "Adds configuration consistency tests (#56562)"

This reverts commit 4f44014e25.
2021-02-02 22:14:47 -05:00
Jordan Brown
4f44014e25 Adds configuration consistency tests (#56562)
Co-authored-by: Mothblocks <35135081+Jared-Fogle@users.noreply.github.com>
2021-02-02 13:22:52 -08:00
Timberpoes
1989497576 Frame stacking fix and unit test addition. (#56287)
* Reverts #56205

* Allow things without density to bypass checks

* The rest of the owl

* The rest of the owl

* Doc and tweak

* More feex

* RCD machine frame unit test

* I suck

* AAAAA

* Bad at unit tests

* Revert unit tests (for including in another PR)

* Fix windoor_assembly return logic

* Comment /mob/living/proc/PushAM logic

* Windoor assembley logic tweak

* Fix frame stacking

* Unit test

* Better wording from macros?
2021-01-22 21:18:05 +08:00
Timberpoes
a83c6aa4c0 Attempts to fix addictions being utterly broken and almost impossible to obtain. (#56302) 2021-01-21 13:16:49 -08:00
Donkie
e71e7cbbe2 Added a standardized json unit test results log and added my vscode test runner to recommendations (#56058)
Link to the test explorer: https://marketplace.visualstudio.com/items?itemName=Donkie.vscode-tgstation-test-adapter

The test explorer adapter lets you compile and run the code in one click of a button, with no messing about with defines necessary

The extension supports reading test results from the unit test logs, but its shitty having to parse logs for that, so this PR also adds support for a somewhat standardized method of logging unit test results to a json file instead.
2021-01-10 20:31:17 +00:00
Gamer025
73921636ad Add unit test for spawning simple_animals (#56021)
Simple unit test that allocates all mobs a gold slime could spawn
2021-01-08 22:59:46 -03:00
WarlockD
56345975ba The Great Radio Rework: NTNET Part 1 of many. (#54462)
Machinery networking refactor.
2020-12-30 21:54:34 +01:00
Qustinnus
f66ca34626 Refactors monkeys into a species (#55614)
Changes monkeys from carbon subtype to species.
2020-12-30 16:30:15 +01:00
interestingusernam3
0bc9ddf7ad Replaces US Indigenous People's Day with International Indigenous People's Day (#55458)
Title. This modifies a unit test that tested the holiday I'm removing to test mother's day instead, as International Indigenous People's Day isn't an nth week holiday.
2020-12-29 14:52:57 +13:00
Gamer025
c3bb60501f Add Designs Unit Test (#55760) 2020-12-28 12:33:06 -08:00
Jack LeCroy
23ee09967e Fix Hanukkah (again) and refactor Moth Week and Beer Day (#55532)
* Fix Hanukkah (again) and refactor Moth Week and Beer Day

* Remove unnecessary changes
2020-12-16 17:16:44 -08:00
Ghilker
d186c4f236 Temperature control unit (#55345)
This PR changes how freezers/heaters work by adding a button in the GUI that allow the users to switch between cooling and heating without the need to deconstruct the machine.
Circuitboards now will build the freezer and can't be changed by screwdriving the board.
Mapping isn't touched, all other functionalities are still there.
2020-12-13 07:16:53 +02:00
silicons
160175ee8b pass_flags handling refactor + rewrites a part of projectiles for the n-th time (#54924)
Yeah uhh this'll probably need testmerging even after it's done because yeah it's a bit big.
If y'all want me to atomize this into two PRs (pass flags vs projectiles) tell me please. Pass flags would have to go in first though, in that case, as new projectile hit handling will rely on pass_flags_self.
Pass flags:

Pass flags handling now uses an atom variable named pass_flags_self.
If any of these match a pass_flag on a thing trying to pass through, it's allowed through by default.
This makes overriding CanAllowThrough unnecessary for the majority of things. I've however not removed overrides for very.. weird cases, like plastic flaps which uses a prob(60) for letting PASSGLASS things through for god knows why.
LETPASSTHROW is now on pass_flags_self
Projectiles:

Not finalized yet, need to do something to make the system I have in mind have less unneeded overhead + snowflake

Basically, for piercing/phasing/otherwise projectiles that go through things instead of hitting the first dense object, I have them use pass_flags flags for two new variables, projectile_phasing and projectile_piercing. Anything with pass_flags_self in the former gets phased through entirely. Anything in the latter gets hit, and the projectile then goes through. on_hit will also register a piercing hit vs a normal hit (so things like missiles can only explode on a normal hit or otherwise, instead of exploding multiple times. Not needed as missiles qdel(src) right now but it's nice to have for the future).

I still need to decide what to do for hit handling proper, as Bump() is still preferred due to it not being as high-overhead as something like scanning on Moved(). I'm thinking I'll make Moved() only scan for cases where it needs to hit a non-dense object - a prone human the user clicked on, anything special like that. Don't know the exact specifics yet, which is why this is still WIP.

Projectiles now use check_pierce() to determine if it goes through something and hits it, doesn't hit it, or doesn't go through something at all (should delete self after hitting). Will likely make an on_pierce proc to be called post-piercing something so you can have !fun! things like projectiles that go down in damage after piercing something. This will likely deprecate the process_hit proc, or at least make it less awful.

scan_for_hit() is now used to attempt to hit something and will return whether the projectile got deleted or not. It will delete the projectile if the projectile does hit something and fails to pierce through it.

scan_moved_turf() (WIP) will be used for handling moving onto a turf.

permutated has been renamed to impacted. Ricocheting projectiles get it reset, allowing projectiles to pierce and potentially hit something again if it goes back around.

A new unit test has been added checking for projectiles with movement type of PHASING. This is because PHASING completely causes projectiles to break down as projectiles mainly sense collisions through Bump. The small boost in performance from using PHASING instead of having all pass flags active/overriding check_pierce is in my opinion not worth the extra snowflake in scan_moved_turf() I'd have to do to deal with having to check for hits manually rather than Bump()ing things.
Movement types

UNSTOPPABLE renamed to PHASING to better describe what it is, going through and crossing everything but not actually bumping.
Why It's Good For The Game

Better pass flags handling allows for less proc overrides, bitflag checks are far less expensive in general.

Fixes penetrating projectiles like sniper penetrators

This system also allows for better handling of piercing projectiles (see above) without too much snowflake code, as you'd only need to modify on_pierce() if you needed to do special handling like dampening damage per target pierced, and otherwise you could just use the standardized system and just set pass flags to what's needed. If you really need a projectile that pierces almost everything, override check_pierce(), which is still going to be easier than what was done before (even with snowflake handling of UNSTOPPABLE flag process_hit() was extremely ugly, now we don't rely on movement types at all.)
2020-12-10 09:29:27 +13:00
Jack LeCroy
f66b0452a2 Fix nth week holidays (#55364)
fix: Holidays appearing on the nth day of the month like Thanksgiving will work now.
tweak: Columbus day is now called Indigenous Peoples' Day.
2020-12-06 17:29:04 -08:00
Qustinnus
f887155b27 Kills oldfood, Puts newfood on top. (#55160)
Slays the last of old-food, making new-food the new normal.

Co-authored-by: MrMelbert <kmelbert4@gmail.com>
Co-authored-by: Jared-Fogle <35135081+Jared-Fogle@users.noreply.github.com>
2020-12-04 00:11:47 -08:00
Jordan Brown
51ba68be76 Merge pull request #55268 from AutomaticFrenzy/patch/docs-from-github-wiki
Migrate some docs from the GitHub wiki into the repository
2020-12-03 11:17:06 -05:00
Tad Hardesty
126df37863 Make unit tests visible to linter and IDE (#55270) 2020-12-01 23:17:02 -05:00