ID:2363823
 
(See the best response by Nadrew.)
Code:
obj
enemyarea
icon='Void.dmi'
layer=TURF_LAYER
alpha = 100
var
mob/Enemy/owner = null
New(location, mob/shooter)
if(shooter)
src.owner = shooter
Entered(mob/m)
if(istype(m,/mob/player/))
var/mob/player/pl = m
if(src.owner)
for(var/mob/Enemy/tr in src.owner.ContainMobs)
tr.foundTarget(pl)
Exited(mob/m)
if(istype(m,/mob/player/))
if(src.owner)
for(var/mob/Enemy/tr in src.owner.ContainMobs)
tr.target=null
mob
Bosses
Enemy

var/speactext
var/list/ContainMobs=list()
icon='Enemies.dmi'
Earthregion
Brusolini3
icon_state="enemy11"
bounds="12,6 to 36,39"
step_size=4
New()

var/turf/T
for(T in range(3, src))
if(T)
if(!T.density)

new/obj/enemyarea(T,src)
for(var/mob/Enemy/c in range(3,src))
src.ContainMobs+=c
Brusolini5
icon_state="enemy3"
bounds="12,6 to 36,39"
step_size=4
New()
var/turf/T

for(T in range(3, src))
if(T)
if(!T.density)
new/obj/enemyarea(T,src)
for(var/mob/Enemy/c in range(3,src))
src.ContainMobs+=c


Problem description:

Somehow obj/Entered() obj/Exited() is not working. If I switch enemyarea to turf or area it is working fine. Aren`t those built-in obj procs ?
Best response
You're not entering the objects, you're entering the turfs they're on. Enter/Exit and Entered/Exited are only called when you move from one container to another gracefully.

turf/Entered(mob/M)
var/obj/enemyarea/A = locate() in src
if(A) A.Entered(M)
I think the proc you want is Crossed(), not Entered(). Crossed() is called when an object "steps on" another object.
In response to Nadrew
Nadrew wrote:
You're not entering the objects, you're entering the turfs they're on. Enter/Exit and Entered/Exited are only called when you move from one container to another gracefully.

> turf/Entered(mob/M)
> var/obj/enemyarea/A = locate() in src
> if(A) A.Entered(M)
>

Ahhh I see. Ty so much :)