ID:259459
 
I would like a few things pertianing to a game host:

Three vars, both with host datum as a base:

- host.key: the key of the host
- host.appname: the application the host is using.This will return "DreamSeeker" or "DreamDaemom" preferably.
- host.IP: the IP address of the host

This would help me a lot in my current endeavours.
Untested. [Edit: oops, little fix]
Host
var
key
appname
IP

New()
src.Setup()

proc/Setup(client/c)
if (istype(c))
if (!c.address)
src.appname = "DreamSeeker"
src.key = c.key
else if (c.address == world.address)
src.appname = "DreamDaemon"
src.key = c.key
if (world.address)
src.address = world.address

var/Host/host

world/New()
host = new

client/New()
. = ..()
host.Setup(src)
In response to Air Mapster
Will c have a key if dream daemon is being used?
In response to Lord of Water
Lord of Water wrote:
Will c have a key if dream daemon is being used?

Yep, c is always a client who is currently connected to the game. I had a chance to test it and fix one other little thing. This appears to work from DreamSeeker or DreamDaemon:
Host
var
key
appname
IP

New()
src.Setup()

proc/Setup(client/c)
if (istype(c))
if (!c.address)
src.appname = "DreamSeeker"
src.key = c.key
else if ((c.address == world.address) || (c.address == "127.0.0.1"))
src.appname = "DreamDaemon"
src.key = c.key
if (world.address)
src.IP = world.address

var/Host/host

world/New()
host = new

client/New()
. = ..()
host.Setup(src)

mob/verb/whoishost()
src << "Host is [host.key] running [host.appname] from [host.IP]"

The only other thing you might want to do is test for when the host player logs out and update the host var accordingly.
In response to Air Mapster
So, what if the host player never logs in? That's where Dantom would need to take things into their hands, I would think.
In response to Lord of Water
Lord of Water wrote:
So, what if the host player never logs in? That's where Dantom would need to take things into their hands, I would think.

Why? If the host never logs in, then by definition there is no host key. Dantom can't possibly know who started the game any more than you could. The host IP is already available through world.address, which is used to set host.IP anyway. I don't see how it can possibly matter whether the host is running in DreamSeeker or DreamDaemon, but you already know that if no host ever logged in (host.key is null), then by definition it must be running in DreamDaemon. I suppose host.appname could be initialized to that by default, but I still don't understand why you might need it.

Either way, it can all be handled programmatically with little effort.
In response to Air Mapster
Okay, I see the light now. Thanks!

-Lord of Water