Chess quality of life update (#5458)

You can now fast fill chess board by clicking on it with chess pieces box.

You can now shake off all pieces off board by clicking on board in your active hand.

Chess box now picks up all chess pieces of same color as box off the turf by clicking on the chess piece
This commit is contained in:
Mykhailo Bykhovtsev
2018-11-02 15:31:25 -07:00
committed by Erki
parent 757ee16bc1
commit 9006de231d
2 changed files with 75 additions and 2 deletions

View File

@@ -30,8 +30,25 @@
else
src.examine(M)
obj/item/weapon/board/attackby(obj/item/I as obj, mob/user as mob)
if(!addPiece(I,user))
/obj/item/weapon/board/attack_self(mob/user)
var/choice = alert("Do you want to throw everything off the [src]?", null, "No", "Yes")
if(choice == "Yes")
for(var/obj/item/weapon/checker/c in src.contents)
c.forceMove(get_turf(src.loc))
num = 0
board_icons = list()
board = list()
selected = -1
src.updateDialog()
interact(user)
..()
/obj/item/weapon/board/attackby(obj/item/I as obj, mob/user as mob)
if(istype(I, /obj/item/weapon/storage/box))
var/obj/item/weapon/storage/box/h = I
for(var/obj/item/weapon/checker/c in h.contents)
addPiece(c,user)
else if(!addPiece(I,user))
..()
/obj/item/weapon/board/proc/addPiece(obj/item/I as obj, mob/user as mob, var/tile = 0)
@@ -239,6 +256,23 @@ obj/item/weapon/board/attackby(obj/item/I as obj, mob/user as mob)
/obj/item/weapon/checker/king/red
piece_color ="red"
/obj/item/weapon/checker/attackby(obj/item/I as obj, mob/user as mob)
if(istype(I, /obj/item/weapon/storage/box/chess))
var/obj/item/weapon/storage/box/chess/b = I
var/turf/T = get_turf(src)
if(T)
for(var/obj/item/weapon/checker/c in T.contents)
if(istype(I, /obj/item/weapon/storage/box/chess/red))
if(c.piece_color == "red")
c.forceMove(b)
else
continue
else if(c.piece_color != "red")
c.forceMove(b)
to_chat(user, "<span class='notice'>You put all checker pieces into [b].</span>")
else
..()
/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."