mob
bump(mob/box/b, d)
if(istype(b))
b.move(d)
..()
box
pwidth = 16
pheight = 16
icon = 'General.dmi'
icon_state = "box"
set_state()
obj
door
icon = 'General.dmi'
icon_state = "doorclosed"
density = 1
turf
button
icon = 'General.dmi'
icon_state = "button"
stepped_on(mob/box)
for(var/obj/door/d)
d.icon_state = "dooropen"
d.density = 0
stepped_off(mob/box)
for(var/obj/door/d)
d.icon_state = "doorclosed"
d.density = 1
Alright so I have it so when a player pushes a box on to a button the door opens. If the box is off the button it closes.
Now the only problem I'm having is if a player also steps on the button while the box is on it, the door closes. So how could I make it so the player doesn't effect the button?
If you want to fix the problem where stepping off the button closes the door (this would happen if you push two boxes on the button, then push one off), you'd need to check if there are any other objects on the button when an object steps off: