Ports the Chem Master choose your pill PR plus post-improvements
This commit is contained in:
@@ -470,19 +470,46 @@ GLOBAL_LIST_EMPTY(asset_datums)
|
||||
/datum/asset/spritesheet/simple/minesweeper
|
||||
name = "minesweeper"
|
||||
assets = list(
|
||||
"1" = 'icons/misc/minesweeper_tiles/one.png',
|
||||
"2" = 'icons/misc/minesweeper_tiles/two.png',
|
||||
"3" = 'icons/misc/minesweeper_tiles/three.png',
|
||||
"4" = 'icons/misc/minesweeper_tiles/four.png',
|
||||
"5" = 'icons/misc/minesweeper_tiles/five.png',
|
||||
"6" = 'icons/misc/minesweeper_tiles/six.png',
|
||||
"7" = 'icons/misc/minesweeper_tiles/seven.png',
|
||||
"8" = 'icons/misc/minesweeper_tiles/eight.png',
|
||||
"empty" = 'icons/misc/minesweeper_tiles/empty.png',
|
||||
"flag" = 'icons/misc/minesweeper_tiles/flag.png',
|
||||
"hidden" = 'icons/misc/minesweeper_tiles/hidden.png',
|
||||
"mine" = 'icons/misc/minesweeper_tiles/mine.png',
|
||||
"minehit" = 'icons/misc/minesweeper_tiles/minehit.png'
|
||||
"1" = 'icons/UI_Icons/minesweeper_tiles/one.png',
|
||||
"2" = 'icons/UI_Icons/minesweeper_tiles/two.png',
|
||||
"3" = 'icons/UI_Icons/minesweeper_tiles/three.png',
|
||||
"4" = 'icons/UI_Icons/minesweeper_tiles/four.png',
|
||||
"5" = 'icons/UI_Icons/minesweeper_tiles/five.png',
|
||||
"6" = 'icons/UI_Icons/minesweeper_tiles/six.png',
|
||||
"7" = 'icons/UI_Icons/minesweeper_tiles/seven.png',
|
||||
"8" = 'icons/UI_Icons/minesweeper_tiles/eight.png',
|
||||
"empty" = 'icons/UI_Icons/minesweeper_tiles/empty.png',
|
||||
"flag" = 'icons/UI_Icons/minesweeper_tiles/flag.png',
|
||||
"hidden" = 'icons/UI_Icons/minesweeper_tiles/hidden.png',
|
||||
"mine" = 'icons/UI_Icons/minesweeper_tiles/mine.png',
|
||||
"minehit" = 'icons/UI_Icons/minesweeper_tiles/minehit.png'
|
||||
)
|
||||
|
||||
/datum/asset/spritesheet/simple/pills
|
||||
name = "pills"
|
||||
assets = list(
|
||||
"pill1" = 'icons/UI_Icons/Pills/pill1.png',
|
||||
"pill2" = 'icons/UI_Icons/Pills/pill2.png',
|
||||
"pill3" = 'icons/UI_Icons/Pills/pill3.png',
|
||||
"pill4" = 'icons/UI_Icons/Pills/pill4.png',
|
||||
"pill5" = 'icons/UI_Icons/Pills/pill5.png',
|
||||
"pill6" = 'icons/UI_Icons/Pills/pill6.png',
|
||||
"pill7" = 'icons/UI_Icons/Pills/pill7.png',
|
||||
"pill8" = 'icons/UI_Icons/Pills/pill8.png',
|
||||
"pill9" = 'icons/UI_Icons/Pills/pill9.png',
|
||||
"pill10" = 'icons/UI_Icons/Pills/pill10.png',
|
||||
"pill11" = 'icons/UI_Icons/Pills/pill11.png',
|
||||
"pill12" = 'icons/UI_Icons/Pills/pill12.png',
|
||||
"pill13" = 'icons/UI_Icons/Pills/pill13.png',
|
||||
"pill14" = 'icons/UI_Icons/Pills/pill14.png',
|
||||
"pill15" = 'icons/UI_Icons/Pills/pill15.png',
|
||||
"pill16" = 'icons/UI_Icons/Pills/pill16.png',
|
||||
"pill17" = 'icons/UI_Icons/Pills/pill17.png',
|
||||
"pill18" = 'icons/UI_Icons/Pills/pill18.png',
|
||||
"pill19" = 'icons/UI_Icons/Pills/pill19.png',
|
||||
"pill20" = 'icons/UI_Icons/Pills/pill20.png',
|
||||
"pill21" = 'icons/UI_Icons/Pills/pill21.png',
|
||||
"pill22" = 'icons/UI_Icons/Pills/pill22.png',
|
||||
)
|
||||
|
||||
/datum/asset/simple/IRV
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#define PILL_STYLE_COUNT 22 //Update this if you add more pill icons or you die
|
||||
#define RANDOM_PILL_STYLE 22 //Dont change this one though
|
||||
|
||||
/obj/machinery/chem_master
|
||||
name = "ChemMaster 3000"
|
||||
desc = "Used to separate chemicals and distribute them in a variety of forms."
|
||||
@@ -13,12 +16,24 @@
|
||||
var/obj/item/storage/pill_bottle/bottle = null
|
||||
var/mode = 1
|
||||
var/condi = FALSE
|
||||
var/chosenPillStyle = 1
|
||||
var/screen = "home"
|
||||
var/analyzeVars[0]
|
||||
var/useramount = 30 // Last used amount
|
||||
var/list/pillStyles
|
||||
|
||||
/obj/machinery/chem_master/Initialize()
|
||||
create_reagents(100)
|
||||
|
||||
//Calculate the span tags and ids fo all the available pill icons
|
||||
var/datum/asset/spritesheet/simple/assets = get_asset_datum(/datum/asset/spritesheet/simple/pills)
|
||||
pillStyles = list()
|
||||
for (var/x in 1 to PILL_STYLE_COUNT)
|
||||
var/list/SL = list()
|
||||
SL["id"] = x
|
||||
SL["htmltag"] = assets.icon_tag("pill[x]")
|
||||
pillStyles += list(SL)
|
||||
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/chem_master/Destroy()
|
||||
@@ -128,9 +143,15 @@
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
var/datum/asset/assets = get_asset_datum(/datum/asset/spritesheet/simple/pills)
|
||||
assets.send(user)
|
||||
ui = new(user, src, ui_key, "chem_master", name, 500, 550, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
//Insert our custom spritesheet css link into the html
|
||||
/obj/machinery/chem_master/ui_base_html(html)
|
||||
var/datum/asset/spritesheet/simple/assets = get_asset_datum(/datum/asset/spritesheet/simple/pills)
|
||||
. = replacetext(html, "<!--customheadhtml-->", assets.css_tag())
|
||||
|
||||
/obj/machinery/chem_master/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
@@ -141,7 +162,7 @@
|
||||
data["condi"] = condi
|
||||
data["screen"] = screen
|
||||
data["analyzeVars"] = analyzeVars
|
||||
|
||||
data["chosenPillStyle"] = chosenPillStyle
|
||||
data["isPillBottleLoaded"] = bottle ? 1 : 0
|
||||
if(bottle)
|
||||
GET_COMPONENT_FROM(STRB, /datum/component/storage, bottle)
|
||||
@@ -160,6 +181,9 @@
|
||||
bufferContents.Add(list(list("name" = N.name, "id" = N.id, "volume" = N.volume))) // ^
|
||||
data["bufferContents"] = bufferContents
|
||||
|
||||
//Calculated at init time as it never changes
|
||||
data["pillStyles"] = pillStyles
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/chem_master/ui_act(action, params)
|
||||
@@ -234,6 +258,12 @@
|
||||
else
|
||||
P = new(drop_location())
|
||||
P.name = trim("[name] pill")
|
||||
if(chosenPillStyle == RANDOM_PILL_STYLE)
|
||||
P.icon_state ="pill[rand(1,21)]"
|
||||
else
|
||||
P.icon_state = "pill[chosenPillStyle]"
|
||||
if(P.icon_state == "pill4")
|
||||
P.desc = "A tablet or capsule, but not just any, a red one, one taken by the ones not scared of knowledge, freedom, uncertainty and the brutal truths of reality."
|
||||
adjust_item_drop_location(P)
|
||||
reagents.trans_to(P,vol_each)
|
||||
else
|
||||
@@ -248,6 +278,10 @@
|
||||
reagents.trans_to(P,10)
|
||||
. = TRUE
|
||||
|
||||
if("pillStyle")
|
||||
var/id = text2num(params["id"])
|
||||
chosenPillStyle = id
|
||||
|
||||
if("createPatch")
|
||||
var/many = params["many"]
|
||||
if(reagents.total_volume == 0)
|
||||
@@ -396,3 +430,6 @@
|
||||
name = "CondiMaster 3000"
|
||||
desc = "Used to create condiments and other cooking supplies."
|
||||
condi = TRUE
|
||||
|
||||
#undef PILL_STYLE_COUNT
|
||||
#undef RANDOM_PILL_STYLE
|
||||
@@ -46,6 +46,9 @@
|
||||
M.visible_message("<span class='danger'>[user] forces [M] to [apply_method] [src].</span>", \
|
||||
"<span class='userdanger'>[user] forces [M] to [apply_method] [src].</span>")
|
||||
|
||||
var/makes_me_think = pick(strings("redpill.json", "redpill_questions"))
|
||||
if(icon_state == "pill4" && prob(5)) //you take the red pill - you stay in Wonderland, and I show you how deep the rabbit hole goes
|
||||
addtimer(CALLBACK(GLOBAL_PROC, /proc/to_chat, M, "<span class='notice'>[makes_me_think]</span>"), 50)
|
||||
|
||||
log_combat(user, M, "fed", reagents.log_list())
|
||||
if(reagents.total_volume)
|
||||
|
||||
@@ -49,6 +49,20 @@
|
||||
if(!ui || ui.status != UI_INTERACTIVE)
|
||||
return 1 // If UI is not interactive or usr calling Topic is not the UI user, bail.
|
||||
|
||||
/**
|
||||
* public
|
||||
*
|
||||
* Called on an object when a tgui object is being created, allowing you to customise the html
|
||||
* For example: inserting a custom stylesheet that you need in the head
|
||||
*
|
||||
* For this purpose, some tags are available in the html, to be parsed out with replacetext
|
||||
* (customheadhtml) - Additions to the head tag
|
||||
*
|
||||
* required html the html base text
|
||||
*
|
||||
**/
|
||||
/datum/proc/ui_base_html(html)
|
||||
return html
|
||||
|
||||
/**
|
||||
* private
|
||||
|
||||
@@ -198,11 +198,19 @@
|
||||
**/
|
||||
/datum/tgui/proc/get_html(var/inline)
|
||||
var/html
|
||||
html = SStgui.basehtml
|
||||
|
||||
//Allow the src object to override the html if needed
|
||||
html = src_object.ui_base_html(html)
|
||||
//Strip out any remaining custom tags that are used in ui_base_html
|
||||
html = replacetext(html, "<!--customheadhtml-->", "")
|
||||
|
||||
// Poplate HTML with JSON if we're supposed to inline.
|
||||
if(inline)
|
||||
html = replacetextEx(SStgui.basehtml, "{}", get_json(initial_data))
|
||||
else
|
||||
html = SStgui.basehtml
|
||||
html = replacetextEx(html, "{}", get_json(initial_data))
|
||||
|
||||
|
||||
//Setup for tgui stuff, including styles
|
||||
html = replacetextEx(html, "\[ref]", "[REF(src)]")
|
||||
html = replacetextEx(html, "\[style]", style)
|
||||
return html
|
||||
|
||||
Reference in New Issue
Block a user