Giter VIP home page Giter VIP logo

jumpdrive's Introduction

Minetest jumpdrive

A simple Jumpdrive for minetest

Take your buildings with you on your journey

Operation

  • Place a 'jumpdrive:engine' into the center of your creation.
  • Connect the engine to a technic HV network
  • Let the engine charge
  • Choose your target coordinates (should be air or ignore blocks)
  • Select your cube-radius
  • Click "show" and check the green (source) and red (target) destination markers if everything is in range
  • Click "jump"

Example setup with technic:

Compatibility

Optional dependencies:

  • Mesecon interaction (execute jump on signal)
  • Technic rechargeable (HV)
  • Travelnet box (gets rewired after jump)
  • Elevator (on_place gets called after jump)
  • Locator (gets removed and added after each jump)
  • Pipeworks teleport tubes (with a patch to pipeworks)
  • Beds (thx to @tuedel)
  • Ropes (thx to @tuedel)
  • Mission-wand as coordinate bookmark (thx to @SwissalpS)
  • Compass as coordinate bookmark (thx to @SwissalpS)
  • Areas
  • Drawers

Fuel

The engine can be connected to a technic HV network or fuelled with power items. Power items are one of the following

  • default:mese_crystal_fragment
  • default:mese_crystal
  • default:mese

Energy requirements

The energy requirements formula looks like this: 10 x radius x distance

For example:

  • Distance: 100 blocks
  • Radius: 5 blocks
  • Required energy: 10 x 5 x 100 = 5000

Upgrades

If the technic mod is installed the following items can be used in the upgrade slot:

  • technic:red_energy_crystal increases power storage
  • technic:green_energy_crystal increases power storage
  • technic:blue_energy_crystal increases power storage
  • technic:control_logic_unit increases power recharge rate

Protection

The source and destination areas are checked for protection so you can't remove and jump into someone else's buildings.

Screenshots

Interface:

Example:

Advanced operation

Coordinate bookmarking

You can place empty books into the drive inventory and write the coordinates to them with the "Write to book" button. The "Read from bookmark" button reads the coordinates from the next valid bookmark item in the inventory. From right to left. A used bookmark item is placed in the first free slot from the left. Bookmark items are:

  • Written books saved by jumpdrive (or correctly by hand)
  • Mission position wands
  • Compasses

Diglines

Settings

Settings in minetest.conf:

  • jumpdrive.max_radius max radius of the jumpdrive (default: 15)
  • jumpdrive.max_area_radius max radius of the area jumpdrive (default: 25)
  • jumpdrive.powerstorage power storage of the drive (default: 1000000)
  • jumpdrive.power_requirement power requirement for charging (default: 2500)

Lua api

Preflight check

The preflight check can be overriden to execute additional checks:

jumpdrive.preflight_check = function(source, destination, radius, player)
	-- check for height limit, only space travel allowed
	if destination.y < 1000 then
		return { success=false, message="Atmospheric travel not allowed!" }
	end

	-- everything ok
	return { success=true }
end

Fuel calc

The default fuel calc can be overwritten by a depending mod:

-- calculates the power requirements for a jump
jumpdrive.calculate_power = function(radius, distance, sourcePos, targetPos)
	return 10 * distance * radius
end

Movenode compatibility

Nodes can be made aware of a changing position if they implement a on_movenode function on the node-definition:

-- example with an override
minetest.override_item("travelnet:travelnet", {
  on_movenode = function(from_pos, to_pos, additional_info)
    -- additional_info = { edge = { x=0, y=0, z=0 } }
    -- magic!
  end
})
  • additional_info.edge is the vector to the nearest edge if any

Hooks

-- register a callback that is called upon jump completion
-- can also be used if the `on_movenode` above needs a kind of "commit" to write the changed state to files
jumpdrive.register_after_jump(function(from_area, to_area)
	-- from_area/to_area = { pos1, pos2 }
end)

Sources

Contributors

  • @tuedel
  • @SwissalpS
  • @Panquesito7
  • @OgelGames
  • @S-S-X
  • Jeremy#2233
  • Purple#2916

License

  • Code: MIT
  • Textures CC BY-SA 4.0

Attributions

  • textures/jumpdrive.png/textures/jumpdrive_backbone.png/textures/jumpdrive_fleet_controller.png/textures/jumpdrive_warpdevice.png
  • Jeremy#2233 / Purple#2916

