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

First Drop Protections: Gas and Static Turrets #6363

Merged
merged 33 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e3258de
Smoke refactoring
Drulikar Jun 2, 2024
b01b415
Sentry name fixes
Drulikar Jun 2, 2024
d515c61
Initial implementation of miasma smoke and static deployable gauss se…
Drulikar Jun 2, 2024
9eda611
Shiva LZ2 habs
Drulikar Jun 2, 2024
857d745
Tweak smoke damage and blur
Drulikar Jun 2, 2024
0389ccc
Fix auto deployment having wrong sentry range
Drulikar Jun 2, 2024
dc495b7
Fix sentry_holder hiding north facing barricades
Drulikar Jun 2, 2024
7972fdc
Add niche logged for toggling deployment of lz turrets
Drulikar Jun 2, 2024
bb3604b
Add examine text if okay battery
Drulikar Jun 2, 2024
68f5711
Tweak examine text
Drulikar Jun 3, 2024
e036f75
Consistency
Drulikar Jun 3, 2024
158cf26
More smoke refactoring
Drulikar Jun 3, 2024
7a3b6bc
Miasma in LZ1 tcoms
Drulikar Jun 3, 2024
b1110b8
Shivas warehouse
Drulikar Jun 3, 2024
7b63bc1
Trijent Dam
Drulikar Jun 3, 2024
1ca3a12
Kutjevo Refinery
Drulikar Jun 3, 2024
8d00007
Chances claim
Drulikar Jun 3, 2024
f4bb33c
New Varadero
Drulikar Jun 3, 2024
35e29ed
Fiorina Cellblocks
Drulikar Jun 3, 2024
142f6af
Corsat
Drulikar Jun 3, 2024
79a1b2d
Combine battery durations into one var
Drulikar Jun 4, 2024
d190f94
Revert shuttle lighting change for alamo/normandy since they don't ha…
Drulikar Jun 4, 2024
b6ca725
increase spaceborne sentry range
Drulikar Jun 4, 2024
d00cb16
Shrink LZ2 area on shivas
Drulikar Jun 4, 2024
f7f75b3
Faster droppod sentries
Drulikar Jun 4, 2024
134bb83
Sanity check in case somehow first drop occurred somehow
Drulikar Jun 4, 2024
b08a6f5
Expand LZ1 area on sci annex
Drulikar Jun 4, 2024
bafdedb
Tweak LZ area poking out.
Drulikar Jun 4, 2024
f3b5a98
Fix vehicles in miasma
Drulikar Jun 4, 2024
589d2ca
No explosions
Drulikar Jun 4, 2024
c0a981c
3 min timer for lz hazards
Drulikar Jun 6, 2024
a50f945
Rework miasma in vehicles
Drulikar Jun 6, 2024
bb9a7df
New Varadero - though this will likely need to discarded and reapplie…
Drulikar Jun 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions code/__DEFINES/defenses.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
#define DEFENSE_BELL_TOWER 4
#define DEFENSE_TESLA_COIL 5

// Defines for /obj/structure/machinery/defenses/sentry/premade/deployable/colony/landing_zone
#define TURRET_BATTERY_STATE_OK 0
#define TURRET_BATTERY_STATE_LOW 1
#define TURRET_BATTERY_STATE_CRITICAL 2
#define TURRET_BATTERY_STATE_DEAD 3

// What range the generator has to be in or defenses has to be in.
#define GEN_SEARCH_RANGE 5
#define GEN_PLASTEEL_COST 10
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define SMOKE_RANK_MED 3
#define SMOKE_RANK_HIGH 4
#define SMOKE_RANK_BOILER 5
#define SMOKE_RANK_MAX 6

// What kind of function to use for Explosions falling off.

Expand Down
1 change: 1 addition & 0 deletions code/game/area/shiva.dm
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@
/area/shiva/interior/lz2_habs
name = "Shiva's Snowball - Argentinian Research Headquarters"
icon_state = "bar1"
is_landing_zone = TRUE

/area/shiva/interior/aux_power
name = "Shiva's Snowball - Auxiliary Generator Station"
Expand Down
109 changes: 109 additions & 0 deletions code/game/gamemodes/colonialmarines/colonialmarines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
var/next_research_allocation = 0
var/next_stat_check = 0
var/list/running_round_stats = list()
var/list/lz_smoke = list()

