mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-12 08:27:13 +01:00
Board games update: chess edition (#5013)
-updates the board to be a little better, porting bay updates to it -adds chess pieces as well, ported from bay too -you can now drag the board to yourself to hold it, instead of having to drag it everywhere if you want to move it -added chess and checkers kits to the loadout
This commit is contained in:
@@ -110,3 +110,11 @@
|
||||
/datum/gear/towel/New()
|
||||
..()
|
||||
gear_tweaks = list(gear_tweak_free_color_choice)
|
||||
|
||||
/datum/gear/checkers
|
||||
display_name = "checkers game kit"
|
||||
path = /obj/item/weapon/storage/box/checkers_kit
|
||||
|
||||
/datum/gear/chess
|
||||
display_name = "chess game kit"
|
||||
path = /obj/item/weapon/storage/box/chess_kit
|
||||
+163
-38
@@ -1,6 +1,6 @@
|
||||
/obj/item/weapon/board
|
||||
name = "board"
|
||||
desc = "A standard 12' checkerboard. Well used."
|
||||
desc = "A standard 16\" checkerboard. Well used."
|
||||
icon = 'icons/obj/pieces.dmi'
|
||||
icon_state = "board"
|
||||
|
||||
@@ -9,12 +9,11 @@
|
||||
var/board = list()
|
||||
var/selected = -1
|
||||
|
||||
/obj/item/weapon/board/New()
|
||||
..()
|
||||
var i
|
||||
for(i = 0; i < 12; i++)
|
||||
new /obj/item/weapon/checker(src.loc)
|
||||
new /obj/item/weapon/checker/red(src.loc)
|
||||
/obj/item/weapon/board/MouseDrop(mob/user as mob)
|
||||
if((user == usr && (!use_check(user))) && (user.contents.Find(src) || in_range(src, user)))
|
||||
if(ishuman(usr))
|
||||
forceMove(get_turf(usr))
|
||||
usr.put_in_hands(src)
|
||||
|
||||
/obj/item/weapon/board/examine(mob/user, var/distance = -1)
|
||||
if(in_range(user,src))
|
||||
@@ -24,6 +23,8 @@
|
||||
..()
|
||||
|
||||
/obj/item/weapon/board/attack_hand(mob/living/carbon/human/M as mob)
|
||||
if(!isturf(loc)) //so if you want to play the game, you need to put it down somewhere
|
||||
..()
|
||||
if(M.machine == src)
|
||||
..()
|
||||
else
|
||||
@@ -73,39 +74,39 @@ obj/item/weapon/board/attackby(obj/item/I as obj, mob/user as mob)
|
||||
user.unset_machine()
|
||||
return
|
||||
|
||||
var/dat = "<HTML>"
|
||||
dat += "<table border='0'>"
|
||||
var i, stagger;
|
||||
var/list/dat = list({"
|
||||
<html><head><style type='text/css'>
|
||||
td,td a{height:50px;width:50px}table{border-spacing:0;border:none;border-collapse:collapse}td{text-align:center;padding:0;background-repeat:no-repeat;background-position:center center}td.light{background-color:#6cf}td.dark{background-color:#544b50}td.selected{background-color:#c8dbc3}td a{display:table-cell;text-decoration:none;position:relative;line-height:50px;height:50px;width:50 px;vertical-align:middle}
|
||||
</style></head><body><table>
|
||||
"})
|
||||
var i, stagger
|
||||
stagger = 0 //so we can have the checkerboard effect
|
||||
for(i=0; i<64; i++)
|
||||
for(i=0, i<64, i++)
|
||||
if(i%8 == 0)
|
||||
dat += "<tr>"
|
||||
stagger = !stagger
|
||||
dat += "<td align='center' height='50' width='50' bgcolor="
|
||||
if(selected == i)
|
||||
dat += "'#FF8566'>"
|
||||
dat += "<td class='selected'"
|
||||
else if((i + stagger)%2 == 0)
|
||||
dat += "'#66CCFF'>"
|
||||
dat += "<td class='dark'"
|
||||
else
|
||||
dat += "'#252536'>"
|
||||
if(!isobserver(user))
|
||||
dat += "<A href='?src=\ref[src];select=[i]' style='display:block;text-decoration:none;'>"
|
||||
dat += "<td class='light'"
|
||||
|
||||
if(board["[i]"])
|
||||
var/obj/item/I = board["[i]"]
|
||||
user << browse_rsc(board_icons["[I.icon] [I.icon_state]"],"[I.icon_state].png")
|
||||
dat += "<image src='[I.icon_state].png' style='border-style: none'>"
|
||||
dat += " style='background-image:url([I.icon_state].png)'>"
|
||||
else
|
||||
dat += " "
|
||||
|
||||
dat+= ">"
|
||||
if(!isobserver(user))
|
||||
dat += "</A>"
|
||||
dat += "<a href='?src=\ref[src];select=[i];person=\ref[user]'></a>"
|
||||
dat += "</td>"
|
||||
|
||||
dat += "</table><br>"
|
||||
dat += "</table>"
|
||||
|
||||
if(selected >= 0 && !isobserver(user))
|
||||
dat += "<br><A href='?src=\ref[src];remove=0'>Remove Selected Piece</A>"
|
||||
user << browse(dat,"window=boardgame;size=500x500")
|
||||
user << browse(jointext(dat, null),"window=boardgame;size=430x500") // 50px * 8 squares + 30 margin
|
||||
onclose(usr, "boardgame")
|
||||
|
||||
/obj/item/weapon/board/Topic(href, href_list)
|
||||
@@ -121,19 +122,19 @@ obj/item/weapon/board/attackby(obj/item/I as obj, mob/user as mob)
|
||||
if(selected >= 0)
|
||||
//check to see if clicked on tile is currently selected one
|
||||
if(text2num(s) == selected)
|
||||
selected = 0 //deselect it
|
||||
return
|
||||
selected = -1 //deselect it
|
||||
else
|
||||
|
||||
if(I) //cant put items on other items.
|
||||
return
|
||||
if(I) //cant put items on other items.
|
||||
return
|
||||
|
||||
//put item in new spot.
|
||||
I = board["[selected]"]
|
||||
board["[selected]"] = null
|
||||
board -= "[selected]"
|
||||
board -= null
|
||||
board["[s]"] = I
|
||||
selected = -1
|
||||
//put item in new spot.
|
||||
I = board["[selected]"]
|
||||
board["[selected]"] = null
|
||||
board -= "[selected]"
|
||||
board -= null
|
||||
board["[s]"] = I
|
||||
selected = -1
|
||||
else
|
||||
if(I)
|
||||
selected = text2num(s)
|
||||
@@ -147,6 +148,8 @@ obj/item/weapon/board/attackby(obj/item/I as obj, mob/user as mob)
|
||||
addPiece(O,H,text2num(s))
|
||||
if(href_list["remove"])
|
||||
var/obj/item/I = board["[selected]"]
|
||||
if(!I)
|
||||
return
|
||||
board["[selected]"] = null
|
||||
board -= "[selected]"
|
||||
board -= null
|
||||
@@ -166,13 +169,135 @@ obj/item/weapon/board/attackby(obj/item/I as obj, mob/user as mob)
|
||||
board_icons -= null
|
||||
src.updateDialog()
|
||||
|
||||
/obj/item/weapon/checker/
|
||||
name = "black checker"
|
||||
//checkes
|
||||
/obj/item/weapon/checker
|
||||
name = "checker"
|
||||
desc = "It is plastic and shiny."
|
||||
icon = 'icons/obj/pieces.dmi'
|
||||
icon_state = "checker_black"
|
||||
w_class = 1
|
||||
var/piece_color ="black"
|
||||
|
||||
/obj/item/weapon/checker/Initialize()
|
||||
. = ..()
|
||||
icon_state = "[name]_[piece_color]"
|
||||
name = "[piece_color] [name]"
|
||||
|
||||
/obj/item/weapon/checker/red
|
||||
name = "red checker"
|
||||
icon_state = "checker_red"
|
||||
piece_color ="red"
|
||||
|
||||
/obj/item/weapon/storage/box/checkers
|
||||
name = "checkers box"
|
||||
desc = "This box holds a nifty portion of checkers."
|
||||
icon_state = "checkers"
|
||||
max_storage_space = 24
|
||||
w_class = 1
|
||||
can_hold = list(/obj/item/weapon/checker)
|
||||
|
||||
/obj/item/weapon/storage/box/checkers/fill()
|
||||
for(var/i = 0; i < 12; i++)
|
||||
new /obj/item/weapon/checker(src)
|
||||
new /obj/item/weapon/checker/red(src)
|
||||
|
||||
//chess
|
||||
|
||||
//Chess
|
||||
|
||||
/obj/item/weapon/checker/pawn
|
||||
name = "pawn"
|
||||
|
||||
/obj/item/weapon/checker/pawn/red
|
||||
piece_color ="red"
|
||||
|
||||
/obj/item/weapon/checker/knight
|
||||
name = "knight"
|
||||
|
||||
/obj/item/weapon/checker/knight/red
|
||||
piece_color ="red"
|
||||
|
||||
/obj/item/weapon/checker/bishop
|
||||
name = "bishop"
|
||||
|
||||
/obj/item/weapon/checker/bishop/red
|
||||
piece_color ="red"
|
||||
|
||||
/obj/item/weapon/checker/rook
|
||||
name = "rook"
|
||||
|
||||
/obj/item/weapon/checker/rook/red
|
||||
piece_color ="red"
|
||||
|
||||
/obj/item/weapon/checker/queen
|
||||
name = "queen"
|
||||
|
||||
/obj/item/weapon/checker/queen/red
|
||||
piece_color ="red"
|
||||
|
||||
/obj/item/weapon/checker/king
|
||||
name = "king"
|
||||
|
||||
/obj/item/weapon/checker/king/red
|
||||
piece_color ="red"
|
||||
|
||||
/obj/item/weapon/storage/box/chess
|
||||
name = "black chess box"
|
||||
desc = "This box holds all the pieces needed for the black side of the chess board."
|
||||
icon_state = "chess_b"
|
||||
max_storage_space = 24
|
||||
w_class = 2
|
||||
can_hold = list(/obj/item/weapon/checker)
|
||||
|
||||
/obj/item/weapon/storage/box/chess/fill()
|
||||
for(var/i = 0; i < 8; i++)
|
||||
new /obj/item/weapon/checker/pawn(src)
|
||||
new /obj/item/weapon/checker/knight (src)
|
||||
new /obj/item/weapon/checker/knight (src)
|
||||
new /obj/item/weapon/checker/bishop (src)
|
||||
new /obj/item/weapon/checker/bishop (src)
|
||||
new /obj/item/weapon/checker/rook (src)
|
||||
new /obj/item/weapon/checker/rook (src)
|
||||
new /obj/item/weapon/checker/queen (src)
|
||||
new /obj/item/weapon/checker/king (src)
|
||||
|
||||
/obj/item/weapon/storage/box/chess/red
|
||||
name = "red chess box"
|
||||
desc = "This box holds all the pieces needed for the red side of the chess board."
|
||||
icon_state = "chess_r"
|
||||
|
||||
/obj/item/weapon/storage/box/chess/red/fill()
|
||||
for(var/i = 0; i < 8; i++)
|
||||
new /obj/item/weapon/checker/pawn/red(src)
|
||||
new /obj/item/weapon/checker/knight/red (src)
|
||||
new /obj/item/weapon/checker/knight/red (src)
|
||||
new /obj/item/weapon/checker/bishop/red (src)
|
||||
new /obj/item/weapon/checker/bishop/red (src)
|
||||
new /obj/item/weapon/checker/rook/red (src)
|
||||
new /obj/item/weapon/checker/rook/red (src)
|
||||
new /obj/item/weapon/checker/queen/red (src)
|
||||
new /obj/item/weapon/checker/king/red (src)
|
||||
|
||||
//game kits
|
||||
/obj/item/weapon/storage/box/checkers_kit
|
||||
name = "checkers game kit"
|
||||
desc = "This box holds all the parts needed for a game of checkers."
|
||||
icon_state = "largebox"
|
||||
max_storage_space = 8
|
||||
can_hold = list(/obj/item/weapon/board,
|
||||
/obj/item/weapon/storage/box/checkers)
|
||||
|
||||
/obj/item/weapon/storage/box/checkers_kit/fill()
|
||||
new /obj/item/weapon/board (src)
|
||||
new /obj/item/weapon/storage/box/checkers (src)
|
||||
|
||||
/obj/item/weapon/storage/box/chess_kit
|
||||
name = "chess game kit"
|
||||
desc = "This box holds all the parts needed for a game of chess."
|
||||
icon_state = "largebox"
|
||||
max_storage_space = 8
|
||||
can_hold = list(/obj/item/weapon/board,
|
||||
/obj/item/weapon/storage/box/chess)
|
||||
|
||||
/obj/item/weapon/storage/box/chess_kit/fill()
|
||||
new /obj/item/weapon/board (src)
|
||||
new /obj/item/weapon/storage/box/chess (src)
|
||||
new /obj/item/weapon/storage/box/chess/red (src)
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
author: Alberyk
|
||||
|
||||
delete-after: True
|
||||
|
||||
changes:
|
||||
- rscadd: "Added checkers and chess game kits to the custom loadout."
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 498 B After Width: | Height: | Size: 1.1 KiB |
Reference in New Issue
Block a user