Help with Deadron's pathfinding and my client/New() in Developer Help
|
|
Greetings!
I have troubles with Deadron's pathfinding.
It conflicts with my:
client/New() var/i if(key in SuperUsers) usr = new/mob/DM() if(!usr.loc) usr.loc = locate(/turf/ground_start) usr.name = key usr.key = key for(i=1,i<=6,i++) usr.equipment[i]="<empty>" usr << "<font color=cyan><b>\[STARTINFO\]: [debug_lightsourcecount] lightsources total.</b></font>" usr << "<font color=cyan><b>\[STARTINFO\]: [debug_litcount] lights were lit.</b></font>" usr << "<font color=Red><b>Hello, master!</b></font>" else usr = new/mob/player() if(!usr.loc) usr.loc = locate(/turf/ground_start) usr.name = key usr.key = key for(i=1,i<=6,i++) usr.equipment[i]="<empty>"
|
I can't find the issue. I thought it has something to do with other stuff, but a simple test like putting it in client/respawn() and putting it in New() like this:
Client/New() ..() sleep(30) respawn()
|
shows that pathfinding works before, but after 3 sec I "respawn" and it doesn't work.
I test it with Click() provided by Demo in download.
#include <deadron/pathfinding> #include <deadron/eventloop>
client Click(atom/movable/object, location)
mob.destination = object return ..()
mob
var/tmp destination next_walk_time walking_delay = 10 movement_percent = 50
Login() src << "<H2>Click any spot to move there.</H2>" src << "<H2>The amazing PathFinding library will avoid all obstacles.</H2>" return ..()
base_EventCycle()
if (next_walk_time <= world.time) if (destination) var/reached_dest = base_StepTowards(destination) if (reached_dest) src << "Reached destination!" destination = null
next_walk_time = world.time + walking_delay return
|
If I click after I respawn() nothing happens.
|
I've solved it by adding GameController.AddEventCycleReceiver(usr) to the end of my code.
Anyone who knows this library good, can you tell me why didn't it assign the new mobs to the list?