From a2bee6628fdf0796960206ed206d19056360fbf3 Mon Sep 17 00:00:00 2001 From: grilledham Date: Sat, 19 May 2018 13:53:29 +0100 Subject: [PATCH] more market command to fish_market.lua --- custom_commands.lua | 1 - fish_market.lua | 8 +++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/custom_commands.lua b/custom_commands.lua index 05abfa40..626fec1f 100644 --- a/custom_commands.lua +++ b/custom_commands.lua @@ -463,7 +463,6 @@ commands.add_command("tpplayer", " - Teleports you to the player. (Admin commands.add_command("invoke", " - Teleports the player to you. (Admins and moderators)", invoke) commands.add_command("tppos", "Teleports you to a selected entity. (Admins only)", teleport_location) commands.add_command("walkabout", ' - Send someone on a walk. (Admins and moderators)', walkabout) -commands.add_command("market", 'Places a fish market near you. (Admins only)', spawn_market) commands.add_command("regulars", 'Prints a list of game regulars.', print_regulars) commands.add_command("regular", ', Change regular status of a player. (Admins and moderators)', regular) commands.add_command("mods", 'Prints a list of game mods.', print_mods) diff --git a/fish_market.lua b/fish_market.lua index 796b9828..3c9dd3b8 100644 --- a/fish_market.lua +++ b/fish_market.lua @@ -19,7 +19,7 @@ make pet follow you moar local Event = require "utils.event" -function spawn_market(cmd) +local function spawn_market(cmd) if not game.player or not game.player.admin then cant_run(cmd.name) return @@ -352,7 +352,7 @@ end if not global.pet_command_rotation then global.pet_command_rotation = 1 end -function on_180_ticks() +local function on_180_ticks() if game.tick % 900 == 0 then if global.player_speed_boost_records then @@ -399,13 +399,15 @@ function on_180_ticks() end end -function fish_player_crafted_item(event) +local function fish_player_crafted_item(event) local x = math.random(1,50) if x == 1 then fish_earned(event, 1) end end +commands.add_command("market", 'Places a fish market near you. (Admins only)', spawn_market) + Event.on_nth_tick(180, on_180_ticks) Event.add(defines.events.on_pre_player_mined_item, pre_player_mined_item) Event.add(defines.events.on_entity_died, fish_drop_entity_died)