From b4d304d4f35341a29b641b56025f051754b1481c Mon Sep 17 00:00:00 2001 From: ihatethisengine Date: Sun, 30 Jul 2023 10:43:23 +0300 Subject: [PATCH 1/3] init --- .../mob/living/carbon/xenomorph/XenoProcs.dm | 2 +- .../mob/living/carbon/xenomorph/death.dm | 1 + .../living/carbon/xenomorph/hive_faction.dm | 3 +- .../living/carbon/xenomorph/xeno_defines.dm | 38 ++++++++++++++----- 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/code/modules/mob/living/carbon/xenomorph/XenoProcs.dm b/code/modules/mob/living/carbon/xenomorph/XenoProcs.dm index 667367339698..37b0aa037cd1 100644 --- a/code/modules/mob/living/carbon/xenomorph/XenoProcs.dm +++ b/code/modules/mob/living/carbon/xenomorph/XenoProcs.dm @@ -18,7 +18,7 @@ if(SSticker.mode && SSticker.mode.xenomorphs.len) //Send to only xenos in our gamemode list. This is faster than scanning all mobs for(var/datum/mind/L in SSticker.mode.xenomorphs) var/mob/living/carbon/M = L.current - if(M && istype(M) && !M.stat && M.client && (!hivenumber || M.ally_of_hivenumber(hivenumber))) //Only living and connected xenos + if(M && istype(M) && !M.stat && M.client && (!hivenumber || M.hivenumber == hivenumber)) //Only living and connected xenos to_chat(M, SPAN_XENODANGER(" [message]")) //Sends a maptext alert to our currently selected squad. Does not make sound. diff --git a/code/modules/mob/living/carbon/xenomorph/death.dm b/code/modules/mob/living/carbon/xenomorph/death.dm index 12c9b3e37c9b..fd25e39f4118 100644 --- a/code/modules/mob/living/carbon/xenomorph/death.dm +++ b/code/modules/mob/living/carbon/xenomorph/death.dm @@ -69,6 +69,7 @@ if(!QDELETED(Q) && Q != src && Q.hivenumber == hivenumber) hive.set_living_xeno_queen(Q) break + hive.on_queen_death() hive.handle_xeno_leader_pheromones() if(SSticker.mode) INVOKE_ASYNC(SSticker.mode, TYPE_PROC_REF(/datum/game_mode, check_queen_status), hivenumber) diff --git a/code/modules/mob/living/carbon/xenomorph/hive_faction.dm b/code/modules/mob/living/carbon/xenomorph/hive_faction.dm index 10af37b8d8e8..e16a5cccd915 100644 --- a/code/modules/mob/living/carbon/xenomorph/hive_faction.dm +++ b/code/modules/mob/living/carbon/xenomorph/hive_faction.dm @@ -56,6 +56,5 @@ GLOBAL_LIST_INIT(hive_alliable_factions, generate_alliable_factions()) return var/should_ally = text2num(params["should_ally"]) - assoc_hive.allies[params["target_faction"]] = should_ally - assoc_hive.on_stance_change(params["target_faction"]) + assoc_hive.change_stance(params["target_faction"], should_ally) . = TRUE diff --git a/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm b/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm index 9bdbf3a89d6d..9e59616f9f90 100644 --- a/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm +++ b/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm @@ -1352,13 +1352,30 @@ /datum/hive_status/corrupted/renegade/faction_is_ally(faction, ignore_queen_check = TRUE) return ..() -/datum/hive_status/proc/on_stance_change(faction) - if(!living_xeno_queen) +/datum/hive_status/proc/on_queen_death() //break alliances on queen's death + if(allow_no_queen_actions || living_xeno_queen) return - if(allies[faction]) - xeno_message(SPAN_XENOANNOUNCE("Your Queen set up an alliance with [faction]!"), 3, hivenumber) - else - xeno_message(SPAN_XENOANNOUNCE("Your Queen broke the alliance with [faction]!"), 3, hivenumber) + var/broken_alliances = FALSE + for(var/faction in allies) + if(!allies[faction]) + continue + change_stance(faction, FALSE) + broken_alliances = TRUE + + + if(broken_alliances) + xeno_message(SPAN_XENOANNOUNCE("With the death of the Queen all alliances has been broken."), 3, hivenumber) + +/datum/hive_status/proc/change_stance(faction, should_ally) + if(allies[faction] == should_ally) + return + allies[faction] = should_ally + + if(living_xeno_queen) + if(allies[faction]) + xeno_message(SPAN_XENOANNOUNCE("Your Queen set up an alliance with [faction]!"), 3, hivenumber) + else + xeno_message(SPAN_XENOANNOUNCE("Your Queen broke the alliance with [faction]!"), 3, hivenumber) for(var/number in GLOB.hive_datum) var/datum/hive_status/target_hive = GLOB.hive_datum[number] @@ -1367,12 +1384,15 @@ if(!target_hive.living_xeno_queen && !target_hive.allow_no_queen_actions) return if(allies[faction]) - xeno_message(SPAN_XENOANNOUNCE("You sense that [name] Queen set up an alliance with us!"), 3, target_hive.hivenumber) + xeno_message(SPAN_XENOANNOUNCE("You sense that [name] [living_xeno_queen ? "Queen " : ""]set up an alliance with us!"), 3, target_hive.hivenumber) return - xeno_message(SPAN_XENOANNOUNCE("You sense that [name] Queen broke the alliance with us!"), 3, target_hive.hivenumber) + xeno_message(SPAN_XENOANNOUNCE("You sense that [name] [living_xeno_queen ? "Queen " : ""]broke the alliance with us!"), 3, target_hive.hivenumber) + if(target_hive.allies[name]) //autobreak alliance on betrayal + target_hive.change_stance(name, FALSE) + -/datum/hive_status/corrupted/on_stance_change(faction) +/datum/hive_status/corrupted/change_stance(faction, should_ally) . = ..() if(allies[faction]) return From bd0614deb37c1acf5dbf053e4223c59897e41a03 Mon Sep 17 00:00:00 2001 From: ihatethisengine Date: Sun, 30 Jul 2023 10:59:36 +0300 Subject: [PATCH 2/3] No self-alliance --- code/modules/mob/living/carbon/xenomorph/xeno_defines.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm b/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm index 9e59616f9f90..a9ade04b3aba 100644 --- a/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm +++ b/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm @@ -1367,6 +1367,8 @@ xeno_message(SPAN_XENOANNOUNCE("With the death of the Queen all alliances has been broken."), 3, hivenumber) /datum/hive_status/proc/change_stance(faction, should_ally) + if(faction == name) + return if(allies[faction] == should_ally) return allies[faction] = should_ally From 91193e98a80f26731d863f0f5f9a07e8efca4be8 Mon Sep 17 00:00:00 2001 From: ihatethisengine <115417687+ihatethisengine@users.noreply.github.com> Date: Fri, 4 Aug 2023 09:36:15 +0300 Subject: [PATCH 3/3] Update code/modules/mob/living/carbon/xenomorph/xeno_defines.dm Co-authored-by: harryob --- code/modules/mob/living/carbon/xenomorph/xeno_defines.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm b/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm index a9ade04b3aba..80a6d0c1e50d 100644 --- a/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm +++ b/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm @@ -1364,7 +1364,7 @@ if(broken_alliances) - xeno_message(SPAN_XENOANNOUNCE("With the death of the Queen all alliances has been broken."), 3, hivenumber) + xeno_message(SPAN_XENOANNOUNCE("With the death of the Queen, all alliances have been broken."), 3, hivenumber) /datum/hive_status/proc/change_stance(faction, should_ally) if(faction == name)