jumpdrive's People

Contributors

buckaroobanzay avatar lejo1 avatar naturefreshmilk avatar nonfreegithub avatar ogelgames avatar panquesito7 avatar s-s-x avatar swissalps avatar thomasrudin avatar tuedel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jumpdrive's Issues

advtrains compat

  • rails (ndb update, global var)
  • trains (?)
  • trains with players attached (!!?)
  • interlocking ๐Ÿ˜ž

Air blocks are not preserved when jumping.

It seems as though if you jump inside of something (In my case underground) all the empty air fills with whatever you jumped into? Inside my ship was completely dark and I was wondering why until I realized I was inside of a node xD.

Problem with node timers (mesecon button for example)

When using a mesecon button to trigger jumpdrive, once jumped, the mesecon button stays in "pressed" state. I guess this is due to node timer not referring to the old position.

Easy way to solve this would be to transform mesecons_button:button_on into mesecons_button:button_off when jumping.

Best way would be to find a way to "move" node timers.

Allow y-rotation of jump area

Rotation about the y-axis should work with most mods; x and z would probably break mesecons and the likes.

Possibly related: #16

Make Books RE-Writable

it would be nice to re-write books.. when moving around it would be nice to have a book that is the last location i was mining in. i edit the book manually to do this now.. that or make it easy to copy and past the location into a jump drive book already written to...

maybe a confirmation (are you sure?) when overwriting

low priority: books can disappear if user really tries hard

https://github.com/thomasrudin-mt/jumpdrive/blob/3f537615099f2c8c6555b63cc591958179adc41d/common.lua#L304

If book is emptied by user manually it still registers as a written book and does not give nil when deserialized. Same applies if all lines are commented out.

To reproduce: take a book with coordinates and comment out the line. Place in jumpdrive and press "read from book"
2nd way: manually replace title and contents with a space and save.

This was detected by xercyst. I told him that was user error but mention it here anyway.

Emerge unloaded destination

https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L3229

  • minetest.emerge_area(pos1, pos2, [callback], [param])
    • Queue all blocks in the area from pos1 to pos2, inclusive, to be
      asynchronously fetched from memory, loaded from disk, or if inexistent,
      generates them.
    • If callback is a valid Lua function, this will be called for each block
      emerged.
    • The function signature of callback is:
      • function EmergeAreaCallback(blockpos, action, calls_remaining, param)
        • blockpos is the block coordinates of the block that had been
          emerged.
        • action could be one of the following constant values:
          • minetest.EMERGE_CANCELLED
          • minetest.EMERGE_ERRORED
          • minetest.EMERGE_FROM_MEMORY
          • minetest.EMERGE_FROM_DISK
          • minetest.EMERGE_GENERATED
        • calls_remaining is the number of callbacks to be expected after
          this one.
        • param is the user-defined parameter passed to emerge_area (or
          nil if the parameter was absent).

Clear meta after jump

Lots of remaining inv and infotexts on stones
Most popular: switching station and sorting pipes

Lost metadata

Sometimes metadata is lost when jumpdrive is being used. For instance, protection blocks are reset, books disappear from a jumpdrive, etc. I think a thread might be stopping since some error happens after several consecutive jumps.

Allow for single-step jump

move.lua has to be changed to handle the overlapping case.
Second move-function with relative in-region offset and the envelope as parameters
Related: #24

Add nodedef override/api

-- "simple" move node
minetest.register_node("my:node", {
 on_movenode = function(from, to)
 end
})

-- callback for jump finalization stage (for example savefile writes)
jumpdrive.register_after_jump(function(from_area, to_area)
  -- from_area = { pos1, pos2 }
  -- to_area = { pos1, pos2 }
end)

infotext/formspec issue

I fixed a few more things, and also found a bug with the fleet controller, where the infotext and formspec doesn't update after jumping, but I'm not sure how to fix it... confused

1-step ability

invert moving for-loops according to direction, should make this possible

Add fleet controller

Prerequisites

  • Add backbone node to connect jumpdrives to each other

Jump process

  • Scan backbone for engines
  • Order by distance
  • Calculate vector and relative/absolute positions
  • Execute preflight sequentially each second or two
  • Execute jump sequentially

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.