set body id to 0 when appropriate
This commit is contained in:
parent
3ab730135f
commit
3eee2633bd
1 changed files with 11 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue