Skip to content

Commit

Permalink
simplifys some behavoir
Browse files Browse the repository at this point in the history
  • Loading branch information
FalloutFalcon committed Oct 13, 2024
1 parent bcc7714 commit dd3b79f
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 70 deletions.
2 changes: 1 addition & 1 deletion code/datums/ruins/space.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
name = "Corporate Mining Module"
description = "An old and rusty mining facility, with big ore potential."
ruin_tags = list(RUIN_TAG_NO_COMBAT, RUIN_TAG_MEDIUM_LOOT, RUIN_TAG_SHELTER)
dynamic_mission_types = list(/datum/mission/dynamic/drill)
dynamic_mission_types = list(/datum/mission/dynamic/signaled/drill)

/datum/map_template/ruin/space/bigderelict1
id = "bigderelict1"
Expand Down
3 changes: 3 additions & 0 deletions code/modules/dynamic_missions/mission.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
var/desc = "Do something for me."
var/faction = /datum/faction/independent
var/value = 1000 /// The mission's payout.
var/atom/movable/mission_reward
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.

Expand Down Expand Up @@ -113,6 +114,8 @@

/datum/mission/proc/spawn_reward(loc)
new /obj/item/spacecash/bundle(loc, value * 1.2)
if(ispath(mission_reward))
new mission_reward(loc)

/datum/mission/proc/can_complete()
return !failed
Expand Down
62 changes: 0 additions & 62 deletions code/modules/dynamic_missions/missions/drill.dm

This file was deleted.

8 changes: 2 additions & 6 deletions code/modules/dynamic_missions/missions/guarded.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@
var/guard_type
var/list/mob/guard_list

/datum/mission/dynamic/guarded/spawn_mission_setpiece(datum/overmap/dynamic/planet)
/datum/mission/dynamic/guarded/spawn_custom_pois(datum/overmap/dynamic/planet)
. = ..()
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
if((!required_item) && mission_poi.type == setpiece_poi)
//Spawns the item or gets it via use_poi then sets it as bound so the mission fails if its deleted
required_item = set_bound(mission_poi.use_poi(setpiece_item), mission_poi.loc, null, TRUE, TRUE)
if(mission_poi.type == guard_poi)
guard_list += list(spawn_guard(mission_poi))
if(!required_item)
CRASH("[src] was unable to find its required landmark")

/datum/mission/dynamic/guarded/proc/spawn_guard(obj/effect/landmark/mission_poi/guard_poi)
var/guard = guard_poi.use_poi(guard_type)
Expand Down
49 changes: 49 additions & 0 deletions code/modules/dynamic_missions/missions/signaled.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,52 @@
set_bound(required_item, null, FALSE, TRUE)
UnregisterSignal(registered_item, mission_main_signal)
remove_bound(registered_item)

/obj/effect/landmark/mission_poi/drill

/datum/mission/dynamic/signaled/drill
name = "drill mission"
desc = "get this drill back up and running and send us proof"
registered_type = /obj/machinery/drill/mission/ruin
setpiece_item = /obj/item/drill_readout
mission_main_signal = COMSIG_DRILL_SAMPLES_DONE

/*
* Core sampling drill
*/
/obj/machinery/drill/mission
name = "core sampling research drill"
desc = "A specialized laser drill designed to extract geological samples."

var/num_current = 0
var/mission_class
var/num_wanted

/obj/machinery/drill/mission/examine()
. = ..()
. += "<span class='notice'>The drill contains [num_current] of the [num_wanted] samples needed.</span>"

/obj/machinery/drill/mission/start_mining()
if(mining.vein_class < mission_class && mining)
say("Error: A vein class of [mission_class] or greater is required for operation.")
return
. = ..()

/obj/machinery/drill/mission/mine_success()
num_current++
if(num_current == num_wanted)
SEND_SIGNAL(src, COMSIG_DRILL_SAMPLES_DONE)

/obj/machinery/drill/mission/ruin
name = "industrial grade mining drill"
desc = "A large scale laser drill. It's able to mine vast amounts of minerals from near-surface ore pockets, this one is designed for mining outposts."
mission_class = 4
num_wanted = 15

/obj/item/drill_readout
name = "drill debug information"
desc = "Created by a mining outpost drill."
icon = 'icons/obj/bureaucracy.dmi'
icon_state = "paper"
item_state = "paper"
w_class = WEIGHT_CLASS_SMALL
1 change: 0 additions & 1 deletion shiptest.dme
Original file line number Diff line number Diff line change
Expand Up @@ -2056,7 +2056,6 @@
#include "code\modules\dynamic_missions\mission.dm"
#include "code\modules\dynamic_missions\mission_board.dm"
#include "code\modules\dynamic_missions\spawner.dm"
#include "code\modules\dynamic_missions\missions\drill.dm"
#include "code\modules\dynamic_missions\missions\dynamic.dm"
#include "code\modules\dynamic_missions\missions\guarded.dm"
#include "code\modules\dynamic_missions\missions\kill.dm"
Expand Down

0 comments on commit dd3b79f

Please sign in to comment.