1
0
Fork 0
forked from OpenNeo/impress

set body id to 0 when appropriate

This commit is contained in:
Emi Matchu 2010-10-09 11:23:59 -04:00
parent 3ab730135f
commit 3eee2633bd

View file

@ -28,8 +28,12 @@ class SwfAsset < ActiveRecord::Base
} }
end end
def body_specific?
self.body_id == 0 || self.zone.type_id < 3
end
def zone def zone
@zone ||= Zone.find(zone_id) Zone.find(zone_id)
end end
def origin_pet_type=(pet_type) def origin_pet_type=(pet_type)
@ -71,6 +75,12 @@ class SwfAsset < ActiveRecord::Base
end end
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 private
def local_path_within_outfit_swfs def local_path_within_outfit_swfs