1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-05-13 21:56:29 +02:00

Artillery usage playtime requirement

This commit is contained in:
MewMew 2018-12-02 19:29:20 +01:00
parent 8e477b7df6
commit 5a07407ae7
2 changed files with 28 additions and 12 deletions

View File

@ -115,20 +115,36 @@ local function on_built_entity(event)
end
end
--Artillery History
--Artillery History and Antigrief
local function on_player_used_capsule(event)
local player = game.players[event.player_index]
local position = event.position
local used_item = event.item
if used_item.name == "artillery-targeting-remote" then
if not global.artillery_history then global.artillery_history = {} end
if #global.artillery_history > 999 then global.artillery_history = {} end
local str = player.name .. " at X:"
str = str .. math.floor(position.x)
str = str .. " Y:"
str = str .. math.floor(position.y)
table.insert(global.artillery_history, str)
end
local used_item = event.item
if used_item.name ~= "artillery-targeting-remote" then return end
local playtime = player.online_time
if global.player_totals then
if global.player_totals[player.name] then
playtime = player.online_time + global.player_totals[player.name][1]
end
end
if playtime < 1296000 and player.admin == false then
player.print("You have not grown accustomed to this technology yet.", { r=0.22, g=0.99, b=0.99})
local area = {{position.x - 1, position.y - 1},{position.x + 1, position.y + 1}}
local entities = player.surface.find_entities_filtered({area = area, name = "artillery-flare"})
for _, e in pairs(entities) do
e.destroy()
end
return
end
if not global.artillery_history then global.artillery_history = {} end
if #global.artillery_history > 999 then global.artillery_history = {} end
local str = player.name .. " at X:"
str = str .. math.floor(position.x)
str = str .. " Y:"
str = str .. math.floor(position.y)
table.insert(global.artillery_history, str)
end
local blacklisted_types = {

View File

@ -9,7 +9,7 @@ require "player_list"
require "poll"
require "score"
--require "maps.tools.cheat_mode"
require "maps.tools.cheat_mode"
---- enable maps here ----
--require "maps.biter_battles"