Commit Graph

41 Commits

Author SHA1 Message Date
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
Tad Hardesty
126df37863 Make unit tests visible to linter and IDE (#55270) 2020-12-01 23:17:02 -05:00
TiviPlus
de7994c0f7 Init sanity unit test (#55147)
https://github.com/tgstation/TerraGov-Marine-Corps/pull/5326
Stemming from 
https://github.com/ParadiseSS13/Paradise/pull/14770

Basically it just checks for bad initialize calls
2020-11-30 17:15:11 -05:00
Ryll Ryll
5e878f504c Kills the quickswap shortcut (#55209) 2020-11-28 23:58:20 -08:00
Arkatos1
ead0e859db Merge type variable fixes and unit test (#55173)
This PR fixes a case where certain materials caused issues when working with stacking machines, because they did not have set merge_type from the get go, which meant that initial() of that variable returned null.

To clarify further - if /obj/item/stack does not have set merge_type, it is generated merge_type upon Initialize(), which is the same as its typepath. For example, currently /obj/item/stack/sheet/bluespace_crystal does not have any merge_type set, and it is given merge_type = /obj/item/stack/sheet/bluespace_crystal upon Initialize(). Each Initialize(). Again and again.

There are quite a bit of these cases in the codebase, especially if its some older code. I have gone through them and set all of them their set merge_type, which they would inevitably receive anyway upon initializing and it fixes a bug mentioned above.

To prevent this happening again, I have also included unit test to check if merge types are set for stacks, included exceptions are usually abstract paths like /obj/item/stack/sheet/mineral, which contains zero behavior on its own and does not spawn unless done via admin tools.
2020-11-26 21:05:52 -05:00
Jared-Fogle
2cec1acfbd Cache values in TEST_ASSERT_EQUAL and TEST_ASSERT_NOTEQUAL (#55074)
Previously if a comparison assertion failed, it would re-evaluate the a and b parameters, which could lead to confusing output if the values passed are not fixed or are impure.
2020-11-22 09:52:20 -08:00
EdgeLordExe
915204167d Unit tests for heretic knowledge (#55022) 2020-11-20 15:53:56 -08:00
Jared-Fogle
151dab8601 Test basic attacks along with the attack chain (#54769)
Tests shoving (as well as the knock down and dropping your item), harming (both with and without an item), and the attack chain.

I can think of a few cases in very recent memory that these have been broken (devil removal breaking melee damage, attack chain breaking due to something else).

Also adds `TRAIT_PERFECT_ATTACKER` which makes your punches always hit. This is currently only used for tests, as they are meant to be reliable.
2020-11-04 10:06:29 -05:00
Jared-Fogle
7117ccaf68 Teleporter machinery now auto links with each other, removes screwdriver + wirecutter interaction (#54325)
Teleporter machinery will now automatically link with each other. This makes the screwdriver + wirecutter interaction redundant, so it has been removed.
2020-10-12 15:08:29 -03:00
NightRed
e9c47aa502 Unit tests for serving trays (#54224) 2020-10-07 15:33:44 -07:00
Jared-Fogle
75663a1c72 Undefine testing only define once tests are finished (#53960) 2020-09-26 09:10:00 -03:00
Jared-Fogle
751328a2ba Fix chemicals not recognizing end of metabolization (#53550)
* Fix chemicals not recognizing end of metabolization

* Make generic to all organs
2020-09-11 09:41:42 -04:00
NightRed
0e5598ba5b Unit tests for expose_mob (#53498)
This is a set of unit tests for expose_mob.
This tests that INGEST, TOUCH, VAPOR, PATCH, INJECT are triggering on standard exposure methods.
2020-09-07 19:04:29 -03:00
NightRed
97d969dfca Many issue fixes for stomachs and chem interactions (#53440)
This changes the has_reagent check to work with stomachs.
Several supporting procs have been added to fully support this behavior.
end_metabolization will work as expected again
expose is working with INGEST items again
on_mob_add working as intended
on_mob_life has been reviewed and worked over.

Health Analyzers now show stomach contents, same with the medical kiosk.

Included the unit test to validate reagent checks.
Unit tests for the new procs on mob
2020-09-05 21:57:30 -03:00
Jared-Fogle
0fcf7d04a2 Add test for emotes (#53430) 2020-09-05 11:38:11 -03:00
Jared-Fogle
fc2cea5955 Fixes quick swapping suits creating illegal suit storage (#53272) 2020-09-01 05:03:25 -03:00
Jared-Fogle
09b9ad869e Change signature of BINARY_INSERT to require the full type path, add test (#53217)
BINARY_INSERT used to only take typepaths like/this. Now, it expects them to be /like/this, to be more consistent with ther est of the code.

Adds documentation to COMPTYPE.

Adds a test for BINARY_INSERT.
2020-09-01 04:40:52 -03:00
Jared-Fogle
4367f41b78 Fix resisting not starting stop, drop, and roll (#53079) 2020-08-20 23:57:03 -03:00
Jared-Fogle
9748709d1e Actually fix machine disassembly (#52871) 2020-08-14 12:37:40 +02:00
Jared-Fogle
7df16c595e Confusion will no longer continue to confuse after being cured (#52286)
* Confusion will no longer continue to confuse after being cured

* Grammar comment fix

* Move to status effect

* Remove test per request

* Make confusion a status effect, confusion curing now completely neuters the confusion

* set_confusion changes, get_confusion

* Fix confusion going down twice per tick

* Change strength = to proc

* Move procs to status_procs
2020-08-05 16:36:00 -03:00
Jared-Fogle
dd393b27e9 Fix multiple message prefixes being allowed at a time. AKA, you can now start messages with ellipses again. (#52498) 2020-07-26 22:07:41 -04:00
Ryll Ryll
9fc7865425 Adds unit tests for suffering Wounds (#52491)
* add wound tests

* comment

* clarify

* compromise
2020-07-26 13:38:56 -04:00
Jared-Fogle
55a204d375 Test metabolization of all reagents 2020-07-23 01:44:23 -07:00
Couls
0a1c90d186 keybind signal support, ported from TGMC (#52219)
* keybind signal support, ported from TGMC

* Thank you linter

* remove unused and extra defines

* move signal defines up and fix emote keybind runtimes

* Apply suggestions

* Update keybinding.dm

* Missed this one in the upstream merge

* Ignore keybindings without names

* back to the OG

* Update living.dm

* Update living.dm

* got it

* trailing newline

* Update code/datums/keybinding/living.dm

Co-authored-by: Rohesie <rohesie@gmail.com>

Co-authored-by: Rohesie <rohesie@gmail.com>
2020-07-22 17:51:52 -03:00
jdawg1290
62676e72a8 Force LF line endings with gitattributes and convert repo (#52266)
Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
2020-07-16 03:02:40 +03:00
Daniel Hultgren
28958169a1 Added SI unit formatting proc and applied it to canister examine (#52235)
* Added si unit formatting proc, and unit tests for it

* Added canister examine note for what their max pressure is

* Fixed the siunit proc comment abit
2020-07-15 22:29:13 +08:00
Jared-Fogle
ee5b005007 Add tests for outfits, fixes families outfits, Syndicate Ship Captain, and armored bounty hunters (#52210)
* Add tests for outfits, fixes families outfits and Syndicate Ship Captain

* Switch out captain uniform from tacticool to combat

* Consistent styling

* My weakness is I'm a pedant

* Check left and right pockets, and fix armored bounty hunter
2020-07-14 20:06:11 -04:00
Jared-Fogle
4b21913c58 Add unit tests for some surgeries, adds more APIs for unit tests to call (#52093)
* Add unit tests for medical related stuff

* Remove inaccurate assertion
2020-07-09 13:41:59 -04:00
Jared-Fogle
640ed8b5fc Fix pulling people through space breaking the chain (#51997)
Includes a unit test because TDD is good.
Why It's Good For The Game

It makes transport through space with friends much more annoying than it should be.
Changelog

cl
fix: Fixed a bug where when teleporting naturally (such as going through a z-level in space), if you were pulling someone that was then pulling another person, only you and the person you were pulling would make it through.
/cl
2020-07-07 10:48:48 +12:00
LemonInTheDark
eab31fd4d5 Adds some card unit tests, cleans up some comments (#51434)
* Adds unit tests, some more checks, and improves some comments

* sweep sweep sweep?

* Braindamage
2020-06-05 18:46:58 +08:00
Emmett Gaines
1c21534422 Adds a unit test to make sure the id_arg_index is used (#49676) 2020-03-04 00:47:48 +08:00
spookydonut
f3a99558c3 Removes some dead/unused code (#48158)
* cleans up some deadcode

* ancient

* goon icons

* rice and garlic

* more

* last one

* fuuuuuuuuuuuuuuuuuucking subtypes
2019-12-15 14:09:02 -05:00
oranges
cd05d64bcf Species types sources refactor (#42523)
There is now a bitflag that controls all the ways a species can be
selected from the different methods of changing species, xeno spawn,
pride mirror, magic mirror etc.

The soviet and capitalist golems are no longer selectable from the pride
or magic mirrors (just the badmin one)

interesting thing I found, androids and synths (including military
synth) are acheivable via xeno extracts!
2019-02-03 20:33:11 +11:00
Emmett Gaines
f1d19d5787 Turn a runtime component sanity check into a unit test (#40851) 2018-10-12 15:41:55 -07:00
kevinz000
9eec1f8db2 Adds move force and move resist, movement/pushing/pulling tweaks (#39556)
* Removes anchroed from mobs, adds move force/resist

* Move force and move resist

* WIP, still has debug messages.

* Fixes

* Update living.dm

* Anchored removal

* Stuff

* Unit tests

* Removes anchored from dview

* DME

* Update anchored_mobs.dm

* Fix

* No ghost spacewind

* Update mulebot.dm

* Update temporary_visual.dm

* Update forcefields.dm

* Update step_triggers.dm

* Update portals.dm

* Update alien_acid.dm

* Update bump_teleporter.dm

* Update landmarks.dm

* Update countdown.dm

* Update blessing.dm

* Update shieldgen.dm

* Update containment_field.dm

* Update field_generator.dm

* Update singularity.dm

* Update atmosmachinery.dm

* Update door.dm

* Update gravitygenerator.dm

* Update door.dm

* Update effects.dm

* Update temporary_visual.dm

* Update bump_teleporter.dm

* Update forcefields.dm

* Update landmarks.dm

* Update portals.dm

* Fixes

* Throwforce annnd done, finally

* Fixes

* Haha I'm dumb sometimes
2018-09-15 05:08:30 -04:00
ninjanomnom
01a79dccb0 Fixes timer buckets going into negatives and adds a regression test 2018-08-16 14:50:09 -04:00
Jordan Brown
fdcddac637 Adds a unit test that spawns some humans and waits a bit (#39067)
* Adds a unit test that spawns some humans and waits a bit

* What the fuck did you just fucking say about me, you little bitch? I'll have you know I graduated top of my class in the Navy Seals, and I've been involved in numerous secret raids on Al-Quaeda, and I have over 300 confirmed kills. I am trained in gorilla warfare and I'm the top sniper in the entire US armed forces. You are nothing to me but just another target. I will wipe you the fuck out with precision the likes of which has never been seen before on this Earth, mark my fucking words. You think you can get away with saying that shit to me over the Internet? Think again, fucker. As we speak I am contacting my secret network of spies across the USA and your IP is being traced right now so you better prepare for the storm, maggot. The storm that wipes out the pathetic little thing you call your life. You're fucking dead, kid. I can be anywhere, anytime, and I can kill you in over seven hundred ways, and that's just with my bare hands. Not only am I extensively trained in unarmed combat, but I have access to the entire arsenal of the United States Marine Corps and I will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit. If only you could have known what unholy retribution your little "clever" comment was about to bring down upon you, maybe you would have held your fucking tongue. But you couldn't, you didn't, and now you're paying the price, you goddamn idiot. I will shit fury all over you and you will drown in it. You're fucking dead, kiddo.
2018-07-12 14:43:36 -04:00
Emmett Gaines
70beb65889 Unit test to make sure all subsystems which initialize call parent (#36466) 2018-03-20 14:01:46 +01:00
Cruix
ad7fc7417c Added chemical reaction unit tests (#35478)
* Added unit tests for reagent recipes

* Renamed recipe_collisions unit test to reagent_recipe_collisions

* Fixed chemical conflict unit test temperature logic

* Made chemical reactions always choose the reaction with the most extreme temperature requirements if there are multiple possible reactions
2018-02-16 09:34:08 +13:00
Cyberboss
d615b56be4 Revert "Remove unit tests"
This reverts commit 69e27bb76ff78af47d2c1b4b8faf91d8b5f9b128.
2018-01-19 11:55:12 -05:00