Git Product home page Git Product logo

anatomy's Introduction

Anatomy

A basic anatomy system for players, NPCs, and creatures alike. Intended to be included with entities in other modules. It is made up of several sub-systems (Skeletal and Circulatory) working independently to provide different functionalities to the entity.

Adding sub-systems

The internal mechanics of a sub-system are entirely up to the content developer but a few things need to be followed to make it properly work along with the Anatomy system.

  • Receiving the AnatomyPartImpactedEvent-

    The Anatomy system receives the OnDamagedEvent, randomly allocates the damage to a body part and sends out the AnatomyPartImpactedEvent with the partId and damage details.

    @ReceiveEvent
      public void onDamage(AnatomyPartImpactedEvent event, EntityRef entityRef, AnatomyComponent anatomyComponent) {
    

    The method used in the Skeletal and Circulatory sub-systems to utilise this was to store part healths and deduct the damage dealt from these part healths. This would also entail setting up a regen mechanism using the DelayedActionTriggeredEvent.

  • Adding effects to the AnatomyStatusGatheringEvent-

    The AnatomyStatusGatheringEvent is sent by the Anatomy system to query sub-systems for the effects that they have applied to the various body parts. The addEffect method of the event can be used for this purpose by looping over the different parts.

    public void addEffect(String partId, String effect) {
    
  • Resetting state when the player respawns-

    When the player respawns, the OnPlayerRespawnedEvent is sent. This can be used to reset the part health values and effects. This is as simple as just removing the InjuredBoneComponent or its equivalent.

    @ReceiveEvent
      public void onPlayerRespawn(OnPlayerRespawnedEvent event, EntityRef entityRef, InjuredBoneComponent injuredBoneComponent) {
          entityRef.removeComponent(InjuredBoneComponent.class);
      }
    

anatomy's People

Contributors

arpan98 avatar cervator avatar e-aakash avatar jdrueckert avatar xrtariq2594 avatar

Watchers

 avatar

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.