Files
Paradise/code/modules/arcade/claw_game.dm
T
Vi3trice f4b37b4177 Port TG updating appearances (#17943)
* Get pants that match or else you gonna look silly yo

* Posters

* Fix other hud elements

* Rereviewed

* Update shotglass.dm

* Fix for new merged PRs

* Typo

* Coming across other stuff

* Update theblob.dm

* No takebacksies

* smh i forget to leave a comment

* Updated for the detgun and cards

* Should have rerun langserver again

* No longer plastic, more in scope

* Damn you bluespace

* Reverting turret logic, out of scope at this point

* Tweak that part

* Went over energy guns again, and fixed UI White's sprite sheet

* Welding masks, glasses, and JUSTICE

* Update portable_atmospherics.dm

* Cleaning up, clearing things up

* Review and suggestions

* Update valve.dm

* More tweaks

* Missing character

* Not distinct lightmasks, so they can be overlays

* Update generator.dm

* Add parameter so holodeck doesn't try to make a perfect copy

* Update unsorted.dm

* Spiders

* Better fix for spiders, fix vamps too

* Ghosts

* Update telekinesis.dm

* Cleaning up old procs

* It's set up to not copy datums... Unless they're in a list

* Donuts, duct tape, and detgun. D3VR coming to Early Access

* Update procs that interact with doors so they call update_state instead

* Forgot one spot, and actually might as well just force lock

* Cleaning up other things... Sigh, and kitty ears

* oops

* Getting used to how it works

* blinds

* Going back to the suit obscuring thing, so it doesn't update all the time

* Missed that from merging master

* I made this PR and forgot about it

* Fix runtimes in cards

* Make things a bit more unified

* Update update_icons.dm

* yarn, really?

* Update library_equipment.dm

* Update shieldgen.dm

* Every time Charlie merges something, I go back and see if I can improve things further

* what's this? more?

* Update misc_special.dm

* wow, paper

* Review

* More reviews

* To be sure, seems like being broken messed something sometimes

* Brought airlocks closer to how TG works to iron out some stuff

* Pizza and morgue

* Doesn't seem to hurt, tried with holodeck

* Revert "Doesn't seem to hurt, tried with holodeck"

This reverts commit 158529302b.

* Icon conflict

* Fix organ damage

* Don't ask how. Why. It's like that on prod too.

* Cutting down on things and updating from TG.

* More flexible. Just in case the thing you stuck it on didn't destroy.

* Hydro was one the things I touched earlier on, better rework it

* Reviews

* Cleaning up further, also bri'ish

* Undo a change I did, and switch over to a more recent implementation

* Update biogenerator.dm

* Rolling back to old airlocks, but with new duct taped note

* Functionally the same. I'd just rather not have the smoothing happen there

* Went over APCs again

* Fix welding helmet names in species files

* Update airlock.dm

* Update persistent_overlay.dm

* Oh, topic
2022-07-21 08:11:59 +02:00

87 lines
3.1 KiB
Plaintext

GLOBAL_VAR(claw_game_html)
/obj/machinery/arcade/claw
name = "Claw Game"
desc = "One of the most infuriating ways to win a toy."
icon = 'icons/obj/arcade.dmi'
icon_state = "clawmachine_1_on"
token_price = 5
window_name = "Claw Game"
var/machine_image = "_1"
var/bonus_prize_chance = 5 //chance to dispense a SECOND prize if you win, increased by matter bin rating
//This is to make sure the images are available
var/list/img_resources = list('icons/obj/arcade_images/backgroundsprite.png',
'icons/obj/arcade_images/clawpieces.png',
'icons/obj/arcade_images/crane_bot.png',
'icons/obj/arcade_images/crane_top.png',
'icons/obj/arcade_images/prize_inside.png',
'icons/obj/arcade_images/prizeorbs.png')
/obj/machinery/arcade/claw/Initialize(mapload)
. = ..()
machine_image = pick("_1", "_2")
update_icon(UPDATE_ICON_STATE)
component_parts = list()
component_parts += new /obj/item/circuitboard/clawgame(null)
component_parts += new /obj/item/stock_parts/matter_bin(null)
component_parts += new /obj/item/stock_parts/manipulator(null)
component_parts += new /obj/item/stack/cable_coil(null, 5)
component_parts += new /obj/item/stack/sheet/glass(null, 1)
RefreshParts()
if(!GLOB.claw_game_html)
GLOB.claw_game_html = file2text('code/modules/arcade/crane.html')
/obj/machinery/arcade/claw/RefreshParts()
var/bin_upgrades = 0
for(var/obj/item/stock_parts/matter_bin/B in component_parts)
bin_upgrades = B.rating
bonus_prize_chance = bin_upgrades * 5 //equals +5% chance per matter bin rating level (+20% with rating 4)
/obj/machinery/arcade/claw/update_icon_state()
if(stat & BROKEN)
icon_state = "clawmachine[machine_image]_broken"
else if(panel_open)
icon_state = "clawmachine[machine_image]_open"
else if(stat & NOPOWER)
icon_state = "clawmachine[machine_image]_off"
else
icon_state = "clawmachine[machine_image]_on"
/obj/machinery/arcade/claw/win()
icon_state = "clawmachine[machine_image]_win"
if(prob(bonus_prize_chance)) //double prize mania!
atom_say("DOUBLE PRIZE!")
new /obj/item/toy/prizeball(get_turf(src))
else
atom_say("WINNER!")
new /obj/item/toy/prizeball(get_turf(src))
playsound(loc, 'sound/arcade/win.ogg', 50, TRUE)
addtimer(CALLBACK(src, /atom/.proc/update_icon, UPDATE_ICON_STATE), 10)
/obj/machinery/arcade/claw/start_play(mob/user as mob)
..()
user << browse_rsc('page.css')
for(var/i in 1 to img_resources.len)
user << browse_rsc(img_resources[i])
var/my_game_html = replacetext(GLOB.claw_game_html, "/* ref src */", UID())
var/datum/browser/popup = new(user, window_name, name, 915, 700, src)
popup.set_content(my_game_html)
popup.add_stylesheet("page.css", 'code/modules/arcade/page.css')
popup.add_stylesheet("Button.scss", 'tgui/packages/tgui/styles/components/Button.scss')
popup.add_script("jquery-1.8.2.min.js", 'html/browser/jquery-1.8.2.min.js')
popup.add_script("jquery-ui-1.8.24.custom.min.js", 'html/browser/jquery-ui-1.8.24.custom.min.js')
popup.open()
user.set_machine(src)
/obj/machinery/arcade/claw/Topic(href, list/href_list)
if(..())
return
var/prize_won = null
prize_won = href_list["prizeWon"]
if(!isnull(prize_won))
close_game()
if(prize_won == "1")
win()