def test_copy_consistency(self): atom = Atom('/datum/test',__file__,0) atom.properties={ 'dir': BYONDValue(2), 'name': BYONDString('test datum') } atom.mapSpecified=['dir','name'] atom2=atom.copy() atom_serialized=atom.MapSerialize() atom2_serialized=atom2.MapSerialize() self.assertEqual(atom_serialized, atom2_serialized)
def Fix(self, atom): newtype = atom.path if atom.path == '/obj/machinery/atmospherics/pipe/simple/insulated': icon_state = '' if 'icon_state' in atom.properties: icon_state = atom.properties['icon_state'].value newtype = self.STATE_TO_TYPE.get(icon_state, '/obj/machinery/atmospherics/pipe/simple/insulated/visible') new_atom = Atom(newtype) if 'dir' in atom.mapSpecified: # Normalize dir direction = int(atom.getProperty('dir', 2)) if direction == 3: direction = 1 elif direction == 8: # Breaks things, for some reason direction = 4 elif direction == 12: direction = 4 new_atom.setProperty('dir', direction, PropertyFlags.MAP_SPECIFIED) return new_atom
def Fix(self, atom): icon_state = atom.properties['icon_state'].value new_atom = Atom(self.STATE_TO_TYPE[icon_state]) if 'dir' in atom.mapSpecified: new_atom.setProperty('dir', atom.getProperty('dir'), PropertyFlags.MAP_SPECIFIED) return new_atom