Loot Chest UPS

by ptx0

UPS friendly, Space Exploration-centric fork of LootChestPlus. Supports all loot added to entity prototype (TheDeadBurn, Alien Loot Economy, Bobenemies). Attempts to accumulate uncollected loot in a game-engine-friendly manner. Adds Multi-Surface support for SE, allowing you to make things easier or harder.

Content
2 years ago
1.1
2.56K
Logistics

g [Fixed] Wasen't this fixed ?

2 years ago

https://cdn.discordapp.com/attachments/697564089907675217/917890722894585946/unknown.png

If i got to understand the change log correcly by Pi-C wasn't this fixed in Version: 1.1.9 ?
This is also waht i was asking for in. https://mods.factorio.com/mod/LootChestUPS/discussion/60aadc88b02b38ccaac11486
"Fixed that loot items accumulated while there was no loot chest would never be moved into the loot chest when one was built." Even reding it know seems like i took wrong but still unsure.

2 years ago

just to double check, what are the mod settings set to in the Map tab?

2 years ago

the checkbox is engaged to drop loot when no chest is placed, it seems fine

Pi-C β˜†
2 years ago

"Fixed that loot items accumulated while there was no loot chest would never be moved into the loot chest when one was built."

"Accumulated loot" doesn't mean loot that's lying on the ground, but the loot that was picked up and stored temporarily in a table. This will only happen if the drop-loot setting is turned off, as ptx0 already pointed out.

2 years ago

ah yes thanks Pi-C, that's the confusion. the setting doesn't pick the items up off the ground.

the way it works, is to delete the loot from the ground, and keep it in a hidden queue.

when the chest is placed, if there is loot on the ground, it doesn't migrate to the chest. only the hidden queued pieces will be dumped into the chest.

2 years ago

yea ok. Still have a bug where it still won't pick up loot even after loot chest is placed and i have killed a pile of spwners. even saw artiefact spawning but not picked up as i killed the enemies

2 years ago

if the loot drop isn't defined in the entity prototype, there's nothing for this chest to pick up. some mods use odd ways of dropping loot. you'd have to talk to them about that.

2 years ago
(updated 2 years ago)

So u have wiped all the artifact from mods that was working in 1.1.8 ? as Bob's and Darkstar. As non of the 2 mod has updated at all since.

Pi-C β˜†
2 years ago

ah yes thanks Pi-C, that's the confusion. the setting doesn't pick the items up off the ground.

the way it works, is to delete the loot from the ground, and keep it in a hidden queue.

Not quite: When an entity dies, it may have loot. However, the mod then steps in right before the loot will be placed on the ground and moves the loot from the entity into the chest, or adds it to the table. This has two advantages: (1) We don't have to scan the ground for loot in regular intervals, but can act on demand (if an entity has died). (2) If a player, turret etc. killed the entity, we know what force they are on, so we can put the loot into the proper chest.

I've thought about picking up loot from the ground, but that's not practical: If you find an item on the ground, there's no way to know how it got there. It may be loot, or it may simply be items you dropped when changing from your power armor MK2 to light armor, or items that were on a belt which has been destroyed. Even if it was proper loot, who should get it? That's of no importance in single player, but in multiplayer mode, it would be unfair if only one force would benefit.

when the chest is placed, if there is loot on the ground, it doesn't migrate to the chest. only the hidden queued pieces will be dumped into the chest.

2 years ago

Not quite: When an entity dies, it may have loot. However, the mod then steps in right before the loot will be placed on the ground and moves the loot from the entity into the chest, or adds it to the table. This has two advantages: (1) We don't have to scan the ground for loot in regular intervals, but can act on demand (if an entity has died). (2) If a player, turret etc. killed the entity, we know what force they are on, so we can put the loot into the proper chest.

yes, i'm the one who wrote the original control script to change the way it works from ground-search to loot tables.

i've also already looked into the spawner drops before, and there were at least one or two cases before that didn't work, and those still won't.

2 years ago
script.on_event(defines.events.on_entity_died, pick_up_loot, {
  {filter = "type", type = "unit"},
  {filter = "type", type = "turret"},
  {filter = "type", type = "unit-spawner"},
  --~ {filter = "type", type = "tree"}, -- This can be removed, it's just for local testing!
})

welp, it's probably this.

Pi-C β˜†
2 years ago

Wait, that's not filters for loot, but to catch the entities that died! This is how on_entity_died was filtered in 1.1.8:

