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

Lesser drone changes #4280

Merged
merged 10 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
32 changes: 25 additions & 7 deletions code/game/gamemodes/cm_initialize.dm
Original file line number Diff line number Diff line change
Expand Up @@ -567,21 +567,39 @@ Additional game mode variables.
var/hive_picked = tgui_input_list(xeno_candidate, "Select which Hive to attempt joining.", "Hive Choice", active_hives, theme="hive_status")
morrowwolf marked this conversation as resolved.
Show resolved Hide resolved
if(!hive_picked)
to_chat(xeno_candidate, SPAN_ALERT("Hive choice error. Aborting."))
return
return FALSE
hive = GLOB.hive_datum[active_hives[hive_picked]]
else
hive = GLOB.hive_datum[last_active_hive]

if(!hive.hive_location)
to_chat(xeno_candidate, SPAN_WARNING("The selected hive does not have a hive core to spawn from!"))
return

for(var/mob_name in hive.banished_ckeys)
if(hive.banished_ckeys[mob_name] == xeno_candidate.ckey)
to_chat(xeno_candidate, SPAN_WARNING("You are banished from the [hive], you may not rejoin unless the Queen re-admits you or dies."))
return
return FALSE

var/list/selection_list = list()
var/list/selection_list_structure = list()

if(hive.hive_location && hive.hive_location.lesser_drone_spawns >= 1)
morrowwolf marked this conversation as resolved.
Show resolved Hide resolved
selection_list += "hive core"
selection_list_structure += hive.hive_location

for(var/obj/effect/alien/resin/special/pylon/cycled_pylon in hive.hive_structures[XENO_STRUCTURE_PYLON])
morrowwolf marked this conversation as resolved.
Show resolved Hide resolved
if(cycled_pylon.lesser_drone_spawns >= 1)
selection_list += "[cycled_pylon.name] at [get_area(cycled_pylon)]"
selection_list_structure += cycled_pylon

if(!length(selection_list))
to_chat(xeno_candidate, SPAN_WARNING("The selected hive does not have enough power for a lesser drone at any hive core or pylon!"))
return FALSE

var/prompt = tgui_input_list(usr, "Select spawn?", "Spawnpoint Selection", selection_list)
morrowwolf marked this conversation as resolved.
Show resolved Hide resolved
if(!prompt)
return FALSE

var/obj/effect/alien/resin/special/pylon/selected_structure = selection_list_structure[selection_list.Find(prompt)]

hive.hive_location.spawn_lesser_drone(xeno_candidate)
selected_structure.spawn_lesser_drone(xeno_candidate)

return TRUE

Expand Down
49 changes: 36 additions & 13 deletions code/modules/cm_aliens/structures/special/pylon_core.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@

var/protection_level = TURF_PROTECTION_CAS

/// How many lesser drone spawns this pylon is able to spawn currently
var/lesser_drone_spawns = 0
/// The maximum amount of lesser drone spawns this pylon can hold
var/lesser_drone_spawn_limit = 5

plane = FLOOR_PLANE

/obj/effect/alien/resin/special/pylon/Initialize(mapload, hive_ref)
Expand All @@ -42,13 +47,23 @@
QDEL_NULL(node)
. = ..()

/obj/effect/alien/resin/special/pylon/process(delta_time)
if(lesser_drone_spawns < lesser_drone_spawn_limit)
// One every 10 seconds while on ovi, one every 120-ish seconds while off ovi
lesser_drone_spawns = min(lesser_drone_spawns + ((linked_hive.living_xeno_queen.ovipositor ? 0.1 : 0.008) * delta_time), lesser_drone_spawn_limit)

/obj/effect/alien/resin/special/pylon/attack_alien(mob/living/carbon/xenomorph/M)
if(isxeno_builder(M) && M.a_intent == INTENT_HELP && M.hivenumber == linked_hive.hivenumber)
do_repair(M) //This handles the delay itself.
return XENO_NO_DELAY_ACTION
else
return ..()

/obj/effect/alien/resin/special/pylon/get_examine_text(mob/user)
. = ..()

. += "Currently holding [SPAN_NOTICE("[Floor(lesser_drone_spawns)]")]/[SPAN_NOTICE("[lesser_drone_spawn_limit]")] lesser drones."
morrowwolf marked this conversation as resolved.
Show resolved Hide resolved

/obj/effect/alien/resin/special/pylon/proc/do_repair(mob/living/carbon/xenomorph/xeno)
if(!istype(xeno))
return
Expand Down Expand Up @@ -94,6 +109,25 @@
pylon_node.resin_parent = src
return pylon_node

/obj/effect/alien/resin/special/pylon/proc/spawn_lesser_drone(mob/xeno_candidate)
if(!linked_hive.can_spawn_as_lesser_drone(xeno_candidate))
return FALSE

if(tgui_alert(xeno_candidate, "Are you sure you want to become a lesser drone?", "Confirmation", list("Yes", "No")) != "Yes")
return FALSE

if(!linked_hive.can_spawn_as_lesser_drone(xeno_candidate))
return FALSE

var/mob/living/carbon/xenomorph/lesser_drone/new_drone = new /mob/living/carbon/xenomorph/lesser_drone(loc, null, linked_hive.hivenumber)
morrowwolf marked this conversation as resolved.
Show resolved Hide resolved
xeno_candidate.mind.transfer_to(new_drone, TRUE)
lesser_drone_spawns -= 1
new_drone.visible_message(SPAN_XENODANGER("A lesser drone emerges out of [src]!"), SPAN_XENODANGER("You emerge out of [src] and awaken from your slumber. For the Hive!"))
playsound(new_drone, 'sound/effects/xeno_newlarva.ogg', 25, TRUE)
new_drone.generate_name()

