#[no_std, cache_output] extract import "constants.spwn" impl @object { set: (self, key: @object_key, value) { $.edit_obj(self, key, value); }, with: (self, key: @object_key, value) { let new_obj = self new_obj.set(key, value) return new_obj }, add_groups: (self, groups: @group | [@group]) { let grps = switch groups { @group: [groups], [@group]: groups }; if self has obj_props.GROUPS { grps += switch self[obj_props.GROUPS] { @group: [self[obj_props.GROUPS]], [@group]: self[obj_props.GROUPS] }; } self.set(obj_props.GROUPS, grps); }, add: (self) { $.add(self); } }