mirror of
https://github.com/veden/Rampant.git
synced 2024-12-28 21:08:22 +02:00
looking into command completion again
This commit is contained in:
parent
0021bab1c3
commit
921a93d053
@ -127,8 +127,8 @@ function upgrade.attempt(natives, setNewSurface, gameSurfaces)
|
||||
natives.pendingStealGroups = {}
|
||||
natives.pendingStealGroups.len = 1
|
||||
end
|
||||
if (global.version < 110) then
|
||||
global.version = 110
|
||||
if (global.version < 111) then
|
||||
global.version = 111
|
||||
|
||||
local gameSurfs
|
||||
if not gameSurfaces then
|
||||
|
@ -1,3 +1,11 @@
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 0.18.12
|
||||
Date: 16. 4 2020
|
||||
Tweaks:
|
||||
- Changed ai credits per rocket launched to 5000
|
||||
Bugfixes:
|
||||
- fixed add movement penalty not using squad chunk
|
||||
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 0.18.11
|
||||
Date: 13. 4 2020
|
||||
|
43
control.lua
43
control.lua
@ -846,7 +846,7 @@ local function onRocketLaunch(event)
|
||||
local entity = event.rocket_silo or event.rocket
|
||||
if entity and entity.valid and (entity.surface.name == natives.activeSurface) then
|
||||
natives.rocketLaunched = natives.rocketLaunched + 1
|
||||
natives.points = natives.points + 2000
|
||||
natives.points = natives.points + 5000
|
||||
end
|
||||
end
|
||||
|
||||
@ -926,22 +926,29 @@ local function onUnitGroupCreated(event)
|
||||
end
|
||||
|
||||
local function onCommandDebugger(event)
|
||||
for i=1,natives.squads.len do
|
||||
if (natives.squads[i].group.valid) and (natives.squads[i].group.group_number == event.unit_number) then
|
||||
local msg
|
||||
if (event.result == defines.behavior_result.in_progress) then
|
||||
msg = "progress"
|
||||
elseif (event.result == defines.behavior_result.fail) then
|
||||
msg = "fail"
|
||||
elseif (event.result == defines.behavior_result.success) then
|
||||
msg = "success"
|
||||
elseif (event.result == defines.behavior_result.deleted) then
|
||||
msg = "deleted"
|
||||
end
|
||||
print(msg, event.unit_number)
|
||||
return
|
||||
end
|
||||
end
|
||||
-- for i=1,natives.squads.len do
|
||||
-- if (natives.squads[i].group.valid) and (natives.squads[i].group.group_number == event.unit_number) then
|
||||
-- local msg
|
||||
-- if (event.result == defines.behavior_result.in_progress) then
|
||||
-- msg = "progress"
|
||||
-- elseif (event.result == defines.behavior_result.fail) then
|
||||
-- msg = "fail"
|
||||
-- elseif (event.result == defines.behavior_result.success) then
|
||||
-- msg = "success"
|
||||
-- elseif (event.result == defines.behavior_result.deleted) then
|
||||
-- msg = "deleted"
|
||||
-- end
|
||||
-- print(msg, event.unit_number)
|
||||
-- return
|
||||
-- end
|
||||
-- end
|
||||
-- if not a then
|
||||
-- a = 0
|
||||
-- end
|
||||
-- a = a + 1
|
||||
-- if ((a % 50) == 0) then
|
||||
-- print("here", a)
|
||||
-- end
|
||||
end
|
||||
|
||||
local function onForceCreated(event)
|
||||
@ -1118,7 +1125,7 @@ script.on_event({defines.events.on_built_entity,
|
||||
defines.events.script_raised_built,
|
||||
defines.events.script_raised_revive}, onBuild)
|
||||
|
||||
-- script.on_event(defines.events.on_ai_command_completed, onCommandDebugger)
|
||||
script.on_event(defines.events.on_ai_command_completed, onCommandDebugger)
|
||||
script.on_event(defines.events.on_entity_spawned, onEntitySpawned)
|
||||
|
||||
script.on_event(defines.events.on_rocket_launched, onRocketLaunch)
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name" : "Rampant",
|
||||
"factorio_version" : "0.18",
|
||||
"version" : "0.18.11",
|
||||
"version" : "0.18.12",
|
||||
"title" : "Rampant",
|
||||
"author" : "Veden",
|
||||
"homepage" : "https://forums.factorio.com/viewtopic.php?f=94&t=31445",
|
||||
|
@ -53,21 +53,26 @@ function movementUtils.findMovementPositionDistort(surface, position)
|
||||
return distortPosition(pos, 8)
|
||||
end
|
||||
|
||||
function movementUtils.addMovementPenalty(units, chunk)
|
||||
if (chunk == -1) or (squadChunk == chunk) then
|
||||
function movementUtils.addMovementPenalty(squad, chunk)
|
||||
if (chunk == -1) or (squad.chunk == chunk) then
|
||||
return
|
||||
end
|
||||
local penalties = units.penalties
|
||||
local penalties = squad.penalties
|
||||
for i=1,#penalties do
|
||||
local penalty = penalties[i]
|
||||
if (penalty.c == chunk) then
|
||||
penalty.v = (2 * penalty.v) + MOVEMENT_PENALTY_AMOUNT
|
||||
print(penalty.v)
|
||||
if (penalty.v > MOVEMENT_PENALTY_AMOUNT * 5) then
|
||||
print("erel", penalty, squad.group.group_number)
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
if (#penalties == 7) then
|
||||
tableRemove(penalties, 7)
|
||||
end
|
||||
print(squad.group.group_number)
|
||||
tableInsert(penalties,
|
||||
1,
|
||||
{ v = MOVEMENT_PENALTY_AMOUNT,
|
||||
|
@ -146,8 +146,8 @@ function aiDefense.retreatUnits(chunk, position, squad, map, surface, tick, radi
|
||||
newSquad.frenzyPosition.x = squadPosition.x
|
||||
newSquad.frenzyPosition.y = squadPosition.y
|
||||
end
|
||||
addSquadToChunk(map, chunk, newSquad)
|
||||
addMovementPenalty(newSquad, chunk)
|
||||
addSquadToChunk(map, chunk, newSquad)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user