return TRUE

/obj/effect/alien/resin/special/pylon/endgame
cover_range = WEED_RANGE_CORE
var/activated = FALSE
Expand Down Expand Up @@ -189,6 +223,7 @@

protection_level = TURF_PROTECTION_OB

lesser_drone_spawn_limit = 10

/obj/effect/alien/resin/special/pylon/core/Initialize(mapload, datum/hive_status/hive_ref)
. = ..()
Expand All @@ -205,6 +240,7 @@
SSminimaps.add_marker(src, z, MINIMAP_FLAG_XENO, "core[health < (initial(health) * 0.5) ? "_warn" : "_passive"]")

/obj/effect/alien/resin/special/pylon/core/process()
. = ..()
update_minimap_icon()

// Handle spawning larva if core is connected to a hive
Expand Down Expand Up @@ -243,7 +279,6 @@
linked_hive.hijack_burrowed_surge = FALSE
xeno_message(SPAN_XENOANNOUNCE("The hive's power wanes. You will no longer gain pooled larva over time."), 3, linked_hive.hivenumber)


// Hive core can repair itself over time
if(health < maxhealth && last_healed <= world.time)
health += min(heal_amount, maxhealth-health)
Expand Down Expand Up @@ -400,18 +435,6 @@
// Tell admins that this condition is reached so they know what has happened if it fails somehow
return

/obj/effect/alien/resin/special/pylon/core/proc/spawn_lesser_drone(mob/xeno_candidate)
if(!linked_hive.can_spawn_as_lesser_drone(xeno_candidate))
return FALSE

var/mob/living/carbon/xenomorph/lesser_drone/new_drone = new /mob/living/carbon/xenomorph/lesser_drone(loc, null, linked_hive.hivenumber)
xeno_candidate.mind.transfer_to(new_drone, TRUE)
new_drone.visible_message(SPAN_XENODANGER("A lesser drone emerges out of [src]!"), SPAN_XENODANGER("You emerge out of [src] and awaken from your slumber. For the Hive!"))
playsound(new_drone, 'sound/effects/xeno_newlarva.ogg', 25, TRUE)
new_drone.generate_name()

return TRUE

/obj/effect/alien/resin/special/pylon/core/attack_ghost(mob/dead/observer/user)
. = ..()
if(SSticker.mode.check_xeno_late_join(user))
Expand Down
25 changes: 20 additions & 5 deletions code/modules/mob/living/carbon/xenomorph/xeno_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@
var/hugger_timelock = 15 MINUTES
/// How many huggers can the hive support
var/playable_hugger_limit = 0
/// Minimum number of huggers available at any hive size
var/playable_hugger_minimum = 2

/// How many lesser drones the hive can support
var/lesser_drone_limit = 0
Expand Down Expand Up @@ -1035,7 +1037,15 @@
return TRUE

/datum/hive_status/proc/update_hugger_limit()
playable_hugger_limit = 2 + Ceiling(totalXenos.len / 4)
var/iterator = 0
for(var/mob/living/carbon/xenomorph/cycled_xeno in totalXenos)
morrowwolf marked this conversation as resolved.
Show resolved Hide resolved
if(cycled_xeno.counts_for_slots)
iterator++
if(iterator >= 4)
morrowwolf marked this conversation as resolved.
Show resolved Hide resolved
playable_hugger_limit++
iterator = 0

playable_hugger_limit = max(playable_hugger_limit, playable_hugger_minimum)

/datum/hive_status/proc/can_spawn_as_hugger(mob/dead/observer/user)
if(!GLOB.hive_datum || ! GLOB.hive_datum[hivenumber])
Expand Down Expand Up @@ -1086,7 +1096,15 @@
hugger.timeofdeath = user.timeofdeath // Keep old death time

/datum/hive_status/proc/update_lesser_drone_limit()
lesser_drone_limit = lesser_drone_minimum + Ceiling(length(totalXenos) / 3)
var/iterator = 0
for(var/mob/living/carbon/xenomorph/cycled_xeno in totalXenos)
morrowwolf marked this conversation as resolved.
Show resolved Hide resolved
if(cycled_xeno.counts_for_slots)
iterator++
if(iterator >= 3)
morrowwolf marked this conversation as resolved.
Show resolved Hide resolved
lesser_drone_limit++
iterator = 0

lesser_drone_limit = max(lesser_drone_limit, lesser_drone_minimum)

/datum/hive_status/proc/can_spawn_as_lesser_drone(mob/dead/observer/user)
if(!GLOB.hive_datum || ! GLOB.hive_datum[hivenumber])
Expand Down Expand Up @@ -1120,9 +1138,6 @@
if(islesserdrone(mob))
current_lesser_drone_count++

if(tgui_alert(user, "Are you sure you want to become a lesser drone?", "Confirmation", list("Yes", "No")) != "Yes")
return FALSE

if(lesser_drone_limit <= current_lesser_drone_count)
to_chat(user, SPAN_WARNING("[GLOB.hive_datum[hivenumber]] cannot support more lesser drones! Limit: <b>[current_lesser_drone_count]/[lesser_drone_limit]</b>"))
return FALSE
Expand Down
Loading