ID:167764
 
I would like to know how to make a place densense so you cannot walk from the space threw the densense line such as

oooooooo
xxxxxxxo
xoooooxo
xoooooxo
xxxxxxxo
oooooooo

the o's are turf and the x's are walls what if I wanted people to stand on top of the x's but not beable to move from the x to the o if the wall is in the way?
turf
> turf1
>> name = "X"
> turf2
>> name = "0"
>> density = 1

mob
> density = 1
In response to Zmadpeter
Zmadpeter wrote:
> turf
> > turf1
> >> name = "X"
> > turf2
> >> name = "0"
> >> density = 1
>
> mob
> > density = 1
>



Um.... I wouldn't post such a stupid question as how to add density in the forums I'm asking how to make the line between the X's and the O's densense so I can stand on either but not walk between
In response to Delamore
I am still not getting what you mean, and what the heck does "densense" mean?
In response to Delamore
It's "dense", not "densense".

As you've probably guessed, you can't do this with normal density. One solution is to override Enter():

turf/O/Enter(atom/movable/A)
if (istype(A.loc, /turf/X))
// Entering mob or obj is on an X,
// so return 0 to stop it entering
return 0
else
// Usual movement rules apply,
// so return what Enter() would normally return
return ..()

turf/X/Enter(atom/movable/A)
if (istype(A.loc, /turf/O))
// Entering mob or obj is on an O,
// so return 0 to stop it entering
return 0
else
// Usual movement rules apply,
// so return what Enter() would normally return
return ..()


There are two problems with the above code:

1. I copied and pasted the code for each turf, which is a bad thing because it generates redundant code, which increases the size of your game and makes it harder to maintain. I'll leave it up to you as an exercise to remove that redundancy.

2. Pathfinding algorithms (such as hub://Deadron.Pathfinding) may not always work correctly in certain subtle circumstances. If you're not using any pathfinding in your game, don't worry about this.
In response to Crispy
Sorry dense -.- Like the walls in citisen where the wall is the space between two turfs