Skip to content

Commit

Permalink
Ripping some stuff out and fixing some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
covertcorvid committed Apr 4, 2024
1 parent 78306f8 commit 5d7e7a0
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 114 deletions.
103 changes: 0 additions & 103 deletions code/modules/unit_tests/get_overmap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,37 +39,6 @@
QDEL_NULL(fighter)
. = ..()


/*
* Reactivate when map loading system improves
/// A mob inside a sabre should have its get_overmap return the sabre
/datum/unit_test/sabre_occupant_overmap
var/obj/structure/overmap/small_craft/transport/sabre/sabre = null
var/mob/living/carbon/human/dummy = null
/datum/unit_test/sabre_occupant_overmap/Run()
for(var/obj/structure/overmap/small_craft/transport/sabre/OM as() in SSstar_system.find_main_overmap().overmaps_in_ship)
sabre = OM
break
if(!sabre)
var/turf/center = SSmapping.get_station_center()
ASSERT(center)
sabre = new /obj/structure/overmap/small_craft/transport/sabre(center)
ASSERT(sabre)
var/tries = 50
while((tries > 0) && (sabre.interior_status != 2))
sleep(5 SECONDS)
tries--
TEST_ASSERT_EQUAL(sabre.interior_status, 2, "The sabre's interior was not ready")
dummy = new(get_turf(sabre))
sabre.enter(dummy)
dummy.update_overmap()
TEST_ASSERT_EQUAL(dummy.get_overmap(), sabre, "The mob's overmap was not the sabre")
*/

/datum/unit_test/fighter_pilot_overmap/Destroy()
QDEL_NULL(dummy)
. = ..()
Expand Down Expand Up @@ -116,75 +85,3 @@
/datum/unit_test/fighter_docking/Destroy()
QDEL_NULL(fighter)
. = ..()

/* This doesn't work because the interior doesn't load in a reasonable amount of time
/// A small craft that docks with an asteroid should have its get_overmap return the asteroid while inside, and then null after leaving
/datum/unit_test/asteroid_docking
var/obj/structure/overmap/small_craft/combat/light/fighter = null
/datum/unit_test/asteroid_docking/Run()
var/start = world.time
var/time_limit = 1 MINUTES
for(var/obj/structure/overmap/small_craft/combat/light/OM as() in SSstar_system.find_main_overmap().overmaps_in_ship)
fighter = OM
break
if(!fighter)
var/turf/center = SSmapping.get_station_center()
ASSERT(center)
fighter = new (center)
fighter.ftl_drive = TRUE //This won't work in real life but it will for the test
var/obj/item/fighter_component/docking_computer/DC = fighter.loadout.get_slot(HARDPOINT_SLOT_DOCKING)
DC.docking_mode = TRUE
fighter.check_overmap_elegibility(ignore_position = TRUE, ignore_cooldown = TRUE)
TEST_ASSERT_EQUAL(fighter.get_overmap(), null, "The fighter's overmap was not null after entering the overmap from the ship")
var/obj/structure/overmap/asteroid/asteroid = new(get_turf(fighter))
fighter.docking_act(asteroid)
while((world.time - start) < time_limit)
sleep(10)
TEST_ASSERT_EQUAL(fighter.get_overmap(), asteroid, "The fighter's overmap was not the asteroid after docking")
fighter.check_overmap_elegibility(ignore_position = TRUE, ignore_cooldown = TRUE)
TEST_ASSERT_EQUAL(fighter.get_overmap(), null, "The fighter's overmap was not null after entering the overmap from the asteroid")
/datum/unit_test/asteroid_docking/Destroy()
QDEL_NULL(fighter)
. = ..()
*/

