mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 03:57:13 +01:00
Merge pull request #4220 from CrAzYPiLoT-SS13/chess_ma_dudes
Adds SpessChess!
This commit is contained in:
@@ -890,6 +890,15 @@ obj/item/weapon/circuitboard/rdserver
|
||||
/obj/item/weapon/stock_parts/manipulator = 1,
|
||||
/obj/item/weapon/stock_parts/console_screen = 1)
|
||||
|
||||
/obj/item/weapon/circuitboard/gameboard
|
||||
name = "circuit board (Virtual Gameboard)"
|
||||
build_path = /obj/machinery/gameboard
|
||||
board_type = "machine"
|
||||
origin_tech = "programming=2"
|
||||
req_components = list(
|
||||
/obj/item/weapon/stock_parts/micro_laser = 1,
|
||||
/obj/item/stack/cable_coil = 3,
|
||||
/obj/item/stack/sheet/glass = 1)
|
||||
|
||||
//Selectable mode board, like vending machine boards
|
||||
/obj/item/weapon/circuitboard/logic_gate
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/obj/machinery/gameboard
|
||||
name = "Virtual Gameboard"
|
||||
icon = 'icons/obj/stationobjs.dmi'
|
||||
icon_state = "gboard_on"
|
||||
desc = "A holographic table allowing the crew to have fun™ on boring shifts! One player per board."
|
||||
density = 1
|
||||
anchored = 1
|
||||
use_power = 1
|
||||
|
||||
/obj/machinery/gameboard/New()
|
||||
..()
|
||||
component_parts = list()
|
||||
component_parts += new /obj/item/weapon/circuitboard/gameboard(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/micro_laser(null)
|
||||
component_parts += new /obj/item/stack/cable_coil(null, 3)
|
||||
component_parts += new /obj/item/stack/sheet/glass(null, 1)
|
||||
RefreshParts()
|
||||
|
||||
/obj/machinery/gameboard/power_change()
|
||||
. = ..()
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/gameboard/update_icon()
|
||||
if(stat & NOPOWER)
|
||||
icon_state = "gboard_off"
|
||||
else
|
||||
icon_state = "gboard_on"
|
||||
|
||||
/obj/machinery/gameboard/attack_hand(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
if(src.in_use)
|
||||
to_chat(user, "This gameboard is already in use!")
|
||||
return
|
||||
interact(user)
|
||||
|
||||
/obj/machinery/gameboard/interact(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/dat
|
||||
dat = replacetext(file2text('html/chess.html'), "\[hsrc]", "\ref[src]")
|
||||
var/datum/asset/simple/chess/assets = get_asset_datum(/datum/asset/simple/chess)
|
||||
assets.send(user)
|
||||
|
||||
var/datum/browser/popup = new(user, "SpessChess", name, 500, 800, src)
|
||||
popup.set_content(dat)
|
||||
popup.add_stylesheet("chess.css", 'html/browser/chess.css')
|
||||
popup.add_script("garbochess.js", 'html/browser/garbochess.js')
|
||||
//popup.add_script("boardui.js", 'html/browser/boardui.js')
|
||||
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.set_window_options("titlebar=0")
|
||||
popup.open()
|
||||
user.set_machine(src)
|
||||
|
||||
/obj/machinery/gameboard/proc/close_game() //yes, shamelessly copied over from arcade_base
|
||||
in_use = 0
|
||||
for(var/mob/user in viewers(world.view, src)) // I don't know who you are.
|
||||
if(user.client && user.machine == src) // I will look for you,
|
||||
user.unset_machine() // I will find you,
|
||||
user << browse(null, "window=SpessChess") // And I will kill you.
|
||||
return
|
||||
|
||||
/obj/machinery/gameboard/Topic(var/href, var/list/href_list)
|
||||
. = ..()
|
||||
var/prize = /obj/item/stack/tickets
|
||||
if (.)
|
||||
return
|
||||
|
||||
if (href_list["checkmate"])
|
||||
visible_message("<span class='info'><span class='name'>[src.name]</span> beeps, \"WINNER!\"</span>")
|
||||
new prize(get_turf(src), 80)
|
||||
close_game()
|
||||
|
||||
if (href_list["close"])
|
||||
close_game()
|
||||
@@ -204,6 +204,27 @@ proc/getFilesSlow(var/client/client, var/list/files, var/register_asset = TRUE)
|
||||
"ntlogo.png" = 'icons/paper_icons/ntlogo.png'
|
||||
)
|
||||
|
||||
/datum/asset/simple/chess
|
||||
assets = list(
|
||||
"bishop_black.png" = 'icons/chess_pieces/bishop_black.png',
|
||||
"bishop_white.png" = 'icons/chess_pieces/bishop_white.png',
|
||||
"king_black.png" = 'icons/chess_pieces/king_black.png',
|
||||
"king_white.png" = 'icons/chess_pieces/king_white.png',
|
||||
"knight_black.png" = 'icons/chess_pieces/knight_black.png',
|
||||
"knight_white.png" = 'icons/chess_pieces/knight_white.png',
|
||||
"pawn_black.png" = 'icons/chess_pieces/pawn_black.png',
|
||||
"pawn_white.png" = 'icons/chess_pieces/pawn_white.png',
|
||||
"queen_black.png" = 'icons/chess_pieces/queen_black.png',
|
||||
"queen_white.png" = 'icons/chess_pieces/queen_white.png',
|
||||
"rook_black.png" = 'icons/chess_pieces/rook_black.png',
|
||||
"rook_white.png" = 'icons/chess_pieces/rook_white.png',
|
||||
"sprites.png" = 'icons/chess_pieces/sprites.png',
|
||||
"blank.gif" = 'icons/chess_pieces/blank.gif',
|
||||
"background.png" = 'nano/images/uiBackground.png',
|
||||
"garbochess.js" = 'html/browser/garbochess.js',
|
||||
"boardui.js" = 'html/browser/boardui.js'
|
||||
)
|
||||
|
||||
/datum/asset/nanoui
|
||||
var/list/common = list()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user