aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
...
* update ziporwell962017-01-25
|
* Fix typo that caused crashorwell962017-01-25
|
* Fix find&replace mistake that broke ATC command interpretationorwell962017-01-24
|
* Fix crash when train went off trackorwell962017-01-24
|
* Create new models and textures for japanese trainorwell962017-01-24
|
* Do not recover wagons from minetest's static storageorwell962017-01-23
| | | | Since missing wagons are spawned anyway by update_trainpart_properties, this only causes visible trouble when a train gets into loaded area. also avoids placing entities into unloaded terrain randomly.
* Add intllib support and German translationorwell962017-01-23
|
* update ziporwell962017-01-19
|
* Merge branch 'master' of https://github.com/orwell96/advtrainsorwell962017-01-19
|\
| * Merge pull request #17 from gpcf/masterorwell962017-01-19
| |\ | | | | | | privilege to remove trains and replaced occurences of deprecated minetest.env:
| | * Removed last occurrence of minetest.envGabriel Pérez-Cerezo2017-01-18
| | |
| | * Merged privGabriel Pérez-Cerezo2017-01-18
| | |\ | | |/ | |/|
| | * Revert "Added stop and reverse rail"Gabriel Pérez-Cerezo2017-01-18
| | | | | | | | | | | | | | | | | | | | | This reverts commit 633d514f5b63d28d80a5c0981ee3e99b61899c41. Conflicts: tracks.lua
| | * Added privilege to remove trainsGabriel Pérez-Cerezo2016-12-29
| | |
| | * Added mechanism to avoid double-detectionGabriel Pérez-Cerezo2016-12-22
| | |
| | * Revert "Depends on Mesecons"Gabriel Pérez-Cerezo2016-12-22
| | | | | | | | | | | | | | | | | | This reverts commit 5f377f7b6c3530635064aa5d7d11f034c6eece45. Master no longer has hard-dependency on mesecons.
| | * Added stop and reverse railGabriel Pérez-Cerezo2016-12-22
| | |
| | * Merge branch 'master' of https://github.com/orwell96/advtrainsGabriel Pérez-Cerezo2016-12-17
| | |\
| | * \ Merge branch 'master' of https://github.com/orwell96/advtrainsGabriel Pérez-Cerezo2016-11-28
| | |\ \
| | * \ \ Merge branch 'master' of https://github.com/orwell96/advtrainsGabriel Pérez-Cerezo2016-11-25
| | |\ \ \
| | * | | | Depends on MeseconsGabriel Pérez-Cerezo2016-11-12
| | | | | |
* | | | | | Make signals work with the nodedb againorwell962017-01-18
| | | | | |
* | | | | | Add 'collision mercy' to get stuck trains out of walls.orwell962017-01-18
| | | | | | | | | | | | | | | | | | | | | | | | Also change the collision logic so that the collision mercy can't be activated accidentally.
* | | | | | update ziporwell962017-01-18
| | | | | |
* | | | | | Update manualorwell962017-01-18
| | | | | |
* | | | | | Add door controls and ATC commandsorwell962017-01-18
| | | | | |
* | | | | | Make 'print debug messages' a settingorwell962017-01-18
|/ / / / /
* | | | | update zip file and disable debug messagesorwell962017-01-17
| | | | |
* | | | | Update readme.txt with contributionsorwell962017-01-17
| | | | |
* | | | | Add detailed steam engine contributed by mbb and Krokoschlangeorwell962017-01-17
| | | | |
* | | | | Correct view offset and wagon_span on new subway wagonorwell962017-01-17
| | | | |
* | | | | Add animation for steam engineorwell962017-01-17
| | | | | | | | | | | | | | | | | | | | I needed to completely rewrite the animation because irrlicht couldn't handle the animation NathanS created.
* | | | | Model, animate, texture and integrate new subway wagonorwell962017-01-17
| | | | | | | | | | | | | | | | | | | | engine follows!
* | | | | Download recent contributions and put them into the assets directoryorwell962017-01-17
| | | | |
* | | | | Don't crash when wagons do not exist but show a warning insteadorwell962017-01-17
| | | | |
* | | | | replace trackdb by nodedborwell962017-01-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - trackdb is kept for large rail networks to still work but not saved anymore - saving node name and param2 instead of track connections, so also signals can be saved. - small serialization format - fast access times, almost no redundancy
* | | | | Unite all save data (except the track database) into a single save fileorwell962017-01-12
| | | | |
* | | | | ziporwell962017-01-10
| | | | |
* | | | | Prevent non-initialized wagons from accidentally polluting the worldorwell962017-01-10
| | | | | | | | | | | | | | | | | | | | | | | | | sometimes wagons get created/loaded but are not initialized. These stand around and can't be removed. Now if a wagon does not get initialized after 20 steps, something went wrong and the wagon is removed.
* | | | | Fix restoring the detector.on_node table when paths get cleaned uporwell962017-01-10
| | | | |
* | | | | Clean up debug message codeorwell962017-01-08
| | | | |
* | | | | update ziporwell962017-01-06
| | | | |
* | | | | Add fancy passenger wagonorwell962017-01-06
| | | | |
* | | | | also print ATC reverse command warningorwell962017-01-04
| | | | | | | | | | | | | | | | | | | | and move atc_command.txt at a better place
* | | | | Purge all debug messages and change 'print' function name to 'atprint'orwell962017-01-04
| | | | | | | | | | | | | | | | | | | | Ready for 2.0 release.
* | | | | update makefile to new circumstancesorwell962017-01-04
| | | | |
* | | | | Fix bug in track databaseorwell962017-01-04
| | | | | | | | | | | | | | | | | | | | the entire database was broken due to a not removed indexing
* | | | | Restructure mod directoryorwell962017-01-04
| | | | |
* | | | | Add Automatic Train Control systemorwell962017-01-04
| | | | |
* | | | | add API documentationorwell962017-01-03
| | | | |
d += dtime * acceleration; m_pos += m_speed * dtime; return; } // Set insane speed to zero // Otherwise there will be divides by zero and other silly stuff if(m_speed.getLength() > 1000.0*BS) m_speed = v3f(0,0,0); // Limit speed to a reasonable value float speed_limit = 20.0*BS; if(m_speed.getLength() > speed_limit) m_speed = m_speed * (speed_limit / m_speed.getLength()); v3f position = m_pos; v3f oldpos = position; /*std::cout<<"oldpos_i=("<<oldpos_i.X<<","<<oldpos_i.Y<<"," <<oldpos_i.Z<<")"<<std::endl;*/ // Maximum time increment (for collision detection etc) // Allow 0.1 blocks per increment // time = distance / speed // NOTE: In the loop below collisions are detected at 0.15*BS radius float speedlength = m_speed.getLength(); f32 dtime_max_increment; if(fabs(speedlength) > 0.001) dtime_max_increment = 0.05*BS / speedlength; else dtime_max_increment = 0.5; m_touching_ground = false; u32 loopcount = 0; do { loopcount++; f32 dtime_part; if(dtime > dtime_max_increment) dtime_part = dtime_max_increment; else dtime_part = dtime; dtime -= dtime_part; // Begin of dtime limited code m_speed += acceleration * dtime_part; position += m_speed * dtime_part; /* Collision detection */ v3s16 pos_i = floatToInt(position, BS); // The loop length is limited to the object moving a distance f32 d = (float)BS * 0.15; core::aabbox3d<f32> objectbox( m_collision_box->MinEdge + position, m_collision_box->MaxEdge + position ); core::aabbox3d<f32> objectbox_old( m_collision_box->MinEdge + oldpos, m_collision_box->MaxEdge + oldpos ); //TODO: Get these ranges from somewhere for(s16 y = oldpos_i.Y - 1; y <= oldpos_i.Y + 2; y++) for(s16 z = oldpos_i.Z - 1; z <= oldpos_i.Z + 1; z++) for(s16 x = oldpos_i.X - 1; x <= oldpos_i.X + 1; x++) { try{ MapNode n = m_block->getNodeParent(v3s16(x,y,z)); if(content_features(n).walkable == false) continue; } catch(InvalidPositionException &e) { // Doing nothing here will block the object from // walking over map borders } core::aabbox3d<f32> nodebox = getNodeBox(v3s16(x,y,z), BS); // See if the object is touching ground if( fabs(nodebox.MaxEdge.Y-objectbox.MinEdge.Y) < d && nodebox.MaxEdge.X-d > objectbox.MinEdge.X && nodebox.MinEdge.X+d < objectbox.MaxEdge.X && nodebox.MaxEdge.Z-d > objectbox.MinEdge.Z && nodebox.MinEdge.Z+d < objectbox.MaxEdge.Z ){ m_touching_ground = true; } if(objectbox.intersectsWithBox(nodebox)) { v3f dirs[3] = { v3f(0,0,1), // back v3f(0,1,0), // top v3f(1,0,0), // right }; for(u16 i=0; i<3; i++) { f32 nodemax = nodebox.MaxEdge.dotProduct(dirs[i]); f32 nodemin = nodebox.MinEdge.dotProduct(dirs[i]); f32 playermax = objectbox.MaxEdge.dotProduct(dirs[i]); f32 playermin = objectbox.MinEdge.dotProduct(dirs[i]); f32 playermax_old = objectbox_old.MaxEdge.dotProduct(dirs[i]); f32 playermin_old = objectbox_old.MinEdge.dotProduct(dirs[i]); bool main_edge_collides = ((nodemax > playermin && nodemax <= playermin_old + d && m_speed.dotProduct(dirs[i]) < 0) || (nodemin < playermax && nodemin >= playermax_old - d && m_speed.dotProduct(dirs[i]) > 0)); bool other_edges_collide = true; for(u16 j=0; j<3; j++) { if(j == i) continue; f32 nodemax = nodebox.MaxEdge.dotProduct(dirs[j]); f32 nodemin = nodebox.MinEdge.dotProduct(dirs[j]); f32 playermax = objectbox.MaxEdge.dotProduct(dirs[j]); f32 playermin = objectbox.MinEdge.dotProduct(dirs[j]); if(!(nodemax - d > playermin && nodemin + d < playermax)) { other_edges_collide = false; break; } } if(main_edge_collides && other_edges_collide) { m_speed -= m_speed.dotProduct(dirs[i]) * dirs[i]; position -= position.dotProduct(dirs[i]) * dirs[i]; position += oldpos.dotProduct(dirs[i]) * dirs[i]; } } } // if(objectbox.intersectsWithBox(nodebox)) } // for y } // End of dtime limited loop while(dtime > 0.001); m_pos = position; } void MovingObject::simpleMove(float dtime) { m_pos_animation_time_counter += dtime; m_pos_animation_counter += dtime; v3f movevector = m_pos - m_oldpos; f32 moveratio; if(m_pos_animation_time < 0.001) moveratio = 1.0; else moveratio = m_pos_animation_counter / m_pos_animation_time; if(moveratio > 1.5) moveratio = 1.5; m_showpos = m_oldpos + movevector * moveratio; } #ifndef SERVER /* RatObject */ void RatObject::addToScene(scene::ISceneManager *smgr) { if(m_node != NULL) return; video::IVideoDriver* driver = smgr->getVideoDriver(); scene::SMesh *mesh = new scene::SMesh(); scene::IMeshBuffer *buf = new scene::SMeshBuffer(); video::SColor c(255,255,255,255); video::S3DVertex vertices[4] = { video::S3DVertex(-BS/2,-BS/4,0, 0,0,0, c, 0,1), video::S3DVertex(BS/2,-BS/4,0, 0,0,0, c, 1,1), video::S3DVertex(BS/2,BS/4,0, 0,0,0, c, 1,0), video::S3DVertex(-BS/2,BS/4,0, 0,0,0, c, 0,0), }; u16 indices[] = {0,1,2,2,3,0}; buf->append(vertices, 4, indices, 6); // Set material buf->getMaterial().setFlag(video::EMF_LIGHTING, false); buf->getMaterial().setFlag(video::EMF_BACK_FACE_CULLING, false); buf->getMaterial().setTexture (0, driver->getTexture(getTexturePath("rat.png").c_str())); buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, false); buf->getMaterial().setFlag(video::EMF_FOG_ENABLE, true); buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL; // Add to mesh mesh->addMeshBuffer(buf); buf->drop(); m_node = smgr->addMeshSceneNode(mesh, NULL); mesh->drop(); updateNodePos(); } #endif /* ItemObject */ #ifndef SERVER void ItemObject::addToScene(scene::ISceneManager *smgr) { if(m_node != NULL) return; //video::IVideoDriver* driver = smgr->getVideoDriver(); // Get image of item for showing video::ITexture *texture = getItemImage(); /* Create a mesh */ scene::SMesh *mesh = new scene::SMesh(); { scene::IMeshBuffer *buf = new scene::SMeshBuffer(); video::SColor c(255,255,255,255); video::S3DVertex vertices[4] = { /*video::S3DVertex(BS/2,-BS/2,0, 0,0,0, c, 0,1), video::S3DVertex(-BS/2,-BS/2,0, 0,0,0, c, 1,1), video::S3DVertex(-BS/2,BS/2,0, 0,0,0, c, 1,0), video::S3DVertex(BS/2,BS/2,0, 0,0,0, c, 0,0),*/ video::S3DVertex(BS/3,-BS/2,0, 0,0,0, c, 0,1),