Finds the spawn function for the entity and calls it.
(SubgameEntity ent, GameExportsImpl gameExports)
| 1000 | * Finds the spawn function for the entity and calls it. |
| 1001 | */ |
| 1002 | public static void ED_CallSpawn(SubgameEntity ent, GameExportsImpl gameExports) { |
| 1003 | |
| 1004 | if (null == ent.classname) { |
| 1005 | gameExports.gameImports.dprintf("ED_CallSpawn: null classname\n"); |
| 1006 | return; |
| 1007 | } |
| 1008 | |
| 1009 | // check item spawn functions |
| 1010 | var item = gameExports.items.stream() |
| 1011 | .filter(it -> ent.classname.equals(it.classname)) |
| 1012 | .findFirst(); |
| 1013 | if (item.isPresent()) { |
| 1014 | GameItems.SpawnItem(ent, item.get(), gameExports); |
| 1015 | return; |
| 1016 | } |
| 1017 | |
| 1018 | // check normal spawn functions |
| 1019 | var spawn = spawns.get(ent.classname.toLowerCase()); |
| 1020 | if (spawn != null) { |
| 1021 | spawn.spawn(ent, gameExports); |
| 1022 | ent.st = null; |
| 1023 | } else { |
| 1024 | gameExports.gameImports.dprintf(ent.classname + " doesn't have a spawn function\n"); |
| 1025 | } |
| 1026 | } |
| 1027 | |
| 1028 | |
| 1029 | static String[] mobs = { "monster_berserk", "monster_gladiator", "monster_gunner", "monster_infantry", "monster_soldier_light", "monster_soldier", "monster_soldier_ss", "monster_tank", "monster_tank_commander", "monster_medic", "monster_chick", "monster_parasite", "monster_flyer", "monster_brain", "monster_floater", "monster_mutant"}; |
no test coverage detected