Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Space mines, Syndicate stealth attacks #2693

Merged
merged 16 commits into from
Sep 26, 2024
Merged
1 change: 1 addition & 0 deletions nsv13.dme
Original file line number Diff line number Diff line change
Expand Up @@ -4049,6 +4049,7 @@
#include "nsv13\code\modules\overmap\types\spacepirates.dm"
#include "nsv13\code\modules\overmap\types\syndicate.dm"
#include "nsv13\code\modules\overmap\weapons\damage.dm"
#include "nsv13\code\modules\overmap\weapons\mines.dm"
#include "nsv13\code\modules\overmap\weapons\plasma_gun.dm"
#include "nsv13\code\modules\overmap\weapons\projectiles_fx.dm"
#include "nsv13\code\modules\overmap\weapons\ship_weapon.dm"
Expand Down
16 changes: 16 additions & 0 deletions nsv13/code/controllers/subsystem/starsystem.dm
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,8 @@ Returns a faction datum by its name (case insensitive!)
SSstar_system.spawn_anomaly(/obj/effect/overmap_anomaly/wormhole, src, center=TRUE)
if(alignment == "syndicate")
spawn_enemies() //Syndicate systems are even more dangerous, and come pre-loaded with some Syndie ships.
if(prob(20)) //Watch your step!
spawn_mines()
DeltaFire15 marked this conversation as resolved.
Show resolved Hide resolved
if(alignment == "unaligned")
if(prob(25))
spawn_enemies()
Expand Down Expand Up @@ -897,6 +899,20 @@ Returns a faction datum by its name (case insensitive!)
enemy_type = pick(SSstar_system.enemy_types) //Spawn a random set of enemies.
SSstar_system.spawn_ship(enemy_type, src)

/datum/star_system/proc/spawn_mines(faction, amount)
if(!amount)
amount = difficulty_budget*2
Bokkiewokkie marked this conversation as resolved.
Show resolved Hide resolved
if(!faction) //Someone forgot to set their IFF
faction = "unaligned"
var/z_level = 1
if(occupying_z)
z_level = occupying_z
for(var/i = 0, i < amount, i++)
var/obj/structure/space_mine/M = new /obj/structure/space_mine(get_turf(locate(rand(5, world.maxx - 5), rand(5, world.maxy - 5), z_level)), faction, src) //random location in the system
Bokkiewokkie marked this conversation as resolved.
Show resolved Hide resolved
Bokkiewokkie marked this conversation as resolved.
Show resolved Hide resolved
if(z_level == 1) //We didn't get one
contents_positions[M] = list("x" = M.x,"y" = M.y)
M.moveToNullspace()

/datum/star_system/proc/lerp_x(datum/star_system/other, t)
return x + (t * (other.x - x))

Expand Down
16 changes: 16 additions & 0 deletions nsv13/code/modules/overmap/ai-skynet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1531,6 +1531,8 @@ Seek a ship thich we'll station ourselves around
OM.send_radar_pulse()
if(OM.patrol_target && overmap_dist(OM, OM.patrol_target) <= 8)
OM.patrol_target = null //You have arrived at your destination.
if(OM.mines_left >= 1) //Deploy a mine if you have one, this should spread them out nicely
OM.deploy_mine()
if(!OM.patrol_target || OM.patrol_target.z != OM.z)
var/min_x = max(OM.x - 50, 15)
var/max_x = min(OM.x + 50, 240)
Expand Down Expand Up @@ -1636,6 +1638,7 @@ Seek a ship thich we'll station ourselves around
//Fleet organisation
var/shots_left = 15 //Number of arbitrary shots an AI can fire with its heavy weapons before it has to resupply with a supply ship.
var/light_shots_left = 300
var/mines_left = 0
var/resupply_range = 15
var/resupplying = 0 //Are we resupplying things right now? If yes, how many?
var/can_resupply = FALSE //Can this ship resupply other ships?
Expand Down Expand Up @@ -2026,6 +2029,8 @@ Seek a ship thich we'll station ourselves around
if(!target || QDELETED(target))
return
desired_angle = overmap_angle(src, target) - 180
if(mines_left >= 1) //if we have mines, we should try to discourage anyone from following
deploy_mine()

