<commit_before>package gibber.systems;

import com.artemisx.Aspect;
import com.artemisx.Component;
import com.artemisx.ComponentMapper;
import com.artemisx.Entity;
import com.artemisx.EntitySystem;
import com.artemisx.World;

import flash.utils.IDataInput2;
import flash.ui.Keyboard;

import gibber.components.ContainableCmp;
import gibber.components.StaticPosCmp;
import gibber.components.TeractNodeCmp;
import gibber.gabby.PortalEdge;
import gibber.gabby.SynTag;
import gibber.commands.MoveCmd;
import gibber.components.BounceCmp;
import gibber.components.CmdQueue;
import gibber.components.ContainerCmp;
import gibber.components.ControllerCmp;
import gibber.components.ClientCmp;
import gibber.components.InventoryCmp;
import gibber.components.InputCmp;
import gibber.components.LookCmp;
import gibber.components.NameIdCmp;
import gibber.components.NetworkPlayerCmp;
import gibber.components.PortalCmp;
import gibber.components.PosCmp;
import gibber.components.PosTrackerCmp;
import gibber.components.RegionCmp;
import gibber.components.RenderCmp;
import gibber.components.SonarCmp;
import gibber.components.SyncCmp;
import gibber.components.TrailCmp;
import gibber.components.TimedEffectCmp;
import gibber.components.TransitRequestCmp;
import gibber.managers.ContainerMgr;
import gibber.scripts.TransitScript;
import gibber.teracts.LookTeract;
import gibber.teracts.MoveTeract;
import utils.Polygon;
import utils.Vec2;

using Lambda;

class EntityAssemblySys extends EntitySystem
{
    public function new() {
        super( Aspect.getEmpty() );
    }

    override public function initialize() : Void {
        containerMgr = world.getManager( ContainerMgr );
        regionMapper = world.getMapper( RegionCmp );
        posMapper = world.getMapper( PosCmp );
    }

    public function createNetworkPlayer( name: String, sector: Entity, position: Vec2, id: UInt ): Entity {
        var player = createPlayer( name, sector, position );
        var npCmp = new NetworkPlayerCmp( id );
        // player.removeComponent( RenderCmp ); // do not render the network player!
        player.removeComponent( InputCmp ); // do not control the network player!
        player.removeComponent( SyncCmp ); // do not sync the network player!
        player.addComponent( npCmp );
        return player;
    }

    public function createPlayer( name: String, sector: Entity, position: Vec2 ): Entity {
        var e = world.createEntity();
        var lookCmp = new LookCmp();
        var nameCmp = new NameIdCmp( name, new SynTag( name, ["sub", name], SynType.NOUN ) );
        var posCmp = new PosCmp( sector, position );
        var renderCmp = new RenderCmp();
        var cmdCmp = new CmdQueue();
        var syncCmp = new SyncCmp();<commit_msg>only render opponent in debug-local builds<commit_after>package gibber.systems;

import com.artemisx.Aspect;
import com.artemisx.Component;
import com.artemisx.ComponentMapper;
import com.artemisx.Entity;
import com.artemisx.EntitySystem;
import com.artemisx.World;

import flash.utils.IDataInput2;
import flash.ui.Keyboard;

import gibber.components.ContainableCmp;
import gibber.components.StaticPosCmp;
import gibber.components.TeractNodeCmp;
import gibber.gabby.PortalEdge;
import gibber.gabby.SynTag;
import gibber.commands.MoveCmd;
import gibber.components.BounceCmp;
import gibber.components.CmdQueue;
import gibber.components.ContainerCmp;
import gibber.components.ControllerCmp;
import gibber.components.ClientCmp;
import gibber.components.InventoryCmp;
import gibber.components.InputCmp;
import gibber.components.LookCmp;
import gibber.components.NameIdCmp;
import gibber.components.NetworkPlayerCmp;
import gibber.components.PortalCmp;
import gibber.components.PosCmp;
import gibber.components.PosTrackerCmp;
import gibber.components.RegionCmp;
import gibber.components.RenderCmp;
import gibber.components.SonarCmp;
import gibber.components.SyncCmp;
import gibber.components.TrailCmp;
import gibber.components.TimedEffectCmp;
import gibber.components.TransitRequestCmp;
import gibber.managers.ContainerMgr;
import gibber.scripts.TransitScript;
import gibber.teracts.LookTeract;
import gibber.teracts.MoveTeract;
import utils.Polygon;
import utils.Vec2;

using Lambda;

class EntityAssemblySys extends EntitySystem
{
    public function new() {
        super( Aspect.getEmpty() );
    }

    override public function initialize() : Void {
        containerMgr = world.getManager( ContainerMgr );
        regionMapper = world.getMapper( RegionCmp );
        posMapper = world.getMapper( PosCmp );
    }

    public function createNetworkPlayer( name: String, sector: Entity, position: Vec2, id: UInt ): Entity {
        var player = createPlayer( name, sector, position );
        var npCmp = new NetworkPlayerCmp( id );
#if ( debug && local )
        // render the network player in debug-local builds
#else
        player.removeComponent( RenderCmp ); // do not render the network player!
#end
        player.removeComponent( InputCmp ); // do not control the network player!
        player.removeComponent( SyncCmp ); // do not sync the network player!
        player.addComponent( npCmp );
        return player;
    }

    public function createPlayer( name: String, sector: Entity, position: Vec2 ): Entity {
        var e = world.createEntity();
        var lookCmp = new LookCmp();
        var nameCmp = new NameIdCmp( name, new SynTag( name, ["sub", name], SynType.NOUN ) );
        var posCmp = new PosCmp( sector, position );
        var renderCmp = new RenderCmp();
        var cmdCmp = new CmdQueue();
        var syncCmp = new SyncCmp();
{'fraction_non_alphanumeric': 0.09266202463845742, 'fraction_numerical': 0.0014283163720764148, 'mean_word_length': 4.23062558356676, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1877964', 'n_tokens_mistral': 1767, 'n_tokens_neox': 1688, 'n_words': 424}