1
0
Fork 0
Commit Graph

225 Commits

Author SHA1 Message Date
Rorkh 4c5d9d38f4 Only nether-native mobs can see through lava 2021-10-02 21:18:18 +01:00
TheHyper45 3b35a00397
Death messages for tamed pets and ocelots are now tamable. (#5243)
* Fixing bugs regarding wolfs and ocelots

* Death messages appear after killing tamed ocelots and wolfs

* Style fix

* Added myself to the CONTRIBUTORS file

* Removed redundant string initialization

* Removed an unsafe cast.

* Changed the order of initialization of fields in constuctor of class cOcelot
2021-06-19 21:25:24 +00:00
Alexander Harkness 62e95745ac
Migrate off CircleCI to Jenkins (#5230)
* Add Jenkinsfile

* cd src

* Escape wildcards

* Refactor stages

* Remove CircleCI junk

* Make clang-tidy do something

* updated regex to include only the files in the base src directory

* fixed errors displayed by new clang tidy version

* adjust clang core count to actual count

* Update README with new Jenkins build

Co-authored-by: 12xx12 <44411062+12xx12@users.noreply.github.com>
2021-06-15 09:00:02 +00:00
nshah25 8be1dd54bb
Add player statistics to API (#5193)
* Fixed issue #5166

Co-authored-by: 12xx12 <44411062+12xx12@users.noreply.github.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2021-05-03 21:07:09 +01:00
Tiger Wang 66c211c33a Unify multiprotocol entity animations 2021-04-12 22:35:07 +01:00
Tiger Wang 6e80f7544d Update entity sizes 2021-04-12 22:35:07 +01:00
Tiger Wang 4cd49d7eca Fix sending incorrect date values on world change
Yak shave: make more things use cTickTime. Fix a couple of incorrect modulo-on-millisecond-value by making them use WorldTickAge.
2021-04-12 22:35:07 +01:00
Tiger Wang 45591cbe7b
Properly deprecate more XYZ parameter'd functions (#5147)
* Fixes #5144
2021-03-15 02:28:18 +00:00
12xx12 3daf253b7f
Some emplace_back replacements (#5149)
* replace push_back with emplace_back when a new object was created in the function call
2021-03-07 16:31:43 +00:00
Tiger Wang 054a89dd9e Clarify cClientHandle, cPlayer ownership semantics
+ A cPlayer, once created, has a strong pointer to the cClientHandle. The player ticks the clienthandle. If he finds the handle destroyed, he destroys himself in turn. Nothing else can kill the player.
* The client handle has a pointer to the player. Once a player is created, the client handle never outlasts the player, nor does it manage the player's lifetime. The pointer is always safe to use after FinishAuthenticate, which is also the point where cProtocol is put into the Game state that allows player manipulation.
+ Entities are once again never lost by constructing a chunk when they try to move into one that doesn't exist.
* Fixed a forgotten Super invocation in cPlayer::OnRemoveFromWorld.
* Fix SaveToDisk usage in destructor by only saving things cPlayer owns, instead of accessing cWorld.
2021-01-12 12:34:34 +00:00
Tiger Wang 9328afe65c Convert most calls to blocking GetHeight/GetBiomeAt to direct chunk accesses
* Hopefully fixes #5094
2021-01-11 16:39:56 +00:00
Tiger Wang 16aeb84cd3
Fix potential destruction crashes (#5095)
* Fix potential destruction crashes

* Fix destructors accessing destroyted objects
* Fix cPlayer not destroying windows (Destroyed never called)
* Tentatively fixes #4608, fixes #3236, fixes #3262
- Remove cEntity::Destroyed() and replace with cEntity::OnRemoveFromWorld()

* Add missing call to OnRemoveFromWorld
2021-01-02 13:50:34 +00:00
Tiger Wang 47c0b48bfd Monsters: improve targeting
* Replace DoWithNearestPlayer with bounding box search (avoid iterating through all players in world).
* Do line-of-sight checks from eye-to-eye.
+ Added LOS and LOS lost timer to target lost checks, in addition to distance.
2020-12-21 13:52:23 +00:00
the1robert 73ae985a4b Enable LOS checks for Hostile Mobs. 2020-12-20 02:00:44 +00:00
12xx12 e35519ec8a
Adding new monster types to enum and saving/loading for easier future implementation (#4941)
* added new monster types to enum
added string <-> enum conversion in namespace serializer
added loading functions
added to saving

* renamed zombie pigman to zombified piglins in enum

Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-11-22 23:41:13 +00:00
12xx12 32ee1708a2
Adding wolf breading and moving breeding functionality to cMonster (#4951)
* added wolf breading

* mpoved breeding to monster

* checkstyle

* fixed my IDE "helping"

* removed magic number
and fixed faster aging

* added flooring to age manipulation

* fixed copiler error

* fixed typo

* moved tps to Defines.h

* removed the TPS constant from the lua API exposure

* added inline constexpr
added explanation

* fixed broken build

* "fixed" build

Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-10-09 20:49:25 +00:00
Mattes D 46398f4671 Replaced cpp14::make_unique<> with std::make_unique<>. 2020-08-01 20:04:31 +01:00
Tiger Wang f49f90906c Reduced packet spam when entities idle
* Try not to send look packets when nothing's changed.
2020-07-06 20:56:05 +01:00
peterbell10 13144a08e4
Enable some more clang-tidy linter checks (#4738)
* Avoid inefficient AString -> c_str() -> AString round trip

* Avoid redundant string init expressions

* Avoid unnecessary return, continue, etc.

* Add .clang-format to help with clang-tidy fix-its

* Avoid unnecessary passing by value

* Avoid unnecessary local copying

* Avoid copying in range-for loops

* Avoid over-complicated boolean expressions

* Some violations missed by my local clang-tidy

* Allow unnecessary continue statements

* Add brackets

* Another expression missed locally

* Move BindingsProcessor call into clang-tidy.sh and add space

* Fix pushd not found error

* Different grouping of CheckBlockInteractionRate
2020-05-14 22:15:35 +00:00
Mattes D 9ee47e5999 Using Super. 2020-04-16 20:07:48 +00:00
Alexander Harkness 4b3043f627
Fix compilation, for real this time.
I should go to sleep now...
2020-04-10 01:01:07 +01:00
Bond-009 8438def87e
Add Zombie Villagers 2020-04-10 00:50:45 +01:00
Mat 23219c4738 Wolves and mooshrooms are passive mobs 2020-04-09 12:39:45 +01:00
Mat 60bcc06f43
Implement wither skeletons (#4563) 2020-04-04 13:44:17 +02: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
Mat 2b32bb0b19
Decrease attack cooldown for monsters (#4542)
* Decrease attack cooldown for monsters

* Nerf some mobs

* Decimal points
2020-03-26 20:11:43 +02:00
Mat 84f86a467e
Improvements to blaze and ghast (#4547) 2020-03-26 18:54:40 +01:00
Mat 9ddf433ae7
Add ambient mob sounds (#4521) 2020-03-22 15:50:34 +00:00
Mat 7d4934534e
Stabilise MoveToWorld (#4004)
* Stabilise MoveToWorld

* Fix comments and deprecate ScheduleMoveToWorld

* Enhanced thread safety for m_WorldChangeInfo

* Return unique_ptr from cAtomicUniquePtr::exchange

* cWorld now calls entity cEntity::OnAddToWorld and cEntity::OnRemoveFromWorld.

Allows broadcasting entities added to the world from the world's tick thread.
This also factors out some common code from cEntity::DoMoveToWorld and cEntity::Initialize.

As a consequence, cEntity::Destroy(false) (i.e. Destroying the entity without broadcasting) is impossible.
This isn't used anywhere in Cuberite so it's now deprecated.

* Update entity position after removing it from the world.
Fixes broadcasts being sent to the wrong chunk.

* Fix style

* cEntity: Update LastSentPosition when sending spawn packet

* Add Wno-deprecated-declarations to the lua bindings

* Kill uses of ScheduleMoveToWorld
2020-03-05 12:52:34 +02: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
changyong guo 57690b81a2 Experience orb (#4259)
* Replace cWorld::FindClosesPlayer with cWorld::DoWithClosestPlayer
* Implement experience reward splitting into the orb sizes used in vanilla
* Modified speed calculation in cExpOrb::Tick to make the orbs fly towards the player

Fixes #4216
2018-08-02 15:59:10 +01:00
peterbell10 950aeffff8
CheckBasicStyle: Check number of empty lines between functions (#4267)
Add check for number of empty lines between functions and fix the corresponding failures
2018-07-26 22:24:36 +01:00
peterbell10 e88b3fa2fe New movement system for leashed entities (#4147)
* New movement system for leashed entities
Entities are accelerated towards the leashed to entity as if by a spring.
 * Mobs now pathfind close to but not directly to the leashing entity.
* Also minor comment changes
2018-01-17 21:40:58 +00:00
Bond-009 3065a101a5 Don't burn mobs in daylight when swimming (#4145) 2018-01-15 22:44:48 +00:00
Alexander Harkness ad22922393 Rename cEntity swim states (#3996)
* Replace cEntity:m_IsSubmerged with m_IsHeadInWater
* Replace cEntity:m_IsSwimming with m_IsInWater
* Add API documentation for new symbols
* Apply SetSwimState to all entities, not just mobs and players
* Pickups now use IsOnFire to check if they are on fire before destruction

Fixes #3987
2018-01-14 18:44:45 +00:00
Lane Kolbly 30c8470a52 Changed BroadcastSoundEffect, SendSoundEffect, and CastThunderbolt parameters to vectors (#3959)
* 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-19 15:12:54 +01:00
peterbell10 307e7aaff5 Fix switch warnings (#4013)
* Fix switch warnings
  * Fix a variety of -Wswitch and -Wswitch-enum warnings
  * Remove unneeded -Wno-error flags

* Reorganise some eMonsterType switches
  * Alpha sort eMonsterType cases in WriteMobMetadata
    and in cNBTChunkSerializer::AddMonsterEntity
  * List all mob types in protocol 1.12 and NBTChunkSerializer

* cStructGenTrees::GetNumTrees: remove switch default

* cWSSAnvil::LoadOldMinecartFromNBT: Log unhandled minecart type
2017-09-14 09:48:57 +01:00
Alexander Harkness 765db880f9 Remove double-checking below world for burning 2017-09-01 14:50:02 +01:00
Alexander Harkness 0140923c35 Fix mobs not burning in daylight when on snow (#3961)
* Fix mobs not burning in daylight when on snow

or other non-transparent partial blocks.

Fixes #3945

* Change from floor to ceil
2017-08-25 16:26:45 +01:00
Lukas Pioch b55e5f5ad1 Use ref instead of pointer 2017-08-24 14:36:29 +02:00
Pablo Beltrán b18f6637b6 Fully implemented leashes (#3798) 2017-08-21 10:46:41 +02:00
Lane Kolbly 8f1ddfa6c3 Changed type of FastRandom in monster drop calculation. (#3920)
* Fixed type of FastRandom in monster drop calculation.

* Distribute dropped items into stacks.

* Moved while loop outside if statement.
2017-08-18 11:23:08 +01:00
Tiger Wang 4ef47aed62 Changed entity ownership model to use smart pointers 2017-08-07 19:24:16 +01:00
peterbell10 360d8eade0 FastRandom rewrite (#3754) 2017-06-13 21:35:30 +02:00
Mattes D 0551d78dff Fixed tracer usage in Entity physics handling. (#3720) 2017-05-28 20:56:17 +02:00
Lukas Pioch fc49ace897 Spawn eggs works again 2017-05-22 18:10:12 +02:00
Pablo Beltrán 2359611c57 Don't destroy monster when last target type is a player (#3721)
In current Cuberite version if you are pursued by monsters you just have to disconnect and connect again to get rid of them. If no other player is in your chunk monsters will get destroyed.
2017-05-21 10:29:06 +02:00
bibo38 cb640ffea4 Spectators added (#2852) 2016-10-12 14:38:45 +02:00
LogicParrot 90be4e7efd Entities now bail out of ticks if destroyed (#3363) 2016-09-03 14:31:27 +03:00
Mattes D 7549f468b3 Fixed implicit rounding warnings. 2016-08-19 14:09:10 +02:00