/obj/structure/overmap/proc/circle_around(atom/target)
brakes = FALSE
Expand Down Expand Up @@ -2081,6 +2086,17 @@ Seek a ship thich we'll station ourselves around
return TRUE
return FALSE

///Make this ship drop a mine.
/obj/structure/overmap/proc/deploy_mine()
if(mines_left <= 0)
return //why are we here
var/static/mine_cooldown = 0
Bokkiewokkie marked this conversation as resolved.
Show resolved Hide resolved
if(mine_cooldown > world.time) //Don't drop them all at once now
return
mine_cooldown = world.time + 6 SECONDS
mines_left--
new /obj/structure/space_mine(get_turf(src),get_center_coordinates(),faction,current_system)

/client/proc/instance_overmap_menu() //Creates a verb for admins to open up the ui
set name = "Instance Overmap"
set desc = "Load a ship midround."
Expand Down
3 changes: 2 additions & 1 deletion nsv13/code/modules/overmap/ai_interiors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
duration = 3 SECONDS
mouse_opacity = FALSE

/obj/effect/temp_visual/fading_overmap/Initialize(mapload, name, icon, icon_state)
/obj/effect/temp_visual/fading_overmap/Initialize(mapload, name, icon, icon_state, alpha)
Bokkiewokkie marked this conversation as resolved.
Show resolved Hide resolved
. = ..()
src.name = name
src.icon = icon
src.icon_state = icon_state
src.alpha = alpha
play()

/obj/effect/temp_visual/fading_overmap/proc/play()
Expand Down
8 changes: 5 additions & 3 deletions nsv13/code/modules/overmap/armour/armour_quadrant.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
new /obj/structure/overmap/syndicate/ai(get_turf(pick(orange(10, src))))

//Thank you once again to qwerty for writing the directional calc for this.
///Returns the quadrant hit based on a vector point
/obj/structure/overmap/proc/check_quadrant(matrix/vector/point_of_collision)
if(!point_of_collision)
return
Expand All @@ -19,9 +20,10 @@
if(270 to 360) //Then this represents the last quadrant of the circle, the northwest one
return ARMOUR_FORWARD_STARBOARD

/obj/structure/overmap/proc/projectile_quadrant_impact(obj/item/projectile/P)
var/shield_angle_hit = SIMPLIFY_DEGREES(get_angle(P, src) - angle)
switch(shield_angle_hit)
///Returns the quadrant hit by an object
/obj/structure/overmap/proc/quadrant_impact(obj/O)
var/hit_angle = SIMPLIFY_DEGREES(get_angle(O, src) - angle)
switch(hit_angle)
if(0 to 89) //0 - 90 deg is the first right quarter of the circle, it's like dividing up a pizza!
return ARMOUR_FORWARD_PORT
if(90 to 179)
Expand Down
7 changes: 5 additions & 2 deletions nsv13/code/modules/overmap/physics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ This proc is to be used when someone gets stuck in an overmap ship, gauss, WHATE
return locs[round(locs.len / 2)+1]
*/

/obj/structure/overmap/proc/get_center_coordinates()
return list("x" = (src.x+(pixel_collision_size_x/32)/2),"y" = (src.y+(pixel_collision_size_y/32)/2))

/obj/structure/overmap/proc/get_pixel_bounds()
for(var/turf/T in obounds(src, pixel_x + pixel_collision_size_x/4, pixel_y + pixel_collision_size_y/4, pixel_x + -pixel_collision_size_x/4, pixel_y + -pixel_collision_size_x/4) )//Forms a zone of 4 quadrants around the desired overmap using some math fuckery.
to_chat(world, "FOO!")
Expand Down Expand Up @@ -479,8 +482,8 @@ This proc is to be used when someone gets stuck in an overmap ship, gauss, WHATE
if(!impact_sound_cooldown && (bonk > 2 || bonk2 > 2))
bonk *= 5 //The rammer gets an innate penalty, to discourage ramming metas.
bonk2 *= 5
take_quadrant_hit(bonk, projectile_quadrant_impact(other)) //This looks horrible, but trust me, it isn't! Probably!. Armour_quadrant.dm for more info
other.take_quadrant_hit(bonk2, projectile_quadrant_impact(src)) //This looks horrible, but trust me, it isn't! Probably!. Armour_quadrant.dm for more info
take_quadrant_hit(bonk, quadrant_impact(other)) //This looks horrible, but trust me, it isn't! Probably!. Armour_quadrant.dm for more info
other.take_quadrant_hit(bonk2, quadrant_impact(src)) //This looks horrible, but trust me, it isn't! Probably!. Armour_quadrant.dm for more info

