Looking for a mod with "kitt"

Place to get help with not working mods / modding interface.
Post Reply
Pi-C
Smart Inserter
Smart Inserter
Posts: 1648
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Looking for a mod with "kitt"

Post by Pi-C »

I've been working on a replacement for this mod for a while now. While I generally understand what the code does, there's still one thing I just don't get:

Code: Select all

script.on_event(defines.events.on_pre_player_mined_item, function(event)
        if event.entity.type == "car" then
                for index,car in pairs(global.cars) do
                        if event.entity == car then
                                global.cars[index] = {}
                                if index == event.player_index then
                                        game.players[index].print("You no longer own a car, use your keys to claim a new one")
                                else
                                        game.players[index].print(game.players[event.player_index].name.." mined your car, use your keys to claim a new one")
                                end
                        end
                end
        elseif event.entity.type == "unit" then
                for index,car in pairs(global.cars) do
                        if not car.valid and event.entity == car.kitt then
                                global.cars[index] = {}
                                global.surface[index] = nil
                                global.position[index] = nil
                                if index == event.player_index then
                                        game.players[index].print("You no longer own a car, use your keys to claim a new one")
                                else
                                        game.players[index].print(game.players[event.player_index].name.." mined your car, use your keys to claim a new one")
                                end
                        end
                end
        end
end)
Both blocks (if/elseif) do basically the same thing, but I have not the slightest idea what "car.kitt" (2 lines after "elseif") could be!

There was a similar thing where the original code looked for the string "turret" in the entity name. I couldn't make sense of it until I read this thread on the original mod's discussion board, which led me to believe addresses an issue with the "Vehicle turrets" mod. I therefore assume that "car.kitt" also is there for compatibility with another mod.

Unfortunately, the original code isn't documented really well, so I have no idea what mod this could come from. Does anybody know of a mod that does something with cars and uses "car.kitt"? I know it's a long shot, but perhaps somebody does know something and can help me out … :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Looking for a mod with "kitt"

Post by Deadlock989 »

Image
Image

Pi-C
Smart Inserter
Smart Inserter
Posts: 1648
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Looking for a mod with "kitt"

Post by Pi-C »

Deadlock989 wrote:
Thu Oct 10, 2019 7:22 pm
(image removed)
:-)

I've thought of that myself already, but it still doesn't really help figuring out what mod it's referenced in.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Looking for a mod with "kitt"

Post by Deadlock989 »

It is odd. It's storing references to entire entities in the global.cars table. The reference to "car.kitt" is only in sections which test for a unit (e.g. a biter-type thing) instead of a car - so maybe some mod which adds car-like pet units? But weirdly only when the unit is also invalid ... I don't see how a unit entity reference would ever have a property called kitt though. The mod itself never puts anything into the global.cars table unless it is a car-type entity. I would be tempted to write this off as dead experimental code that just got left in.

There's some prime desync material in that mod - the variable ticks_since_action is a local variable outside of the global table so any players who connect to a session, leave, then reconnect later will end up with a different value in it.
Image

Pi-C
Smart Inserter
Smart Inserter
Posts: 1648
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Looking for a mod with "kitt"

Post by Pi-C »

Deadlock989 wrote:
Thu Oct 10, 2019 7:59 pm
I would be tempted to write this off as dead experimental code that just got left in.
I thought of that, too. That's why I've been asking -- if it's meaningless, it can be deleted, but I wouldn't want to remove something that has been included for some purpose that I don't understand. Well, it shouldn't hurt to comment that out for some time and see if anything breaks.
There's some prime desync material in that mod - the variable ticks_since_action is a local variable outside of the global table so any players who connect to a session, leave, then reconnect later will end up with a different value in it.
I've released my latest update just moments before I saw your reply. This version should be fit for multiplayer. (Spent a lot of time on testing, alas only locally with up to three instances of the game running simultaneously on one computer, so perhaps there may still be issues in real games.)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 2420
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Looking for a mod with "kitt"

Post by BlueTemplar »

BobDiggity (mod-scenario-pack)

Post Reply

Return to “Modding help”