1
0
Fork 0
Commit Graph

157 Commits

Author SHA1 Message Date
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
Damián Imrich 071b7be3d4
Basic elytra flight (#5124)
* Basic elytra flight

Co-authored-by: 12xx12 <44411062+12xx12@users.noreply.github.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2021-04-03 18:45:20 +01:00
Tiger Wang be2bf999c2 Fix #5118 2021-02-07 22:36:15 +00:00
Damián Imrich 59e906ec6c
Implementation of totem of undying behaviour (#5111)
* notchian totem of undying

* ...

* ....

* Update src/Entities/Pawn.cpp

Co-authored-by: Alexander Harkness <me@bearbin.net>

* DeductTotem func

* fixed build errors

* Added myself to CONTRIBUTORS

* Small changes

Co-authored-by: Peter <peter@cassoviacode.com>
Co-authored-by: Alexander Harkness <me@bearbin.net>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2021-01-22 09:05:18 +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 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
Aiden Neill 3d044d2dde
Added magma block contact damage (#5055)
* Added magma block contact damage
* Fireproof entities do not take damage from magma
* Fire resistance prevents magma damage
* No magma damage when hovering over magma block
2020-11-25 17:56:55 +00:00
Tiger Wang 4519469547 Do not call into things we don't own in destructors
- Remove improper accesses in cChunk destructor
* Fixes #4894
2020-09-25 14:51:16 +01:00
Tiger Wang 93adbdce9a
Use tracing for explosions (#4845)
* 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-09-12 18:57:44 +00:00
peterbell10 154df6b09d
Cleanup unneeded globals (#4736) 2020-05-10 16:16:38 +00:00
Tiger Wang 07ca095740
Improve entity position updates (#4701)
* Make puking pickups fly nicer

* Improve entity position updates

* Move determination of whether a delta is too big for a packet into the protocol handlers
+ Less jittery movement
+ Generalise CollectEntity to take any entity
2020-05-04 08:10:47 +00: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
Alexander Harkness 994036a3b8
Add cEntity::GetBoundingBox, and use where appropriate. (#4711)
* Add cEntity::GetBoundingBox, and use where appropriate.
2020-05-03 21:04:33 +01:00
Tiger Wang 50893667db MoveToWorld must always be provided a world 2020-04-18 19:51:30 +01:00
Tiger Wang e98f93a079 Only store IDs across ticks 2020-04-18 19:51:30 +01:00
Mattes D 9ee47e5999 Using Super. 2020-04-16 20:07:48 +00:00
Alexander Harkness 9210501af5
Prevent player from being destroyed by plugins (#4584)
* Prevent player from being destroyed by plugins

Add manual binding, bails out with error message if attempted
entity to destroy is player.

* Improve warnings and documentation, remove automatic binding

* Remove old and unnecessary deprecated function
2020-03-31 11:39:23 +00:00
Mat 782619e3f8
Send respawn packet by default (#4540) 2020-03-24 14:54:12 +00:00
Mat c750c4e55f
Fix armor protection (#4506)
* Fix armor protection

* Check min damage

* Check min damage

* Commit missing changes

* Convert to int

* Use float

* Float some more
2020-03-22 12:39:32 +02:00
Mat 5a2163d7e6
Don't send entity velocity for boats (#4488)
* Don't send entity velocity for boats
2020-03-07 13:56:02 +02: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
Mattes D 365cbc6e1c
Refactored more of Entities and BlockEntities to use Vector3. (#4403) 2019-09-29 14:59:24 +02:00
Bond-009 e0ca4d8399 Fix building with clang 8.0 (#4346) 2019-08-11 10:39:43 +01:00
Aplaus228 466d986e5e Change TakeDamageInfo::FinalDamage from int to float (#4359)
Closes #4357
2019-08-08 11:51:38 +01:00
peterbell10 c94d7184eb Broadcast refactor (#4264)
* Move Broadcast functions from cChunkMap to cBroadcaster

- Remove cBroadcastInterface in favour of cBroadcaster.

- cChunk: Remove broadcast functions.

* resurect broadcast interface

* Absorb cBroadcaster into cWorld.
Removes the need for forwarding the function calls.

* Improve const-correctness

* Use Int8 instead of char

+ Comment `ForClients` functions

* Improve comments

* Broadcaster: Rename ForClients functions
2018-07-24 22:30:49 +01:00
peterbell10 e27290f7d2
cPawn: Reset last ground height in ResetPosition (#4261)
Prevents fall damage after teleporting/portaling to a lower height.

Fixes #3457
2018-07-23 17:26:48 +01:00
changyong guo 01e72ddb65 Rewrite explosion knock back (#4251)
1. Base knockback on an entity's bounding box intersection with the explosion 
2. Armor blast protection reduces knockback
3. Don't apply knockback to players flying in creative mode

Fixes #4139
2018-07-23 10:24:00 +01:00
changyong guo 2d3013d1d3 Support swap item between main hand and offhand by press key "F" (#4241)
Hi,

I found cuberite don't support to press key "F" to swap items on main hand and offhand, so I implemented this feature.

Best regards
Changyong
2018-06-24 10:24:10 +01:00
peterbell10 4bf160d596 Update m_LastSentPosition in TeleportToCoords and DoMoveToWorld. (#4211) 2018-04-11 08:39:24 +01: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
Fabian 0dd172b80f Store Health as a float (#4073)
* Fix #4024

* Fix clang error

* Add comment

* Fix behaviour

* Save Health as float

* Changed m_Health to float

* Remove redundant static_cast

* Fix casts
2017-11-22 13:47:52 +00:00
Alexander Harkness a4c07d2f98 Adjust lava damage values (#4020)
Fixes isue #2925
2017-09-12 09:02:17 +01:00
Lukas Pioch ed7adef1ca Updated APIDoc (#3985) 2017-09-07 10:33:46 +02:00
Bond-009 104f9e127b Changed some int parameters to vector parameters (#3937) 2017-09-07 10:25:34 +02:00
Lane Kolbly 5d64451f74 Protocol Spawn Position Should Use LastSentPosition (#3929)
+ Added GetLastSentPos

* Fixed spawn position bug in 1.8.
2017-08-30 15:01:33 +01:00
Lane Kolbly 1f9788a801 Added ShouldSendRespawn parameter to ScheduleMoveToWorld (#3979) 2017-08-30 02:35:53 +03:00
mathiascode 02775e52c4 Minor changes (#3909) 2017-08-24 11:19:40 +02:00
Pablo Beltrán b18f6637b6 Fully implemented leashes (#3798) 2017-08-21 10:46:41 +02:00
Tiger Wang 4ef47aed62 Changed entity ownership model to use smart pointers 2017-08-07 19:24:16 +01:00
peterbell10 759618b035 Remove double includes part 2 (#3890) 2017-08-03 15:34:19 +02:00
Lane Kolbly 5402b214b3 Check for intersection between placed blocks and entities. (#3850)
* Check for intersection between placed blocks and entities.

+ Implemented GetPlacementCollisionBox, to permit custom placement collision boxes for blocks.

* Factored block-entity placement checking into another function in cPlayer.

- Removed vector min/max functions

* Use GetWorld to get the world in DoesPlacingBlocksIntersectEntity.

+ Added block height checks, allow different cEntity subclasses to decide whether they will prevent block placement.
2017-07-28 17:59:21 +01:00
Lane Kolbly 87af95b67c Updated armor cover calculation. (#3858)
* Updated armor damage calculation.

+ Added lua docs, added casts from float to int.

* Changed verbage in docstring and comment.
2017-07-23 10:46:38 +01:00
Mattes D 885d80ccdb Entity: Replaced a mutexed counter with a std::atomic. (#3773) 2017-06-15 16:06:50 +01:00
Marvin Kopf dbdcb85346 Added a nullptr check to cEntity::IsA (#3659)
Fixes #3603
2017-04-01 23:15:08 +02:00
Lukas Pioch 0c10704d1f Export GetPosition and GetSpeed from cEntity as a copy instead of a pointer to lua. 2016-12-10 13:32:11 +01:00
bibo38 cb640ffea4 Spectators added (#2852) 2016-10-12 14:38:45 +02:00
Mattes D f8e1df2476 Updated API documentation. 2016-07-18 22:11:40 +02:00
beeduck db65e11d57 Fixes for boat entities (#3265)
protocol for vehicles now properly handled, protocol for boat paddles now properly handled, boats can no longer spawn underwater, boats now properly float, boat metadata now properly broadcasted.
2016-07-18 22:10:00 +02:00
Tiger Wang a5ec2d8ca2 Fixed fall damage
* Fixes #3216
2016-06-01 23:46:24 +01:00