mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 09:42:29 +00:00
[MIRROR] Fixes slips being broken and adds a unit test to catch it happening again. [MDB IGNORE] (#14299)
* Fixes slips being broken and adds a unit test to catch it happening again. (#67741) * Fixes slips being broken and adds a unit test to catch it happening again. Co-authored-by: Timberpoes <silent_insomnia_pp@hotmail.co.uk>
This commit is contained in:
@@ -76,7 +76,7 @@
|
||||
if(!isliving(arrived))
|
||||
return
|
||||
var/mob/living/victim = arrived
|
||||
if(!(victim.movement_type & FLYING|FLOATING) && victim.slip(knockdown_time, parent, lube_flags, paralyze_time, force_drop_items) && callback)
|
||||
if(!(victim.movement_type & (FLYING | FLOATING)) && victim.slip(knockdown_time, parent, lube_flags, paralyze_time, force_drop_items) && callback)
|
||||
callback.Invoke(victim)
|
||||
|
||||
/*
|
||||
|
||||
@@ -266,7 +266,7 @@
|
||||
return TRUE
|
||||
|
||||
/turf/open/handle_slip(mob/living/carbon/slipper, knockdown_amount, obj/O, lube, paralyze_amount, force_drop)
|
||||
if(slipper.movement_type & FLYING|FLOATING)
|
||||
if(slipper.movement_type & (FLYING | FLOATING))
|
||||
return FALSE
|
||||
if(has_gravity(src))
|
||||
var/obj/buckled_obj
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/mob/living/carbon/slip(knockdown_amount, obj/O, lube, paralyze, force_drop)
|
||||
if(movement_type & FLYING|FLOATING)
|
||||
if(movement_type & (FLYING | FLOATING))
|
||||
return FALSE
|
||||
if(!(lube&SLIDE_ICE))
|
||||
log_combat(src, (O ? O : get_turf(src)), "slipped on the", null, ((lube & SLIDE) ? "(LUBE)" : null))
|
||||
|
||||
@@ -138,6 +138,7 @@
|
||||
#include "security_officer_distribution.dm"
|
||||
#include "serving_tray.dm"
|
||||
#include "siunit.dm"
|
||||
#include "slips.dm"
|
||||
#include "spawn_humans.dm"
|
||||
#include "spawn_mobs.dm"
|
||||
#include "species_config_sanity.dm"
|
||||
|
||||
16
code/modules/unit_tests/slips.dm
Normal file
16
code/modules/unit_tests/slips.dm
Normal file
@@ -0,0 +1,16 @@
|
||||
/// Unit test that forces various slips on a mob and checks return values and mob state to see if the slip has likely been successful.
|
||||
/datum/unit_test/slips
|
||||
|
||||
/datum/unit_test/slips/Run()
|
||||
// Test just forced slipping, which calls turf slip code as well.
|
||||
var/mob/living/carbon/human/mso = allocate(/mob/living/carbon/human)
|
||||
|
||||
TEST_ASSERT(mso.slip(100) == TRUE, "/mob/living/carbon/human/slip() returned FALSE when TRUE was expected")
|
||||
TEST_ASSERT(!!(mso.IsKnockdown()), "/mob/living/carbon/human/slip() failed to knockdown target when knockdown was expected")
|
||||
|
||||
// Test the slipping component, which calls mob slip code. Just for good measure.
|
||||
var/mob/living/carbon/human/msos_friend_mso = allocate(/mob/living/carbon/human, run_loc_floor_bottom_left)
|
||||
var/obj/item/grown/bananapeel/specialpeel/mso_bane = allocate(/obj/item/grown/bananapeel/specialpeel, get_step(run_loc_floor_bottom_left, EAST))
|
||||
|
||||
msos_friend_mso.Move(get_turf(mso_bane), EAST)
|
||||
TEST_ASSERT(!!(msos_friend_mso.IsKnockdown()), "Banana peel which should have slipping component failed to knockdown target when knockdown was expected")
|
||||
Reference in New Issue
Block a user