obj/veh/terran/turret
name = "Fletchette Turret"
desc = "Terran fletchette turrets are completely automated cannons that (yadda yadda)"
icon = 'imgObjVehTerranTurret.dmi'
icon_state = "idle"
var/currentAngle // Current angle this turret is pointing
var/const/DEGREES_TURNED_PER_TURN = 25 // This is also the angle of the maximum deviance allowed to fire per turn.
var/atom/currentTarget
var/icon/southIcon // A south facing icon.
var/const/MIN_TERRAN_TURRET_DAMAGE = 5
var/const/MAX_TERRAN_TURRET_DAMAGE = 15
density = 1
layer = 4
New(var/loc)
dir = SOUTH
currentAngle = 90
DebugMsg("Turret created and New() run. Can you see me?")
if (loc == null)
DebugMsg("[type] requires a valid location.")
del src
else if (!istype(loc,/turf/veh))
DebugMsg("[type] must be placed on a /turf/veh.")
del src
GenSouthIcon()
spawn()
sleep()
Heartbeat()
..(loc)
Oddly, this seems to happen only with this particular object in my game. Sometimes, they get created properly and New() runs. Other times, they get created and New() doesn't run.
I know they're being created because I can use a GM command to find them in the world, and other objects in the world try to interact with them, even though these turrets are invisible and have no icon.
I know that New() isn't running because otherwise I would see "Turret created and New() run. Can you see me?"
Not being created properly generates no error messages of any kind - at least where I know where to look. (Not in the chat window, not in the server profile readout.)
So, very weird thing - any ideas how I can solve this problem? I kinda need the things I ask to be created with new() to be reliably created for my game to function.
I do have a ton of processes going on, including one that runs about 100-1000 times a second before sleeping, so that's one probable conflict.