Commit Graph

11482 Commits

Author SHA1 Message Date
teknomunk
929d7a6492 Make trains experimental behind a setting 2024-12-31 02:36:18 +01:00
teknomunk
b627d71750 Allow curved special rail conversion without dropping as item 2024-12-31 02:36:18 +01:00
teknomunk
6559bc23f9 Fix orientation of carts on slopes 2024-12-31 02:36:18 +01:00
teknomunk
e28b55c16a Replace linear cart fill with mcl_loot.fill_inventory() using a fake inventory, remove debug print 2024-12-31 02:36:18 +01:00
teknomunk
bf3b98021f Fix conversion of cart inventories to mod storage without duplicating items 2024-12-31 02:36:18 +01:00
teknomunk
a694675b87 Remove stray line 2024-12-31 02:36:18 +01:00
teknomunk
8118495c80 Add guard to prevent crash and log when this happens 2024-12-31 02:36:18 +01:00
teknomunk
3cc8a8474d Fix rebase duplicating code 2024-12-31 02:36:18 +01:00
teknomunk
8881048a4c Remove debug minetest.log() 2024-12-31 02:36:18 +01:00
teknomunk
ddb70e5ebf Increase off-rail friction, make off-rail carts shake, remove debug print 2024-12-31 02:36:18 +01:00
teknomunk
6f5760000e Address review comments 2024-12-31 02:36:18 +01:00
teknomunk
dd9edcb827 Change cart punching to impulse on velocity instead of acceleration, make punch impulse larger 2024-12-31 02:36:18 +01:00
teknomunk
bf3e9190b3 Fix syntax error from rebase, fix cart tilt, change cart speed to 4 blocks/second and make into a setting, make minecart settings compatibily with upcoming dynamic rules PR (#4662) 2024-12-31 02:36:18 +01:00
teknomunk
879175bb97 Fix crash when train cars leave track 2024-12-31 02:36:18 +01:00
teknomunk
fc38b6eea1 Add in working curved variants of special rails 2024-12-31 02:36:18 +01:00
teknomunk
f6f8c3e5bc Make powered rails always accelerate moving carts 2024-12-31 02:36:18 +01:00
teknomunk
fcbb4f6e34 Fix detector rail strangeness, prevent crash 2024-12-31 02:36:18 +01:00
teknomunk
524fe37f4a Use correct vectors for look directions east/west 2024-12-31 02:36:18 +01:00
teknomunk
cea82c07f8 Remove debug code 2024-12-31 02:36:18 +01:00
teknomunk
56a5a28e58 Fix minecart entity rotation 2024-12-31 02:36:18 +01:00
teknomunk
6143832ee3 Fix crash 2024-12-31 02:36:18 +01:00
teknomunk
c8611b08f9 Make straight rails with a free end bend towards newly placed rail and form corners 2024-12-31 02:36:18 +01:00
teknomunk
8e2a58a4c6 Finish restricting 45 degree movement code to horizontal plane 2024-12-31 02:36:18 +01:00
teknomunk
1503aaeced Fix vertical movement that was hitting 45 degree curve code, reset pitch on minecarts 2024-12-31 02:36:18 +01:00
teknomunk
e025070233 Fix friction on slopes, fix cart reversal when timestep is very small or zero 2024-12-31 02:36:18 +01:00
teknomunk
295589f032 Allow functions for _rail_acceleration, make powered rail only accelerate carts when one side of the rail is a solid block or stairs 2024-12-31 02:36:18 +01:00
teknomunk
3e6fe24a57 Remove instance of debug logging, change movement.lua function export 2024-12-31 02:36:18 +01:00
teknomunk
fd559ec40d Fix crash with minecart on activator rail 2024-12-31 02:36:18 +01:00
teknomunk
cc74a5e75e Fix cart pitch when detached 2024-12-31 02:36:18 +01:00
teknomunk
0ddecdff2a Add workaround to prevent random detached inventory doesn't exist warning when right-clicking entities with inventory 2024-12-31 02:36:18 +01:00
teknomunk
acd8195d9b Fix right-clicking nodes while holding rail 2024-12-31 02:36:18 +01:00
teknomunk
d6f6bd3fa1 Add back shift+punch to immediately drop minecart 2024-12-31 02:36:18 +01:00
teknomunk
b138add498 Fix another crash, fix rail tee on texture 2024-12-31 02:36:18 +01:00
teknomunk
e7c550858d Calculate acceleration of trains based on average of acceleration for all carts in the train, make velocity not change on slopes and 45 degree track 2024-12-31 02:36:18 +01:00
teknomunk
0119814c0d Prevent trains from slowing on 45 degree track 2024-12-31 02:36:18 +01:00
teknomunk
9ef2e02463 Add guard that prevents crash when itemstack is nil 2024-12-31 02:36:18 +01:00
teknomunk
ee49ff612d Silence debug prints and logging 2024-12-31 02:36:18 +01:00
teknomunk
8cde9d4244 Prevent removal of old minecarts 2024-12-31 02:36:18 +01:00
teknomunk
b963936c6d Add legacy node conversion to vl_legacy and update rails.lua to use it 2024-12-31 02:36:18 +01:00
teknomunk
46c1330d31 Make activated tnt minecarts glow in the dark, fix crash with lit tnt minecarts 2024-12-31 02:36:18 +01:00
teknomunk
3d7f45154b Fix a couple of crashes (TNT minecart trying to update orientation after exploding, trying to punch/push a minecart not on track) 2024-12-31 02:36:18 +01:00
teknomunk
b83fb8ccba Expand mcl_util.hopper_pull() to mcl_util.hopper_pull_to_inventory() 2024-12-31 02:36:18 +01:00
teknomunk
c328f9920e Add profiling code to force_get_node() 2024-12-31 02:36:18 +01:00
teknomunk
00665063da Address additional review comments 2024-12-31 02:36:18 +01:00
teknomunk
80c0f52e17 Update API documentation to always use , add compatibility shim to mcl_minecarts.is_rail() and mcl_minecarts.ge_rail_direction() 2024-12-31 02:36:18 +01:00
teknomunk
16caed401c Rewrite mcl_util.hopper_pull in terms of mcl_util.hopper_pull_to_inventory 2024-12-31 02:36:18 +01:00
teknomunk
a176d04bda Correct documentation per review 2024-12-31 02:36:18 +01:00
teknomunk
8c754bf55d Switch over to using vl_legacy for item conversion in player inventories 2024-12-31 02:36:18 +01:00
teknomunk
c165938c1b Fix typo 2024-12-31 02:36:18 +01:00
teknomunk
0dece0afbf Register rail conversions 2024-12-31 02:36:18 +01:00
teknomunk
b47288a260 Implement vl_legacy deprecated function and item conversion APIs 2024-12-31 02:36:18 +01:00
teknomunk
78afadd8b1 Fix crashes 2024-12-31 02:36:18 +01:00
teknomunk
41860500a3 Make old rails have a drawtype, make update lbm always run 2024-12-31 02:36:18 +01:00
teknomunk
dcb534bf9a Move the various rails to their own files, code cleanup 2024-12-31 02:36:18 +01:00
teknomunk
cd1e915638 Remove undefined global for optional environmental physics 2024-12-31 02:36:18 +01:00
teknomunk
f6a002a0b9 Remove Emerge-0 warning that occurs when placing mineshafts 2024-12-31 02:36:18 +01:00
teknomunk
9c7b4d366c Restore 45 degree cart movement, remove warning about unknown global 2024-12-31 02:36:18 +01:00
teknomunk
3eb1e82f7e Complete rework of curve/tee rail direction functions 2024-12-31 02:36:18 +01:00
teknomunk
788db71850 Rework rail_dir_curve to significantly reduce code size 2024-12-31 02:36:18 +01:00
teknomunk
8736f463ad Convert curved rails direction code to use fourdir 2024-12-31 02:36:18 +01:00
teknomunk
90cfa2cf40 Change verticle offset for testing reattaching to rail to 0.55, which is a bit more than the stair step height 2024-12-31 02:36:18 +01:00
teknomunk
2c22f1537e Fix cart detaching without unregistering from everything 2024-12-31 02:36:18 +01:00
teknomunk
c02ce8b8e7 Fix typo, set use_texture_alpha = clip for all rail 2024-12-31 02:36:18 +01:00
teknomunk
fa29e3410b Fix several undefined global warnings, fix cart movement when over maximum speed, fix cart reattachment to sloped track 2024-12-31 02:36:18 +01:00
teknomunk
356328ce4b Revert changed made to debug minecart-updates integration into tsm_railcorridors 2024-12-31 02:36:18 +01:00
teknomunk
10865e6dbb Make punch move minecarts a little, comment out more debug prints 2024-12-31 02:36:18 +01:00
teknomunk
0a935d1f99 Fix visual artifacts on the sides of rails 2024-12-31 02:36:18 +01:00
teknomunk
689b6a8d30 Stop carts from reversing when they stop, make stopped carts try to start moving in the direction the player is facing 2024-12-31 02:36:18 +01:00
teknomunk
8351f39fb1 Fix crash after entering a minecart not on rails 2024-12-31 02:36:18 +01:00
teknomunk
de01ba45a6 Fix placed rail conversion, start automatic inventory rail conversion 2024-12-31 02:36:18 +01:00
teknomunk
4c56707336 Fix players repelling carts with new player metadata system 2024-12-31 02:36:18 +01:00
teknomunk
1831e34b09 Cleanup debug prints 2024-12-31 02:36:18 +01:00
teknomunk
aec9665ecc Add documentation for newly exposed attach_driver 2024-12-31 02:36:18 +01:00
teknomunk
22f5369db9 Add persistent player-specific metadata into mcl_playerinfo, simple cart reattachment (only exists if the luaentity for the cart exists when the player logs in) 2024-12-31 02:36:18 +01:00
teknomunk
3bbd5a20fa More fixes for minecart-hopper movement 2024-12-31 02:36:18 +01:00
teknomunk
7990ed65f6 Get rail placement creating corners that lead into a downward sloped rail 2024-12-31 02:36:18 +01:00
teknomunk
e1ff394204 Create mcl_util.metadata_timer, fix crashes, add checks to prevent hoppers from pulling from carts that are not in the square above it 2024-12-31 02:36:18 +01:00
teknomunk
712f0b9b9b Fix hopper-minecart interaction, convert ipairs(table) to use for i=1,#table instead 2024-12-31 02:36:18 +01:00
teknomunk
d93cf5d4f5 Update mineshafts for new rail and minecarts, add loot to generated chest and hopper minecarts (and remove notes about a hack) 2024-12-31 02:36:18 +01:00
teknomunk
04d29e8f2b Give carts a small vertical lift when pushed to allow them to get back on rails 2024-12-31 02:36:18 +01:00
teknomunk
eae9a2b6ad Stop rail from being placed directly above rail (floating in air) 2024-12-31 02:36:18 +01:00
teknomunk
7a1e0d9a52 Fix sloped power,activator and detector rails, remove debug print 2024-12-31 02:36:18 +01:00
teknomunk
9f192e87f3 Modify mcl_entity_invs to add support for save/load items hooks in entities, add save/load hooks to minecarts to store item list in the minecart data and not in the entity data so that respawn doesn't destroy items 2024-12-31 02:36:18 +01:00
teknomunk
e208e9c4ce Add documentation on the rail 2024-12-31 02:36:18 +01:00
teknomunk
61a81cc143 Add documentation on file structure and overviewes of each file 2024-12-31 02:36:18 +01:00
teknomunk
a9b71ea7ce Fix crashes, fix link in documentation 2024-12-31 02:36:18 +01:00
teknomunk
a364fa8112 More documentation, add myself to copyright list in README.txt 2024-12-31 02:36:18 +01:00
teknomunk
f7398db6d0 More minor changes to API.md, start overall implementation documentation 2024-12-31 02:36:18 +01:00
teknomunk
434c55350d Fix table of contents 2024-12-31 02:36:18 +01:00
teknomunk
7dcc1046a6 Finish writing API documentation, remove drop_railcarts (replaced by try_detach_minecart), rename constants to ALL CAPS for consistency, change mcl_minecarts. to mod. for API function definitions 2024-12-31 02:36:18 +01:00
teknomunk
7c1b7801ce Nearly finish API documentation, create mcl_minecarts.add_blocks_to_map() 2024-12-31 02:36:18 +01:00
teknomunk
c44d291fee Continue writing API documentation, update call signatures for a couple of API functions 2024-12-31 02:36:18 +01:00
teknomunk
19f21db8c9 Change document formatting, finally move cactus cart dropping to node definition for mcl_core:cactus 2024-12-31 02:36:18 +01:00
teknomunk
dba86a8d60 Correct crashes/item duplication with dropping carts, start API documentation 2024-12-31 02:36:18 +01:00
teknomunk
48b1a4d7e5 Fix cart controls, cart pushing 2024-12-31 02:36:18 +01:00
teknomunk
867fc20782 Fix typo in rail replacement mapping, fix several crashes 2024-12-31 02:36:18 +01:00
teknomunk
74a14a5a74 Implement movement thru tee rails 2024-12-31 02:36:18 +01:00
teknomunk
1eda16a1a1 Tune respawn distance limit 2024-12-31 02:36:18 +01:00
teknomunk
135eea4de4 Fix crashes 2024-12-31 02:36:18 +01:00
teknomunk
c99f972b31 Remove memory leak for cart data, check distance to players before respawning distant carts to prevent adding entities that are immediately inactivated 2024-12-31 02:36:18 +01:00
teknomunk
4dccfff1d0 Implement offline/out of range minecart movement and fix minecart respawning, remove railtype tracking 2024-12-31 02:36:18 +01:00
teknomunk
a500f554e0 Remove do_movement dependency on the existence of a cart luaentity 2024-12-31 02:36:18 +01:00
teknomunk
7c7a987342 Fix undefined global warning, move player off to the side of a cart when dismounting so trains don't get pushed apart when getting out 2024-12-31 02:36:18 +01:00
teknomunk
265a25d6ae Make trains containing a player in a minecart function, minor cleanup in mcl_playerinfo 2024-12-31 02:36:18 +01:00
teknomunk
2e41f2df48 Fix crashes in train logic, allow breaking apart trains 2024-12-31 02:36:18 +01:00
teknomunk
d280e2e942 Implement train reversing 2024-12-31 02:36:18 +01:00
teknomunk
88ed70ce92 Repair vectors in cart data, mostly fix train movement bugs (still possible to have a furnace minecart flip, without the train also flipping) 2024-12-31 02:36:18 +01:00
teknomunk
d6e6194316 Add cart entity respawn/destroy to match cart data (partially working) 2024-12-31 02:36:18 +01:00
teknomunk
7bd95257bd Give furnace minecart minimum velocity when lit, add train separation code, update logging code, add sequence number to entity staticdata to allow respawn/despawn when carts move when the entity is unloaded 2024-12-31 02:36:18 +01:00
teknomunk
40a5184703 Fix rail detach crash, make tnt minecarts explode if they hit something hard (off rails) 2024-12-31 02:36:18 +01:00
teknomunk
e680869cbd Make sure carts get detatch if the rail under them is removed 2024-12-31 02:36:18 +01:00
teknomunk
eb0f82bdfb Fixish reorganizing, initial train implementation 2024-12-31 02:36:18 +01:00
teknomunk
dbeec9b542 Major reorganization, start setup for trains 2024-12-31 02:36:18 +01:00
teknomunk
1b9c149803 Make sure carts that collide move in the same direction the colliding cart was 2024-12-31 02:36:18 +01:00
teknomunk
09f044245e Add utilities to convert between an ObjectRef, it's active object id and a 128bit uuid, move minecart data from entity staticdata to mod storage to eventually allow updating carts when out of range of players and also track what carts are alive, implement on-rail cart collisions 2024-12-31 02:36:18 +01:00
teknomunk
8117b9010a Harden against unknown nodes 2024-12-31 02:36:18 +01:00
teknomunk
d318390778 Allow players to push minecarts that are not on track 2024-12-31 02:36:18 +01:00
teknomunk
f089d0a702 Fix rails in creative inventory, make minecart with tnt not crash server when exploding, make minecart with tnt slightly more powerful than regular tnt 2024-12-31 02:36:18 +01:00
teknomunk
60ee3a06b9 Fix rail movement regressions 2024-12-31 02:36:18 +01:00
teknomunk
e1b973fbf5 Move cart code to its own file, more code cleanup, add aliases for old track items 2024-12-31 02:36:18 +01:00
teknomunk
b59d6d37dc Cleanup code, restore uphill/downhill cart movement, completely remove old rail 2024-12-31 02:36:18 +01:00
teknomunk
f490846892 Get rail reattachment (especially after jumps) working correctly 2024-12-31 02:36:18 +01:00
teknomunk
e7605b7abd Make legacy rail update apply to all old rail types, add basic detached railcart physics with a stub to use mcl_physics when it gets merged 2024-12-31 02:36:18 +01:00
teknomunk
140689cd7d Silence unmaskable print statements 2024-12-31 02:36:18 +01:00
teknomunk
fdf8161d23 Add immortal item entity support, add legacy rail conversion that uses immortal item drops for corners/tees/crosses that are no longer possible 2024-12-31 02:36:18 +01:00
teknomunk
7944015266 Fix more rail connection bugs 2024-12-31 02:36:18 +01:00
teknomunk
e02906e46f Get sloped connections working correctly 2024-12-31 02:36:18 +01:00
teknomunk
48dbe97516 Re-enable rule for powering rail from underneath, have stairs block minecart movement, fix crash when lightning strikes a minecart 2024-12-31 02:36:18 +01:00
teknomunk
279733e711 Fix mcl_util.table_merge where a standard value overwrites a table, fix base definition usage, implement behavior difference when there is a solid block after a straight piece of track (this will eventually allow minecarts to fly off the end of the track) 2024-12-31 02:36:18 +01:00
teknomunk
be18edf7c6 Update all rail types to new version 2024-12-31 02:36:18 +01:00
teknomunk
40b62eea1d Reorganize 2024-12-31 02:36:18 +01:00
teknomunk
06c1b362b2 Finish reverting 08b41a3b392005e7078b09d68854e6df562d5fd7 2024-12-31 02:36:18 +01:00
teknomunk
e1c4606e8f Enable new track with get_next_dir handlers 2024-12-31 02:36:18 +01:00
teknomunk
6a9080844e Change connection rules again to allow building parallel track, tees and crosses), start implementing rail rules callbacks 2024-12-31 02:36:18 +01:00
teknomunk
f3a4d928da Add sloped rail 2024-12-31 02:36:18 +01:00
teknomunk
b870fcebd0 Fix rail visuals, add switch operation 2024-12-31 02:36:18 +01:00
teknomunk
2151644b1c Implement initial rail connection logic (no vertical track yet), experiment with texture modifiers and gravel underlay for display (not working) 2024-12-31 02:36:18 +01:00
teknomunk
8fafb32a5c Start implementing new rail nodes 2024-12-31 02:36:18 +01:00
teknomunk
4c6c506713 Implement minecart with command block 2024-12-31 02:36:18 +01:00
teknomunk
fd154f7f79 Create mesecons command API and modify commandblock to use it 2024-12-31 02:36:18 +01:00
teknomunk
3443e327ec Disable punch to move minecarts, implement punch to drop minecart, enable basic cart keyboard controls (accelerate and brake) 2024-12-31 02:36:18 +01:00
teknomunk
3f4d8f5ec2 Remove cart oscillation when pushed 2024-12-31 02:36:18 +01:00
teknomunk
be241f64fe Limit top speed of furnace minecarts to 4 blocks/second, limit total fuel time to 27 minutes 2024-12-31 02:36:18 +01:00
teknomunk
bf3872e445 Fix bug with furnace minecart at max velocity (stopped until fuel ran out), move _fueltime into staticdata 2024-12-31 02:36:18 +01:00
teknomunk
718938b0fe Fix call signature of mcl_util.hopper_pull_to_inventory, move cart-specific behaviors to _mcl_minecarts_on_step handlers, fix typo, change distance used in rail reattach code, move cart_id generation 2024-12-31 02:36:18 +01:00
teknomunk
f5616738e7 Add groups to minecart entities (for containers), fix cart node watch handling, relocate hopper_push_to_mc in mcl_hopper/init.lua, implement hopper-to-minecart push using enter/leave hooks for both straight and bent hoppers 2024-12-31 02:36:18 +01:00
teknomunk
615df7378a Add API function to remove node watch 2024-12-31 02:36:18 +01:00
teknomunk
fba7b04e82 Refactor enter/leave hook processing, add node watches for implementing hopper-to-minecart functionality (should properly handle heavy server lag without missing any time), temporarily disable hopper push/pull to minecart in mcl_hoppers, prepare to move minecart-specific on_step behavior out of main on_step function and to a minecart-specific handler 2024-12-31 02:36:18 +01:00
teknomunk
93373aa1c5 Start adding hooks for implpementing minecart with command block 2024-12-31 02:36:18 +01:00
teknomunk
ca2ede87f5 Make minecarts solid and add players pushing 2024-12-31 02:36:18 +01:00