1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-14 02:34:09 +02:00

module addition

This commit is contained in:
MewMew 2019-05-07 23:38:14 +02:00
parent a71a4b4b8e
commit 8ef281b88c
4 changed files with 44 additions and 2 deletions

View File

@ -2,6 +2,10 @@
require "maps.wave_of_death.intro"
require "modules.biter_evasion_hp_increaser"
require "modules.custom_death_messages"
require "modules.dangerous_goods"
require "modules.floaty_chat"
local event = require 'utils.event'
local init = require "maps.wave_of_death.init"
local on_chunk_generated = require "maps.wave_of_death.terrain"

View File

@ -73,7 +73,7 @@ end
ai.trigger_new_wave = function(event)
local entity = event.entity
if entity.name ~= "loader" then return end
if game.tick < 18000 then entity.force.print(">> It is too early to spawn waves yet.", {r = 180, g = 0, b = 0}) return end
if game.tick < 18000 then entity.force.print(">> It is too early to call waves yet.", {r = 180, g = 0, b = 0}) return end
if #game.players < 4 then entity.force.print(">> More players are required to spawn waves.", {r = 180, g = 0, b = 0}) return end
local lane_number = tonumber(entity.force.name)
if not global.wod_lane[lane_number] then return end

View File

@ -41,7 +41,7 @@ local function init_forces(surface)
force.share_chart = true
for _, force_2 in pairs(game.forces) do
if force_2.name ~= "enemy" then
force.set_friend(force_2.name, true)
force.set_cease_fire(force_2.name, true)
end
end
end

38
modules/floaty_chat.lua Normal file
View File

@ -0,0 +1,38 @@
local event = require 'utils.event'
local function on_console_chat(event)
if not event.message then return end
if not event.player_index then return end
local player = game.players[event.player_index]
if not player.character then return end
if global.player_floaty_chat[player.index] then
rendering.destroy(global.player_floaty_chat[player.index])
global.player_floaty_chat[player.index] = nil
end
global.player_floaty_chat[player.index] = rendering.draw_text{
text = event.message,
surface = player.surface,
target = player.character,
target_offset = {-0.1, -3},
color = {
r = player.color.r * 0.6 + 0.25,
g = player.color.g * 0.6 + 0.25,
b = player.color.b * 0.6 + 0.25,
a = 1
},
time_to_live = 600,
scale = 0.9,
font = "default-game",
alignment = "center",
scale_with_zoom = true
}
end
local function on_init(event)
global.player_floaty_chat = {}
end
event.on_init(on_init)
event.add(defines.events.on_console_chat, on_console_chat)