1
0
Fork 0
Commit Graph

401 Commits

Author SHA1 Message Date
Peter Bell fa917259a5 Fix doors and trapdoors closing on server restart 2020-08-25 21:38:49 +01:00
Tiger Wang d8c8d0124d Replace PowerData struct with PowerLevel
* We no longer need to track the powering block with the removal of SolidBlockHandler. PowerLevel is now just an unsigned char
2020-08-21 00:50:09 +01:00
Tiger Wang 3143d6ce67 Remove std::make_unique from redstone handler creation 2020-08-21 00:50:09 +01:00
Tiger Wang 40eba5244d Remove the redstone solid block handler
- Remove cSolidBlockHandler
* Functionality now integrated into simulator dispatcher
* Fix door double open/close issues, arisen due to the top/bottom halves getting different power
+ Small migration to block states for redstone wire
2020-08-08 18:22:16 +01:00
Tiger Wang d2156aab7c WakeUpSimulators correct Y computation
+ Add Y validity check to SimulatorManager
2020-08-05 08:35:37 +01:00
Tiger Wang c3d6afe47e Corrected wakeup sequences
* Pistons/Ice no longer need to FastSetBlock first (#4600), and the former don't drop items when broken in creative
- Begin migration away from stationary fluids
* Tick the chunk after applying a client's changed
* Broadcast pending blocks at the end of a tick
2020-08-04 18:15:18 +01:00
Tiger Wang adb86a75da Do not GetBlock individually in simulators
* Have the simulator manager get the block and pass it on
+ Add new overload for WakeUp, called when the manager wakes face positions
2020-08-04 18:15:18 +01:00
Tiger Wang 225c2fa9f6 Always use relative coordinates in AddBlock
+ Pass block, use relatives
* Fixes everything immediately converting abs back to rel and getting block, when these data were already available
2020-08-02 15:52:06 +01:00
Tiger Wang 99856df686 Add WakeUp/AddBlock distinction
* WakeUp is for singular changes (block breaking for example). The simulator should check blocks around the position and discover other affected blocks as it sees fit
* AddBlock is for when you know a whole area is to be updated; chunk loading, or area wakeups for example
+ Prepares for correct handling of destroyed blocks after removal of SolidBlockHandler in the redstone simulator
2020-08-02 15:52:06 +01:00
Tiger Wang 6c47f46c31 Ensure updating relatives calls the correct base case
* Fixed recursive base unintentionally scheduling the origin position for an update because it called the wrong function
2020-08-02 15:52:06 +01:00
Mattes D 46398f4671 Replaced cpp14::make_unique<> with std::make_unique<>. 2020-08-01 20:04:31 +01:00
Tiger Wang 1673c84978 Remove redundant ErasePowerData call
* Also fix a return that should've been continue
2020-07-26 16:08:20 +01:00
Tiger Wang 7d93742498 Clang Tidy fix 2020-07-26 16:06:57 +01:00
Tiger Wang 2e18e4f51c Comparators: use <= in comparison mode 2020-07-26 14:16:46 +01:00
Tiger Wang 4e5ab02a58 Use SimulateChunk in redstone simulator
+ Improved performance, reduces bottleneck in chunkmap lookup
* Stop allocating and throwing away lots of small vectors in Update/GetValidSourcePositions return values
- Remove unused GetPowerLevel virtual
2020-07-26 14:16:46 +01:00
Tiger Wang 6d650d5f3c Reduce unnecessary wakeups
- cSimulator no longer wakes up positions already woken by cChunk::SetBlock
2020-07-25 20:59:12 +01:00
Tiger Wang bc01cd5e75 Redstone: check validity of GetBlock 2020-07-24 09:11:40 +01:00
Tiger Wang 3f712ca9cf Precompile unordered_map/set
+ Add inclusions to Globals.h
* Sort Globals.h
- Remove sys/stat.h from Globals.h
2020-07-19 19:58:53 +01:00
peterbell10 99d96337da
Fire sim: Handle fuel block being destroyed (#4751) 2020-05-31 20:27:08 +01:00
Tiger Wang 9e8598fb1c
Upgrade to C++17 [CMake] (#4717)
* Make our CMake slightly less insane
2020-05-16 20:59:10 +01:00
peterbell10 84289a2ba9
Cleanup some workarounds and warnings (#4735)
* Cleanup thread_local usage in FastRandom

* Use constexpr to avoid clang warning

* Fix more Wglobal-constructor warnings

* Make MSVC happy?
2020-05-10 16:16:49 +00:00
Peter Bell 1123c95cf2 Enable C++17 in build 2020-05-09 20:37:16 +01:00
peterbell10 e6634ed26c
Update submodules (#4727)
Closes #4708

This updates jsoncpp, mbedtls, TCLAP and SQLiteCpp to their latest stable release. A few additional changes were needed:

* jsoncpp deprecated Reader, FastWriter and StyledWriter which I've replaced
  with some helper functions in JsonUtils.cpp

* SQLiteCpp changed how it builds with external sqlite libraries, now expecting
  them to be installed. The simplest path was to remove sqlite from cuberite's
  submodule and just use SQLiteCpp's internal version.
2020-05-09 15:51:15 +01:00
Tiger Wang a9e06d33c5 Add some comments about terracing 2020-05-08 10:52:35 +01:00
Tiger Wang 6ac11925f1 Update RedstoneWireHandler style 2020-05-08 10:52:35 +01:00
peterbell10 c4ca11b372
Fix SetBlockMeta call in observer handler (#4728) 2020-05-08 09:46:03 +01:00
DrButcher 258318ab98
Buttons can now be triggered by arrows. (#4670)
* Buttons can now be triggered by arrows.
2020-05-03 21:05:32 +01:00
mBornand 5b92e6654f Update src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h
Co-authored-by: peterbell10 <peterbell10@live.co.uk>
2020-05-03 11:51:11 +01:00
mBornand 1c579f58aa Update src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h
Co-authored-by: peterbell10 <peterbell10@live.co.uk>
2020-05-03 11:51:11 +01:00
Marc_Bornand 83193f132c Made some style update and add comments 2020-05-03 11:51:11 +01:00
Marc_Bornand 055c9ef90e Fix the connexion to the side of the repeater 2020-05-03 11:51:11 +01:00
Mattes D 487f9a2aa9
Vector3 in Handlers (#4680)
Refactored all cBlockHandler and cItemHandler descendants to use Vector3.
2020-04-21 22:19:22 +02:00
Tiger Wang c1ea5f982d Re-implement repeater locking 2020-04-18 16:51:29 +01:00
DrButcher 3591be50b2
Fixing washing away of redstone mechanisms (#4665) 2020-04-17 21:01:21 +01:00
Tiger Wang ede56a5750
ಠ_ಠ (#4660)
+ Provisional handling for observers
2020-04-16 22:27:04 +01:00
Mattes D 9ee47e5999 Using Super. 2020-04-16 20:07:48 +00:00
DrButcher 35299b8509
Pressure plate sounds and delay (#4643)
+ Added sounds on depress and release
+ Added correct delay times
2020-04-13 23:23:43 +01:00
Mattes D bdedab15c9
Falling blocks can now be spawned at any position. (#4620)
* Falling blocks can now be spawned at any position.

* Added a /cake command to Debuggers that throws a cake in a nice slow arc.

* Fixed regular falling blocks.
2020-04-09 20:25:20 +00:00
peterbell10 19ad96561c
Filter blocks to add to redstone sim's wake queue (#4621) 2020-04-05 19:20:52 +00:00
Alexander Harkness 16b3de94c8
Add potatoes to washed away list also 2020-04-05 12:43:03 +01:00
metiu07 6bde0dd9ad
FluidSimulator: Carrots should be also washable (#4619) 2020-04-05 11:41:31 +00:00
Mattes D 01b8ed5295
Pulled the BlockID and BlockInfo headers from Globals.h. (#4591)
The BlockID.h file was removed from Globals.h and renamed to BlockType.h (main change)
The BlockInfo.h file was removed from Globals.h (main change)
The ENUM_BLOCK_ID and ENUM_ITEM_ID enum names were replaced with ENUM_BLOCK_TYPE and ENUM_ITEM_TYPE (cosmetics)
The various enums, such as eDimension, eDamageType and eExplosionSource were moved from BlockType.h to Defines.h, together with the helper functions for converting between them and strings (StringToDimension et al.) (minor)
Many inline functions were moved from headers to their respective cpp files, so that BlockType.h could be included only into the cpp file, rather than the header.
That broke our tests a bit, since they pick bits and pieces out of the main code and provide stubs for the rest; they had to be re-stubbed and re-verified.
eMonsterType values are no longer tied to E_ITEM_SPAWN_EGG_META_* values
2020-04-03 08:57:01 +02:00
Bond-009 ea386eaab1
Lock hopper when powered by redstone (#4347)
* Lock hopper when powered by redstone

* Add to manual bindings

* Add hopper API documentation

Co-authored-by: Mat <mail@mathias.is>
2020-03-27 12:03:28 +00:00
Mat c968f1f7da
TNT position fixes (#4519)
* TNT position fixes

* Don't add offset to explosion spawn coords

* Don't make other entities push TNT

* Correct initial TNT speed

* Fix typo

* Improvements

* Revert unwanted change

* Style fixes

* Update format
2020-03-22 17:33:36 +02:00
Mattes D 61904af626 Moved growing from cWorld / cChunk to cBlockHandler descendants. 2019-10-28 10:45:43 +01:00
Mattes D 221cc4ec5c
Refactored block-to-pickup conversion. (#4417) 2019-10-16 10:06:34 +02:00
Bond-009 e0ca4d8399 Fix building with clang 8.0 (#4346) 2019-08-11 10:39:43 +01:00
peterbell10 4727ed2084 Add a formatting function for Vector3 (#4282)
* Vector3: Add custom fmt compatible formatter.

* cLuaState: Add fmt version of ApiParamError

* Use vector formatting in manual bindings

* Always log vectors with FLOG
2018-09-24 21:33:39 +01:00
peterbell10 ee84197014
Force all headers other than "Globals.h" to be included with relative paths (#4269)
Closes #4236

CMake now creates a header file in the build directory under the path "include/Globals.h" which just includes "src/Globals.h" with an absolute path. Then instead of adding "src/" to the include directories, it adds "include/".

#include "Globals.h" still works by including the build generated file and any other src-relative path will not work.
2018-08-29 01:51:25 +01:00
bionext03 90d552a702 Add new flow direction calculating algorithm (#4160) 2018-07-27 10:01:53 +01:00