From 8ea25982541f0cfd2a02c560b2374271882f8992 Mon Sep 17 00:00:00 2001 From: "kepler155c@gmail.com" Date: Tue, 7 May 2019 07:14:30 -0400 Subject: [PATCH] milo: unassign machine --- {neural => ignore}/rabbitRancher.lua | 12 +++++++----- milo/plugins/item/machinesTab.lua | 8 ++++++-- 2 files changed, 13 insertions(+), 7 deletions(-) rename {neural => ignore}/rabbitRancher.lua (93%) diff --git a/neural/rabbitRancher.lua b/ignore/rabbitRancher.lua similarity index 93% rename from neural/rabbitRancher.lua rename to ignore/rabbitRancher.lua index 712f5dd..6650c11 100644 --- a/neural/rabbitRancher.lua +++ b/ignore/rabbitRancher.lua @@ -10,8 +10,9 @@ local Util = require('util') local os = _G.os local BREEDING = 'Rabbit' -local WALK_SPEED = 2 -local MAX_GROWN = 18 +local WALK_SPEED = 1.3 +local MAX_GROWN = 100 +local BREED_DELAY = 120 neural.assertModules({ 'plethora:sensor', @@ -46,7 +47,7 @@ local function breed(entity) entity.lastFed = os.clock() fed[entity.id] = entity - neural.walkTo(entity, WALK_SPEED, 1) + neural.walkTo(entity, WALK_SPEED, .5) entity = neural.getMetaByID(entity.id) if entity and not entity.isChild then neural.lookAt(entity) @@ -57,7 +58,7 @@ end local function kill(entity) print('killing') - neural.walkTo(entity, WALK_SPEED, 2.5) + neural.walkTo(entity, WALK_SPEED, 2) entity = neural.getMetaByID(entity.id) if entity and not entity.isChild then neural.lookAt(entity) @@ -77,7 +78,8 @@ end local function getHungry(entities) for _,v in pairs(entities) do - if not fed[v.id] or os.clock() - fed[v.id].lastFed > 90 then + if not fed[v.id] or + os.clock() - fed[v.id].lastFed > BREED_DELAY then return v end end diff --git a/milo/plugins/item/machinesTab.lua b/milo/plugins/item/machinesTab.lua index ce61d13..5bdd82d 100644 --- a/milo/plugins/item/machinesTab.lua +++ b/milo/plugins/item/machinesTab.lua @@ -51,11 +51,15 @@ end function machinesTab:eventHandler(event) if event.type == 'grid_select' then - Craft.machineLookup[self.item.key] = event.selected.name + if event.selected.name == Craft.machineLookup[self.item.key] then + Craft.machineLookup[self.item.key] = nil + else + Craft.machineLookup[self.item.key] = event.selected.name + end Util.writeTable(Craft.MACHINE_LOOKUP, Craft.machineLookup) self.grid:draw() - self:emit({ type = 'info_message', message = 'Machine saved' }) + self:emit({ type = 'info_message', message = 'Saved' }) return true end