Giter Club home page Giter Club logo

health's Introduction

This is a module for Terasology. It adds the concept of health (or hitpoints) to the game and handles regeneration, restoration and damage of entities.

Contributing

We welcome contributions to our modules, be it bug fixes or feature contributions. Check out the Contributor Guide on the main project wiki to learn more.

To check out this module (and all its dependencies) to your Terasology workspace run (in the workspace root):

groovyw module recurse Health

To build a module JAR for just this module run (in the workspace root):

gradlew :module:Health:jar

To run all tests and static code checks for this module run (in the workspace root):

gradlew :module:Health:check

Documentation via gh-pages

The documentation of this module is build with docsify. It is served via gh-pages. To preview the site you can either use the docsify CLI tool or just run a static server on the docs folder.

health's People

Contributors

askneller avatar cervator avatar darkweird avatar e-aakash avatar eaguairesama avatar jdrueckert avatar kblaszczyk avatar keturn avatar ktksan avatar pollend avatar sabo2k avatar skaldarnar avatar vedant-shroff avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

health's Issues

Instantly heal player to full health

Some event should be provided for other systems to heal an entity to full health.
Currently, other systems increase the health value by huge amount to do the same. Providing with an event for it will improve intersystem interaction, as they will not have to directly access HealthComponent.

Make things more ECS way

Currently, the RegenComponent has many logic bits in it. ECS asks for components with only data, and logic should be kept away for the system to handle.

Save and reload stops ongoing regen

When a block is damaged, and the game is reloaded, the block remains at same "damage state".

The cause might be that scheduler information is lost on leaving the game.

Possible solution: Add a postBegin() to schedule regen

Damage Indicator shows up on Host if Client is damaged

In a multiplayer setting, when the client is damaged, the visual damage indicator is shown on the host instead of the client. This happens irrespective of whether the damage inflicted comes from the host, another client or other origins such as falling.

RegenComponent is removed at full health

If a player drinks a regen potion, it activates regen by ActivateRegenEvent(). But the regen component, and hence the regeneration information is lost if the player is at full health.

ComponentSystemManager tries to load system that does not exist

This is a mystery to me ๐Ÿ”ฎ According to the logs, the ComponentSystemManager is trying to load a CoreHealthSystem as a system, but complains that it is not a subclass of ComponentSystem. The mystery part - this class does not (no longer) exist, not in this module nor in any other module ๐Ÿ‘€

Could this be a reflection issue?

22:59:45.674 [main] ERROR o.t.e.core.ComponentSystemManager - Cannot load CoreHealthSystem, must be a subclass of ComponentSystem

organize under single `health` package

The package names currently used in this module make it difficult to distinguish which classes are in this module and which are from engine or elsewhere.

Recommend all packages here descend from a single org.terasology.health (or org.terasology.module.health?) instead of org.terasology.logic & rendering.

Network events without default constructor

Events need to have a default constructor (no arguments) if they shall be sent over the network. Currently, some of the events violate this requirement.

22:59:44.119 [main] ERROR o.t.e.e.metadata.EventMetadata - Event 'Health:OnRestoredEvent' is a network event but lacks a default constructor - will not be replicated
22:59:44.120 [main] ERROR o.t.e.e.metadata.EventMetadata - Event 'Health:MaxHealthChangedEvent' is a network event but lacks a default constructor - will not be replicated
22:59:44.121 [main] ERROR o.t.e.e.metadata.EventMetadata - Event 'Health:OnDamagedEvent' is a network event but lacks a default constructor - will not be replicated

Fix JavaDoc integration in module docs

JavaDoc Links in Module Docs

Problem

