mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-06-21 22:24:09 +01:00
baf3837ae8
# Conflicts: # _maps/RandomRuins/SpaceRuins/derelict_sulaco.dmm # _maps/RandomRuins/SpaceRuins/garbagetruck2.dmm # _maps/map_files/CatwalkStation/CatwalkStation_2023.dmm # _maps/map_files/tramstation/tramstation.dmm # code/_onclick/hud/new_player.dm # code/datums/components/squashable.dm # code/datums/diseases/advance/symptoms/heal.dm # code/datums/diseases/chronic_illness.dm # code/datums/status_effects/buffs.dm # code/datums/status_effects/debuffs/drunk.dm # code/datums/status_effects/debuffs/stamcrit.dm # code/game/machinery/computer/crew.dm # code/game/objects/items/devices/scanners/health_analyzer.dm # code/game/objects/items/wall_mounted.dm # code/game/turfs/closed/indestructible.dm # code/modules/admin/view_variables/filterrific.dm # code/modules/antagonists/heretic/influences.dm # code/modules/cargo/orderconsole.dm # code/modules/client/preferences.dm # code/modules/events/space_vines/vine_mutations.dm # code/modules/mob/dead/new_player/new_player.dm # code/modules/mob/living/carbon/human/death.dm # code/modules/mob/living/carbon/human/species_types/jellypeople.dm # code/modules/mob/living/damage_procs.dm # code/modules/mob/living/living.dm # code/modules/mob_spawn/ghost_roles/mining_roles.dm # code/modules/mob_spawn/mob_spawn.dm # code/modules/projectiles/ammunition/energy/laser.dm # code/modules/projectiles/guns/ballistic/launchers.dm # code/modules/projectiles/guns/energy/laser.dm # code/modules/reagents/chemistry/machinery/chem_dispenser.dm # code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm # code/modules/reagents/chemistry/reagents/drinks/alcohol_reagents.dm # code/modules/reagents/chemistry/reagents/medicine_reagents.dm # code/modules/surgery/healing.dm # code/modules/unit_tests/designs.dm # icons/mob/inhands/items_lefthand.dmi # icons/mob/inhands/items_righthand.dmi # tgui/packages/tgui/interfaces/ChemDispenser.tsx
40 lines
2.4 KiB
Plaintext
40 lines
2.4 KiB
Plaintext
///Tests all projectiles that none of them are phasing.
|
|
/datum/unit_test/projectile_movetypes
|
|
|
|
/datum/unit_test/projectile_movetypes/Run()
|
|
for(var/obj/projectile/projectile as anything in typesof(/obj/projectile))
|
|
if(initial(projectile.movement_type) & PHASING)
|
|
TEST_FAIL("[projectile] has default movement type PHASING. Piercing projectiles should be done using the projectile piercing system, not movement_types!")
|
|
|
|
///Shoots a victim with a gun to ensure the gun properly loads and the victim take the correct amount of damage.
|
|
/datum/unit_test/gun_go_bang
|
|
|
|
/datum/unit_test/gun_go_bang/Run()
|
|
// test is for a ballistic gun that starts loaded + chambered
|
|
var/obj/item/gun/ballistic/test_gun = allocate(/obj/item/gun/ballistic/automatic/pistol)
|
|
var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human/consistent)
|
|
var/mob/living/carbon/human/gunner = allocate(/mob/living/carbon/human/consistent)
|
|
ADD_TRAIT(victim, TRAIT_PIERCEIMMUNE, INNATE_TRAIT) // So the human isn't randomly affected by shrapnel
|
|
test_gun.can_misfire = FALSE //just in case
|
|
|
|
var/obj/item/ammo_casing/loaded_casing = test_gun.chambered
|
|
TEST_ASSERT(loaded_casing, "Gun started without round chambered, should be loaded")
|
|
var/obj/projectile/loaded_bullet = loaded_casing.loaded_projectile
|
|
TEST_ASSERT(loaded_bullet, "Ammo casing has no loaded bullet")
|
|
|
|
gunner.put_in_hands(test_gun, forced=TRUE)
|
|
//SKYRAT EDIT ADDITION BEGIN
|
|
if(test_gun.GetComponent(/datum/component/gun_safety))
|
|
qdel(test_gun.GetComponent(/datum/component/gun_safety))
|
|
loaded_bullet.wound_bonus = CANT_WOUND //Baseline wounding makes things weird
|
|
//SKYRAT EDIT ADDITION END
|
|
gunner.set_combat_mode(FALSE) // just to make sure we know we're not trying to pistol-whip them
|
|
var/expected_damage = loaded_bullet.damage
|
|
loaded_bullet.def_zone = BODY_ZONE_CHEST
|
|
var/did_we_shoot = test_gun.melee_attack_chain(gunner, victim)
|
|
TEST_ASSERT(did_we_shoot, "Gun does not appeared to have successfully fired.")
|
|
TEST_ASSERT_EQUAL(victim.get_brute_loss(), expected_damage, "Victim took incorrect amount of damage, expected [expected_damage], got [victim.get_brute_loss()].")
|
|
|
|
var/obj/item/bodypart/expected_part = victim.get_bodypart(BODY_ZONE_CHEST)
|
|
TEST_ASSERT_EQUAL(expected_part.brute_dam, expected_damage, "Intended bodypart took incorrect amount of damage, either it hit another bodypart or armor was incorrectly applied. Expected [expected_damage], got [expected_part.brute_dam].")
|