ID:166857
 
How do u make it so that when you can open chesting and boxes using a number on the num pad with num lock off?
Dbgtsuperfreak wrote:
How do u make it so that when you can open chesting and boxes using a number on the num pad with num lock off?

I'm assuming you want to be able to do an action by pressing a key on the numpad.

Since the keys on the numpad represent directions (numpad 1 being southwest, while numpad 9 is northeast), you can just use the handily defined client/Northeast() and Southwest() procs. (All the directions have been predefined for your usage, so there is a North, South, East, and West proc too)

Therefore, if you wanted to open a box by pressing Numpad 5, (client/Center()), you would do this.

client
Center()
src.mob.OpenChest() // call the client's mob's OpenChest() proc

mob/proc
OpenChest()
var/obj/chest/C = locate() in get_step(src, src.dir)
if(C) // if there is a chest in front of the player
C.Open(src) // open it

obj/chest
proc/Open(mob/opener)
view(src) << "The chest has been opened by [opener]!"
// chest opening code


~~> Unknown Person