ID:261453
Apr 7 2002, 8:00 am
|
|
I was woundering when I used the area.Entered() proc it does whats in the proc. But when I add the same thing to the Obj's.Entered() proc it doesnt do any thing. Tell me somthing is there a diffrence between the two?
|
Apr 7 2002, 8:03 am
|
|
Yep. Entered() is never called for objects, period.
|
In response to Nadrew
|
|
Nadrew wrote:
Yep. Entered() is never called for objects, period. Well, it can be, but only if you specifically make it possible to climb inside of objects. Foomer does it in his MUD, and that's the only occurrence of it that I'm aware of. |
In response to Spuzzum
|
|
Spuzzum wrote:
Nadrew wrote: Actually, any time you use Move() and supply an object as the destination, it will be called. For example, if you have a RPG with sacks or backpacks, you might move an object inside another object. |
Green Lime wrote:
I was woundering when I used the area.Entered() proc it does whats in the proc. But when I add the same thing to the Obj's.Entered() proc it doesnt do any thing. Tell me somthing is there a diffrence between the two? It sounds to me like what you're really after is to call Entered() for a turf containing a particular object. If so, you've got your proc in the wrong place. What you'd really want to do would be something like this: turf That snippet will automatically pick up objects of type /obj/item whenever you walk onto a turf. (That's actually an inefficient way to manage this, but it's a start.) Lummox JR |
In response to Lummox JR
|
|
I've posted a Bwiki page on the topic of triggering objs when they are stepped on: http://www.deadron.com/byond/ByondBwicki.dmb?TriggeredObjs
|
In response to Shadowdarke
|
|
It seems like kind of a waste to call Entered and do tests each time something enters a turf when you may only have 1 turf mined out of 100 (as an example). Unfortunately I can't think of any better way to have objects be triggered in the same way where it would be anymore efficient. Any other suggestions?
I guess you could use Bump instead and just move the bumper afterwards like this: mob Bump(var/atom/A) A.Bumped(src) atom/proc/Bumped() return obj Mine Bumped(var/mob/M) Triggered(M) M.loc = loc Unfortunately this causes Bump to be used often but it will be used less than Entered(). |
In response to English
|
|
English wrote:
It seems like kind of a waste to call Entered and do tests each time something enters a turf when you may only have 1 turf mined out of 100 (as an example). Unfortunately I can't think of any better way to have objects be triggered in the same way where it would be anymore efficient. Any other suggestions? Entered() is already called whenever you enter a turf and there are no additional tests. There isn't a single if statement in the core Trigger() code I presented. The extra testing comes with the special items, which would have to test what they are effecting, however you impliment them. If nothing is in the turf, the for loop isn't even executed. If you do not overide Trigger() for an obj, nothing will happen for it. Admittedly, it does produce a little overhead to call an empty proc, but unless you have a ridiculous number of objs in each turf, it will cause no noticable lag. I guess you could use Bump instead and just move the bumper afterwards like this: Bump() requires dense objs, which is not exactly the behaviour wanted. Moving a mob after it bumps a solid obj can lead to some unexpected results and you would have to add additional code so that movable atoms that do not trigger the effect can still move through the space. |
In response to Shadowdarke
|
|
I guess I'm still in my ants mindset :p
I'd like to have hundreds of ants running arround so extra proc calls and test statements can start to add up. In most games/programs your right, it wouldn't really add much overhead. I must be hallucinating or something, I thought I saw an if statement :p (I checked and there isn't of course) |
In response to Skysaw
|
|
Actually, any time you use Move() and supply an object as the destination, it will be called. For example, if you have a RPG with sacks or backpacks, you might move an object inside another object. Ah, for some reason I wasn't thinking of the obj-entering-obj case. How silly of me. |