| 323 | } |
| 324 | |
| 325 | function createEssentialComponents (defaultComponents, pos, isHero) { |
| 326 | const physicalConfig = { pos } |
| 327 | const physicalComponent = _.find(defaultComponents || [], { original: PhysicalID }) |
| 328 | if (physicalComponent && physicalComponent.config) { |
| 329 | physicalConfig.pos.z = physicalComponent.config.pos.z // Get the z right |
| 330 | } |
| 331 | if (isHero) { |
| 332 | physicalConfig.pos.x = 6 |
| 333 | physicalConfig.pos.y = 14 |
| 334 | } |
| 335 | |
| 336 | const components = [ |
| 337 | { original: ExistsID, majorVersion: 0, config: {} }, |
| 338 | { original: PhysicalID, majorVersion: 0, config: physicalConfig } |
| 339 | ] |
| 340 | if (isHero) { |
| 341 | for (const [name, id] of Object.entries(defaultHeroComponentIDs)) { |
| 342 | const component = { original: id, majorVersion: 0 } |
| 343 | const config = defaultHeroComponentConfig[name] |
| 344 | if (config) { |
| 345 | component.config = config |
| 346 | } |
| 347 | components.push(component) |
| 348 | } |
| 349 | } |
| 350 | return components |
| 351 | } |
| 352 | |
| 353 | // Stores thangType with spriteName as the key |
| 354 | const spriteNamesToThangTypes = {} |