milo: unassign machine
This commit is contained in:
@@ -10,8 +10,9 @@ local Util = require('util')
|
|||||||
local os = _G.os
|
local os = _G.os
|
||||||
|
|
||||||
local BREEDING = 'Rabbit'
|
local BREEDING = 'Rabbit'
|
||||||
local WALK_SPEED = 2
|
local WALK_SPEED = 1.3
|
||||||
local MAX_GROWN = 18
|
local MAX_GROWN = 100
|
||||||
|
local BREED_DELAY = 120
|
||||||
|
|
||||||
neural.assertModules({
|
neural.assertModules({
|
||||||
'plethora:sensor',
|
'plethora:sensor',
|
||||||
@@ -46,7 +47,7 @@ local function breed(entity)
|
|||||||
entity.lastFed = os.clock()
|
entity.lastFed = os.clock()
|
||||||
fed[entity.id] = entity
|
fed[entity.id] = entity
|
||||||
|
|
||||||
neural.walkTo(entity, WALK_SPEED, 1)
|
neural.walkTo(entity, WALK_SPEED, .5)
|
||||||
entity = neural.getMetaByID(entity.id)
|
entity = neural.getMetaByID(entity.id)
|
||||||
if entity and not entity.isChild then
|
if entity and not entity.isChild then
|
||||||
neural.lookAt(entity)
|
neural.lookAt(entity)
|
||||||
@@ -57,7 +58,7 @@ end
|
|||||||
|
|
||||||
local function kill(entity)
|
local function kill(entity)
|
||||||
print('killing')
|
print('killing')
|
||||||
neural.walkTo(entity, WALK_SPEED, 2.5)
|
neural.walkTo(entity, WALK_SPEED, 2)
|
||||||
entity = neural.getMetaByID(entity.id)
|
entity = neural.getMetaByID(entity.id)
|
||||||
if entity and not entity.isChild then
|
if entity and not entity.isChild then
|
||||||
neural.lookAt(entity)
|
neural.lookAt(entity)
|
||||||
@@ -77,7 +78,8 @@ end
|
|||||||
|
|
||||||
local function getHungry(entities)
|
local function getHungry(entities)
|
||||||
for _,v in pairs(entities) do
|
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
|
return v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -51,11 +51,15 @@ end
|
|||||||
|
|
||||||
function machinesTab:eventHandler(event)
|
function machinesTab:eventHandler(event)
|
||||||
if event.type == 'grid_select' then
|
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)
|
Util.writeTable(Craft.MACHINE_LOOKUP, Craft.machineLookup)
|
||||||
|
|
||||||
self.grid:draw()
|
self.grid:draw()
|
||||||
self:emit({ type = 'info_message', message = 'Machine saved' })
|
self:emit({ type = 'info_message', message = 'Saved' })
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user