Fixes and prizes

This commit is contained in:
Matt
2016-04-19 22:05:43 +02:00
parent 0b0ce96ddb
commit 8f4fd998a9
5 changed files with 65 additions and 10 deletions
@@ -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
+42 -6
View File
@@ -7,6 +7,15 @@
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()
@@ -19,25 +28,52 @@
/obj/machinery/gameboard/attack_hand(mob/user)
. = ..()
if (.)
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 (.)
if(.)
return
var/dat
dat = file2text('html/chess.html')
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)
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("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.open()
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()
+2 -1
View File
@@ -221,7 +221,8 @@ proc/getFilesSlow(var/client/client, var/list/files, var/register_asset = TRUE)
"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'
"garbochess.js" = 'html/browser/garbochess.js',
"boardui.js" = 'html/browser/boardui.js'
)
/datum/asset/nanoui
+5 -1
View File
@@ -29,6 +29,10 @@ function UINewGame() {
}
}
function UIClose() {
window.location = "byond://?src=" + hSrc + ";close=1";
}
function EnsureAnalysisStopped() {
if (g_analyzing && g_backgroundEngine != null) {
g_backgroundEngine.terminate();
@@ -95,7 +99,7 @@ function FinishMove(bestMove, value, timeTaken, ply) {
if (bestMove != null) {
UIPlayMove(bestMove, BuildPVMessage(bestMove, value, timeTaken, ply));
} else {
alert("Checkmate!");
window.location = "byond://?src=" + hSrc + ";checkmate=1";
}
}
+7 -2
View File
@@ -1,3 +1,5 @@
<script type="text/javascript">var hSrc = "[hsrc]"</script>
<script src="boardui.js"></script>
<script type="text/javascript">
$(document).ready(function () {
g_timeout = 1000;
@@ -11,7 +13,7 @@
<option value="white">White</option>
<option value="black">Black</option>
</select>
Time per move: <input id="TimePerMove" value="3000" onchange="javascript:UIChangeTimePerMove()" />ms
Time per move: <input id="TimePerMove" value="3000" onchange="javascript:UIChangeTimePerMove()" disabled/>ms
<a href="javascript:UIUndoMove()">Undo</a>
</div>
<div style="margin-top:5px;">
@@ -23,4 +25,7 @@
</div>
<input id='FenTextBox' onchange="javascript:UIChangeFEN()" style="display: none;"/>
</div>
</div>
<div>
<a href="javascript:UIClose()">Close</a>
</div>
</div>