1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-06 00:23:49 +02:00

small tweak

This commit is contained in:
MewMew 2019-11-09 14:14:21 +01:00
parent 4413fadd2d
commit c370333c78

View File

@ -12,6 +12,7 @@ local strings = {
"nibble", "nibble",
"nom", "nom", "nom", "nom", "nom", "nom", "nom", "nom", "nom", "nom", "nom", "nom", "nom", "nom", "nom", "nom", "nom", "nom", "nom", "nom", "nom", "nom"
}
local size_of_strings = #strings
local whitelist = {
["small-biter"] = true,
@ -24,11 +25,11 @@ local function on_entity_damaged(event)
if not event.cause then return end
if not event.cause.valid then return end
if not whitelist[event.cause.name] then return end
if math.random(1,5) == 1 then
if math_random(1,5) == 1 then
event.cause.surface.create_entity({
name = "flying-text",
position = event.cause.position,
text = strings[math_random(1,#strings)],
text = strings[math_random(1, size_of_strings)],
color = {r = math_random(130, 170), g = math_random(130, 170), b = 130}
})
end