log_game("[key_name(pilot)] has impacted an overmap ship into [other] with velocity [bonk]")

Expand Down
3 changes: 3 additions & 0 deletions nsv13/code/modules/overmap/types/syndicate.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
name = "Mauler class flak frigate"
icon_state = "mako_flak"
flak_battery_amount = 1
mines_left = 10
mass = MASS_MEDIUM
combat_dice_type = /datum/combat_dice/frigate

Expand Down Expand Up @@ -259,6 +260,7 @@
integrity_failure = 600
bounty = 3000
torpedoes = 0
mines_left = 5 //As a treat
armor = list("overmap_light" = 90, "overmap_medium" = 60, "overmap_heavy" = 10)
can_resupply = TRUE
ai_flags = AI_FLAG_SUPPLY
Expand Down Expand Up @@ -416,6 +418,7 @@
integrity_failure = 500
missiles = 10
torpedoes = 10 //Torp boat!
mines_left = 15 //And mine layer!
shots_left = 10
armor = list("overmap_light" = 80, "overmap_medium" = 45, "overmap_heavy" = 10)
ai_flags = AI_FLAG_DESTROYER
Expand Down
2 changes: 1 addition & 1 deletion nsv13/code/modules/overmap/weapons/damage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Bullet reactions
visible_message("<span class='danger'>[src] is hit by \a [P]!</span>", null, null, COMBAT_MESSAGE_RANGE)
if(!QDELETED(src)) //Bullet on_hit effect might have already destroyed this object
//var/datum/vector2d/point_of_collision = src.physics2d?.collider2d.get_collision_point(P.physics2d?.collider2d)//Get the collision point, see if the armour quadrants need to absorb this hit.
take_quadrant_hit(run_obj_armor(P.damage, P.damage_type, P.flag, null, P.armour_penetration), projectile_quadrant_impact(P)) //This looks horrible, but trust me, it isn't! Probably!. Armour_quadrant.dm for more info
take_quadrant_hit(run_obj_armor(P.damage, P.damage_type, P.flag, null, P.armour_penetration), quadrant_impact(P)) //This looks horrible, but trust me, it isn't! Probably!. Armour_quadrant.dm for more info

/obj/structure/overmap/proc/relay_damage(proj_type)
if(!length(occupying_levels))
Expand Down
99 changes: 99 additions & 0 deletions nsv13/code/modules/overmap/weapons/mines.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/obj/structure/space_mine
name = "space mine"
desc = "Like a naval mine, but in space!"
icon = 'nsv13/icons/overmap/effects.dmi'
icon_state = "mine_syndicate"
anchored = TRUE
density = FALSE
layer = ABOVE_MOB_LAYER
animate_movement = NO_STEPS
max_integrity = 300
integrity_failure = 100
var/datum/star_system/current_system
Bokkiewokkie marked this conversation as resolved.
Show resolved Hide resolved
var/faction = "syndicate" //evil mines
var/damage = 100
var/damage_type = BRUTE
var/damage_flag = "overmap_heavy"
alpha = 50 //They're supposed to be sneaky, their main advantage is being cloaked

/obj/structure/space_mine/Initialize(mapload, var/list/coordinates, var/new_faction, var/datum/star_system/system)
Bokkiewokkie marked this conversation as resolved.
Show resolved Hide resolved
. = ..()
if(system)
current_system = system
else //Someone is probably spawning us on the overmap, so we assume it's next to the main ship
Bokkiewokkie marked this conversation as resolved.
Show resolved Hide resolved
current_system = SSstar_system.find_main_overmap().current_system
current_system.system_contents |= src
if(new_faction)
faction = new_faction
update_icon()
if(coordinates)
x = coordinates["x"]
y = coordinates["y"]
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = PROC_REF(on_entered),
)
AddElement(/datum/element/connect_loc, loc_connections)

