Ports tg simple_animal bots

This commit is contained in:
Tastyfish
2016-03-28 00:22:04 -04:00
parent a19f646e0e
commit 25195208a9
110 changed files with 5551 additions and 5360 deletions
+4 -4
View File
@@ -96,7 +96,7 @@
/datum/data/pda/app/power/update_ui(mob/user as mob, list/data)
update = PDA_APP_UPDATE_SLOW
if (powmonitor && !isnull(powmonitor.powernet))
data["records"] = list(
"powerconnected" = 1,
@@ -226,7 +226,7 @@
beepskyData["botstatus"] = list("loca" = null, "mode" = -1)
var/botsCount=0
if(SC.botlist && SC.botlist.len)
for(var/obj/machinery/bot/B in SC.botlist)
for(var/mob/living/simple_animal/bot/B in SC.botlist)
botsCount++
if(B.loc)
botsData[++botsData.len] = list("Name" = sanitize(B.name), "Location" = sanitize(B.loc.loc.name), "ref" = "\ref[B]")
@@ -276,7 +276,7 @@
var/mulebotsCount=0
for(var/obj/machinery/bot/B in QC.botlist)
for(var/mob/living/simple_animal/bot/B in QC.botlist)
mulebotsCount++
if(B.loc)
mulebotsData[++mulebotsData.len] = list("Name" = sanitize(B.name), "Location" = sanitize(B.loc.loc.name), "ref" = "\ref[B]")
@@ -392,7 +392,7 @@
BucketData[++BucketData.len] = list("x" = 0, "y" = 0, dir=null, status = null)
var/CbotData[0]
for(var/obj/machinery/bot/cleanbot/B in aibots)
for(var/mob/living/simple_animal/bot/cleanbot/B in simple_animal_list)
var/turf/bl = get_turf(B)
if(bl)
if(bl.z != cl.z)
+27 -92
View File
@@ -5,7 +5,7 @@
icon_state = "power_mod"
var/obj/item/device/pda/hostpda = null
var/list/botlist = null // list of bots
var/obj/machinery/bot/active // the active bot; if null, show bot list
var/mob/living/simple_animal/bot/active // the active bot; if null, show bot list
var/list/botstatus // the status signal sent by the bot
var/bot_type //The type of bot it is.
var/bot_filter //Determines which radio filter to use.
@@ -17,9 +17,9 @@
/obj/item/radio/integrated/New()
..()
if (istype(loc.loc, /obj/item/device/pda))
if(istype(loc.loc, /obj/item/device/pda))
hostpda = loc.loc
if (bot_filter)
if(bot_filter)
spawn(5)
add_to_radio(bot_filter)
@@ -51,31 +51,22 @@
frequency.post_signal(src, signal, filter = s_filter)
/obj/item/radio/integrated/receive_signal(datum/signal/signal)
/*var/obj/item/device/pda/P = src.loc
world << "recvd:[P] : [signal.source]"
for(var/d in signal.data)
world << "- [d] = [signal.data[d]]"
*/
if (signal.data["type"] == bot_type)
if(!botlist)
botlist = new()
if(!(signal.source in botlist))
botlist += signal.source
var/obj/machinery/bot_core/core = signal.source
if(active == signal.source)
if(istype(core) && !(core.owner in botlist))
botlist += core.owner
if(active == core.owner)
var/list/b = signal.data
botstatus = b.Copy()
/obj/item/radio/integrated/Topic(href, href_list)
..()
var/obj/item/device/pda/PDA = src.hostpda
switch(href_list["op"])
if("control")
active = locate(href_list["bot"])
spawn(0)
@@ -89,14 +80,14 @@
if("botlist")
active = null
if("stop", "go")
if("stop", "go", "home")
spawn(0)
post_signal(control_freq, "command", href_list["op"], "active", active, s_filter = bot_filter)
post_signal(control_freq, "command", "bot_status", "active", active, s_filter = bot_filter)
if("summon")
spawn(0)
post_signal(control_freq, "command", "summon", "active", active, "target", get_turf(PDA) , "useraccess", PDA.GetAccess(), s_filter = bot_filter)
post_signal(control_freq, "command", "summon", "active", active, "target", get_turf(hostpda), "useraccess", hostpda.GetAccess(), "user", usr, s_filter = bot_filter)
post_signal(control_freq, "command", "bot_status", "active", active, s_filter = bot_filter)
/obj/item/radio/integrated/proc/add_to_radio(bot_filter) //Master filter control for bots. Must be placed in the bot's local New() to support map spawned bots.
@@ -121,101 +112,45 @@
bot_type = CLEAN_BOT
/obj/item/radio/integrated/mule
//var/list/botlist = null // list of bots
//var/obj/machinery/bot/mulebot/active // the active bot; if null, show bot list
//var/list/botstatus // the status signal sent by the bot
var/list/beacons
var/beacon_freq = 1400
control_freq = 1447
// create a new QM cartridge, and register to receive bot control & beacon message
/obj/item/radio/integrated/mule/New()
..()
spawn(5)
if(radio_controller)
radio_controller.add_object(src, control_freq, filter = RADIO_MULEBOT)
radio_controller.add_object(src, beacon_freq, filter = RADIO_NAVBEACONS)
spawn(10)
post_signal(beacon_freq, "findbeacon", "delivery", s_filter = RADIO_NAVBEACONS)
/obj/item/radio/integrated/mule/Destroy()
if(radio_controller)
radio_controller.remove_object(src,beacon_freq)
return ..()
// receive radio signals
// can detect bot status signals
// and beacon locations
// create/populate lists as they are recvd
/obj/item/radio/integrated/mule/receive_signal(datum/signal/signal)
if(signal.data["type"] == MULE_BOT)
if(!botlist)
botlist = new()
if(!(signal.source in botlist))
botlist += signal.source
if(active == signal.source)
var/list/b = signal.data
botstatus = b.Copy()
else if(signal.data["beacon"])
if(!beacons)
beacons = new()
beacons[signal.data["beacon"] ] = signal.source
bot_filter = RADIO_MULEBOT
bot_type = MULE_BOT
/obj/item/radio/integrated/mule/Topic(href, href_list)
//..()
//var/obj/item/device/pda/PDA = src.hostpda
var/cmd = "command"
if(active)
cmd = "command [active.suffix]"
..()
switch(href_list["op"])
if("control")
active = locate(href_list["bot"])
if("scanbots") // find all bots
botlist = null
if("botlist")
active = null
if("start")
spawn(0)
post_signal(control_freq, "command", "start", "active", active, s_filter = RADIO_MULEBOT)
if("unload")
spawn(0)
post_signal(control_freq, cmd, "unload", s_filter = RADIO_MULEBOT)
post_signal(control_freq, "command", "unload", "active", active, s_filter = RADIO_MULEBOT)
if("setdest")
if(beacons)
var/dest = input("Select Bot Destination", "Mulebot [active.suffix] Interlink", active.destination) as null|anything in beacons
if(deliverybeacons)
var/dest = input("Select Bot Destination", "Mulebot [active.suffix] Interlink", active.destination) as null|anything in deliverybeacontags
if(dest)
spawn(0)
post_signal(control_freq, cmd, "target", "destination", dest, s_filter = RADIO_MULEBOT)
post_signal(control_freq, "command", "target", "active", active, "destination", dest, s_filter = RADIO_MULEBOT)
if("retoff")
spawn(0)
post_signal(control_freq, cmd, "autoret", "value", 0, s_filter = RADIO_MULEBOT)
post_signal(control_freq, "command", "autoret", "active", active, "value", 0, s_filter = RADIO_MULEBOT)
if("reton")
spawn(0)
post_signal(control_freq, cmd, "autoret", "value", 1, s_filter = RADIO_MULEBOT)
post_signal(control_freq, "command", "autoret", "active", active, "value", 1, s_filter = RADIO_MULEBOT)
if("pickoff")
spawn(0)
post_signal(control_freq, cmd, "autopick", "value", 0, s_filter = RADIO_MULEBOT)
post_signal(control_freq, "command", "autopick", "active", active, "value", 0, s_filter = RADIO_MULEBOT)
if("pickon")
spawn(0)
post_signal(control_freq, cmd, "autopick", "value", 1, s_filter = RADIO_MULEBOT)
if("stop", "go", "home")
spawn(0)
post_signal(control_freq, cmd, href_list["op"], s_filter = RADIO_MULEBOT)
post_signal(control_freq, "command", "autopick", "active", active, "value", 1, s_filter = RADIO_MULEBOT)
spawn(10)
post_signal(control_freq, cmd, "bot_status", s_filter = RADIO_MULEBOT)
post_signal(control_freq, "command", "bot_status", "active", active, s_filter = RADIO_MULEBOT)