script.on_event(defines.events.on_entity_died, function(event)
    local foundLoot = false
    if not global.artifactList then
        global.artifactList = {}
    end
    if string.find(event.entity.name,"spitter") or string.find(event.entity.name, "biter") or string.find(event.entity.name, "worm") or string.find(event.entity.name, "nest") then

Aren't these supposed to be of type unit, turret (the worms), and unit-spawner?

2 years ago

well, i knew i didn't do it the ideal way before :) but it certainly seems to behave differently this way. i guess it's possible that some entity could be described as the wrong type? does that ... work for spawners?

at risk of sounding like a broken record, Sgamez can you supply a save file for this?

2 years ago

btw, i remember not using the entire list of dead units because klonan's mining drones behaved oddly with it.

Pi-C β˜†
2 years ago

It should still be more efficient to use event filters by type, because filtering is done directly by the game (in C, not in Lua). But adding a second-tier filter for specific names would work. Actually, why not add another remote function so mods can blacklist entities whose death will be ignored?

2 years ago
(updated 2 years ago)

a remote function for other mods to overwrite the loot tables with custom definitions would solve all of the problems and even add new functionality to the loot table system (e.g. the ability to increase or reduce the power, type, or quantity of the drops)

2 years ago

access denied to this file (i thought i'd send this reply but i guess i didn't)

2 years ago

downlode in the top right corner

Pi-C β˜†
2 years ago

a remote function for other mods to overwrite the loot tables with custom definitions would solve all of the problems and even add new functionality to the loot table system (e.g. the ability to increase or reduce the power, type, or quantity of the drops)

As loot is defined directly in the prototype of entities that can be killed, this can already be done in the data stage, no need to define a remote function for that.

Pi-C β˜†
2 years ago

downlode in the top right corner

I'm supposed to "sign in to continue to Google Drive". Of course, I've never trusted Google enough to get an account there …

2 years ago

same. it requires that i request permission

2 years ago

As loot is defined directly in the prototype of entities that can be killed, this can already be done in the data stage, no need to define a remote function for that.

i'm talking about dynamically altering the loot tables, which isn't possible without restarting the game otherwise. and conditional startup values like that seems like a good way to desync.

imagine Alien Loot Economy had a way to ramp up the value of loot. imagine that Big Monsters could adjust its loot value just for a single mission.

similiar to how my "Mining an object returns its build materials" mod works to reimplement the prototype mechanism for that same behaviour, because that allows Expensive mode to work the same way.

2 years ago

Try the link now.

2 years ago

ah... that's... a lot of mods, and my internet connection is very slow. if you can't reduce that to a minimal number of mods to reproduce the issue for me then i'll have to leave it to Pi-C

2 years ago

sorry i'm affraid not. Aslo some of them are fixed just to be used for own use too

Pi-C β˜†
2 years ago

ah... that's... a lot of mods, and my internet connection is very slow. if you can't reduce that to a minimal number of mods to reproduce the issue for me then i'll have to leave it to Pi-C

I'm currently syncing the mods.

Pi-C β˜†
2 years ago

well, i knew i didn't do it the ideal way before :) but it certainly seems to behave differently this way. i guess it's possible that some entity could be described as the wrong type?

Unlikely. Mods creating new enemies would want to use the proper types so they don't have to worry about things like pathfinding or aiming.

does that ... work for spawners?

Sure, type == "unit-spawner" will catch these. At least it does so with the Maps mod. :-)

Pi-C β˜†
2 years ago
(updated 2 years ago)

a remote function for other mods to overwrite the loot tables with custom definitions would solve all of the problems and even add new functionality to the loot table system (e.g. the ability to increase or reduce the power, type, or quantity of the drops)

The loot table is not stable. Other mods may add to it in the data stage, and they may intercept and modify the actually spawned loot in the control stage. For example, my maps mod adds different kinds of maps to trees: small maps reveal just a small area, but have a much higher chance to be in the loot than big maps, which reveal a huge area. It could happen that one tree spawns both big and small maps, but that is useless because the area revealed by the big map includes the area revealed by the small one. So if a tree contains both big and small maps, I just remove the small ones in the control stage.

You've already added optional dependencies on the other mods. Thus, they are loaded before this mod, and when events are triggered, their event scripts will run before the Loot Chest scripts. So, the other mods should listen to on_entity_died and modify the loot on their end. The loot we get to see is the loot remaining after all mods running before us have changed it. So it probably would be easier to add an optional dependency than a remote interface.

Pi-C β˜†
2 years ago

yea ok. Still have a bug where it still won't pick up loot even after loot chest is placed and i have killed a pile of spwners. even saw artiefact spawning but not picked up as i killed the enemies

Confirmed. I noticed there was a loot chest. Using gvv, I found that it wasn't registered for some reason. So, you don't have a loot chest as far as the game is concerned, and your setting for "Loot drop when no chest placed" says the loot should be left on the ground. Thus, almost everything is as expected. Remove the chest (it's empty anyway) and place it again, then it should work.

The real problem is that the loot chest isn't registered. It may be a bug in the migration script. Do you remember when you placed the loot chest? Was it with version 1.1.8, or with 1.1.9?

2 years ago

3 days ago he opened the "Crash while placeing" thread so I guess it's the same chest he placed that was there when it crashed.

Pi-C β˜†
2 years ago

Likely, but he could have downgraded again after the crash and placed the chest in 1.1.8. :-)

Pi-C β˜†
2 years ago

Please try version 1.1.11!

2 years ago
(updated 2 years ago)

Likely, but he could have downgraded again after the crash and placed the chest in 1.1.8. :-)

No i did just update to version after the crash since u basicly realesed it so quicly

This thread has been locked.