This commit is contained in:
Timothy Teakettle
2020-12-26 23:09:19 +00:00
parent 1b450f7f14
commit c3e9cdd9a5
12 changed files with 131 additions and 21 deletions

View File

@@ -55,6 +55,9 @@
//donator items
#define LOADOUT_CATEGORY_DONATOR "Donator"
//unlockable items
#define LOADOUT_CATEGORY_UNLOCKABLE "Unlockable"
//how many prosthetics can we have
#define MAXIMUM_LOADOUT_PROSTHETICS 2

View File

@@ -9,5 +9,6 @@ GLOBAL_LIST_INIT(loadout_categories, list(
LOADOUT_CATEGORY_SHOES = LOADOUT_SUBCATEGORIES_NONE,
LOADOUT_CATEGORY_GLOVES = LOADOUT_SUBCATEGORIES_NONE,
LOADOUT_CATEGORY_GLASSES = LOADOUT_SUBCATEGORIES_NONE,
LOADOUT_CATEGORY_DONATOR = LOADOUT_SUBCATEGORIES_NONE
LOADOUT_CATEGORY_DONATOR = LOADOUT_SUBCATEGORIES_NONE,
LOADOUT_CATEGORY_UNLOCKABLE = LOADOUT_SUBCATEGORIES_NONE
))

View File

@@ -24,13 +24,17 @@
create_reagents(mopcap, NONE, NO_REAGENTS_VALUE)
/obj/item/mop/proc/clean(turf/A)
/obj/item/mop/proc/clean(turf/A, mob/user)
if(reagents.has_reagent(/datum/reagent/water, 1) || reagents.has_reagent(/datum/reagent/water/holywater, 1) || reagents.has_reagent(/datum/reagent/consumable/ethanol/vodka, 1) || reagents.has_reagent(/datum/reagent/space_cleaner, 1))
SEND_SIGNAL(A, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_MEDIUM)
A.clean_blood()
var/cleaned_something = FALSE
for(var/obj/effect/O in A)
if(is_cleanable(O))
cleaned_something = TRUE
qdel(O)
if(cleaned_something && user && user.client)
user.client.increment_progress("janitor", 1)
reagents.reaction(A, TOUCH, 10) //Needed for proper floor wetting.
reagents.remove_any(1) //reaction() doesn't use up the reagents
@@ -59,7 +63,7 @@
if(!L.UseStaminaBuffer(stamusage, warn = TRUE))
return
user.visible_message("[user] cleans \the [T] with [src].", "<span class='notice'>You clean \the [T] with [src].</span>")
clean(T)
clean(T, user)
user.DelayNextAction(CLICK_CD_MELEE)
user.do_attack_animation(T, used_item = src)
playsound(T, "slosh", 50, 1)

View File

@@ -243,7 +243,7 @@ LINEN BINS
/obj/item/bedsheet/random/Initialize()
..()
var/type = pick(typesof(/obj/item/bedsheet) - list(/obj/item/bedsheet/random, /obj/item/bedsheet/chameleon))
var/type = pick(typesof(/obj/item/bedsheet) - (list(/obj/item/bedsheet/random, /obj/item/bedsheet/chameleon) + typesof(/obj/item/bedsheet/unlockable)))
new type(loc)
return INITIALIZE_HINT_QDEL
@@ -257,9 +257,32 @@ LINEN BINS
chameleon_action = new(src)
chameleon_action.chameleon_type = /obj/item/bedsheet
chameleon_action.chameleon_name = "Bedsheet"
chameleon_action.chameleon_blacklist = typecacheof(list(/obj/item/bedsheet/chameleon, /obj/item/bedsheet/random), only_root_path = TRUE)
chameleon_action.chameleon_blacklist = typecacheof(list(/obj/item/bedsheet/chameleon, /obj/item/bedsheet/random, /obj/item/bedsheet/unlockable), only_root_path = FALSE)
chameleon_action.initialize_disguises()
//unlockable bedsheets
/obj/item/bedsheet/unlockable
name = "unlockable bedsheet"
desc = "this shouldn't be here!"
//janitor: clean 100 messes with mop as janitor
/obj/item/bedsheet/unlockable/janitor
name = "janitor bedsheet"
desc = "A white bedsheet, with a warning sign on the front."
icon_state = "sheetjanitor"
//cook: use microwave 100 times properly (contents must make one good item) as cook
/obj/item/bedsheet/unlockable/cook
name = "cook bedsheet"
desc = "A grey bedsheet, with a microwave on the front."
icon_state = "sheetcook"
//miner: redeem 100,000 mining points
/obj/item/bedsheet/unlockable/miner
name = "miner bedsheet"
desc = "A red and black bedsheet. It seems to be made with goliath hide."
icon_state = "sheetminer"
//bedsheet bin
/obj/structure/bedsheetbin
name = "linen bin"

View File

