Page 1 of 1

LuaScriptArea more features

Posted: Tue May 19, 2020 12:55 pm
by LuziferSenpai
Hey,

so it would be nice if we could get this for LuaScriptArea, so its more useful then already.
First make it a own Class.
With that we could use with Stuff like this:

LuaScriptArea::name → string [Read-Write]
LuaScriptArea::id → uint [Read-only]
LuaScriptArea::area → BoundingBox [Read-Write]
LuaScriptArea::color → Color [Read-Write]
LuaScriptArea::get_polution() → double
LuaScriptArea::get_entities() → array of LuaEntity
LuaScriptArea::get_entities_filtered{name=…, type=…, ghost_name=…, ghost_type=…, direction=…, collision_mask=…, force=…, to_be_upgraded=…, limit=…, invert=…} → array of LuaEntity
LuaScriptArea::get_tiles_filtered{name=…, limit=…, has_hidden_tile=…, collision_mask=…} → array of LuaTile
LuaScriptArea::count_entities_filtered{name=…, type=…, ghost_name=…, ghost_type=…, direction=…, collision_mask=…, force=…, limit=…, invert=…} → uint
LuaScriptArea::count_tiles_filtered{name=…, limit=…, has_hidden_tile=…, collision_mask=…} → uint
LuaScriptArea::find_non_colliding_position(name, precision, force_to_tile_center) → Position
LuaScriptArea::find_enemy_units(force) → array of LuaEntity
LuaScriptArea::find_units{force=…, condition=…} → array of LuaEntity
LuaScriptArea::pollute(amount)
LuaScriptArea::deconstruct_area{force=…, player=…, skip_fog_of_war=…, item=…}
LuaScriptArea::cancel_deconstruct_area{force=…, player=…, skip_fog_of_war=…, item=…}
LuaScriptArea::upgrade_area{force=…, player=…, skip_fog_of_war=…, item=…}
LuaScriptArea:cancel_upgrade_area{force=…, player=…, skip_fog_of_war=…, item=…}
LuaScriptArea::destroy_decoratives{position=…, name=…, limit=…, invert=…}
LuaScriptArea:get_decoratives_filtered{name=…, limit=…, invert=…} → array of DecorativeResult
LuaScriptArea::get_resource_counts() → dictionary string → uint

ONLY eventually LuaScriptArea::clone_script_area{destination_area=…, destination_surface=…, destination_force=…, clone_tiles=…, clone_entities=…, clone_decoratives=…, clear_destination_entities=…, clear_destination_decoratives=…, expand_map=…}

LuaScriptArea::clone_brush{destination_offset=…, destination_surface=…, destination_force=…, clone_tiles=…, clone_entities=…, clone_decoratives=…, clear_destination_entities=…, clear_destination_decoratives=…, expand_map=…, manual_collision_mode=…}

Greetz,

Luzifer

Re: LuaScriptArea more features

Posted: Tue May 19, 2020 1:01 pm
by posila
What would be benefit of duplicating bunch of functions that already exist on LuaSurface onto some other class though?

Re: LuaScriptArea more features

Posted: Tue May 19, 2020 1:02 pm
by LuziferSenpai
Some of these functions DONT support Area and we dont need to go down in a table just to get the area, so it would be less script.

Re: LuaScriptArea more features

Posted: Tue May 19, 2020 5:13 pm
by Rseding91
LuziferSenpai wrote: Tue May 19, 2020 1:02 pm Some of these functions DONT support Area ...
Some of those functions aren't even meant to exist outside of our own development purposes but we left them because "maybe someone will find them handy"
LuziferSenpai wrote: Tue May 19, 2020 1:02 pm ... and we dont need to go down in a table just to get the area, so it would be less script.
That's exactly what you're supposed to do. As Posila said; I don't see the point in copy-pasting all of that code into another area just so someone can write a few less lines of Lua.