Refine my orignal attempt at a resource system, and fix some bugs

Signed-off-by: HACKhalo2 <hackhalotwo@gmail.com>
Merge branch 'resource_m2' of github.com:HACKhalo2/Sigma into resource_m2