@@ -1002,3 +1002,26 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
verb_tabs |= verb_to_init.category
verblist[++verblist.len] = list(verb_to_init.category, verb_to_init.name)
src << output("[url_encode(json_encode(verb_tabs))];[url_encode(json_encode(verblist))]", "statbrowser:init_verbs")
//increment progress for an unlockable loadout item
/client/proc/increment_progress(key, amount)
if(prefs)
var/savefile/S = new /savefile(prefs.path)
var/list/unlockable_loadout_data = S["unlockable_loadout"]
if(!length(unlockable_loadout_data))
unlockable_loadout_data = list()
unlockable_loadout_data[key] = amount
S["unlockable_loadout"] << unlockable_loadout_data
prefs.unlockable_loadout_data = unlockable_loadout_data
return TRUE
else
if(unlockable_loadout_data[key])
unlockable_loadout_data[key] += amount
else
unlockable_loadout_data[key] = amount
S["unlockable_loadout"] << unlockable_loadout_data
prefs.unlockable_loadout_data = unlockable_loadout_data
WRITE_FILE(S["unlockable_loadout"], unlockable_loadout_data)
return TRUE
return FALSE

View File

@@ -180,10 +180,10 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/gear_points = 10
var/list/gear_categories
var/list/loadout_data = list()
var/list/unlockable_loadout_data = list()
var/loadout_slot = 1 //goes from 1 to MAXIMUM_LOADOUT_SAVES
var/gear_category
var/gear_subcategory
var/list/loadout_progress = list()
var/screenshake = 100
var/damagescreenshake = 2
@@ -879,7 +879,10 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/list/loadout_item = has_loadout_gear(loadout_slot, "[gear.type]")
var/extra_color_data = ""
if(loadout_item)
class_link = "style='white-space:normal;' class='linkOn' href='?_src_=prefs;preference=gear;toggle_gear_path=[html_encode(name)];toggle_gear=0'"
if(gear.category != LOADOUT_CATEGORY_UNLOCKABLE || (can_use_unlockable(gear)))
class_link = "style='white-space:normal;' class='linkOn' href='?_src_=prefs;preference=gear;toggle_gear_path=[html_encode(name)];toggle_gear=0'"
else
class_link = "style='white-space:normal;' class='linkOff'"
if(gear.loadout_flags & LOADOUT_CAN_COLOR_POLYCHROMIC)
extra_color_data += "<BR><a href='?_src_=prefs;preference=gear;loadout_color_polychromic=1;loadout_gear_name=[html_encode(gear.name)];'>Color</a>"
for(var/loadout_color in loadout_item[LOADOUT_COLOR])
@@ -890,7 +893,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
loadout_color_non_poly = loadout_item[LOADOUT_COLOR][1]
extra_color_data += "<BR><a href='?_src_=prefs;preference=gear;loadout_color=1;loadout_gear_name=[html_encode(gear.name)];'>Color</a>"
extra_color_data += "<span style='border: 1px solid #161616; background-color: [loadout_color_non_poly];'>&nbsp;&nbsp;&nbsp;</span>"
else if(gear_points <= 0)
else if((gear_points - gear.cost) < 0)
class_link = "style='white-space:normal;' class='linkOff'"
else if(donoritem)
class_link = "style='white-space:normal;background:#ebc42e;' href='?_src_=prefs;preference=gear;toggle_gear_path=[html_encode(name)];toggle_gear=1'"
@@ -2658,6 +2661,9 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if(G.donoritem && !G.donator_ckey_check(user.ckey))
to_chat(user, "<span class='danger'>This is an item intended for donator use only. You are not authorized to use this item.</span>")
return
if(istype(G, /datum/gear/unlockable) && !can_use_unlockable(G))
to_chat(user, "<span class='danger'>To use this item, you need to meet the defined requirements!</span>")
return
if(gear_points >= initial(G.cost))
var/list/new_loadout_data = list(LOADOUT_ITEM = "[G.type]")
if(length(G.loadout_initial_colors))
@@ -2943,6 +2949,11 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if(find_gear)
loadout_data["SAVE_[save_slot]"] -= list(find_gear)
/datum/preferences/proc/can_use_unlockable(datum/gear/unlockable/unlockable_gear)
if(unlockable_loadout_data[unlockable_gear.progress_key] >= unlockable_gear.progress_required)
return TRUE
return FALSE
#undef DEFAULT_SLOT_AMT
#undef HANDS_SLOT_AMT
#undef BACKPACK_SLOT_AMT

View File

@@ -738,6 +738,8 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
//gear loadout
loadout_data = safe_json_decode(S["loadout"])
unlockable_loadout_data = S["unlockable_loadout"]
//try to fix any outdated data if necessary
//preference updating will handle saving the updated data for us.
if(needs_update >= 0)
@@ -1075,6 +1077,11 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
else
S["loadout"] << safe_json_encode(list())
if(length(unlockable_loadout_data))
S["unlockable_loadout"] << unlockable_loadout_data
else
S["unlockable_loadout"] << list()
cit_character_pref_save(S)
return 1

View File

