1
0
Fork 0
Commit Graph

106 Commits

Author SHA1 Message Date
Rorkh 4c5d9d38f4 Only nether-native mobs can see through lava 2021-10-02 21:18:18 +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 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
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
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 9ee47e5999 Using Super. 2020-04-16 20:07:48 +00:00
mathiascode d5c58c6b17 Tweak attack ranges 2020-04-02 09:30:50 +02: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
Muhammad Kaisar Arkhan 73689024f0 Add BurnsInDaylight to Lua API and Monsters.ini (#4295)
* Monster.h: Export SetBurnsInDaylight

This commit also adds BurnsInDaylight to check if the Monster burns in daylight
or not.

Closes https://github.com/cuberite/cuberite/issues/4294

* MonsterConfig.cpp: Add BurnsInDaylight

Closes https://github.com/cuberite/cuberite/issues/4294
2018-09-24 21:32:47 +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
Lukas Pioch b55e5f5ad1 Use ref instead of pointer 2017-08-24 14:36:29 +02:00
Safwat Halaby c1b1cb87a1 Removed outdated pathfinder comment (#3955) 2017-08-23 22:05:33 +03:00
Pablo Beltrán b18f6637b6 Fully implemented leashes (#3798) 2017-08-21 10:46:41 +02:00
Tiger Wang 72d7027861 Merge pull request #3489 from cuberite/EntityOwnership
* Changed entity ownership model to use smart pointers
2017-08-18 11:17:56 +01:00
Lukas Pioch 743a50014a Replaced includes with forward declarations 2017-08-13 12:31:10 +01:00
Tiger Wang 4ef47aed62 Changed entity ownership model to use smart pointers 2017-08-07 19:24:16 +01:00
Lukas Pioch 07f25253a2 Removed unneeded includes (#3902) 2017-08-06 20:57:44 +01:00
peterbell10 759618b035 Remove double includes part 2 (#3890) 2017-08-03 15:34:19 +02:00
Lukas Pioch 0397535fa7 Removed unused forward declarations (#3888) 2017-08-03 15:10:29 +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
Lukas Pioch e35ac1bfb9 Clang 5.0 fixes
- Added override keyword
- Removed inherited member variables
2017-05-21 12:19:06 +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
Mattes D 2622a8622a APIDump: Reformatted the docs to include type information.
Also fixed a bit of documentation in the CPP source.
2016-09-12 23:21:15 +02:00
LogicParrot 4aade202e0 cMonster::m_Target safety across worlds 2016-02-03 22:50:17 +02:00
LogicParrot d344e574de Spiders now friendly at daylight, new cChunk functions 2016-01-21 08:21:29 +02:00
LogicParrot 21df3cb0d8 Fix mob attack interval 2016-01-12 14:20:17 +02:00
LogicParrot 359e772dee Tamed wolf assists owner (attack / defence) 2016-01-12 11:47:59 +02:00
Safwat Halaby dfeced18b2 PF - "Special blocks" handling 2015-12-24 06:20:16 +02:00
Gargaj 66e6589883 blockheight mechanism 2015-12-13 15:16:15 +01:00
Safwat Halaby 8a5df43e6c Decoupled cMonster and path recalc logic, re-implemented recalc 2015-12-13 07:13:34 +02:00
Gargaj 4ae3b64b07 implement breeding 2015-11-29 20:14:28 +01:00
Julian Laubstein 48f84cc3e9 changed mob age from char to int 2015-11-16 14:13:44 +01:00
Safwat Halaby db40172b64 Partial revert of #2446 2015-09-28 08:52:08 +03:00
Tiger Wang baf3a07804 Fixed a position bug in the pathfinder 2015-08-22 17:06:08 +01:00
Mattes D 6e4122e551 Unified the doxy-comment format. 2015-07-31 16:49:10 +02:00
hallucino 9c85ed5864 Spawn baby mobs 2015-07-16 22:49:55 +02:00
Hallucino 53207d3f18 Support ageable mobs
Move ageable stuff in Monster directly
2015-07-14 22:41:31 +02:00
tycho 4956e8700d Merge branch 'master' into PreventNewWarnings
Conflicts:
	src/Entities/ArrowEntity.cpp
2015-05-29 00:12:56 +01:00
SafwatHalaby f1540173da AI - Sane Skeleton 2015-05-28 19:19:56 +03:00
tycho 77f1f58c0a Make -Werror disabling file only
Ad fix a load of warnings
2015-05-19 19:32:10 +01:00
SafwatHalaby 29e31c5be9 Pathfinder - approximated paths when original destination unreachable 2015-05-17 19:36:52 +03:00
Mattes D c13b1931ff More style checking.
Spaces around some operators are checked.
2015-05-09 12:58:54 +02:00
wiseoldman95 b8aa38b18d (duplicate) AI - Livestock escape fixed, water jumping fixed 2015-05-06 17:23:07 +03:00
wiseoldman95 304bc4eca4 AI - More conservative use of ResetPathFinding, fixed minor swimming / jumping bug 2015-05-05 12:51:58 +03:00
Tiger Wang a509cf00ef Entity improvements
•Pathfinder improvements
•Fixes #1217
•Fixes #1933

Merge remote-tracking branch 'SafwatHalaby/water2' into fixes
2015-05-03 23:58:12 +01:00