////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -120,9 +121,116 @@

addtimer(CALLBACK(src, PROC_REF(ares_online)), 5 SECONDS)
addtimer(CALLBACK(src, PROC_REF(map_announcement)), 20 SECONDS)
addtimer(CALLBACK(src, PROC_REF(start_lz_hazards)), 2 MINUTES)

return ..()

/datum/game_mode/colonialmarines/ds_first_landed(obj/docking_port/stationary/marine_dropship)
. = ..()
clear_lz_hazards() // This shouldn't normally do anything, but is here just in case

// Assumption: Shuttle origin is its center
// Assumption: dwidth is atleast 2 and dheight is atleast 4 otherwise there will be overlap
var/list/options = list()
var/list/structures_to_break = list(/obj/structure/barricade, /obj/structure/surface/table, /obj/structure/bed)
var/bottom = marine_dropship.y - marine_dropship.dheight - 2
var/top = marine_dropship.y + marine_dropship.dheight + 2
var/left = marine_dropship.x - marine_dropship.dwidth - 2
var/right = marine_dropship.x + marine_dropship.dwidth + 2
var/z = marine_dropship.z

// Bottom left
options += get_valid_sentry_turfs(left, bottom, z, width=5, height=2, structures_to_ignore=structures_to_break)
options += get_valid_sentry_turfs(left, bottom + 2, z, width=2, height=6, structures_to_ignore=structures_to_break)
spawn_lz_sentry(pick(options), structures_to_break)

// Bottom right
options.Cut()
options += get_valid_sentry_turfs(right-4, bottom, z, width=5, height=2, structures_to_ignore=structures_to_break)
options += get_valid_sentry_turfs(right-1, bottom + 2, z, width=2, height=6, structures_to_ignore=structures_to_break)
spawn_lz_sentry(pick(options), structures_to_break)

// Top left
options.Cut()
options += get_valid_sentry_turfs(left, top-1, z, width=5, height=2, structures_to_ignore=structures_to_break)
options += get_valid_sentry_turfs(left, top-7, z, width=2, height=6, structures_to_ignore=structures_to_break)
spawn_lz_sentry(pick(options), structures_to_break)

// Top right
options.Cut()
options += get_valid_sentry_turfs(right-4, top-1, z, width=5, height=2, structures_to_ignore=structures_to_break)
options += get_valid_sentry_turfs(right-1, top-7, z, width=2, height=6, structures_to_ignore=structures_to_break)
spawn_lz_sentry(pick(options), structures_to_break)

///Returns a list of non-dense turfs using the given block arguments ignoring the provided structure types
/datum/game_mode/colonialmarines/proc/get_valid_sentry_turfs(left, bottom, z, width, height, list/structures_to_ignore)
var/valid_turfs = list()
for(var/turf/turf in block(left, bottom, z, left+width-1, bottom+height-1))
if(turf.density)
continue
var/structure_blocking = FALSE
for(var/obj/structure/existing_structure in turf)
if(!existing_structure.density)
continue
if(!is_type_in_list(existing_structure, structures_to_ignore))
structure_blocking = TRUE
break
if(structure_blocking)
continue
valid_turfs += turf
return valid_turfs

///Spawns a droppod with a temporary defense sentry at the given turf
/datum/game_mode/colonialmarines/proc/spawn_lz_sentry(turf/target, list/structures_to_break)
var/obj/structure/droppod/equipment/sentry_holder/droppod = new(target, /obj/structure/machinery/sentry_holder/landing_zone)
droppod.special_structures_to_damage = structures_to_break
droppod.special_structure_damage = 500
droppod.drop_time = 5 SECONDS
droppod.launch(target)

///Creates an OB warning at each LZ to warn of the miasma and then spawns the miasma
/datum/game_mode/colonialmarines/proc/start_lz_hazards()
INVOKE_ASYNC(src, PROC_REF(warn_lz_hazard), locate(/obj/structure/machinery/computer/shuttle/dropship/flight/lz1))
INVOKE_ASYNC(src, PROC_REF(warn_lz_hazard), locate(/obj/structure/machinery/computer/shuttle/dropship/flight/lz2))
addtimer(CALLBACK(src, PROC_REF(spawn_lz_hazards)), OB_TRAVEL_TIMING + 1 SECONDS)

