diff --git a/app/models/swf_asset.rb b/app/models/swf_asset.rb index 77267581..e5a8f3d3 100644 --- a/app/models/swf_asset.rb +++ b/app/models/swf_asset.rb @@ -28,8 +28,12 @@ class SwfAsset < ActiveRecord::Base } end + def body_specific? + self.body_id == 0 || self.zone.type_id < 3 + end + def zone - @zone ||= Zone.find(zone_id) + Zone.find(zone_id) end def origin_pet_type=(pet_type) @@ -71,6 +75,12 @@ class SwfAsset < ActiveRecord::Base end end + def before_save + # If an asset body ID changes, that means more than one body ID has been + # linked to it, meaning that it's probably wearable by all bodies. + self.body_id = 0 if self.body_id_changed? || !self.body_specific? + end + private def local_path_within_outfit_swfs