Skip to content
This repository has been archived by the owner on Oct 27, 2024. It is now read-only.
/ ripent.py Public archive

Python ripent utility for mass-editing maps entity data

License

Notifications You must be signed in to change notification settings

Mikk155/ripent.py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

On hiatus until the library hlunity.py is fully done.

About

ripent.py is a python script for exporting, importing and modifying entity data by using logic rules

This is heavily inspired in lazyripent.py

Release

Installing

  • windows (1.0.0)

    • It may be threated as malware due to python being repacked within the executable
    • It is trustful, you can see the workflows where it is built
    • If you still have your doubts you can always install python and use the open-source library
  • python (2.0)

    pip install MikkUtils
    
  • linux (1.0.0)

    • Probably the same as windows executable
    • This workflows program has not been tested yet so i'm unsure if this even works
  • rules

    • This is a example rules made for another project that is using this tool

Using

Run the script and follow the instructions or use it in with arguments for advanced mode

Advanced mode

Logic Rules


NOTE: It is recommended to use a decent program if you are not familiar with JSON, as these will show you your errors if you make any. Visual Studio Code is recommended.


The JSON format we will use is composed of an array of dictionaries

Each dictionary represents a rule to be applied to the map entities.

There are two types of rules: selectors and actions.

While selectors are responsible for "choosing" entities, actions are responsible for executing certain actions if they were chosen.

graph TD;
    a["["] --> b["{ }"];
    a1["]"] --> b["{ }"];
    b["{ }"];
    b --> c["match\n{ }"];
    c --> e1["string"];
    b --> c2["not_match\n{ }"];
    c2 --> e2["string"];
    b --> c3["have\n[ ]"];
    c3 --> e4["string"];
    b --> c4["not_have\n[ ]"];
    c4 --> e5["string"];
    b --> c5["replace\n{ }"];
    c5 --> e6["string"];
    b --> c6["rename\n{ }"];
    c6 --> e7["string"];
    b --> c7["add\n{ }"];
    c7 --> e8["string"];
    b --> c8["remove\n[ ]"];
    c8 --> e9["string"];
    b --> c9["new_entity\n[ ]"];
    c9 --> e10["{ }"];
    e10 --> e10b["string"];
    b --> c10["maps\n[ ]"];
    c10 --> e11["string"];
Loading

Selectors

match

"match":
{
    "classname": "monster_barney",
    "models": "models/barney2.mdl"
}

The entity MUST have the following values defined.

not_match

"not_match":
{
    "weapons": "1"
}

The entity MUST NOT have the following values defined.

maps

"maps":
[
    "c1a0",
    "c1a1"
]

The map MUST be named one of these.

NOTE: maps, match and not_match are special and support initial and final wildcarding with an asterisk *

have

"have":
[
    "body",
    "skin"
]

The entity MUST have these keys, regardless of their value.

not_have

"not_have":
[
    "spawnflags"
]

The entity MUST NOT have these keys, regardless of their value.

Actions

delete

"delete": true

Deletes the entity

replace

"replace":
{
    "models": "models/mymod/barney.mdl"
}

Replaces the value of a key.

rename

"rename":
{
    "body": "bodygroup"
}

Renames the key while keeping the original value.

add

"add":
{
    "weapons": "1"
}

Adds a new key-value pair.

remove

"remove":
[
    "skin"
]

Removes the key and its value.

new_entity

"new_entity":
[
    {
        "classname": "env_sprite_follow",
        "target": "$targetname"
    }
]

Creates one or more new entities.


values

In some cases, you can use a dollar sign $ at the beginning to copy the original value of the entity.

For example: "body": "$bodygroup"

In this case, we are copying the existing value in the "bodygroup" key.

That feature works for the values of:

  • new_entity
  • replace
  • add

Credits