ID:168045
 
I have no experience coding. Most of my code is copied :( I'm still trying to learn.

My code for water is:

water
icon = 'water.dmi'
density = 1

My gun's shot is:

obj/basicshot
Bump(mob/M)
if(ismob(M))
M.HP-=5
del(src)

To make sure I can't walk on water I have to set it's density to 1 but then my gunshot stops when it hits the water. What can I do to let it go on the water?
Just overwrite Enter() for the water turf, and only let bullets go through.

turf/water
icno = 'water.dmi'
density = 1
Enter(atom/movable/A)
if(istype(A, /obj/bullet))
return 1
return ..()


~~> Unknown Person
In response to Unknown Person
Now I have a small(I think)problem.

I have a boat(just a normal enemy) in the water, and now the shot just passes through it. It's density is set to 1 as well.
In response to Dude902
Yeah, if you did it my quick way, that would happen, since it would ignore all objects.

The way to do it in this kind of situation is to make the water's density 0, and disallow everything but the bullets (or any other things) to go through.

turf/water
icon = 'water.dmi'
Enter(atom/movable/A)
if(istype(A, /obj/bullet))
return ..()
return 0


~~> Unknown Person
In response to Unknown Person
Thanks for the help.

Meh, now I'm getting another problem, but it has nothing to do with this.