Skip to content

Commit

Permalink
tweak: cargo few orders and change access for cargo quest console (#4472
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Rerik007 authored Feb 20, 2024
1 parent 41a4390 commit 634fb03
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 134 deletions.
27 changes: 16 additions & 11 deletions code/modules/economy/quests/_base_quests.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
if(!quest_type)
var/list/possible_types = list()
if((length(GLOB.clients) < MIN_PLAYERS_FOR_MIX) && (length(current_quests) == 2))
for(var/datum/cargo_quest/quest in current_quests)
for(var/datum/cargo_quest/quest as anything in current_quests)
possible_types += quest.type
else
for(var/path in subtypesof(/datum/cargo_quest) - /datum/cargo_quest/thing)
Expand All @@ -75,10 +75,10 @@
possible_types.Remove(customer.cant_order)
quest_type = pick(possible_types)

for(var/datum/cargo_quest/quest in current_quests)
for(var/datum/cargo_quest/quest as anything in current_quests)
if(quest.type != quest_type)
continue
quest.generate_goal(difficultly = quest_difficulty.diff_flag)
quest.add_goal(difficultly = quest_difficulty.diff_flag)
quest.update_interface_icon()
return

Expand Down Expand Up @@ -140,10 +140,12 @@
var/datum/cargo_quests_storage/q_storage
/// Quest desc, using in interface.
var/list/desc = list()
/// Quest interface icons, using in interface.
var/list/interface_icons = list()
/// Quest interface icon states, using in interface.
var/list/interface_icon_states = list()
/// Quest base icon, using in interface.
var/interface_icon
/// Quest base icon state, using in interface.
var/interface_icon_state
/// Quest interface images, using in interface.
var/list/interface_images = list()
/// Requested order's item types, unless otherwise specified.
var/list/req_items = list()
///possible difficultly
Expand All @@ -152,18 +154,21 @@

/datum/cargo_quest/New(storage)
q_storage = storage
generate_goal(difficultly = q_storage.quest_difficulty.diff_flag)
add_goal(difficultly = q_storage.quest_difficulty.diff_flag)
update_interface_icon()

/datum/cargo_quest/proc/generate_goal(difficultly)
/datum/cargo_quest/proc/generate_goal_list(difficultly)
return

/datum/cargo_quest/proc/length_quest()
/datum/cargo_quest/proc/add_goal(difficultly)
return

/datum/cargo_quest/proc/update_interface_icon()
/datum/cargo_quest/proc/length_quest()
return

/datum/cargo_quest/proc/update_interface_icon()
if(interface_icon && interface_icon_state)
interface_images += icon2base64(icon(interface_icon, interface_icon_state, SOUTH, 1))

/datum/cargo_quest/proc/check_required_item(atom/movable/check_item)
return
Expand Down
8 changes: 3 additions & 5 deletions code/modules/economy/quests/quest_console.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
desc = "Essential for supply requests. Your bread and butter."
icon_keyboard = "cargo_quest_key"
icon_screen = "cargo_quest"
req_access = list(ACCESS_QM)
req_access = list(ACCESS_CARGO)
circuit = /obj/item/circuitboard/supplyquest
/// If TRUE you can see only active quests
var/for_active_quests = FALSE
Expand Down Expand Up @@ -71,17 +71,16 @@
/obj/machinery/computer/supplyquest/ui_data(mob/user)
var/list/data = list()
var/list/quest_storages = list()
for(var/datum/cargo_quests_storage/quest_storage in SScargo_quests.quest_storages)
for(var/datum/cargo_quests_storage/quest_storage as anything in SScargo_quests.quest_storages)
if(for_active_quests && !quest_storage.active)
continue
var/timeleft_sec = round((quest_storage.time_start + quest_storage.quest_time - world.time) / 10)
var/list/quests_items = list()
for(var/datum/cargo_quest/cargo_quest as anything in quest_storage.current_quests)
var/image_index = rand(1, length(cargo_quest.interface_icons))
quests_items.Add(list(list(
"quest_type_name" = cargo_quest.quest_type_name,
"desc" = cargo_quest.desc.Join(""),
"image" = "[icon2base64(icon(cargo_quest.interface_icons[image_index], cargo_quest.interface_icon_states[image_index], SOUTH, 1))]",
"image" = "[cargo_quest.interface_images[rand(1, length(cargo_quest.interface_images))]]",
)))

quest_storages.Add(list(list(
Expand Down Expand Up @@ -236,7 +235,6 @@
for_active_quests = TRUE
circuit = /obj/item/circuitboard/questcons
density = FALSE
req_access = list(ACCESS_CARGO)


/obj/machinery/computer/supplyquest/workers/Initialize(mapload)
Expand Down
21 changes: 5 additions & 16 deletions code/modules/economy/quests/reagents_quests.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/datum/cargo_quest/reagents
quest_type_name = "Chemical"
req_items = list(/obj/item/reagent_containers)
interface_icons = list('icons/obj/chemical.dmi')
interface_icon_states = list("beakerlarge")
interface_icon = 'icons/obj/chemical.dmi'
interface_icon_state = "beakerlarge"

difficultly_flags = (QUEST_DIFFICULTY_EASY)

Expand Down Expand Up @@ -34,7 +34,7 @@
"growthserum" = list("volume" = 15, "reward" = 55)
)

/datum/cargo_quest/reagents/generate_goal(difficultly)
/datum/cargo_quest/reagents/add_goal(difficultly)
var/list/possible_reagents_list = repeated_reagents.Copy() + unique_reagents.Copy()
var/our_reagent = pick(possible_reagents_list)
required_reagents[our_reagent] += possible_reagents_list[our_reagent]
Expand Down Expand Up @@ -65,9 +65,6 @@

/datum/cargo_quest/reagents/drinks
quest_type_name = "Drink"
interface_icons = list()
interface_icon_states = list()

repeated_reagents = list(
"b52" = list("volume" = 30,"reward" = 60),
"bacchus_blessing" = list("volume" = 30,"reward" = 100),
Expand Down Expand Up @@ -107,17 +104,9 @@


/datum/cargo_quest/reagents/drinks/update_interface_icon()
var/list/new_interface_icons = list()
var/list/new_interface_icon_states = list()

for(var/reagent_id in required_reagents)
var/datum/reagent/reagent = GLOB.chemical_reagents_list[reagent_id]
if(reagent.drink_icon)
new_interface_icons += 'icons/obj/drinks.dmi'
new_interface_icon_states += reagent.drink_icon
interface_images += icon2base64(icon('icons/obj/drinks.dmi', reagent.drink_icon, SOUTH, 1))
else
new_interface_icons += 'icons/obj/chemical.dmi'
new_interface_icon_states += "beakerlarge"

interface_icons = new_interface_icons
interface_icon_states = new_interface_icon_states
interface_images += icon2base64(icon('icons/obj/chemical.dmi', "beakerlarge", SOUTH, 1))
Loading

0 comments on commit 634fb03

Please sign in to comment.