mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-18 18:44:48 +01:00
Re-weighted secondary goals. (#26586)
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
var/list/blob_overminds = list()
|
||||
|
||||
var/list/datum/station_goal/station_goals = list() // A list of all station goals for this game mode
|
||||
var/list/secondary_goal_grab_bags = null // Once initialized, contains an associative list of department_name -> list(secondary_goal_type). When a goal is requested, a type will be pulled out of the department's grab bag. When the bag is empty, it will be refilled from the list of all goals in that department, with the amount of each set to the type's weight, max 10.
|
||||
var/list/datum/station_goal/secondary/secondary_goals = list() // A list of all secondary goals issued
|
||||
|
||||
/// Each item in this list can only be rolled once on average.
|
||||
|
||||
@@ -3379,7 +3379,7 @@
|
||||
if(T == /datum/station_goal/secondary)
|
||||
continue
|
||||
var/datum/station_goal/secondary/SG = T
|
||||
if(initial(SG.abstract))
|
||||
if(initial(SG.weight) < 1)
|
||||
type_choices -= SG
|
||||
var/picked = pick_closest_path(FALSE, make_types_fancy(type_choices), skip_filter = TRUE)
|
||||
if(!picked)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/datum/station_goal/secondary/random_bulk_reagent/bar
|
||||
name = "Random Bulk Drink"
|
||||
department = "Bar"
|
||||
abstract = FALSE
|
||||
weight = 9
|
||||
|
||||
/datum/station_goal/secondary/random_bulk_reagent/bar/randomize_params()
|
||||
..()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
progress_type = /datum/secondary_goal_progress/variety_reagent
|
||||
department = "Bar"
|
||||
generic_name_plural = "alcoholic drinks"
|
||||
abstract = FALSE
|
||||
weight = 1
|
||||
|
||||
/datum/station_goal/secondary/variety_reagent/bar/randomize_params()
|
||||
..()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
name = "Random Kudzu"
|
||||
department = "Hydroponics"
|
||||
progress_type = /datum/secondary_goal_progress/random_kudzu
|
||||
abstract = FALSE
|
||||
weight = 1
|
||||
var/list/traits = list()
|
||||
var/amount = 5
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/datum/station_goal/secondary/random_bulk_reagent/kitchen
|
||||
name = "Random Bulk Condiment"
|
||||
department = "Kitchen"
|
||||
abstract = FALSE
|
||||
weight = 1
|
||||
|
||||
/datum/station_goal/secondary/random_bulk_reagent/kitchen/randomize_params()
|
||||
..()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
name = "Random Bulk Food"
|
||||
department = "Kitchen"
|
||||
progress_type = /datum/secondary_goal_progress/random_bulk_food
|
||||
abstract = FALSE
|
||||
weight = 8
|
||||
var/obj/item/food/food_type
|
||||
var/amount
|
||||
var/reward
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
name = "Variety of Food"
|
||||
progress_type = /datum/secondary_goal_progress/variety_food
|
||||
department = "Kitchen"
|
||||
abstract = FALSE
|
||||
weight = 1
|
||||
/// How many different types of food are needed.
|
||||
var/different_types = 10
|
||||
/// How many of each food type are needed.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/datum/station_goal/secondary/random_bulk_reagent/medchem
|
||||
name = "Random Bulk Medicine"
|
||||
department = "Chemistry"
|
||||
abstract = FALSE
|
||||
weight = 9
|
||||
|
||||
/datum/station_goal/secondary/random_bulk_reagent/medchem/randomize_params()
|
||||
..()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
progress_type = /datum/secondary_goal_progress/variety_reagent
|
||||
department = "Chemistry"
|
||||
generic_name_plural = "medicines"
|
||||
abstract = FALSE
|
||||
weight = 1
|
||||
|
||||
/datum/station_goal/secondary/variety_reagent/medchem/randomize_params()
|
||||
..()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/datum/station_goal/secondary/random_bulk_reagent/scichem
|
||||
name = "Random Bulk Chemical"
|
||||
department = "Science"
|
||||
abstract = FALSE
|
||||
weight = 9
|
||||
|
||||
/datum/station_goal/secondary/random_bulk_reagent/scichem/randomize_params()
|
||||
..()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
department = "Robotics"
|
||||
progress_type = /datum/secondary_goal_progress/random_ripley
|
||||
should_send_crate = FALSE
|
||||
abstract = FALSE
|
||||
weight = 1
|
||||
var/list/modules = list()
|
||||
var/static/list/general_modules = list(
|
||||
/obj/item/mecha_parts/mecha_equipment/repair_droid,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
different_types = 5
|
||||
department = "Science"
|
||||
generic_name_plural = "chemicals"
|
||||
abstract = FALSE
|
||||
weight = 1
|
||||
|
||||
/datum/station_goal/secondary/variety_reagent/scichem/randomize_params()
|
||||
..()
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
var/datum/secondary_goal_progress/progress
|
||||
/// Tracker that manages the goal progress, permanent and temporary.
|
||||
var/datum/secondary_goal_tracker/tracker
|
||||
/// Abstract goals can't be used directly.
|
||||
var/abstract = TRUE
|
||||
/// The goal weight of a secondary goal type defines how many copies of it are in the grab bag that new secondary goals are pulled from. When the bag is empty, it gets refilled with the same number of each secondary goal type. Max 10.
|
||||
weight = 0
|
||||
|
||||
/datum/station_goal/secondary/proc/Initialize(requester_name_in, requester_account)
|
||||
SHOULD_CALL_PARENT(TRUE)
|
||||
@@ -53,23 +53,38 @@
|
||||
if(department != "Bridge")
|
||||
send_requests_console_message(message_parts, "Central Command", "Bridge", "Stamped with the Central Command rubber stamp.", "Verified by A.L.I.C.E (CentCom AI)", RQ_NORMALPRIORITY)
|
||||
|
||||
/proc/generate_secondary_goal(department, requester = null, mob/user = null)
|
||||
var/list/possible = list()
|
||||
var/list/departments = list()
|
||||
/proc/init_secondary_goal_grab_bags()
|
||||
SSticker.mode.secondary_goal_grab_bags = list()
|
||||
for(var/T in subtypesof(/datum/station_goal/secondary))
|
||||
var/datum/station_goal/secondary/G = T
|
||||
if(!initial(G.abstract) && !departments[initial(G.department)])
|
||||
departments[initial(G.department)] = TRUE
|
||||
if(initial(G.department) != department || initial(G.abstract))
|
||||
if(initial(G.weight) < 1)
|
||||
continue
|
||||
possible += G
|
||||
var/department = initial(G.department)
|
||||
if(isnull(SSticker.mode.secondary_goal_grab_bags[department]))
|
||||
SSticker.mode.secondary_goal_grab_bags[department] = list()
|
||||
for(var/i in 1 to min(10, initial(G.weight)))
|
||||
SSticker.mode.secondary_goal_grab_bags[department] += G
|
||||
|
||||
if(!length(possible))
|
||||
/proc/generate_secondary_goal(department, requester = null, mob/user = null)
|
||||
if(isnull(SSticker.mode.secondary_goal_grab_bags))
|
||||
init_secondary_goal_grab_bags()
|
||||
|
||||
var/list/possible = SSticker.mode.secondary_goal_grab_bags[department]
|
||||
|
||||
if(isnull(possible))
|
||||
if(user)
|
||||
to_chat(user, "<span class='notice'>No goals available for [department]. Goals are currently available for [english_list(departments)].</span>")
|
||||
to_chat(user, "<span class='notice'>No goals available for [department]. Goals are currently available for [english_list(SSticker.mode.secondary_goal_grab_bags)].</span>")
|
||||
return
|
||||
|
||||
var/datum/station_goal/secondary/picked = pick(possible)
|
||||
if(length(possible) == 0)
|
||||
for(var/T in subtypesof(/datum/station_goal/secondary))
|
||||
var/datum/station_goal/secondary/G = T
|
||||
if(initial(G.weight) < 1 || initial(G.department) != department)
|
||||
continue
|
||||
for(var/i in 1 to min(10, initial(G.weight)))
|
||||
possible += G
|
||||
|
||||
var/datum/station_goal/secondary/picked = pick_n_take(possible)
|
||||
var/datum/station_goal/secondary/built = new picked
|
||||
|
||||
var/requester_name = null
|
||||
|
||||
Reference in New Issue
Block a user