Ports the Chem Master choose your pill PR plus post-improvements

This commit is contained in:
Ghommie
2019-07-12 07:39:17 +02:00
parent c76f6b8a54
commit d36bae06a7
45 changed files with 171 additions and 31 deletions
+4
View File
@@ -233,6 +233,10 @@ GLOBAL_LIST_INIT(transit_tube_recipes, list(
playsound(get_turf(user), 'sound/items/deconstruct.ogg', 50, 1)
return(BRUTELOSS)
/obj/item/pipe_dispenser/ui_base_html(html)
var/datum/asset/spritesheet/assets = get_asset_datum(/datum/asset/spritesheet/pipes)
. = replacetext(html, "<!--customheadhtml-->", assets.css_tag())
/obj/item/pipe_dispenser/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
+40 -13
View File
@@ -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)
+14
View File
@@ -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
+11 -3
View File
@@ -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
Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

Before

Width:  |  Height:  |  Size: 392 B

After

Width:  |  Height:  |  Size: 392 B

Before

Width:  |  Height:  |  Size: 84 B

After

Width:  |  Height:  |  Size: 84 B

Before

Width:  |  Height:  |  Size: 454 B

After

Width:  |  Height:  |  Size: 454 B

Before

Width:  |  Height:  |  Size: 487 B

After

Width:  |  Height:  |  Size: 487 B

Before

Width:  |  Height:  |  Size: 491 B

After

Width:  |  Height:  |  Size: 491 B

Before

Width:  |  Height:  |  Size: 164 B

After

Width:  |  Height:  |  Size: 164 B

Before

Width:  |  Height:  |  Size: 275 B

After

Width:  |  Height:  |  Size: 275 B

Before

Width:  |  Height:  |  Size: 256 B

After

Width:  |  Height:  |  Size: 256 B

Before

Width:  |  Height:  |  Size: 326 B

After

Width:  |  Height:  |  Size: 326 B

Before

Width:  |  Height:  |  Size: 352 B

After

Width:  |  Height:  |  Size: 352 B

Before

Width:  |  Height:  |  Size: 468 B

After

Width:  |  Height:  |  Size: 468 B

Before

Width:  |  Height:  |  Size: 449 B

After

Width:  |  Height:  |  Size: 449 B

Before

Width:  |  Height:  |  Size: 503 B

After

Width:  |  Height:  |  Size: 503 B

+43
View File
@@ -0,0 +1,43 @@
{
"redpill_questions": [
"What happened to the ceiling?",
"Why is it called the emergency shuttle if it arrives every single shift?",
"Where does the Cook get all this meat from?",
"Space wind? How does that even make sense?",
"Why does Nanotrasen hire Clowns and Mimes for every single station?",
"Why is the station's air supply connected to the plasma tank?",
"Why are there fire alarms everywhere but no sprinklers?",
"Why is this a plasma research station if we know everything about plasma already?",
"Who hires all these unqualified, violent assistants?",
"How do the morgue trays know whether someone's soul is still in their body?",
"If two miners were in Lavaland and one of them killed the other with a pickaxe, wouldn't that be fucked up or what?",
"How do I know the names of all these people that I've never met before?",
"How do I know the name of someone just by hearing them talk?",
"How come a hole in the floor doesn't suck you out into space?",
"Why is space cold?",
"Why does space circle around on itself?",
"Nanotrasen just clones us every shift.",
"There's no biological difference between lizards and humans.",
"Why is there a floor, but no roof?",
"The universe always ends after we reach Centcomm.",
"Everyone is controlled by strings behind a glowing screen",
"Seperation is absolute.",
"It doesn't take much for people to murder their friends.",
"All the crew are just greytiders with different paint.",
"What the fuck is CO2?",
"2008 was 550 years ago.",
"This is all an endless looping nightmare of misery.",
"The ultimate god is really really stoned.",
"Space stations are no substitute for healthy social interaction.",
"The gods are always watching, and will wipe you from existence if you fuck up.",
"How do mirrors give people haircuts?",
"Why is this station so poorly designed?",
"How can an escape pod only take two people normally, but an infinite number of people if they're lying down?",
"Why do only lizards get their own native language?",
"Why do people just randomly murder all their friends some shifts?",
"If magic is real, why aren't we researching that?",
"How is everyone a complete expert in every threat in the universe?",
"If suit sensors are so important, why don't they always start maximized?",
"If we can wash clothes in a sink, why do we need washing machines?"
]
}
+10 -10
View File
File diff suppressed because one or more lines are too long
+6 -3
View File
@@ -1,4 +1,4 @@
{{#if data.screen == "home"}}
{{#if data.screen == "home"}}
<ui-display title='Beaker' button>
<ui-button icon='{{data.isBeakerLoaded ? "Eject" : "close"}}'
style='{{data.isBeakerLoaded ? "selected" : null}}'
@@ -50,14 +50,17 @@
{{#if !data.condi}}
<ui-display title='Pills, Bottles and Patches' >
{{#each data.pillStyles}}
<ui-button state='{{id==data.chosenPillStyle ? "selected" : null}}' action='pillStyle' params='{"id": "{{id}}"}'>{{{htmltag}}}</ui-button>
{{/each}}
<br>
{{#if data.isPillBottleLoaded}}
<ui-button action='ejectp' state='{{data.isPillBottleLoaded ? null : "disabled"}}'>{{data.isPillBottleLoaded ? "Eject" : "No Pill bottle loaded"}}</ui-button>
<span class='content'>{{data.pillBotContent}}/{{data.pillBotMaxContent}}</span>
{{else}}
<span class='average'>No Pillbottle</span>
{{/if}}
<br/>
<br/>
<ui-button action='createPill' params='{"many": 0}' state='{{data.bufferContents ? null : "disabled"}}' >Create Pill (max 50µ)</ui-button>
<br/>
+2 -1
View File
@@ -16,7 +16,8 @@
};
</script>
<link rel='stylesheet' href='tgui.css'/>
<link rel='stylesheet' href='spritesheet_pipes.css'/>
<!-- This is processed in byond, so interfaces can override the html head if needed, for custom sheets of style etc -->
<!--customheadhtml-->
<script id='data' type='application/json' data-ref='[ref]'>{}</script>
<script defer src='tgui.js'></script>
</head>