///Creates an OB warning at each LZ to warn of the incoming miasma
/datum/game_mode/colonialmarines/proc/warn_lz_hazard(lz)
if(!lz)
return
var/turf/target = get_turf(lz)
if(!target)
return
var/obj/structure/ob_ammo/warhead/explosive/warhead = new
warhead.name = "\improper CN20-X miasma warhead"
warhead.clear_power = 0
warhead.clear_falloff = 400
warhead.standard_power = 0
warhead.standard_falloff = 30
warhead.clear_delay = 3
warhead.double_explosion_delay = 6
warhead.warhead_impact(target) // This is a blocking call
playsound(target, 'sound/effects/smoke.ogg', vol=50, vary=1, sound_range=75)

///Spawns miasma smoke in landing zones
/datum/game_mode/colonialmarines/proc/spawn_lz_hazards()
var/datum/cause_data/new_cause_data = create_cause_data("CN20-X miasma")
for(var/area/area in GLOB.all_areas)
if(!area.is_landing_zone)
continue
if(!is_ground_level(area.z))
continue
for(var/turf/turf in area)
if(turf.density)
continue
lz_smoke += new /obj/effect/particle_effect/smoke/miasma(turf, null, new_cause_data)

///Clears miasma smoke in landing zones
/datum/game_mode/colonialmarines/proc/clear_lz_hazards()
for(var/obj/effect/particle_effect/smoke/miasma/smoke as anything in lz_smoke)
smoke.time_to_live = rand(1, 5)
lz_smoke.Cut()

#define MONKEYS_TO_TOTAL_RATIO 1/32

/datum/game_mode/colonialmarines/proc/spawn_smallhosts()
Expand Down Expand Up @@ -289,6 +397,7 @@
/datum/game_mode/colonialmarines/ds_first_drop(obj/docking_port/mobile/marine_dropship)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(show_blurb_uscm)), DROPSHIP_DROP_MSG_DELAY)
add_current_round_status_to_end_results("First Drop")
clear_lz_hazards()

///////////////////////////
//Checks to see who won///
Expand Down
38 changes: 38 additions & 0 deletions code/game/machinery/sentry_holder.dm
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,41 @@
/obj/structure/machinery/sentry_holder/almayer/mini/aicore/attack_hand(mob/user)
to_chat(user, SPAN_WARNING("[src] can only be deployed remotely."))
return

/obj/structure/machinery/sentry_holder/landing_zone
icon_state = "floor_sentry_installed" // TODO: More appropriate sprites
turret_path = /obj/structure/machinery/defenses/sentry/premade/deployable/colony/landing_zone
base_icon_state = "floor_sentry" // TODO: More appropriate sprites
layer = HATCH_LAYER // Needs to not hide barricades

/obj/structure/machinery/sentry_holder/landing_zone/attack_hand(mob/user)
var/obj/structure/machinery/defenses/sentry/premade/deployable/colony/landing_zone/turret = deployed_turret
if(!istype(turret))
to_chat(user, SPAN_WARNING("[src] is unresponsive."))
return

if(deployment_cooldown > world.time)
to_chat(user, SPAN_WARNING("[src] is busy."))
return

if(deployed_turret.loc == src) //not deployed
if(turret.battery_state == TURRET_BATTERY_STATE_DEAD)
to_chat(user, SPAN_WARNING("[src] is non-functional."))
return

if(require_red_alert && (seclevel2num(get_security_level()) < SEC_LEVEL_RED))
to_chat(user, SPAN_WARNING("[src] can only be activated in emergencies."))
return

to_chat(user, SPAN_NOTICE("You deploy [src]."))
deploy_sentry()
msg_admin_niche("[key_name(user)] deployed [turret] at [get_location_in_text(src)] [ADMIN_JMP(loc)]")
return

to_chat(user, SPAN_NOTICE("You retract [src]."))
msg_admin_niche("[key_name(user)] retracted [turret] at [get_location_in_text(src)] [ADMIN_JMP(loc)]")
undeploy_sentry()
return

/obj/structure/machinery/sentry_holder/landing_zone/update_use_power(new_use_power)
return
Loading
Loading