/obj/structure/space_mine/Destroy(force)
current_system?.contents_positions.Remove(src)
current_system?.system_contents.Remove(src)
RemoveElement(/datum/element/connect_loc)
. = ..()

/// This makes us not drift like normal objects in space do
/obj/structure/space_mine/Process_Spacemove(movement_dir = 0)
return 1

/obj/structure/space_mine/proc/on_entered(datum/source, atom/movable/AM)
SIGNAL_HANDLER

if(!(istype(AM, /obj/structure/overmap) || istype(AM, /obj/item/projectile)))
return

switch(AM.type)
if(/obj/item/projectile)
var/obj/item/projectile/P = AM
if(P.faction != faction || !(P.faction == "nanotrasen" || P.faction == "solgov") && (faction == "nanotrasen" || faction == "solgov"))
Bokkiewokkie marked this conversation as resolved.
Show resolved Hide resolved
P.Impact(src)

if(/obj/structure/overmap)
var/obj/structure/overmap/OM = AM
if(OM.faction != faction || !(OM.faction == "nanotrasen" || OM.faction == "solgov") && (faction == "nanotrasen" || faction == "solgov"))
Bokkiewokkie marked this conversation as resolved.
Show resolved Hide resolved
mine_explode(OM)

/obj/structure/space_mine/update_icon(updates)
. = ..()
icon_state = "mine_[faction]"
Bokkiewokkie marked this conversation as resolved.
Show resolved Hide resolved

/obj/structure/space_mine/obj_break(damage_flag)
if(prob(80))
obj_destruction()
else //Whoops, IFF broke!
faction = "unaligned"

/obj/structure/space_mine/obj_destruction(damage_flag)
mine_explode() //Why you mine explode? To the woods with you
..(damage_flag)
Bokkiewokkie marked this conversation as resolved.
Show resolved Hide resolved

/obj/structure/space_mine/proc/mine_explode(obj/structure/overmap/OM)
var/armour_penetration
Bokkiewokkie marked this conversation as resolved.
Show resolved Hide resolved
if(OM) //You just flew into a mine
armour_penetration = 20 //It's blowing up right next to you, this is what it was designed for
if(OM.use_armour_quadrants)
OM.take_quadrant_hit(OM.run_obj_armor(damage, damage_type, damage_flag, null, armour_penetration), OM.quadrant_impact(src))
else
OM.take_damage(damage, damage_type, damage_flag, FALSE, TRUE)
if(OM.linked_areas) //Hope nothing precious was in that room.
var/area/A = pick(OM.linked_areas)
var/turf/T = pick(get_area_turfs(A))
new /obj/effect/temp_visual/explosion_telegraph(T, damage)
else
for(var/obj/structure/overmap/O in orange(2)) //You're in range! Keep in mind this affects *all* ships, explosions don't discriminate between friend and foe
Bokkiewokkie marked this conversation as resolved.
Show resolved Hide resolved
OM = O
Bokkiewokkie marked this conversation as resolved.
Show resolved Hide resolved
if(OM.use_armour_quadrants)
OM.take_quadrant_hit(OM.run_obj_armor(damage, damage_type, damage_flag, null, armour_penetration), OM.quadrant_impact(src))
else
OM.take_damage(damage, damage_type, damage_flag, FALSE, TRUE)
new /obj/effect/temp_visual/fading_overmap(get_turf(src), name, icon, icon_state, alpha)


2 changes: 1 addition & 1 deletion nsv13/code/modules/projectiles/projectile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ GLOBAL_LIST_INIT(projectile_hitbox, list(new /matrix/vector(-2,16),\
var/obj/structure/overmap/OM = A
if(!istype(OM))
return TRUE
if(faction != OM.faction)
if(faction != OM.faction || !(OM.faction == "nanotrasen" || OM.faction == "solgov") && !(faction == "nanotrasen" || faction == "solgov"))
Bokkiewokkie marked this conversation as resolved.
Show resolved Hide resolved
return TRUE
return FALSE
Binary file modified nsv13/icons/obj/munition_types.dmi
Binary file not shown.
Binary file modified nsv13/icons/overmap/effects.dmi
Binary file not shown.
Loading