From bcc7714bdd20ac955fc1702feb9ab9b0ca145c63 Mon Sep 17 00:00:00 2001 From: FalloutFalcon Date: Sun, 13 Oct 2024 17:47:13 -0500 Subject: [PATCH] missions and stuff --- .../JungleRuins/jungle_bombed_starport.dmm | 1 + .../lavaland_abandonedlisteningpost.dmm | 1 + _maps/RandomRuins/SpaceRuins/power_puzzle.dmm | 6 +-- code/datums/ruins/jungle.dm | 1 + code/datums/ruins/lavaland.dm | 1 + code/datums/ruins/space.dm | 1 + .../mission_code/undergroundoutpost45.dm | 39 ------------------- code/modules/dynamic_missions/mission.dm | 7 ++-- .../dynamic_missions/missions/dynamic.dm | 39 ++++++++++++++++--- .../modules/dynamic_missions/missions/kill.dm | 4 +- .../dynamic_missions/missions/signaled.dm | 17 ++++++++ code/modules/overmap/objects/dynamic_datum.dm | 2 +- shiptest.dme | 2 +- 13 files changed, 67 insertions(+), 54 deletions(-) delete mode 100644 code/modules/awaymissions/mission_code/undergroundoutpost45.dm create mode 100644 code/modules/dynamic_missions/missions/signaled.dm diff --git a/_maps/RandomRuins/JungleRuins/jungle_bombed_starport.dmm b/_maps/RandomRuins/JungleRuins/jungle_bombed_starport.dmm index 77c280d07e90..1cef88927090 100644 --- a/_maps/RandomRuins/JungleRuins/jungle_bombed_starport.dmm +++ b/_maps/RandomRuins/JungleRuins/jungle_bombed_starport.dmm @@ -7415,6 +7415,7 @@ /area/overmap_encounter/planetoid/jungle/explored) "YA" = ( /obj/machinery/blackbox_recorder, +/obj/effect/landmark/mission_poi/main/blackbox, /turf/open/floor/mineral/plastitanium/red, /area/ruin/jungle/starport/tower) "YC" = ( diff --git a/_maps/RandomRuins/LavaRuins/lavaland_abandonedlisteningpost.dmm b/_maps/RandomRuins/LavaRuins/lavaland_abandonedlisteningpost.dmm index 8cc99b4a591a..846527608fd0 100644 --- a/_maps/RandomRuins/LavaRuins/lavaland_abandonedlisteningpost.dmm +++ b/_maps/RandomRuins/LavaRuins/lavaland_abandonedlisteningpost.dmm @@ -151,6 +151,7 @@ /obj/effect/turf_decal/siding/thinplating/dark{ dir = 4 }, +/obj/effect/landmark/mission_poi/main/blackbox, /turf/open/floor/plasteel/dark, /area/ruin/unpowered/listening_post/operations) "db" = ( diff --git a/_maps/RandomRuins/SpaceRuins/power_puzzle.dmm b/_maps/RandomRuins/SpaceRuins/power_puzzle.dmm index 3d05cfb13d35..87abeb36a536 100644 --- a/_maps/RandomRuins/SpaceRuins/power_puzzle.dmm +++ b/_maps/RandomRuins/SpaceRuins/power_puzzle.dmm @@ -1216,7 +1216,7 @@ /obj/structure/chair/office{ dir = 8 }, -/obj/machinery/firealarm/directional/north, +/obj/machinery/firealarm/directional/east, /turf/open/floor/plasteel, /area/ruin/space/has_grav/powerpuzzle/secure) "jy" = ( @@ -3506,9 +3506,7 @@ /turf/open/floor/plasteel/dark, /area/ruin/space/has_grav/powerpuzzle/secure) "UV" = ( -/obj/structure/salvageable/computer{ - dir = 1 - }, +/obj/effect/landmark/mission_poi/main, /obj/machinery/door/poddoor/shutters{ id = "vaultshutters2" }, diff --git a/code/datums/ruins/jungle.dm b/code/datums/ruins/jungle.dm index e6be9dd1de45..cdd9bd774b1f 100644 --- a/code/datums/ruins/jungle.dm +++ b/code/datums/ruins/jungle.dm @@ -49,6 +49,7 @@ description = "A bombed out airbase from the ICW, taken back over by nature" suffix = "jungle_bombed_starport.dmm" ruin_tags = list(RUIN_TAG_MEDIUM_COMBAT, RUIN_TAG_MAJOR_LOOT, RUIN_TAG_HAZARDOUS, RUIN_TAG_LIVEABLE) + dynamic_mission_types = list(/datum/mission/dynamic/blackbox) /datum/map_template/ruin/jungle/medtech name = "MedTech facility" diff --git a/code/datums/ruins/lavaland.dm b/code/datums/ruins/lavaland.dm index f94d75bd71f9..7a60d4e1223f 100644 --- a/code/datums/ruins/lavaland.dm +++ b/code/datums/ruins/lavaland.dm @@ -41,3 +41,4 @@ id = "abandonedlistening" description = "An abandoned Cybersun listening post. Seems like the Ramzi Clique has an interest in the site." suffix = "lavaland_abandonedlisteningpost.dmm" + dynamic_mission_types = list(/datum/mission/dynamic/blackbox) diff --git a/code/datums/ruins/space.dm b/code/datums/ruins/space.dm index dcf258a702f4..02afd5ac6274 100644 --- a/code/datums/ruins/space.dm +++ b/code/datums/ruins/space.dm @@ -36,6 +36,7 @@ description = "an abandoned secure storage location. there is no power left in the batteries and the former ocupants locked it pretty tight before leaving.\ You will have to power areas to raise the bolts on the doors. look out for secrets." ruin_tags = list(RUIN_TAG_MINOR_COMBAT, RUIN_TAG_MAJOR_LOOT, RUIN_TAG_SHELTER, RUIN_TAG_HAZARDOUS) + dynamic_mission_types = list(/datum/mission/dynamic/data_reterival) /datum/map_template/ruin/space/astraeus id = "astraeus" diff --git a/code/modules/awaymissions/mission_code/undergroundoutpost45.dm b/code/modules/awaymissions/mission_code/undergroundoutpost45.dm deleted file mode 100644 index 415303202430..000000000000 --- a/code/modules/awaymissions/mission_code/undergroundoutpost45.dm +++ /dev/null @@ -1,39 +0,0 @@ -// undergroundoutpost45 - -//Areas -/area/awaymission/undergroundoutpost45 - name = "space" - icon_state = "awaycontent1" - -/area/awaymission/undergroundoutpost45/central - name = "UO45 Central Hall" - icon_state = "awaycontent2" - -/area/awaymission/undergroundoutpost45/crew_quarters - name = "UO45 Crew Quarters" - icon_state = "awaycontent3" - -/area/awaymission/undergroundoutpost45/engineering - name = "UO45 Engineering" - icon_state = "awaycontent4" - -/area/awaymission/undergroundoutpost45/mining - name = "UO45 Mining" - icon_state = "awaycontent5" - -/area/awaymission/undergroundoutpost45/research - name = "UO45 Research" - icon_state = "awaycontent6" - -/area/awaymission/undergroundoutpost45/gateway - name = "UO45 Gateway" - icon_state = "awaycontent7" - -/area/awaymission/undergroundoutpost45/caves - name = "UO45 Caves" - icon_state = "awaycontent8" - always_unpowered = TRUE - power_environ = FALSE - power_equip = FALSE - power_light = FALSE - poweralm = FALSE diff --git a/code/modules/dynamic_missions/mission.dm b/code/modules/dynamic_missions/mission.dm index cc610d28d73b..b38acb55b1d3 100644 --- a/code/modules/dynamic_missions/mission.dm +++ b/code/modules/dynamic_missions/mission.dm @@ -7,7 +7,7 @@ var/duration /// The amount of time in which to complete the mission. Setting it to 0 will result in no time limit var/weight = 0 /// The relative probability of this mission being selected. 0-weight missions are never selected. - ///Only needed if you have multipe missiosn that use the same poi's on the map + ///Only needed if you have multipe missiosn that use the same poi's on the map. Set at new. var/mission_index var/location_specific = TRUE @@ -31,9 +31,10 @@ /// is a callback to be invoked upon the atom's qdeletion. var/list/atom/movable/bound_atoms -/datum/mission/New(_location) +/datum/mission/New(location, mission_index) //source_outpost = _outpost - mission_location = _location + src.mission_location = location + src.mission_index = mission_index SSmissions.inactive_missions += list(src) //RegisterSignal(source_outpost, COMSIG_PARENT_QDELETING, PROC_REF(on_vital_delete)) RegisterSignal(mission_location, COMSIG_PARENT_QDELETING, PROC_REF(on_vital_delete)) diff --git a/code/modules/dynamic_missions/missions/dynamic.dm b/code/modules/dynamic_missions/missions/dynamic.dm index 37b0dce39d50..64bb787299f8 100644 --- a/code/modules/dynamic_missions/missions/dynamic.dm +++ b/code/modules/dynamic_missions/missions/dynamic.dm @@ -11,15 +11,31 @@ /datum/mission/dynamic/spawn_mission_setpiece(datum/overmap/dynamic/planet) for(var/obj/effect/landmark/mission_poi/mission_poi in planet.spawned_mission_pois) - if(mission_poi.type == setpiece_poi) + if(!isnull(mission_poi.mission_index) && (mission_index != mission_poi.mission_index)) + continue + if(istype(mission_poi, setpiece_poi)) //Spawns the item or gets it via use_poi then sets it as bound so the mission fails if its deleted spawn_main_piece(planet, mission_poi) - return - CRASH("[src] was unable to find its required landmark") + break + + spawn_custom_pois(planet) + + // Reiterate through the loop and attemp to spawn any mission that matches our index but dont pass any type so it will need its own + for(var/obj/effect/landmark/mission_poi/mission_poi in planet.spawned_mission_pois) + if(isnull(mission_poi.mission_index) || (mission_index != mission_poi.mission_index)) + continue + mission_poi.use_poi() + + if(!isatom(setpiece_item)) + CRASH("[src] was unable to find its required landmark") /datum/mission/dynamic/proc/spawn_main_piece(datum/overmap/dynamic/planet, obj/effect/landmark/mission_poi/mission_poi) required_item = set_bound(mission_poi.use_poi(setpiece_item), mission_poi.loc, null, TRUE, TRUE) +/// For handling logic outside of main piece thats too complex for the basic reiteration or you want to not require indexs to match. +/datum/mission/dynamic/proc/spawn_custom_pois(datum/overmap/dynamic/planet) + return + /datum/mission/dynamic/can_turn_in(atom/movable/item_to_check) if(istype(required_item)) if(specific_item) @@ -31,10 +47,10 @@ /datum/mission/dynamic/data_reterival name = "data recovery" - ///Assumes its a list setpiece_item = list( /obj/item/blackbox, - /obj/item/research_notes/loot + /obj/item/research_notes/loot, + /obj/item/documents ) /datum/mission/dynamic/data_reterival/generate_mission_details() @@ -42,3 +58,16 @@ if(ispath(setpiece_item, /obj/item)) var/obj/item/mission_item = setpiece_item desc = "We are looking for a [mission_item::name]" + +/obj/effect/landmark/mission_poi/main/blackbox + icon_state = "main_blackbox" + already_spawned = TRUE + +/obj/effect/landmark/mission_poi/main/blackbox/use_poi(_type_to_spawn) + var/obj/machinery/blackbox_recorder/recorder = ..() + if(istype(recorder, /obj/machinery/blackbox_recorder)) + if(istype(recorder.stored, /obj/item/blackbox)) + return recorder.stored + +/datum/mission/dynamic/blackbox + setpiece_item = /obj/machinery/blackbox_recorder diff --git a/code/modules/dynamic_missions/missions/kill.dm b/code/modules/dynamic_missions/missions/kill.dm index 5edfd7aad988..ac84c751d618 100644 --- a/code/modules/dynamic_missions/missions/kill.dm +++ b/code/modules/dynamic_missions/missions/kill.dm @@ -46,6 +46,7 @@ /mob/living/simple_animal/hostile/megafauna/blood_drunk_miner, /mob/living/simple_animal/hostile/megafauna/claw, ) + . = ..() /datum/mission/dynamic/kill/elite @@ -54,5 +55,6 @@ /mob/living/simple_animal/hostile/asteroid/elite/broodmother, /mob/living/simple_animal/hostile/asteroid/elite/herald, /mob/living/simple_animal/hostile/asteroid/elite/legionnaire, - /mob/living/simple_animal/hostile/asteroid/elite/pandora + /mob/living/simple_animal/hostile/asteroid/elite/pandora, ) + . = ..() diff --git a/code/modules/dynamic_missions/missions/signaled.dm b/code/modules/dynamic_missions/missions/signaled.dm new file mode 100644 index 000000000000..a41f5018164e --- /dev/null +++ b/code/modules/dynamic_missions/missions/signaled.dm @@ -0,0 +1,17 @@ +/datum/mission/dynamic/signaled + var/registered_type + var/atom/movable/registered_item + /// What signal will spawn the required item + var/mission_main_signal + +/datum/mission/dynamic/signaled/spawn_main_piece(obj/effect/landmark/mission_poi/mission_poi) + var/registered_item = set_bound(mission_poi.use_poi(registered_type), null, FALSE, TRUE) + RegisterSignal(registered_item, mission_main_signal, PROC_REF(on_signaled)) + +/datum/mission/dynamic/signaled/proc/on_signaled(atom/movable/registered_item) + SIGNAL_HANDLER + + required_item = new setpiece_item(registered_item.loc) + set_bound(required_item, null, FALSE, TRUE) + UnregisterSignal(registered_item, mission_main_signal) + remove_bound(registered_item) diff --git a/code/modules/overmap/objects/dynamic_datum.dm b/code/modules/overmap/objects/dynamic_datum.dm index a955c9a3ba0e..94e7b5610442 100644 --- a/code/modules/overmap/objects/dynamic_datum.dm +++ b/code/modules/overmap/objects/dynamic_datum.dm @@ -154,7 +154,7 @@ var/datum/map_template/ruin/used_ruin = ispath(selected_ruin) ? (new selected_ruin()) : selected_ruin if(istype(used_ruin)) for(var/mission_type in used_ruin.dynamic_mission_types) - dynamic_missions += new mission_type(src) + dynamic_missions += new mission_type(src, 1 + length(dynamic_missions)) if(vlevel_height >= 255 && vlevel_width >= 255) //little easter egg planet_name = "LV-[pick(rand(11111,99999))]" diff --git a/shiptest.dme b/shiptest.dme index 776d919e1f63..f048fca934d8 100644 --- a/shiptest.dme +++ b/shiptest.dme @@ -1844,7 +1844,6 @@ #include "code\modules\awaymissions\mission_code\research.dm" #include "code\modules\awaymissions\mission_code\snowdin.dm" #include "code\modules\awaymissions\mission_code\spacebattle.dm" -#include "code\modules\awaymissions\mission_code\undergroundoutpost45.dm" #include "code\modules\balloon_alert\balloon_alert.dm" #include "code\modules\buildmode\bm_mode.dm" #include "code\modules\buildmode\buildmode.dm" @@ -2061,6 +2060,7 @@ #include "code\modules\dynamic_missions\missions\dynamic.dm" #include "code\modules\dynamic_missions\missions\guarded.dm" #include "code\modules\dynamic_missions\missions\kill.dm" +#include "code\modules\dynamic_missions\missions\signaled.dm" #include "code\modules\economy\_economy.dm" #include "code\modules\economy\account.dm" #include "code\modules\economy\pay_stand.dm"