Skip to content

Commit bc22ce2

Browse files
committed
Slight optimization
1 parent 64f1879 commit bc22ce2

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

Optional Features/#1. (Choose From This Folder First)/No Enemy Map Spots/gamedata/scripts/sim_squad_generic.script

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,12 @@ function sim_squad_generic:create_npc(spawn_smart)
204204

205205
local custom_resource = nil
206206
local min_npc, max_npc = 3, 5
207+
local spawn_level = spawn_smart.smart_level
207208

208209
if self.player_id == "monster" then
209210

210211
local min, max = 0, 5
211-
local monster_resource = monster_resource_by_level[spawn_smart.smart_level]
212+
local monster_resource = monster_resource_by_level[spawn_level]
212213

213214
if monster_resource ~= nil then
214215
min = monster_resource[1]
@@ -231,7 +232,7 @@ function sim_squad_generic:create_npc(spawn_smart)
231232
position.x = position.x + math_random(-2, 2)
232233
position.z = position.z + math_random(-2, 2)
233234

234-
local spawn_section = faction:get_spawn_section(spawn_smart, custom_resource)
235+
local spawn_section = faction:get_spawn_section(spawn_level, custom_resource)
235236
local obj = sim:create(spawn_section, position, base_lvi, base_gvi)
236237
local obj_id = obj.id
237238

Optional Features/#2. (Choose From This Folder Last)/Show Only Ally Map Spots/gamedata/scripts/sim_squad_generic.script

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,12 @@ function sim_squad_generic:create_npc(spawn_smart)
204204

205205
local custom_resource = nil
206206
local min_npc, max_npc = 3, 5
207+
local spawn_level = spawn_smart.smart_level
207208

208209
if self.player_id == "monster" then
209210

210211
local min, max = 0, 5
211-
local monster_resource = monster_resource_by_level[spawn_smart.smart_level]
212+
local monster_resource = monster_resource_by_level[spawn_level]
212213

213214
if monster_resource ~= nil then
214215
min = monster_resource[1]
@@ -231,7 +232,7 @@ function sim_squad_generic:create_npc(spawn_smart)
231232
position.x = position.x + math_random(-2, 2)
232233
position.z = position.z + math_random(-2, 2)
233234

234-
local spawn_section = faction:get_spawn_section(spawn_smart, custom_resource)
235+
local spawn_section = faction:get_spawn_section(spawn_level, custom_resource)
235236
local obj = sim:create(spawn_section, position, base_lvi, base_gvi)
236237
local obj_id = obj.id
237238

gamedata/scripts/sim_faction.script

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ function se_sim_faction:update()
364364
-- self:refresh()
365365
end
366366

367-
function se_sim_faction:get_spawn_section(spawn_smart, custom_resource)
367+
function se_sim_faction:get_spawn_section(level_name, custom_resource)
368368

369369
local resource_spawn_data
370370
if custom_resource ~= nil then
@@ -387,7 +387,6 @@ function se_sim_faction:get_spawn_section(spawn_smart, custom_resource)
387387
end
388388
end
389389

390-
local level_name = spawn_smart.smart_level
391390
local level_spawn_data = self.spawn_by_level[level_name]
392391

393392
if level_spawn_data == nil then

gamedata/scripts/sim_squad_generic.script

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,12 @@ function sim_squad_generic:create_npc(spawn_smart)
204204

205205
local custom_resource = nil
206206
local min_npc, max_npc = 3, 5
207+
local spawn_level = spawn_smart.smart_level
207208

208209
if self.player_id == "monster" then
209210

210211
local min, max = 0, 5
211-
local monster_resource = monster_resource_by_level[spawn_smart.smart_level]
212+
local monster_resource = monster_resource_by_level[spawn_level]
212213

213214
if monster_resource ~= nil then
214215
min = monster_resource[1]
@@ -231,7 +232,7 @@ function sim_squad_generic:create_npc(spawn_smart)
231232
position.x = position.x + math_random(-2, 2)
232233
position.z = position.z + math_random(-2, 2)
233234

234-
local spawn_section = faction:get_spawn_section(spawn_smart, custom_resource)
235+
local spawn_section = faction:get_spawn_section(spawn_level, custom_resource)
235236
local obj = sim:create(spawn_section, position, base_lvi, base_gvi)
236237
local obj_id = obj.id
237238

0 commit comments

Comments
 (0)