debugged beginning of new lua entity code