@@ -195,7 +195,7 @@
/obj/machinery/microwave/AltClick(mob/user)
. = ..()
if(user.canUseTopic(src, !hasSiliconAccessInArea(user)))
cook()
cook(user)
return TRUE
/obj/machinery/microwave/ui_interact(mob/user)
@@ -226,7 +226,7 @@
if("eject")
eject()
if("use")
cook()
cook(user)
if("examine")
examine(user)
@@ -236,7 +236,7 @@
AM.forceMove(drop_location())
ingredients.Cut()
/obj/machinery/microwave/proc/cook()
/obj/machinery/microwave/proc/cook(mob/user)
if(stat & (NOPOWER|BROKEN))
return
if(operating || broken > 0 || panel_open || !anchored || dirty == 100)
@@ -257,7 +257,7 @@
start_can_fail()
return
break
start()
start(user)
/obj/machinery/microwave/proc/turn_on()
visible_message("\The [src] turns on.", "<span class='italics'>You hear a microwave humming.</span>")
@@ -277,9 +277,9 @@
#define MICROWAVE_MUCK 1
#define MICROWAVE_PRE 2
/obj/machinery/microwave/proc/start()
/obj/machinery/microwave/proc/start(mob/user)
turn_on()
loop(MICROWAVE_NORMAL, 10)
loop(MICROWAVE_NORMAL, 10, wait = max(12 - 2 * productivity, 2), user)
/obj/machinery/microwave/proc/start_can_fail()
turn_on()
@@ -292,7 +292,7 @@
update_icon()
loop(MICROWAVE_MUCK, 4)
/obj/machinery/microwave/proc/loop(type, time, wait = max(12 - 2 * productivity, 2)) // standard wait is 10
/obj/machinery/microwave/proc/loop(type, time, wait = max(12 - 2 * productivity, 2), mob/user) // standard wait is 10
if(stat & (NOPOWER|BROKEN))
if(type == MICROWAVE_PRE)
pre_fail()
@@ -300,7 +300,7 @@
if(!time)
switch(type)
if(MICROWAVE_NORMAL)
loop_finish()
loop_finish(user)
if(MICROWAVE_MUCK)
muck_finish()
if(MICROWAVE_PRE)
@@ -308,16 +308,21 @@
return
time--
use_power(500)
addtimer(CALLBACK(src, .proc/loop, type, time, wait), wait)
addtimer(CALLBACK(src, .proc/loop, type, time, wait, user), wait)
/obj/machinery/microwave/proc/loop_finish()
/obj/machinery/microwave/proc/loop_finish(mob/user)
operating = FALSE
var/metal = 0
var/cooked_food = 0
for(var/obj/item/O in ingredients)
O.microwave_act(src)
var/cooked_result = O.microwave_act(src)
if(!istype(cooked_result, /obj/item/reagent_containers/food/snacks/badrecipe))
cooked_food += 1
if(O.custom_materials?.len)
metal += O.custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)]
if(cooked_food && user.client)
user.client.increment_progress("cook", cooked_food)
if(metal)
spark()
@@ -336,8 +341,8 @@
spark()
after_finish_loop()
/obj/machinery/microwave/proc/pre_success()
loop(MICROWAVE_NORMAL, 10)
/obj/machinery/microwave/proc/pre_success(mob/user)
loop(MICROWAVE_NORMAL, 10, user)
/obj/machinery/microwave/proc/muck_finish()
visible_message("<span class='warning'>\The [src] gets covered in muck!</span>")

View File

@@ -30,6 +30,8 @@
if(points)
if(I)
I.mining_points += points
if(usr.client)
usr.client.increment_progress("miner", points)
points = 0
else
to_chat(usr, "<span class='warning'>No ID detected.</span>")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 51 KiB

View File

@@ -0,0 +1,30 @@
/datum/gear/unlockable
category = LOADOUT_CATEGORY_UNLOCKABLE
slot = SLOT_NECK
var/progress_required //what does our progress need to be to unlock it
var/progress_key //what is the key used to retrieve existing progress for this unlockable
/datum/gear/unlockable/janitor
name = "Janitor Bedsheet"
description = "Clean 100 messes with a mop to unlock this. It has a warning sign on!"
path = /obj/item/bedsheet/unlockable/janitor
progress_required = 100
progress_key = "janitor"
/datum/gear/unlockable/cook
name = "Cook Bedsheet"
description = "Cook 250 items using the microwave to unlock this. It has a microwave on!"
path = /obj/item/bedsheet/unlockable/cook
progress_required = 250
progress_key = "cook"
/datum/gear/unlockable/miner
name = "Miner Bedsheet"
description = "Redeem a total of 100,000 miner points to unlock this. It's made out of goliath hide!"
path = /obj/item/bedsheet/unlockable/miner
progress_required = 100000
progress_key = "miner"

View File

@@ -3605,6 +3605,7 @@
#include "modular_citadel\code\modules\client\loadout\shoes.dm"
#include "modular_citadel\code\modules\client\loadout\suit.dm"
#include "modular_citadel\code\modules\client\loadout\uniform.dm"
#include "modular_citadel\code\modules\client\loadout\unlockable.dm"
#include "modular_citadel\code\modules\client\verbs\who.dm"
#include "modular_citadel\code\modules\clothing\neck.dm"
#include "modular_citadel\code\modules\clothing\trek.dm"