Skip to content
This repository was archived by the owner on Nov 21, 2017. It is now read-only.

Commit 176d98f

Browse files
committed
Fix bug where Micro-HARPA would not work you have never built a regular HARPA before
1 parent 5281c15 commit 176d98f

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PACKAGE_NAME := Misanthrope
2-
VERSION_STRING := 0.2.3
2+
VERSION_STRING := 0.2.4
33

44
OUTPUT_NAME := $(PACKAGE_NAME)_$(VERSION_STRING)
55
OUTPUT_DIR := build/$(OUTPUT_NAME)

libs/harpa.lua

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ require "defines"
22

33
Harpa = {}
44

5-
function Harpa.register(entity, player_idx)
5+
function Harpa.setup()
66
if not global.harpa_list then
77
global.harpa_list = {}
88
end
@@ -18,7 +18,10 @@ function Harpa.register(entity, player_idx)
1818
if not global.harpa_overlays then
1919
global.harpa_overlays = {}
2020
end
21+
end
2122

23+
function Harpa.register(entity, player_idx)
24+
Harpa.setup()
2225
if Harpa.is_powered(entity, nil) then
2326
if player_idx then
2427
Harpa.create_overlay(entity, player_idx)
@@ -139,7 +142,7 @@ end
139142
function Harpa.tick()
140143
if global.harpa_list then
141144
if not global.idle_harpa_list then global.idle_harpa_list = {} end
142-
145+
Harpa.setup()
143146
Harpa.update_overlays()
144147

145148
-- check idle emitters less often
@@ -209,6 +212,7 @@ function Harpa.update_power_armor()
209212
for i = 1, #game.players do
210213
local player = game.players[i]
211214
if Harpa.has_micro_emitter(player) and not Harpa.is_idle(player, 20) then
215+
Harpa.setup()
212216
table.insert(global.micro_harpa_players, player)
213217
end
214218
end
@@ -217,6 +221,7 @@ function Harpa.update_power_armor()
217221
for i = #global.micro_harpa_players, 1, -1 do
218222
local player = global.micro_harpa_players[i]
219223
if Harpa.has_micro_emitter(player) then
224+
Harpa.setup()
220225
Harpa.tick_emitter(player, 16)
221226
else
222227
table.remove(global.micro_harpa_players, i)
@@ -319,12 +324,14 @@ function Harpa.tick_emitter(entity, radius)
319324
end
320325

321326
function Harpa.ignore_biter(entity)
322-
for i = #global.biter_ignore_list, 1, -1 do
323-
local biter_data = global.biter_ignore_list[i]
324-
if not biter_data.biter.valid or game.tick > biter_data.until_tick then
325-
table.remove(global.biter_ignore_list, i)
326-
elseif biter_data.biter == entity then
327-
return true
327+
if global.biter_ignore_list then
328+
for i = #global.biter_ignore_list, 1, -1 do
329+
local biter_data = global.biter_ignore_list[i]
330+
if not biter_data.biter.valid or game.tick > biter_data.until_tick then
331+
table.remove(global.biter_ignore_list, i)
332+
elseif biter_data.biter == entity then
333+
return true
334+
end
328335
end
329336
end
330337
return false

0 commit comments

Comments
 (0)