Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ship grabber #3565

Merged
merged 3 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions objects/kheAA/kheAA_grabber/kheAA_grabber.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
require "/scripts/kheAA/excavatorCommon.lua"

local vacuumRegion

function init()
excavatorCommon.init()
vacuumRegion = config.getParameter("vacuumRegion")
end

function update(dt)
Expand All @@ -18,6 +21,8 @@ function anims()

end

function setRunning()

end
function setRunning(bState)
if vacuumRegion then
physics.setForceEnabled(vacuumRegion, bState)
end
end
51 changes: 51 additions & 0 deletions objects/kheAA/kheAA_grabber/kheAA_grabbership.object
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"objectName" : "network_grabbership",
"objectType" : "physics",
"colonyTags" : ["wired"],
"printable" : false,
"rarity" : "essential",
"description" : "Specialized grabber only for use on ships. Absolutely massive range, but no storage.
^blue;Input: ^white;On/Off Switch^reset;",
"shortdescription" : "Grabber (Ship)",
"tooltipKind" : "basenew",
"race" : "generic",

"category" : "wire",
"price" : 64,

"inventoryIcon" : "kheAA_grabbericon.png",
"orientations" : [
{
"image" : "kheAA_grabber.png:<color>.off",
"imagePosition" : [0, 0],

"spaceScan" : 0.1,
"anchors" : [ "background" ]
}
],

"scripts" : [ "/objects/kheAA/kheAA_grabber/kheAA_grabber.lua"],
"scriptDelta" : 1,
"physicsForces":{
"pull":{
"type":"RadialForceRegion",
"categoryWhitelist":["itemdrop"],
"outerRadius":40,
"innerRadius":3,
"targetRadialVelocity":-20,
"controlForce":1200
}
},
"animationParts" : {
"grabber" : "kheAA_grabber.png"
},
"animationPosition" : [0, 0],
"kheAA_logicNode":0,
"kheAA_isVacuum":true,
"kheAA_vacuumDelay":1,
"kheAA_vacuumRange":10000,
"kheAA_vacuumMinRange":4,
"kheAA_limitToShip":true,
"vacuumRegion":"pull",
"inputNodes" : [ [0, 0] ]
}
15 changes: 15 additions & 0 deletions recipes/kheAA/kheAA_grabbership.recipe
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"input" : [
{ "item" : "network_grabber3", "count" : 1 },
{ "item" : "refinedaegisalt", "count" : 1 },
{ "item" : "refinedferozium", "count" : 1 },
{ "item" : "refinedviolium", "count" : 1 },
{ "item" : "corefragmentore", "count" : 1 },
{ "item" : "teleportercore", "count" : 1 }
],
"output" : {
"item" : "network_grabbership",
"count" : 1
},
"groups" : [ "powerstation2", "network", "all" ]
}
16 changes: 16 additions & 0 deletions scripts/kheAA/excavatorCommon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ function excavatorCommon.init()
sb.logInfo("excavatorCommon disabled on non-objects (current is \"%s\") for safety reasons.",entityType.entityType())
return
end
if (config.getParameter("kheAA_limitToShip")==true) and not (type(world.getProperty("ship.level"))=="number") then
storage.state="disabled"
return
end
excavatorCommon.vars={}
excavatorCommon.vars.direction=util.clamp(object.direction(),0,1)
excavatorCommon.vars.facing=object.direction()
Expand Down Expand Up @@ -67,6 +71,7 @@ function excavatorCommon.init()

if excavatorCommon.vars.isVacuum then
excavatorCommon.vars.vacuumRange=config.getParameter("kheAA_vacuumRange",4)
excavatorCommon.vars.vacuumMinRange=config.getParameter("kheAA_vacuumMinRange")
excavatorCommon.vars.vacuumDelay=config.getParameter("kheAA_vacuumDelay",0)--in seconds
end

Expand Down Expand Up @@ -245,6 +250,17 @@ function excavatorCommon.grab(grabPos)
return
end
local drops = world.itemDropQuery(grabPos,excavatorCommon.vars.vacuumRange)
if excavatorCommon.vars.vacuumMinRange then
drops = util.filter(drops,
function(entityId)
if world.magnitude(grabPos, world.entityPosition(entityId)) < excavatorCommon.vars.vacuumMinRange then
--sb.logInfo("eid %s too close",entityId)
return false
end
return true
end
)
end
--local size=world.containerItemsCanFit(transferUtil.vars.containerId,drops[i])
for _,id in pairs(drops) do
--if entity.entityInSight(drops[i])
Expand Down
4 changes: 2 additions & 2 deletions zb/researchTree/fu_power.config
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
"position" : [-120, 0],
"children" : [ "worker2", "wiringadv", "manufacturing" ],
"price" : [["fuscienceresource", 800], ["electromagnet", 5], ["laserdiode", 5]],
"unlocks" : [ "network_router", "network_pointsensor", "configurable3statecycler", "network_terminal", "network_repeater", "fu_watcher", "isn_incinerator", "network_containerlink", "network_containerlink2", "network_spout", "pumpoutfu", "pumpinfu", "pumpoutpressurefu", "network_currencytoken", "network_unhandledtoken", "smartbox_singular", "smartbox_comparer", "smartbox_halver", "smartbox_splitter", "network_dropper", "network_capacitySensor", "network_itemsensor", "network_grabber", "network_grabber2", "network_grabber3", "massincinerator" ]
"unlocks" : [ "network_router", "network_pointsensor", "configurable3statecycler", "network_terminal", "network_repeater", "fu_watcher", "isn_incinerator", "network_containerlink", "network_containerlink2", "network_spout", "pumpoutfu", "pumpinfu", "pumpoutpressurefu", "network_currencytoken", "network_unhandledtoken", "smartbox_singular", "smartbox_comparer", "smartbox_halver", "smartbox_splitter", "network_dropper", "network_capacitySensor", "network_itemsensor", "network_grabber", "network_grabber2", "network_grabber3", "network_grabbership", "massincinerator" ]
},
"worker2" : {
"icon" : "/objects/kheAA/kheAA_pump/kheAA_pump_ironicon.png",
Expand Down Expand Up @@ -419,7 +419,7 @@
// "SOLAR2", "SOLAR3", "WINDPOWER", "FISSION", "BLASTFURNACE", "QUANTUMPOWER", "ARCSMELTER", "QUANTUMEXTRACTOR", "BATTERY2", "BATTERY3", "BATTERY4", "BATTERY5A", "BATTERY5B", "CENTRIFUGE2", "SIFTER2", "CENTRIFUGE3", "WORKER2", "WORKER3", "WORKER4", "WIRINGADV", "TURRETS", "MANUFACTURING", "ANSIBLE", "CONDENSER" "MIXER", "FILTER", "REGULATOR", "REGENMATRIX", "SOLAR1", "COMBUSTION", "BATTERY1", "ITEMNETWORK", "FISSION", "LIQUIDCOLLECTOR"

"versions":{
"fu_power" : "0.159"
"fu_power" : "0.1591"
},
"initiallyResearched" : {
"fu_power" : ["BASICTRAINING"]
Expand Down
Loading