コード例 #1
0
 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
コード例 #2
0
ファイル: __init__.py プロジェクト: ComicIronic/ByondToolsv3
 def GetAtom(self, path):
     if self.tree is not None:
         atom = self.tree.GetAtom(path)
         if atom is None and self.forgiving_atom_lookups:
             self.missing_atoms.add(path)
             return Atom(path, '(map)', missing=True)
         return atom
     return Atom(path)
コード例 #3
0
    def test_serialization(self):
        from byond.basetypes import Atom, BYONDString, BYONDValue
        atom = Atom('/datum/test', __file__, 0)

        # Assign properties.  Order is important (orderedDict!)
        atom.properties['dir'] = BYONDValue(2)
        atom.properties['name'] = BYONDString('test datum')

        # What we expect after running str().
        atom_serialized = '/datum/test{dir=2;name="test datum"}'

        # Check it
        self.assertEqual(str(atom), atom_serialized)
コード例 #4
0
ファイル: Atom.py プロジェクト: Boggart/ByondTools
 def test_serialization(self):
     from byond.basetypes import Atom, BYONDString, BYONDValue
     atom = Atom('/datum/test',__file__,0)
     
     # Assign properties.  Order is important (orderedDict!)
     atom.properties['dir']=BYONDValue(2)
     atom.properties['name']=BYONDString('test datum')
     
     # What we expect after running str().
     atom_serialized='/datum/test{dir=2;name="test datum"}'
     
     # Check it
     self.assertEqual(str(atom), atom_serialized)
コード例 #5
0
ファイル: Atom.py プロジェクト: Eternia-Backup/Files
 def test_copy_consistency(self):
     from byond.basetypes import Atom, BYONDString, BYONDValue
     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)
コード例 #6
0
 def Fix(self, atom):
     newtype = atom.path
     if atom.path == ATMOSBASE+'/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, ATMOSBASE+'/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
コード例 #7
0
ファイル: ss13_vgstation.py プロジェクト: kilozombie/Paradise
 def Fix(self, atom):
     newtype = atom.path
     if atom.path == '/obj/machinery/networked/atmos/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/networked/atmos/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
コード例 #8
0
    def test_copy_consistency(self):
        from byond.basetypes import Atom, BYONDString, BYONDValue
        atom = Atom('/datum/test', __file__, 0)

        atom.properties['dir'] = BYONDValue(2)
        atom.properties['name'] = BYONDString('test datum')

        atom.mapSpecified = ['dir', 'name']

        atom2 = atom.copy()

        atom_serialized = atom.dumpPropInfo('test')
        atom2_serialized = atom2.dumpPropInfo('test')

        self.assertEqual(atom_serialized, atom2_serialized)
コード例 #9
0
 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
コード例 #10
0
ファイル: dmm.py プロジェクト: Boggart/ByondTools
 def changeMarker(ln):
     a = Atom('/obj/effect/byondtools/changed')
     a.setProperty('tag','{}:{}'.format(currentpatch,ln),flags=PropertyFlags.MAP_SPECIFIED)
     return a
コード例 #11
0
ファイル: ss13_vgstation.py プロジェクト: kilozombie/Paradise
 def getNewType(self, tmpl, color_code, visible, color_wheel=COLOR_CODES):
     visibility = 'visible'
     if not visible:
         visibility = 'hidden'
     color = color_wheel[color_code]
     return Atom(tmpl.format(color=color, visibility=visibility))
コード例 #12
0
ファイル: dmm.py プロジェクト: ComicIronic/ByondToolsv3
 def changeMarker(ln):
     a = Atom('/obj/effect/byondtools/changed')
     a.setProperty('tag',
                   '{}:{}'.format(currentpatch, ln),
                   flags=PropertyFlags.MAP_SPECIFIED)
     return a