Example #1
0
// Cleans up user module when exiting a device
func leaveDevice(user api.User) {
	dev_id := user.GetDeviceId()
	if dev_id == 0 {
		return
	}
	dev, _ := core.GetDeviceById(dev_id)
	hax := dev.GetHackSession()
	if hax == nil {
		return
	}
	hax.RemoveUser(user)
	if hax.NumOfUsers() == 0 {
		dev.SetHackSession(nil)
	}
}