mirror of
https://github.com/veden/Rampant.git
synced 2025-01-16 02:33:53 +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 = {}
|
||||||
natives.pendingStealGroups.len = 1
|
natives.pendingStealGroups.len = 1
|
||||||
end
|
end
|
||||||
if (global.version < 110) then
|
if (global.version < 111) then
|
||||||
global.version = 110
|
global.version = 111
|
||||||
|
|
||||||
local gameSurfs
|
local gameSurfs
|
||||||
if not gameSurfaces then
|
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
|
Version: 0.18.11
|
||||||
Date: 13. 4 2020
|
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
|
local entity = event.rocket_silo or event.rocket
|
||||||
if entity and entity.valid and (entity.surface.name == natives.activeSurface) then
|
if entity and entity.valid and (entity.surface.name == natives.activeSurface) then
|
||||||
natives.rocketLaunched = natives.rocketLaunched + 1
|
natives.rocketLaunched = natives.rocketLaunched + 1
|
||||||
natives.points = natives.points + 2000
|
natives.points = natives.points + 5000
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -926,22 +926,29 @@ local function onUnitGroupCreated(event)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function onCommandDebugger(event)
|
local function onCommandDebugger(event)
|
||||||
for i=1,natives.squads.len do
|
-- for i=1,natives.squads.len do
|
||||||
if (natives.squads[i].group.valid) and (natives.squads[i].group.group_number == event.unit_number) then
|
-- if (natives.squads[i].group.valid) and (natives.squads[i].group.group_number == event.unit_number) then
|
||||||
local msg
|
-- local msg
|
||||||
if (event.result == defines.behavior_result.in_progress) then
|
-- if (event.result == defines.behavior_result.in_progress) then
|
||||||
msg = "progress"
|
-- msg = "progress"
|
||||||
elseif (event.result == defines.behavior_result.fail) then
|
-- elseif (event.result == defines.behavior_result.fail) then
|
||||||
msg = "fail"
|
-- msg = "fail"
|
||||||
elseif (event.result == defines.behavior_result.success) then
|
-- elseif (event.result == defines.behavior_result.success) then
|
||||||
msg = "success"
|
-- msg = "success"
|
||||||
elseif (event.result == defines.behavior_result.deleted) then
|
-- elseif (event.result == defines.behavior_result.deleted) then
|
||||||
msg = "deleted"
|
-- msg = "deleted"
|
||||||
end
|
-- end
|
||||||
print(msg, event.unit_number)
|
-- print(msg, event.unit_number)
|
||||||
return
|
-- return
|
||||||
end
|
-- end
|
||||||
end
|
-- end
|
||||||
|
-- if not a then
|
||||||
|
-- a = 0
|
||||||
|
-- end
|
||||||
|
-- a = a + 1
|
||||||
|
-- if ((a % 50) == 0) then
|
||||||
|
-- print("here", a)
|
||||||
|
-- end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function onForceCreated(event)
|
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_built,
|
||||||
defines.events.script_raised_revive}, onBuild)
|
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_entity_spawned, onEntitySpawned)
|
||||||
|
|
||||||
script.on_event(defines.events.on_rocket_launched, onRocketLaunch)
|
script.on_event(defines.events.on_rocket_launched, onRocketLaunch)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name" : "Rampant",
|
"name" : "Rampant",
|
||||||
"factorio_version" : "0.18",
|
"factorio_version" : "0.18",
|
||||||
"version" : "0.18.11",
|
"version" : "0.18.12",
|
||||||
"title" : "Rampant",
|
"title" : "Rampant",
|
||||||
"author" : "Veden",
|
"author" : "Veden",
|
||||||
"homepage" : "https://forums.factorio.com/viewtopic.php?f=94&t=31445",
|
"homepage" : "https://forums.factorio.com/viewtopic.php?f=94&t=31445",
|
||||||
|
@ -53,21 +53,26 @@ function movementUtils.findMovementPositionDistort(surface, position)
|
|||||||
return distortPosition(pos, 8)
|
return distortPosition(pos, 8)
|
||||||
end
|
end
|
||||||
|
|
||||||
function movementUtils.addMovementPenalty(units, chunk)
|
function movementUtils.addMovementPenalty(squad, chunk)
|
||||||
if (chunk == -1) or (squadChunk == chunk) then
|
if (chunk == -1) or (squad.chunk == chunk) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local penalties = units.penalties
|
local penalties = squad.penalties
|
||||||
for i=1,#penalties do
|
for i=1,#penalties do
|
||||||
local penalty = penalties[i]
|
local penalty = penalties[i]
|
||||||
if (penalty.c == chunk) then
|
if (penalty.c == chunk) then
|
||||||
penalty.v = (2 * penalty.v) + MOVEMENT_PENALTY_AMOUNT
|
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
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if (#penalties == 7) then
|
if (#penalties == 7) then
|
||||||
tableRemove(penalties, 7)
|
tableRemove(penalties, 7)
|
||||||
end
|
end
|
||||||
|
print(squad.group.group_number)
|
||||||
tableInsert(penalties,
|
tableInsert(penalties,
|
||||||
1,
|
1,
|
||||||
{ v = MOVEMENT_PENALTY_AMOUNT,
|
{ 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.x = squadPosition.x
|
||||||
newSquad.frenzyPosition.y = squadPosition.y
|
newSquad.frenzyPosition.y = squadPosition.y
|
||||||
end
|
end
|
||||||
addSquadToChunk(map, chunk, newSquad)
|
|
||||||
addMovementPenalty(newSquad, chunk)
|
addMovementPenalty(newSquad, chunk)
|
||||||
|
addSquadToChunk(map, chunk, newSquad)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user