obj/duel_obj
name = "-"
icon = 'd_stats.dmi'
icon_state = ""
var/duel_type = ""
var/spectate = 0
var/mob/d_mob
Click()
if(usr.isduel) return
if(usr.isbusy) return
if(usr.looking) return
if(!d_mob.name) return
if(!d_mob.dir) return
if(!spectate)
//-------------------------------------------------------------------------------------
var/xx = d_mob.x
var/yy = d_mob.y
var/zz = d_mob.z
switch(d_mob.dir)
if(NORTH)
yy += 8
if(SOUTH)
yy -= 8
if(EAST)
xx += 8
if(WEST)
xx -= 8
if(zz == 3 || zz == 5 || zz == 6 || zz == 7)
return
if(usr.z == 3 || usr.z == 5 || usr.z == 6 || usr.z == 7)
return
var/turf/T = locate(xx,yy,zz)
if(T.density) return
for(var/mob/MXX in world)
if(MXX.x == xx && MXX.y == yy && MXX.z == zz)
return
var/oo = usr.density
var/ooo = usr.alpha // Whatever your Alpha was before you warped
usr.density = 0
usr.alpha = 0
var/obj/WARP_PORTAL_S/P = new(1)
P.loc = locate(xx,yy,zz)
usr.alpha = 0
usr.density = 0
usr.Move(locate(xx,yy,zz))
usr.density = oo
switch(d_mob.dir)
if(NORTH)
usr.dir = SOUTH
if(SOUTH)
usr.dir = NORTH
if(EAST)
usr.dir = WEST
if(WEST)
usr.dir = EAST
if(istype(loc, /turf/KTOWER/diag_zone))
for(var/turf/KTOWER/diag_zone/d_turf in world)
if(d_turf.x == usr.x && d_turf.y == usr.y && d_turf.z == usr.z)
if(d_turf.diag_dir == "NW" || d_turf.diag_dir == "NE")
usr.dir = NORTH
if(d_turf.diag_dir == "SW" || d_turf.diag_dir == "SE")
usr.dir = SOUTH
spawn()
for(var/ii=0;ii<ooo;ii+=12)
if(usr.isduel) break
alpha = ii
sleep(1)
usr.alpha = ooo
if(spectate)
usr.Look(d_mob)
return
Stat Panel Coding...
statpanel("Duels")
if(statpanel("Duels"))
var/duels = 0
var/list/d_stat_list = list()
for(var/client/D) if(D.mob) if(D.mob.isduel)
var/TO_Format = "OCG"
if(D.mob.C_Format == 1) TO_Format = "TCG"
if(D.mob.C_Format == 3) TO_Format = "RANDOM"
var/obj/duel_obj/O = new()
O.d_mob = D.mob
if(D.mob.Opponents.len)
O.icon = 'd_stats.dmi'
if(D.mob.rated)
O.name = {"<font color=#ff0000>"}
O.icon_state = "rank"
else
O.name = {"<font color=#b54d4d>"}
O.icon_state = "full"
var/dup_check = 0
for(var/obj/OO in d_stat_list)
if(findtext(OO.name,D.mob.name))
dup_check = 1
if(!dup_check)
O.name += {"<b>[D.mob.name]</b>"}
if(D.mob.Partners.len) for(var/X in D.mob.Partners)
var/mob/M = D.mob.Partners[X]
if(!findtext(O.name,M.name))
O.name += {" and <b>[M.name]</b>"}
for(var/XX in D.mob.Opponents)
var/mob/M = D.mob.Opponents[XX]
if(!findtext(O.name,M.name))
O.name += {" -VS- <b>[M.name]</b>"}
if(M.Partners.len) for(var/X in M.Partners)
var/mob/MP = M.Partners[X]
if(!findtext(O.name,MP.name))
O.name += {" and <b>[MP.name]</b>"}
O.name += {"</font>"}
O.spectate = 1
d_stat_list += O
else
O.name = "<font color=#6bb54d><b>[D.mob.name] ([TO_Format]) - ([D.mob.x], [D.mob.y], [get_level(D.mob.x,D.mob.y,D.mob.z)])</b></font>"
O.icon = D.mob.cicon
O.icon_state = D.mob.icon_state
O.dir = SOUTH
d_stat_list += O
duels++
if(!duels)
stat("<font color=#F59A2F><b>No Players Dueling</b></font>","[FindPlayersNum()] Online")
else
for(var/O in d_stat_list)
if(d_stat_list.len > 1)
if(O != d_stat_list[1])
stat("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
stat(O)
So I'm sure there's a more efficient way of doing this but... I have a stat panel that shows a series of objects that have a click() function attached to them. Each object represents a single match between players in the game.
The click on them will do something different depending on if its a player waiting for an opponent or if its an ongoing match.
If a player is waiting for an opponent, clicking on the obj in the stat panel will teleport you to that player so you can play against them.
If its an ongoing match, it'll put you in spectator mode so you can watch the match.
Problem is, the...hitbox? on the objects dont seem to be entirely accurate. Players seem to have issues where, when they're trying to click on 1 line, it'll get treated as clicking one of the adjacent lines instead occasionally.
Any recommendations here?