@@ -146,48 +146,46 @@ public IEnumerable<TreeEntry> GetAllDescendants(TreeEntry treeEntry) {
146146 /// (by calling the result of <see cref="DreamObject.InitProc(DreamThread, DreamObject?, DreamProcArguments)"/> or <see cref="DreamObject.InitSpawn(DreamProcArguments)"/>)
147147 /// </remarks>
148148 public DreamObject CreateObject ( TreeEntry type ) {
149- using ( Profiler . BeginZone ( $ "new { type } ") ) {
150- if ( type == List )
151- return CreateList ( ) ;
152- if ( type == Savefile )
153- return new DreamObjectSavefile ( Savefile . ObjectDefinition ) ;
154- if ( type . ObjectDefinition . IsSubtypeOf ( DatabaseQuery ) )
155- return new DreamObjectDatabaseQuery ( type . ObjectDefinition ) ;
156- if ( type . ObjectDefinition . IsSubtypeOf ( Database ) )
157- return new DreamObjectDatabase ( type . ObjectDefinition ) ;
158- if ( type . ObjectDefinition . IsSubtypeOf ( Matrix ) )
159- return new DreamObjectMatrix ( type . ObjectDefinition ) ;
160- if ( type . ObjectDefinition . IsSubtypeOf ( Sound ) )
161- return new DreamObjectSound ( type . ObjectDefinition ) ;
162- if ( type . ObjectDefinition . IsSubtypeOf ( Regex ) )
163- return new DreamObjectRegex ( type . ObjectDefinition ) ;
164- if ( type . ObjectDefinition . IsSubtypeOf ( Image ) )
165- return new DreamObjectImage ( type . ObjectDefinition ) ;
166- if ( type . ObjectDefinition . IsSubtypeOf ( Icon ) )
167- return new DreamObjectIcon ( type . ObjectDefinition ) ;
168- if ( type . ObjectDefinition . IsSubtypeOf ( Filter ) )
169- return new DreamObjectFilter ( type . ObjectDefinition ) ;
170- if ( type . ObjectDefinition . IsSubtypeOf ( Mob ) )
171- return new DreamObjectMob ( type . ObjectDefinition ) ;
172- if ( type . ObjectDefinition . IsSubtypeOf ( Movable ) )
173- return new DreamObjectMovable ( type . ObjectDefinition ) ;
174- if ( type . ObjectDefinition . IsSubtypeOf ( Area ) )
175- return new DreamObjectArea ( type . ObjectDefinition ) ;
176- if ( type . ObjectDefinition . IsSubtypeOf ( Atom ) )
177- return new DreamObjectAtom ( type . ObjectDefinition ) ;
178- if ( type . ObjectDefinition . IsSubtypeOf ( Client ) )
179- throw new Exception ( "Cannot create objects of type /client" ) ;
180- if ( type . ObjectDefinition . IsSubtypeOf ( Turf ) )
181- throw new Exception ( "New turfs must be created by the map manager" ) ;
182- if ( type . ObjectDefinition . IsSubtypeOf ( Exception ) )
183- return new DreamObjectException ( type . ObjectDefinition ) ;
184- if ( type . ObjectDefinition . IsSubtypeOf ( Callee ) )
185- return new DreamObjectCallee ( type . ObjectDefinition ) ;
186- if ( type . ObjectDefinition . IsSubtypeOf ( Vector ) )
187- return new DreamObjectVector ( type . ObjectDefinition ) ;
188-
189- return new DreamObject ( type . ObjectDefinition ) ;
190- }
149+ if ( type == List )
150+ return CreateList ( ) ;
151+ if ( type == Savefile )
152+ return new DreamObjectSavefile ( Savefile . ObjectDefinition ) ;
153+ if ( type . ObjectDefinition . IsSubtypeOf ( DatabaseQuery ) )
154+ return new DreamObjectDatabaseQuery ( type . ObjectDefinition ) ;
155+ if ( type . ObjectDefinition . IsSubtypeOf ( Database ) )
156+ return new DreamObjectDatabase ( type . ObjectDefinition ) ;
157+ if ( type . ObjectDefinition . IsSubtypeOf ( Matrix ) )
158+ return new DreamObjectMatrix ( type . ObjectDefinition ) ;
159+ if ( type . ObjectDefinition . IsSubtypeOf ( Sound ) )
160+ return new DreamObjectSound ( type . ObjectDefinition ) ;
161+ if ( type . ObjectDefinition . IsSubtypeOf ( Regex ) )
162+ return new DreamObjectRegex ( type . ObjectDefinition ) ;
163+ if ( type . ObjectDefinition . IsSubtypeOf ( Image ) )
164+ return new DreamObjectImage ( type . ObjectDefinition ) ;
165+ if ( type . ObjectDefinition . IsSubtypeOf ( Icon ) )
166+ return new DreamObjectIcon ( type . ObjectDefinition ) ;
167+ if ( type . ObjectDefinition . IsSubtypeOf ( Filter ) )
168+ return new DreamObjectFilter ( type . ObjectDefinition ) ;
169+ if ( type . ObjectDefinition . IsSubtypeOf ( Mob ) )
170+ return new DreamObjectMob ( type . ObjectDefinition ) ;
171+ if ( type . ObjectDefinition . IsSubtypeOf ( Movable ) )
172+ return new DreamObjectMovable ( type . ObjectDefinition ) ;
173+ if ( type . ObjectDefinition . IsSubtypeOf ( Area ) )
174+ return new DreamObjectArea ( type . ObjectDefinition ) ;
175+ if ( type . ObjectDefinition . IsSubtypeOf ( Atom ) )
176+ return new DreamObjectAtom ( type . ObjectDefinition ) ;
177+ if ( type . ObjectDefinition . IsSubtypeOf ( Client ) )
178+ throw new Exception ( "Cannot create objects of type /client" ) ;
179+ if ( type . ObjectDefinition . IsSubtypeOf ( Turf ) )
180+ throw new Exception ( "New turfs must be created by the map manager" ) ;
181+ if ( type . ObjectDefinition . IsSubtypeOf ( Exception ) )
182+ return new DreamObjectException ( type . ObjectDefinition ) ;
183+ if ( type . ObjectDefinition . IsSubtypeOf ( Callee ) )
184+ return new DreamObjectCallee ( type . ObjectDefinition ) ;
185+ if ( type . ObjectDefinition . IsSubtypeOf ( Vector ) )
186+ return new DreamObjectVector ( type . ObjectDefinition ) ;
187+
188+ return new DreamObject ( type . ObjectDefinition ) ;
191189 }
192190
193191 public T CreateObject < T > ( TreeEntry type ) where T : DreamObject {
0 commit comments