How to get entity vars from a script

Place to get help with not working mods / modding interface.
midnight109
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Thu Jun 27, 2013 3:59 pm
Contact:

How to get entity vars from a script

Post by midnight109 »

I am working on a detector script for mines, to see how much of a resource is around a drilling unit
when i use the createdentity i can get the basics but not the resource_searching_radius variable
so im curious for a way to look at all mods and base to get that variable for the games mines as well as mods mines to see thier search radius. The idea is to get thier search radius, divide by two and run game.findentitiesfiltered every so often on each mine to see how much it has access to then also need to get and store the mines/drills cords ie its X/Y location
any ideas?

midnight109
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Thu Jun 27, 2013 3:59 pm
Contact:

Re: How to get entity vars from a script

Post by midnight109 »

Well still no luck <.< I keep trying to use the wiki, it says all the info is stored in the data.raw table, but it always says the the table is empty when I doa serpent or when i access it its always nill
I am using a require "dataloader" and running local t109 = data.raw.ammo["piercing-bullet-magazine"].magazine_size gives a - attempt to index field 'ammo' (a nil value)
I tried accessing it with names, types, always says its nil value.
When i do a glob.player.print(serpent.block(data.raw)) it says its empty - { } <memory address>
https://forums.factorio.com/wiki/inde ... g_overview says I can access the info this way but I cant seem to get it to load anything <.< any suggestions on what im messing up

User avatar
rk84
Filter Inserter
Filter Inserter
Posts: 556
Joined: Wed Feb 13, 2013 9:15 am
Contact:

Re: How to get entity vars from a script

Post by rk84 »

Data.raw only exist when factorio is starting and you use data.lua file to edit it.
Its temporary holder of prototype definitions until all data.luas are done and the game will retrieve the data.
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela

Post Reply

Return to “Modding help”