Module docs contain references to Java implementation details, such as specific components, systems, events, or methods. Somebody reading the docs and wanting to learn more about these components, systems, events, or methods would need to search for them in the JavaDocs (provided the link works again in the first place, see #101 ), which can be tedious depending on the module size.

Suggestion

Link all component, system, event, and method references to their respective JavaDoc.

Depends on #101

Base Regen handling

It would be better if baseRegen with 0 value is not added to the scheduler.

Concurrent modification server crash after PR #8

Probably related to two paths hitting the same map in the regeneration scheduler

Scenario: Server/client hosting a BuilderSampleGameplay world, 2nd client joins. Beat randomly on a few blocks and observe yep they don't regen right now, that's another known issue.

Host beat on 2nd client via fisticuffs for a few seconds, observed regen happen fine for 2nd client.

2nd client beat on host for several more seconds, observed regen starting fine but then crashed the server:

21:15:18.188 [main] ERROR o.t.e.e.internal.PojoEntityManager - Adding a component (class org.terasology.logic.health.RegenComponent) over an existing component for entity 31
21:15:18.188 [main] WARN  o.t.logic.health.RegenComponent - Regen added baseRegen
21:15:18.188 [main] WARN  o.t.logic.health.RegenComponent - Regen added baseRegen
21:15:18.241 [main] WARN  o.t.logic.health.RegenComponent - regenerating 3
21:15:18.241 [main] ERROR o.terasology.engine.TerasologyEngine - Uncaught exception, attempting clean game shutdown
java.util.ConcurrentModificationException: null
	at java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1211)
	at java.util.TreeMap$EntryIterator.next(TreeMap.java:1247)
	at java.util.TreeMap$EntryIterator.next(TreeMap.java:1242)
	at com.google.common.collect.AbstractMapBasedMultimap$Itr.next(AbstractMapBasedMultimap.java:1177)
	at org.terasology.logic.health.RegenAuthoritySystem.regenerate(RegenAuthoritySystem.java:102)
	at org.terasology.logic.health.RegenAuthoritySystem.invokeRegenOperations(RegenAuthoritySystem.java:98)
	at org.terasology.logic.health.RegenAuthoritySystem.update(RegenAuthoritySystem.java:70)
	at org.terasology.engine.modes.StateIngame.update(StateIngame.java:171)
	at org.terasology.engine.TerasologyEngine.tick(TerasologyEngine.java:458)
	at org.terasology.engine.TerasologyEngine.mainLoop(TerasologyEngine.java:421)
	at org.terasology.engine.TerasologyEngine.run(TerasologyEngine.java:397)
	at org.terasology.engine.Terasology.main(Terasology.java:156)
21:15:18.241 [main] INFO  o.terasology.engine.TerasologyEngine - Shutting down Terasology...
21:15:18.303 [main] INFO  o.t.p.i.ReadWriteStorageManager - Saving - Creating game snapshot
21:15:18.352 [main] INFO  o.t.p.i.ReadWriteStorageManager - Saving - Snapshot created: Writing phase starts
21:15:18.363 [main] INFO  o.t.n.internal.NetworkSystemImpl - Client disconnected: Cerv2
21:15:18.365 [main] INFO  o.t.logic.console.ConsoleImpl - [NOTIFICATION] Player "Cerv2" has left the game
21:15:18.365 [main] INFO  o.t.n.internal.NetworkSystemImpl - Client disconnected: Cerv1
21:15:18.366 [main] INFO  o.t.logic.console.ConsoleImpl - [NOTIFICATION] Player "Cerv1" has left the game
21:15:18.366 [main] INFO  o.t.n.internal.NetworkSystemImpl - Network shutdown

Suspect something relatively simple is wrong in scheduler management land :-)

Document how to add more damage types

Context

The Health module doc mentions the DamageResistComponent that allows configuring damage types an entity will not be damaged by. Most basic damage types are provided by the Terasology engine code base. There is a minor note on damage types in the Asset System Tutorial. Like all other prefabs, damage types can be modified on module level using Deltas & Overrides. New damage types can further be provided as module assets.

Task

Extend the module docs with information on how to add more damage types.

Open Questions

Should this information be in module-level docs or rather in the engine wiki and only linked to in the Health module docs?

Module is not allowed to implement a TypeHandler

In #84 we introduced the notion of Duration and Instant with corresponding TypeHandlers. As the logs indicate, defining those in the module is not allowed ("Denied access to class").

22:59:42.851 [Thread-3] ERROR o.t.g.m.s.JavaModuleClassLoader - Denied access to class (not allowed with this module's permissions): org.terasology.persistence.typeHandling.TypeHandler
22:59:42.853 [Thread-3] ERROR o.t.g.m.s.JavaModuleClassLoader - Denied access to class (not allowed with this module's permissions): org.terasology.persistence.typeHandling.TypeHandler

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.