summaryrefslogtreecommitdiffstats
path: root/src/Simulator/IncrementalRedstoneSimulator (unfollow)
Commit message (Collapse)AuthorFilesLines
2022-06-18Additional Y height checks (#5405)Debucquoy Anthony tonitch4-31/+52
For redstone wire, block area bindings, and fire simulator. Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2022-04-20Valid Height is now checked by vector.x12xx12x3-4/+4
2022-01-14syntaxTiger Wang1-1/+1
2022-01-14eblockfaceTiger Wang1-1/+1
2022-01-14Fixed Compiler Warningsx12xx12x1-1/+1
2022-01-02Fixed diagonal redstone powering (#5363)Michal Havlíček1-1/+1
* Fixed diagonal redstone powering * Transparent blocks don't transmit downwards
2021-12-30Transparent blocks no longer conduct redstone power (#5359)Michal Havlíček2-30/+1
* Fixes #5336
2021-09-15Ignore dead entities and spectator players on pressure plates (#5294)Ethan Jones1-2/+14
2021-04-30Chest, weather, crash, and miscellaneous fixes (#5215)Tiger Wang5-20/+5
* Alpha-sort cChestEntity * Chests: use SendUpdateBlockEntity * Pathfinder: fix out of range Y * 1.13: correct weather packet ID * Chests: fix neighbour scanner + Add OnAddToWorld and overload to scan neighbours there, instead of in the constructor/OnUse. This fixes hoppers accessing newly loaded double chests and seeing a null m_Neighbour, thus thinking its a single chest. * Fix typo in cross coords computation. * Simplify hopper logic. * Block entities: ASSERT that type is correct If you match the block type first before calling DoWithBlockEntity, the corresponding block entity must either be empty or correspond to the block type. * Chunk: fix some forgotten PendingSendBE cleanup + Add cleanup in SetAllData, WriteBlockArea - Remove RemoveBlockEntity (used once), HasBlockEntity (not used) * Replace MakeIndex with MakeIndexNoCheck * Remove extraneous MarkDirty in hopper & chests
2021-04-12Hoppers: use 'locked' bit in metaTiger Wang1-4/+15
2021-04-12Fix sending incorrect date values on world changeTiger Wang1-1/+1
Yak shave: make more things use cTickTime. Fix a couple of incorrect modulo-on-millisecond-value by making them use WorldTickAge.
2021-03-28Move some redstone implementations into the source fileTiger Wang3-101/+119
2021-03-28Unify DoWithBlockEntity (#5168)Tiger Wang7-15/+39
+ DoWith calls now broadcast the block entity and mark the chunk dirty + Add block entity change queue to synchronise BE updates with block updates * Fixed a few incorrect assertions about BE type - Remove manual overloads
2021-03-05Prepare ChunkData for BlockState storage (#5105)Tiger Wang1-0/+1
* Rename ChunkData Creatable test * Add missing Y-check in RedstoneWireHandler * Remove ChunkDef.h dependency in Scoreboard * Prepare ChunkData for BlockState storage + Split chunk block, meta, block & sky light storage + Load the height map from disk - Reduce duplicated code in ChunkData - Remove saving MCSBiomes, there aren't any - Remove the allocation pool, ref #4315, #3864 * fixed build * fixed test * fixed the debug compile Co-authored-by: 12xx12 <44411062+12xx12@users.noreply.github.com>
2021-02-11Clang 7?Tiger Wang1-10/+0
2021-01-22Redstone: inline -> staticTiger Wang21-89/+89
2021-01-18cChunk: don't inherit from cChunkDef (#5106)Tiger Wang1-2/+2
2020-12-26Daylight Sensor: remove redundant delayTiger Wang1-3/+0
Daylight Sensors are already always ticked.
2020-12-21Prepare for 1.15+ (#4856)Tiger Wang2-7/+8
+ Add type-safe container for states * Split registry Blocks into BlockTypes, BlockStates so the block types enumeration can be #included without too much penalty * Ensure Registry uses type-safe container
2020-12-19New pull request for daylight sensor (#5066)Aiden Neill5-53/+127
* Fixes #4918 Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-12-18Warnings improvementsTiger Wang1-4/+5
* Turn off global-constructors warning. These are needed to implement cRoot signal handler functionality * Add Clang flags based on version lookup instead of a compile test. The CMake config process is single threaded and slow enough already * Reduced GetStackValue verbosity + Clarify EnchantmentLevel, StayCount, AlwaysTicked, ViewDistance signedness + Give SettingsRepositoryInterface a move constructor to simplify main.cpp code - Remove do {} while (false) construction in redstone handler
2020-10-05Fix cmake not adding Werror on clang, and _lots_ of warnings (#4963)peterbell1011-70/+85
* Fix cmake not adding Werror on clang, and _lots_ of warnings * WIP: Build fixes * Cannot make intermediate blockhandler instance * Tiger's changes * Fix BitIndex check * Handle invalid NextState values in cMultiVersionProtocol Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-09-29Doors: check power & toggle correctlyTiger Wang1-20/+55
* Fixed upper half ignoring its updates * Fixes #4945 * Fixed doors playing sound effects when they didn't actually toggle
2020-09-21Implement redstone quasi-connectivity (#4889)Tiger Wang5-28/+76
2020-09-12Use tracing for explosions (#4845)Tiger Wang1-2/+1
* TNT: Implement tracing algorithm + Add intensity tracing * Fix iterating over all players to SendExplosion, even those not in range * Implemented TNT entity interaction * Fixed misaligned destruction tracing * Finalise TNT algorithm - Remove BlockArea and just use chunks Using SetBlock makes it so that we can update everything properly, and does appear to be faster. * BlockInfo learns about explosion attentuation * Rename Explodinator parameters * TNT: pull block destruction into common function Co-authored-by: Alexander Harkness <me@bearbin.net>
2020-08-28Minor style fixesTiger Wang2-0/+12
2020-08-25Fix doors and trapdoors closing on server restartPeter Bell2-2/+6
2020-08-21Replace PowerData struct with PowerLevelTiger Wang25-189/+171
* We no longer need to track the powering block with the removal of SolidBlockHandler. PowerLevel is now just an unsigned char
2020-08-21Remove std::make_unique from redstone handler creationTiger Wang28-545/+494
2020-08-08Remove the redstone solid block handlerTiger Wang28-525/+632
- 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-04Do not GetBlock individually in simulatorsTiger Wang2-50/+38
* 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-02Always use relative coordinates in AddBlockTiger Wang2-34/+20
+ Pass block, use relatives * Fixes everything immediately converting abs back to rel and getting block, when these data were already available
2020-08-02Add WakeUp/AddBlock distinctionTiger Wang2-41/+58
* 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-02Ensure updating relatives calls the correct base caseTiger Wang9-14/+15
* Fixed recursive base unintentionally scheduling the origin position for an update because it called the wrong function
2020-08-01Replaced cpp14::make_unique<> with std::make_unique<>.Mattes D1-22/+22
2020-07-26Remove redundant ErasePowerData callTiger Wang1-7/+5
* Also fix a return that should've been continue
2020-07-26Clang Tidy fixTiger Wang1-11/+11
2020-07-26Comparators: use <= in comparison modeTiger Wang1-1/+1
2020-07-26Use SimulateChunk in redstone simulatorTiger Wang25-815/+758
+ 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-24Redstone: check validity of GetBlockTiger Wang1-1/+5
2020-07-19Precompile unordered_map/setTiger Wang1-1/+0
+ Add inclusions to Globals.h * Sort Globals.h - Remove sys/stat.h from Globals.h
2020-05-16Upgrade to C++17 [CMake] (#4717)Tiger Wang1-9/+2
* Make our CMake slightly less insane
2020-05-08Add some comments about terracingTiger Wang1-17/+43
2020-05-08Update RedstoneWireHandler styleTiger Wang1-11/+9
2020-05-08Fix SetBlockMeta call in observer handler (#4728)peterbell101-2/+2
2020-05-03Buttons can now be triggered by arrows. (#4670)DrButcher1-3/+3
* Buttons can now be triggered by arrows.
2020-05-03Update src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.hmBornand1-8/+1
Co-authored-by: peterbell10 <peterbell10@live.co.uk>
2020-05-03Update src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.hmBornand1-8/+1
Co-authored-by: peterbell10 <peterbell10@live.co.uk>
2020-05-03Made some style update and add commentsMarc_Bornand1-4/+9
2020-05-03Fix the connexion to the side of the repeaterMarc_Bornand1-3/+25
2020-04-21Vector3 in Handlers (#4680)Mattes D1-1/+13
Refactored all cBlockHandler and cItemHandler descendants to use Vector3.
2020-04-18Re-implement repeater lockingTiger Wang1-5/+85
2020-04-17Fixing washing away of redstone mechanisms (#4665)DrButcher1-0/+1
2020-04-16ಠ_ಠ (#4660)Tiger Wang4-0/+112
+ Provisional handling for observers
2020-04-16Using Super.Mattes D19-40/+78
2020-04-14Pressure plate sounds and delay (#4643)DrButcher1-7/+141
+ Added sounds on depress and release + Added correct delay times
2020-04-05Filter blocks to add to redstone sim's wake queue (#4621)peterbell102-6/+62
2020-03-27 Lock hopper when powered by redstone (#4347)Bond-0093-0/+65
* Lock hopper when powered by redstone * Add to manual bindings * Add hopper API documentation Co-authored-by: Mat <mail@mathias.is>
2020-03-22TNT position fixes (#4519)Mat1-2/+1
* 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
2019-08-11Fix building with clang 8.0 (#4346)Bond-0092-2/+2
2018-08-29Force all headers other than "Globals.h" to be included with relative paths (#4269)peterbell1014-17/+14
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-07-27cWorld: Manually bind deprecated broadcast functions (#4265)peterbell101-1/+1
Ref: https://github.com/cuberite/cuberite/pull/4264#discussion_r204769193
2018-07-26CheckBasicStyle: Check number of empty lines between functions (#4267)peterbell102-2/+0
Add check for number of empty lines between functions and fix the corresponding failures
2018-07-25At long last... Piston animations!Tiger Wang2-27/+12
* Fixes #3198 * Fixes #57 (again lol)
2018-01-03Add the fmt library (#4065)peterbell101-0/+1
* Replaces AppendVPrintf with fmt::sprintf * fmt::ArgList now used as a type safe alternative to varargs. * Removed SIZE_T_FMT compatibility macros. fmt::sprintf is fully portable and supports %zu. * Adds FLOG functions to log with fmt's native formatting style.
2017-09-25cPressurePlateHandler: Fix uninitialised variables. (#4047)peterbell101-2/+2
2017-09-19Changed BroadcastSoundEffect, SendSoundEffect, and CastThunderbolt parameters to vectors (#3959)Lane Kolbly1-1/+1
* Made BroadcastSoundEffect take vector parameters. * Added docs for new vectored methods * Removed old code * Fixed lua warnings * Made old BroadcastSoundEffect not an override. * m_Block to m_BlockPos, used Vector3d constructor where prettier. * a_Block to a_BlockPos * Changed thunderbolt a_Block to a_BlockPos
2017-09-19Removed UTF-8 BOM (#4033)Lukas Pioch1-1/+1
2017-09-11Replace ItemCallbacks with lambdas (#3993)peterbell107-116/+36
2017-09-07Changed some int parameters to vector parameters (#3937)Bond-00920-87/+87
2017-09-02Revert "Replace ItemCallbacks with lambdas (#3948)"LogicParrot7-36/+116
This reverts commit 496c337cdfa593654018c171f6a74c28272265b5.
2017-09-01Replace ItemCallbacks with lambdas (#3948)peterbell107-116/+36
2017-08-17Changed int parameters to vector parameters in cCuboid and simulators (#3874)Lane Kolbly1-2/+2
2017-08-06Removed unneeded includes (#3902)Lukas Pioch2-3/+0
2017-08-03Remove double includes part 2 (#3890)peterbell102-2/+0
2017-07-17Allocate redstone component handlers upfrontpeterbell1022-299/+264
2017-05-21Clang 5.0 fixesLukas Pioch1-1/+1
- Added override keyword - Removed inherited member variables
2017-04-29Fix fence gates (#3683)Bond-0091-0/+5
This commit fixes an issue where a pressureplate would only open oak fence gates
2017-02-15Updated sounds and effect IDs (#3422)mathiascode2-2/+2
2016-12-06Fix comparator segfaultsMarvin Kopf1-1/+8
The handler would get called for any BlockEntity, but not every BlockEntity is a BlockEntityWithItems. Downcasting with static_cast is UB on fail.
2016-07-31Redstone fixes (#3285)Tiger Wang2-52/+86
* Comparators and pistons no longer update instantly * Fixes #3168. * Consolidated comparator code * As a result, fixed an issue where GetPowerLevel didn't consider block entities behind it (only GetFrontPowerLevel did)
2016-07-29Revert "Redstone fixes"Mattes D2-86/+52
2016-07-29Consolidated comparator codeTiger Wang1-46/+37
* As a result, fixed an issue where GetPowerLevel didn't consider block entities behind it (only GetFrontPowerLevel did)
2016-07-29Comparators and pistons no longer update instantlyTiger Wang2-12/+55
* Fixes #3168.
2016-07-18CMake: Remove needless minimum version specifications.Mattes D1-1/+0
2016-07-01Revert "Made redstone handlers static"Lukas Pioch2-93/+31
2016-06-15- Add a activation flag to droppers and dispensers. Previously droppers and dispensers shot items with every block update.QUSpilPrgm2-5/+28
- Fixes a range check inside cIncrementalRedstoneSimulator::Simulate
2016-05-28Don't let redstone blocks power adjacent blocks. (#3214)QUSpilPrgm2-3/+2
* Don't let redstone blocks power adjacent blocks. This fixes issue #2966
2016-05-28Made redstone handlers staticTiger Wang2-31/+93
* Improvements to performance? Maybe. Can't hurt (he says).
2016-02-09Update RedstoneSimulator to delete unused cached PowerDataMarvin Kopf2-1/+10
When a new block was placed that has a corresponding RedstoneHandler the PowerData for the position was cached, but never deleted and remained unchanged when the block got destroyed. The RedstoneSimulator now erases all cached PowerData for positions where the block doesn't have a RedstoneHandler (i.e. Air).
2016-02-05Bulk clearing of whitespaceLogicParrot2-3/+3
2016-01-11Fixed issue #2218Austin Martin1-3/+5
2016-01-01Renamed leftover strings to Cuberite / Server, as needed.Mattes D1-1/+1
Also upgraded the user setting file for MSVC to 2013.
2015-12-28Removed excessive logging in redstone simulator.Mattes D1-7/+0
2015-12-24Silenced the Redstone Simulator console spamSafwat Halaby17-20/+20
2015-12-24PF - "Special blocks" handlingSafwat Halaby4-4/+4
2015-12-19Fixes for clang-3.7Lukas Pioch4-6/+6
2015-12-18Reorganised the redstone simulatorTiger Wang24-0/+2195
-> Many thanks to @worktycho for the idea, and @Haxi52 for the implementation plan! * Uses classes and inheritance now * Speed should be improved