/datum/unit_test/armor_quadrnt_test/Run()
// Test without ngle
var/datum/overmap/source = new /datum/overmap(0, 0, 0, 0, 0)
// Test north east
var/datum/overmap/ne = new /datum/overmap(5, 5, 0, 0, 0)
TEST_ASSERT_EQUAL(source.get_armour_quadrant_for_impact(ne), ARMOUR_QUADRANT_NORTH_EAST, "n impct coming from the top right, should hit the north east quadrant.")
// Test north west
var/datum/overmap/nw = new /datum/overmap(-5, 5, 0, 0, 0)
TEST_ASSERT_EQUAL(source.get_armour_quadrant_for_impact(nw), ARMOUR_QUADRANT_NORTH_WEST, "n impct coming from the top left, should hit the north west quadrant.")
// Test south west
var/datum/overmap/sw = new /datum/overmap(-5, -5, 0, 0, 0)
TEST_ASSERT_EQUAL(source.get_armour_quadrant_for_impact(sw), ARMOUR_QUADRANT_SOUTH_WEST, "n impct coming from the bottom left, should hit the south west quadrant.")
// Test south west
var/datum/overmap/se = new /datum/overmap(5, -5, 0, 0, 0)
TEST_ASSERT_EQUAL(source.get_armour_quadrant_for_impact(se), ARMOUR_QUADRANT_SOUTH_EAST, "n impct coming from the bottom right, should hit the south est quadrant.")
// Modify the ngle so tht we re now pointing 90 degrees to the left
// Test rotated 90 degrees to the left. This means our armour quadrants will also be 90 degrees rotated
// Imagining these ships in my head being attacked and rotated almost melted my brain, I hope n ngle of 90 mens 90 nticlockwise nd not clockwise
source = new /datum/overmap(0, 0, 0, -90, 0)
TEST_ASSERT_EQUAL(source.get_armour_quadrant_for_impact(ne), ARMOUR_QUADRANT_SOUTH_EAST, "If the ship is rotted 90 degrees to the left, then n ttck from (1, 1) should hit the bottom right shield.")
TEST_ASSERT_EQUAL(source.get_armour_quadrant_for_impact(nw), ARMOUR_QUADRANT_NORTH_EAST, "If the ship is rotated 90 degrees to the left, then an attack from (-1, 1) should hit the top right shield")
TEST_ASSERT_EQUAL(source.get_armour_quadrant_for_impact(sw), ARMOUR_QUADRANT_NORTH_WEST, "If the ship is rotated 90 degrees to the left, then an attack from (-1, -1) should hit the top left shield.")
TEST_ASSERT_EQUAL(source.get_armour_quadrant_for_impact(se), ARMOUR_QUADRANT_SOUTH_WEST, "If the ship is rotated 90 degrees to the left, then an attack from (1, -1) should hit the bottom left shield")
// Test 90 degrees to the right
source = new /datum/overmap(0, 0, 0, 90, 0)
TEST_ASSERT_EQUAL(source.get_armour_quadrant_for_impact(ne), ARMOUR_QUADRANT_NORTH_WEST, "If the ship is rotated 90 degrees to the right, then an attack from (1, 1) should hit the top left shield")
TEST_ASSERT_EQUAL(source.get_armour_quadrant_for_impact(nw), ARMOUR_QUADRANT_SOUTH_WEST, "If the ship is rotated 90 degrees to the right, then an attck from (-1, 1) should hit the bottom left shield")
TEST_ASSERT_EQUAL(source.get_armour_quadrant_for_impact(sw), ARMOUR_QUADRANT_SOUTH_EAST, "If the ship is rotted 90 degrees to the right, then n ttck from (-1, -1) should hit the bottom right shield")
TEST_ASSERT_EQUAL(source.get_armour_quadrant_for_impact(se), ARMOUR_QUADRANT_NORTH_EAST, "If the ship is rotated 90 degrees to the right, then an atatck from (1, -1) should hit the top right shield")
// Test a middle angle
// A slight rotation of 5 in either direction shouldnt ffect the answer
source = new /datum/overmap(0, 0, 0, 5, 0)
TEST_ASSERT_EQUAL(source.get_armour_quadrant_for_impact(ne), ARMOUR_QUADRANT_NORTH_EAST, "Rotating the ship to the right shouldnt affect the attack from the north east.")
source = new /datum/overmap(0, 0, 0, -5, 0)
TEST_ASSERT_EQUAL(source.get_armour_quadrant_for_impact(ne), ARMOUR_QUADRANT_NORTH_EAST, "Rotating the ship to the left shouldnt affect the attack from the north east.")
1 change: 1 addition & 0 deletions nsv13.dme
Original file line number Diff line number Diff line change
Expand Up @@ -3682,6 +3682,7 @@
#include "nsv13\code\__DEFINES\paths.dm"
#include "nsv13\code\__DEFINES\research.dm"
#include "nsv13\code\__DEFINES\robot_defines.dm"
#include "nsv13\code\__DEFINES\ships.dm"
#include "nsv13\code\__DEFINES\skynet.dm"
#include "nsv13\code\__DEFINES\starsystem.dm"
#include "nsv13\code\__DEFINES\traits.dm"
Expand Down
9 changes: 0 additions & 9 deletions nsv13/code/__DEFINES/overmap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,6 @@ GLOBAL_LIST_INIT(overmap_impact_sounds, list('nsv13/sound/effects/ship/freespace
//Overmap flags
#define OVERMAP_FLAG_ZLEVEL_CARRIER (1<<0) //! This overmap is meant to carry a z with it, prompting restoration in certain cases.

//Ship mass
#define MASS_TINY 1 //1 Player - Fighters
#define MASS_SMALL 2 //2-5 Players - FoB/Mining Ship
#define MASS_MEDIUM 3 //10-20 Players - Small Capital Ships
#define MASS_MEDIUM_LARGE 5 //10-20 Players - Small Capital Ships
#define MASS_LARGE 7 //20-40 Players - Medium Capital Ships
#define MASS_TITAN 150 //40+ Players - Large Capital Ships
#define MASS_IMMOBILE 200 //Things that should not be moving. See: stations

//Fun tools
#define SHIELD_NOEFFECT 0 //!Shield failed to absorb hit.
#define SHIELD_ABSORB 1 //!Shield absorbed hit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
return
if(!selected_weapon_group)
return
for(var/W in selected_weapon_group.weapon_list)
for(var/W as() in selected_weapon_group.weapon_list)
var/datum/overmap_weapon/weap = W
if(weap.fire(target, proj_angle))
break
Expand Down
2 changes: 1 addition & 1 deletion nsv13/code/modules/overmap/overmapJS/overmap_js_physics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ PROCESSING_SUBSYSTEM_DEF(physics_processing)
//Set up this grid.
var/rows = (JS_OVERMAP_TACMAP_TOTAL_SQUARES)
var/cols = (JS_OVERMAP_TACMAP_TOTAL_SQUARES)
physics_levels[z_str] = new(cols)
physics_levels[z_str] = new/list(cols)
//TODO: test me
for(var/y = 1; y <= rows; y++)
var/list/row = new(rows)
Expand Down

0 comments on commit 5d7e7a0

Please sign in to comment.