1
0
Fork 0
Commit Graph

147 Commits

Author SHA1 Message Date
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
LogicParrot b3d4e0fca6 Fixed death on teleportation or leaving Minecart (#3181) 2016-05-03 10:48:39 +03:00
LogicParrot 9e796f4e62 MoveToWorld defaults to spawnpoint 2016-03-30 11:42:06 +03:00
LogicParrot 83459d0d89 Proper entity destruction in non-ticking chunks 2016-02-19 07:05:22 +02:00
Marvin Kopf a1c48f4853 Fix cPawn pushing
cPawn instances can no longer push an entity they are attached to. cEntity now has a IsAttachedTo method.
2016-02-02 14:57:20 +01:00
LogicParrot 439b3304f4 Improved tamed wolf pack cooperation and projectile reactions 2016-01-22 21:16:27 +02:00
LogicParrot d344e574de Spiders now friendly at daylight, new cChunk functions 2016-01-21 08:21:29 +02:00
Gargaj 4ae3b64b07 implement breeding 2015-11-29 20:14:28 +01:00
Alexander Harkness 1d4c6d3fbe Destroy an ender crystal, damage a dragon when hit by an egg. 2015-11-05 16:42:42 +00:00
bibo38 73b8be0fef Implemented the FireResistence potion effects.
This not only provides fire resistence, but also prevents blaze fireballs.
See #2556
2015-10-31 23:06:10 +01:00
Tiger Wang de2cce9b79 Fixed food drain bugs 2015-08-20 16:26:42 +01:00