aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
...
* 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
| | | | |
* | | | | make detector code clear entries of trains that do not existorwell962017-01-02
| | | | |
* | | | | unify update_trainpart_properties and check_trainpartloadorwell962017-01-02
| | | | |
l opt">{ /* This can result in a maximum of 6 areas */ // If a is an empty area, return the current area as a whole if(a.getExtent() == v3s16(0,0,0)) { VoxelArea b = *this; if(b.getVolume() != 0) result.push_back(b); return; } assert(contains(a)); // pre-condition // Take back area, XY inclusive { v3s16 min(MinEdge.X, MinEdge.Y, a.MaxEdge.Z+1); v3s16 max(MaxEdge.X, MaxEdge.Y, MaxEdge.Z); VoxelArea b(min, max); if(b.getVolume() != 0) result.push_back(b); } // Take front area, XY inclusive { v3s16 min(MinEdge.X, MinEdge.Y, MinEdge.Z); v3s16 max(MaxEdge.X, MaxEdge.Y, a.MinEdge.Z-1); VoxelArea b(min, max); if(b.getVolume() != 0) result.push_back(b); } // Take top area, X inclusive { v3s16 min(MinEdge.X, a.MaxEdge.Y+1, a.MinEdge.Z); v3s16 max(MaxEdge.X, MaxEdge.Y, a.MaxEdge.Z); VoxelArea b(min, max); if(b.getVolume() != 0) result.push_back(b); } // Take bottom area, X inclusive { v3s16 min(MinEdge.X, MinEdge.Y, a.MinEdge.Z); v3s16 max(MaxEdge.X, a.MinEdge.Y-1, a.MaxEdge.Z); VoxelArea b(min, max); if(b.getVolume() != 0) result.push_back(b); } // Take left area, non-inclusive { v3s16 min(MinEdge.X, a.MinEdge.Y, a.MinEdge.Z); v3s16 max(a.MinEdge.X-1, a.MaxEdge.Y, a.MaxEdge.Z); VoxelArea b(min, max); if(b.getVolume() != 0) result.push_back(b); } // Take right area, non-inclusive { v3s16 min(a.MaxEdge.X+1, a.MinEdge.Y, a.MinEdge.Z); v3s16 max(MaxEdge.X, a.MaxEdge.Y, a.MaxEdge.Z); VoxelArea b(min, max); if(b.getVolume() != 0) result.push_back(b); } } /* Translates position from virtual coordinates to array index */ s32 index(s16 x, s16 y, s16 z) const { v3s16 em = getExtent(); v3s16 off = MinEdge; s32 i = (s32)(z-off.Z)*em.Y*em.X + (y-off.Y)*em.X + (x-off.X); //dstream<<" i("<<x<<","<<y<<","<<z<<")="<<i<<" "; return i; } s32 index(v3s16 p) const { return index(p.X, p.Y, p.Z); } // Translate index in the X coordinate void add_x(const v3s16 &extent, u32 &i, s16 a) { i += a; } // Translate index in the Y coordinate void add_y(const v3s16 &extent, u32 &i, s16 a) { i += a * extent.X; } // Translate index in the Z coordinate void add_z(const v3s16 &extent, u32 &i, s16 a) { i += a * extent.X*extent.Y; } // Translate index in space void add_p(const v3s16 &extent, u32 &i, v3s16 a) { i += a.Z*extent.X*extent.Y + a.Y*extent.X + a.X; } /* Print method for debugging */ void print(std::ostream &o) const { v3s16 e = getExtent(); o<<"("<<MinEdge.X <<","<<MinEdge.Y <<","<<MinEdge.Z <<")("<<MaxEdge.X <<","<<MaxEdge.Y <<","<<MaxEdge.Z <<")" <<"="<<e.X<<"x"<<e.Y<<"x"<<e.Z<<"="<<getVolume(); } // Edges are inclusive v3s16 MinEdge; v3s16 MaxEdge; }; // unused #define VOXELFLAG_UNUSED (1<<0) // no data about that node #define VOXELFLAG_NO_DATA (1<<1) // Algorithm-dependent #define VOXELFLAG_CHECKED1 (1<<2) // Algorithm-dependent #define VOXELFLAG_CHECKED2 (1<<3) // Algorithm-dependent #define VOXELFLAG_CHECKED3 (1<<4) // Algorithm-dependent #define VOXELFLAG_CHECKED4 (1<<5) enum VoxelPrintMode { VOXELPRINT_NOTHING, VOXELPRINT_MATERIAL, VOXELPRINT_WATERPRESSURE, VOXELPRINT_LIGHT_DAY, }; class VoxelManipulator /*: public NodeContainer*/ { public: VoxelManipulator(); virtual ~VoxelManipulator(); /* Virtuals from NodeContainer */ /*virtual u16 nodeContainerId() const { return NODECONTAINER_ID_VOXELMANIPULATOR; } bool isValidPosition(v3s16 p) { addArea(p); return !(m_flags[m_area.index(p)] & VOXELFLAG_NO_DATA); }*/ /* These are a bit slow and shouldn't be used internally. Use m_data[m_area.index(p)] instead. */ MapNode getNode(v3s16 p) { VoxelArea voxel_area(p); addArea(voxel_area); if(m_flags[m_area.index(p)] & VOXELFLAG_NO_DATA) { /*dstream<<"EXCEPT: VoxelManipulator::getNode(): " <<"p=("<<p.X<<","<<p.Y<<","<<p.Z<<")" <<", index="<<m_area.index(p) <<", flags="<<(int)m_flags[m_area.index(p)] <<" is inexistent"<<std::endl;*/ throw InvalidPositionException ("VoxelManipulator: getNode: inexistent"); } return m_data[m_area.index(p)]; } MapNode getNodeNoEx(v3s16 p) { VoxelArea voxel_area(p); addArea(voxel_area); if(m_flags[m_area.index(p)] & VOXELFLAG_NO_DATA) { return MapNode(CONTENT_IGNORE); } return m_data[m_area.index(p)]; } MapNode getNodeNoExNoEmerge(v3s16 p) { if(m_area.contains(p) == false) return MapNode(CONTENT_IGNORE); if(m_flags[m_area.index(p)] & VOXELFLAG_NO_DATA) return MapNode(CONTENT_IGNORE); return m_data[m_area.index(p)]; } // Stuff explodes if non-emerged area is touched with this. // Emerge first, and check VOXELFLAG_NO_DATA if appropriate. MapNode & getNodeRefUnsafe(const v3s16 &p) { return m_data[m_area.index(p)]; } const MapNode & getNodeRefUnsafeCheckFlags(const v3s16 &p) { s32 index = m_area.index(p); if (m_flags[index] & VOXELFLAG_NO_DATA) return ContentIgnoreNode; return m_data[index]; } u8 & getFlagsRefUnsafe(v3s16 p) { return m_flags[m_area.index(p)]; } bool exists(v3s16 p) { return m_area.contains(p) && !(getFlagsRefUnsafe(p) & VOXELFLAG_NO_DATA); } MapNode & getNodeRef(v3s16 p) { VoxelArea voxel_area(p); addArea(voxel_area); if(getFlagsRefUnsafe(p) & VOXELFLAG_NO_DATA) { /*dstream<<"EXCEPT: VoxelManipulator::getNode(): " <<"p=("<<p.X<<","<<p.Y<<","<<p.Z<<")" <<", index="<<m_area.index(p) <<", flags="<<(int)getFlagsRefUnsafe(p) <<" is inexistent"<<std::endl;*/ throw InvalidPositionException ("VoxelManipulator: getNode: inexistent"); } return getNodeRefUnsafe(p); } void setNode(v3s16 p, const MapNode &n) { VoxelArea voxel_area(p); addArea(voxel_area); m_data[m_area.index(p)] = n; m_flags[m_area.index(p)] &= ~VOXELFLAG_NO_DATA; } // TODO: Should be removed and replaced with setNode void setNodeNoRef(v3s16 p, const MapNode &n) { setNode(p, n); } /*void setExists(VoxelArea a) { addArea(a); for(s32 z=a.MinEdge.Z; z<=a.MaxEdge.Z; z++) for(s32 y=a.MinEdge.Y; y<=a.MaxEdge.Y; y++) for(s32 x=a.MinEdge.X; x<=a.MaxEdge.X; x++) { m_flags[m_area.index(x,y,z)] &= ~VOXELFLAG_NO_DATA; } }*/ /*MapNode & operator[](v3s16 p) { //dstream<<"operator[] p=("<<p.X<<","<<p.Y<<","<<p.Z<<")"<<std::endl; if(isValidPosition(p) == false) addArea(VoxelArea(p)); return m_data[m_area.index(p)]; }*/ /* Set stuff if available without an emerge. Return false if failed. This is convenient but slower than playing around directly with the m_data table with indices. */ bool setNodeNoEmerge(v3s16 p, MapNode n) { if(m_area.contains(p) == false) return false; m_data[m_area.index(p)] = n; return true; } bool setNodeNoEmerge(s32 i, MapNode n) { if(m_area.contains(i) == false) return false; m_data[i] = n; return true; } /*bool setContentNoEmerge(v3s16 p, u8 c) { if(isValidPosition(p) == false) return false; m_data[m_area.index(p)].d = c; }*/ /* Control */ virtual void clear(); void print(std::ostream &o, INodeDefManager *nodemgr, VoxelPrintMode mode=VOXELPRINT_MATERIAL); void addArea(const VoxelArea &area); /* Copy data and set flags to 0 dst_area.getExtent() <= src_area.getExtent() */ void copyFrom(MapNode *src, const VoxelArea& src_area, v3s16 from_pos, v3s16 to_pos, v3s16 size); // Copy data