ID:271994
 
I wanna make a verb attached to double clicking on turfs.
When user double clicks a turf, theyre teleported to it.
However, I want to also prevent movement through dense objects...
In the image below, green tiles represent possible telportaion destinations, red ones are inaccessible because there is a dense wall in the way. Blue tile is user's location..
From the blue circle, the user should have access to almost all tiles on the map


I dont want to stick to plain directions; because the diagonals are SO broad that lots of locations would be disallowed when they shouldnt

Excuse the sloppy post. Im REALLY tired.
Look at AbyssDragon's BasicMath library, namely the get_line() function.
In response to Popisfizzy
if u know how to use the double click function, then i dont really see ur problem.

what r u trying to accomplish here???

if its basic teleport on double click, without being able to warp on dense, just do a double click thing on turfs, and do an
if(src.density == 1) then return

for basics, thats all really.
In response to Superbike32
He means he doesn't want to be able to teleport THROUGH dense objects.
In response to Garthor
you can easily do a
var/turf/T = locate(x,y,z) //wherever
if(T.Enter(src))src.loc=T

Something like that. I keep forgetting if T.Enter(src) would actually set your loc or simply return 1 or 0 if your allowed to be set their, regardless what i just did will work.

Sorry misread, theres a lot more thought to be put in to what you want to do.
In response to Superbike32
Superbike32 wrote:
if u know how to use the double click function, then i dont really see ur problem.

what r u trying to accomplish here???

if its basic teleport on double click, without being able to warp on dense, just do a double click thing on turfs, and do an
if(src.density == 1) then return

for basics, thats all really.

no because if the turf isnt dense but a dense object/mob is occupying it then the teleport code will not work properly.
In response to Masterdan
well, then u do for(var/obj/A in world)
if(A.loc == src.loc)
if(A.density == 1)
return

then same for mob
for(var/mob/A in world)
if(A.loc == src.loc)
if(A.density == 1)
return
In response to Superbike32
That... wouldn't work at all.

Please, stop "helping" people if you have no clue what you're talking about. The solution to the problem's already been given.
In response to Superbike32
No. Bad. Do not ever post code on these forums again unless you are asking for help, or until you start actually trying to learn to program well. That code is absolutely wrong. In fact, it couldn't be further from what he wanted.
What you might find interesting is setting the "opacity" of all objects that are dense, then using the view() proc. Then, within the same tick, reset the objects' opacities to their former levels. Because you set the opacity of the dense objects to 1, the view() proc will not see anything behind the dense objects, so those turfs won't be valid destinations. Because you set the opacity back to 0 in that same instant, no one sees the objects become opaque.

Android Data/Crashed did a procedure up that does this. They use it so dense objects block people from being sucked into space through see-through windows, but you can use it for a variety of other purposes, including the one you're asking about. The link is on the Snippets Database below:

http://www.byond.com/members/Jtgibson/forum?id=169
In response to Jtgibson
actually, my code would of course work unless some syntax is wrong, but may be quite absolutely not even near what he wants to use.

but it would work if of course the syntax is wrong.

please dont tell me to stop trying to help, i am doing as best as i can for as much as ive actually coded.
In response to Superbike32
Sadly, Superbike32, you're incorrect. Also, you responded to my post and not to the other posts, which isn't very good either.

Your snippet of code was not what he was asking for. He was asking for a system to prevent people from teleporting past dense objects. You provided code that would prevent anyone from teleporting into their own location (you can test it if you'd like) if there was a dense obj or mob in it.

I deleted the spammy/flamey subthread, but the basic concept still goes: please don't post in response to topics unless you actually know exactly what the person wants. If you continue to post responses that don't actually help, we're going to have to remove you from the boards because it just slows things down when people are given bad advice. I hate to say this, because we don't normally do this sort of thing, but please, please do not respond to a topic until you are much better at DM.

Thanks!
In response to Superbike32
Maybe it does. They point they've been trying to make to you is that showing them what you say works, even if it does work, is teaching them bad practices. It is better to leave helping to the more experienced users.
In response to Jtgibson
from what i understood, or maybe what i saw at that time seemed to be what i gave him, if its not what he wanted, someone could have been nice enough to explain to me that it wasnt what he wanted, and then explained to me what he wanted, instead of making me look like a fool.

i thought all he wanted was to not be able to teleport onto squares that r dense, because of a dense mob, turf, or object.
In response to Pseudonym
which is good, but most people these days have lots of help posts out, and no answers, and all the people seem to be telling people theyre doing it wrong, and not sharing with the world how to do it, so nobodys getting better at coding if nobody better than you at coding posts.

if someone good at coding posted, i would stop, because then theyd have any answer, and a good answer.

i dont want people to not be able to make their projects because nobody tried to hand out code.

if none of the good people r helping, someone has to do it, so i am trying my best to help.

You are only as good as uve been taught to be, self-taught or otherwise, and if the good people dont help, i feel they should receive help from someone.
In response to Superbike32
Many of these people have explained to you that this is not at all what he wanted. In any case, that same code isn't what is needed. It shouldn't even compile.
In response to Pseudonym
they have simply told me that its not what he wanted, yes, but to what all i thought is that they misunderstood, and that i was actually right, and nobody had explained how i was wrong, or what was wrong with what i was trying to do.

i am doing my best to help sicne nobody else has yet far.
In response to Superbike32
Even then, sadly, your code wouldn't work as you intended. It would prevent them from teleporting into their own location only (the A.loc == src.loc line being the killer).

It's not that we think you're a fool or want to make you look like one; it's that we're reacting to something that you seem to do a lot. You tend to misinterpret posts somewhat often, and in the cases where you know exactly what they want you sometimes post code that doesn't work or has various problems.

It's good that you're trying, but what I'm asking is that you spend a bit more time gaining experience before you try to help out. There are a lot of experts around and they tend to get to the posts eventually, so save your time! Instead of helping people, build your skills and release a really awesome game -- especially an original game built from scratch. BYOND needs more of those.
In response to Superbike32
Really all you need to be competent enough to use DM properly is the DM guide, and the DM reference(F1 in Dream Maker). I suggest you start reading.

For now, it's best if you not try to help. We have plenty of competent coders in the forums, namely Garthor, Popisfizzy, and... well, one other that I can't think of right now. Anyway, just stop trying to help. It's injuring them.