Welcome to the new Diaspora forums, please let us know if you see anything broken! Notice: Some users may need to reupload their avatars due to an issue during forum setup!
RDA Automatic Mining Drones
Ever wanted to go space mining but didn't actually want to do anything?
Want to put something in those empty hangars of your titan or station that are useful?
Introducing RDA Automatic Mining Drone Starfall!
the RDA Practical Science Division has been working on this for about 3 months (I know it looks like a long time for something like this put part of the process was learning Starfall). This chip allows you to create automatic Drones that go mining for you!
How to use/Commands:
Put chip onto drone (it needs to be an industrial core with a mineral collection beam and some solar panels at the minimum)
Make sure your mining lasers are facing the front of the ship
Wire "Fire" input on your lasers to "Fire" on the output of the Starfall
Wire "Drone" to your drones parent prop
Wire "Station" to your drones docking station
Parent your ship
!Dock to teleport the Drone to your specified docking location
!Teleport to teleport the Drone to a random asteroid on the map (Capacitor must be at least 90%)
!LaserOn to activate your mining lasers
!LaserOff to deactivate your mining lasers
When your done mining you should teleport the Drone to the Dock and pump all your minerals into Global storage for later use
Code:
Github: https://github.com/elwolf6/G-Data/blob/master/Starfall/RDA Automated Drone Mining Computer.txt
Update: Implemented some of NinjrKillr's reforms
Name changed to Semi-Automated drones
All the commands have been moved into one function
DroneFalse moved into DroneMove which is in Commands function now
Made it so you don't have to put your name in the Operator table it auto puts the owner in there
Update 2: removed useless crap from older version of the Starfall
Want to put something in those empty hangars of your titan or station that are useful?
Introducing RDA Automatic Mining Drone Starfall!
the RDA Practical Science Division has been working on this for about 3 months (I know it looks like a long time for something like this put part of the process was learning Starfall). This chip allows you to create automatic Drones that go mining for you!
How to use/Commands:
Put chip onto drone (it needs to be an industrial core with a mineral collection beam and some solar panels at the minimum)
Make sure your mining lasers are facing the front of the ship
Wire "Fire" input on your lasers to "Fire" on the output of the Starfall
Wire "Drone" to your drones parent prop
Wire "Station" to your drones docking station
Parent your ship
!Dock to teleport the Drone to your specified docking location
!Teleport to teleport the Drone to a random asteroid on the map (Capacitor must be at least 90%)
!LaserOn to activate your mining lasers
!LaserOff to deactivate your mining lasers
When your done mining you should teleport the Drone to the Dock and pump all your minerals into Global storage for later use
Code:
Github: https://github.com/elwolf6/G-Data/blob/master/Starfall/RDA Automated Drone Mining Computer.txt
--@name RDA Semi-Automated Drone Mining Computer --@author RDA Practical Science Division --@autoupdate -- Credits -- njits23 and hobnob: (IsOperator func) -- LtBrandon: Misc Lua things -- elwolf6: everything else -- How to use -- Put starfall on drone -- Wire "Fire" on mining laser to "Fire" on starfall -- Parent drone -- When the drone is at full Capacitor do !teleport -- do !laseron to start mining (dont worry if you start to lose a lot of Capacitor, the laser is still running) -- do !laseroff after like 5 minutes -- do !dock -- pump your stuff in Global Storage if SERVER then --Config Operators = {tostring(entities.owner()),"elwolf6"} --Put the people who should have access to the drone here. do not remove entities.owner() or else you wont be able to operate the drone --More things will be added here like wheather you want the drone to orbit the asteroid and such --End Config wire.adjustInputs({"Drone","Station"}, {"Entity","Entity"}) wire.adjustOutputs({"Fire"},{"Normal"}) ENT = {Entity=entities.self()} Drone = wire.ports.Drone DroneCore = Drone:GetCoreEntity() Station = wire.ports.Station --Asteroid finding AstTable = find.ByClass("mining_asteroid") --Find all the asteroids (returns table) Asteroid = AstTable[1] -- Pick the first thing in the table (returns entity) --Find operators (got this function from HobCo), this stops random people from using the Drone function IsOperator(Ent) for I=1,#Operators do if Ent == FindPlayerByName(Operators[I]) then return true end end return false end hook.Add("Think","OperatorCheck", IsOperator) -- Hook that calls IsOperator every server tick timer.Simple( 0.1, function() hook.Add("PlayerSay","DroneFalse", function(ply, text) if ( string.lower( text ) == "!teleport") and IsOperator(entities.player()) and ( DroneCore:GetCapAmount()/DroneCore:GetCapMax() < 0.89) then print("Drone doesnt have enough Capacitor!") return "" end end) end ) function Commands(ply, text) --All of the commands are in this function --!Teleport command if ( string.lower( text ) == "!teleport") and IsOperator(entities.player()) and ( DroneCore:GetCapAmount()/DroneCore:GetCapMax() > 0.89) then Drone:SetPos(Asteroid:GetPos() + Vector(0,0,0)) Drone:SetAngles((Asteroid:GetPos() - Drone:GetPos()):Angle()) Drone:SetFrozen(true) timer.Simple(0.1,function() print("Drone Teleported to Asteroid") end) return "" --Hide the command from chat end if ( string.lower( text ) == "!teleport") and IsOperator(entities.player()) and ( DroneCore:GetCapAmount()/DroneCore:GetCapMax() < 0.89) then print("Drone doesnt have enough Capacitor!") return "" end --!Dock command if ( string.lower( text ) == "!dock") and IsOperator(entities.player()) then Drone:SetPos(Station:GetPos() + Vector(0,0,200)) Drone:SetAngles(Angle(0,0,0)) timer.Simple(0.1,function() print("Drone Teleported to Dock!") end) return "" --Hide command from chat end --!LaserOn command if ( string.lower( text ) == "!laseron") and IsOperator(entities.player()) then timer.Simple(0.1,function() print("Mining Laser On!") end) Drone:SetAngles((Asteroid:GetPos() - Drone:GetPos()):Angle()) wire.TriggerOutput("Fire", 1) return "" --Hide the command from chat end if ( string.lower( text ) == "!laseroff") and IsOperator(entities.player()) then timer.Simple(0.1,function() print("Mining Laser shutting down") end) wire.TriggerOutput("Fire", 0) return "" --Hide the command from chat end end hook.Add("PlayerSay","Commands",Commands) --Hook to tell the function to run end
Update: Implemented some of NinjrKillr's reforms
Name changed to Semi-Automated drones
All the commands have been moved into one function
DroneFalse moved into DroneMove which is in Commands function now
Made it so you don't have to put your name in the Operator table it auto puts the owner in there
Update 2: removed useless crap from older version of the Starfall
Tagged:
Comments
[*] Why's it called an automated drone when it.... isn't?
[*] Why do you have a think hook running the isOperator command? I feel like that will achieve nothing more than pointless calculations on tick.
[*] I feel like having one function in PlayerSay that forks out to the different commands might be more efficient? I see a lot of reused code that could be consolidated.
[*] Is there no owner() command, to automatically populate yourself into the Operators list?
[*] The DroneFalse hook, in the timer? Could be merged with the DroneMove hook, because they're doing the exact same check. Just put the "Not enough Capacitor" in an else.
[*] The apostrophe in your instructions makes half of the code on the forum look like a string. Maybe turn "don't" into "dont" (in !laseron instructions), to make it a little more readable here
PS: Yay for BBCode lists not working properly. @LtBrandon