Skip to content

Commit

Permalink
Final stuff
Browse files Browse the repository at this point in the history
Watch out when flying into Syndicate space!
  • Loading branch information
Bokkiewokkie committed Jul 5, 2024
1 parent 2b6aa64 commit a85ae3a
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 14 deletions.
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()
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
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
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
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)
. = ..()
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
3 changes: 3 additions & 0 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
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
60 changes: 47 additions & 13 deletions nsv13/code/modules/overmap/weapons/mines.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/obj/structure/space_mine
name = "space mine"
desc = "Like a naval mine, but in space!"
icon = "nsv13/icons/overmap/effects.dmi"
icon_state = "mine"
icon = 'nsv13/icons/overmap/effects.dmi'
icon_state = "mine_syndicate"
anchored = TRUE
density = FALSE
layer = ABOVE_MOB_LAYER
Expand All @@ -11,39 +11,69 @@
integrity_failure = 100
var/datum/star_system/current_system
var/faction = "syndicate" //evil mines
var/damage = 85
var/damage = 100
var/damage_type = BRUTE
var/damage_flag = "overmap_heavy"
alpha = 50 //spawns in being 'invisible' on sensors (and pretty hard to see in general)
alpha = 50 //They're supposed to be sneaky, their main advantage is being cloaked

/obj/structure/space_mine/Initialize(mapload)
/obj/structure/space_mine/Initialize(mapload, var/list/coordinates, var/new_faction, var/datum/star_system/system)
. = ..()
if(system)
current_system = system
else //Someone is probably spawning us on the overmap, so we assume it's next to the main ship
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))
var/obj/structure/overmap/OM = AM
if(OM.faction != faction || !(OM.faction == "nanotrasen" || OM.faction == "solgov") && !(faction == "nanotrasen" || faction == "solgov"))
mine_explode(OM)
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"))
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"))
mine_explode(OM)

/obj/structure/space_mine/update_icon(updates)
. = ..()
icon_state = "mine_[faction]"

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

/obj/structure/space_mine/obj_destruction(damage_flag)
mine_explode() //Why you mine explode? To the woods with you
. = ..(damage_flag)
..(damage_flag)

/obj/structure/space_mine/proc/mine_explode(obj/structure/overmap/OM)
var/armour_penetration
Expand All @@ -53,13 +83,17 @@
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
OM = O
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)
new /obj/effect/temp_visual/fading_overmap(get_turf(src), name, icon, icon_state, alpha)


Binary file modified nsv13/icons/overmap/effects.dmi
Binary file not shown.

0 comments on commit a85ae3a

Please sign in to comment.