ID:2713731
 
(See the best response by Ter13.)
I am working on traps for my game I am designing. I ran into an issue when spawning the traps on the players tiles. Think like a flame trap that does damage while your standing in it, acid, poison, etc. You get the idea.

Problem is when spawning something on the players tile, it obviously does not trigger Enter() or Cross() procs. I have tried to use oview(), view(), range() and others to detect mobs in distance 0. This for some reason bugs out a ton. Not so much when dealing with one tile, but when spawning multiple.

I am not looking for a code fix, I just want some opinions on how you would handle the situation. If I am missing some proc that would make this easier, or perhaps just design ideas to handle the scenario.

I would hate to have to re-work how I plan on using these traps. But if its a Byond limitation, I could understand that. I am not too familiar with this system.

Thanks in advance!
Well without much going on here.. the awnser I can give you is that you are wrong. Cross() is called when you place things using Move() and not setting loc = pos.

So create your trap in a null loc, and Move() it into position.

So try that.. should instantly fix your issue and maintain your code the way it is right now.

But if its a Byond limitation, I could understand that. I am not too familiar with this system.
^ This should never be an assumption.
Cross() is called when you place things using Move() and not setting loc = pos.

I am confused, is that not what I said? My problem is I am placing something there directly. I want the mob hurt when its placed there. Its not calling move, as I am directly setting it there when creating it.

Mob steps on pressure plate, spawn lava. There is no move to activate the Cross() as the mob is where the lava spawned in.

So how do I go about triggering that Crossed() without that movement? Thats my current problem. Is there another way to set location directly that will call movement?





Best response
Implement reciprocal functions for Crossed(). Where Crossed() is called on src by o, onCrossed() should be called on o by src.

Then create your trap in a null loc, and Move() it into position. You can trap for crossings via the reciprocal.