[Mod 12.29+] Player sensitive pressure plates 0.1.3

Topics and discussion about specific mods
User avatar
Dr. Walrus
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Fri Nov 20, 2015 6:30 am
Contact:

[Mod 12.29+] Player sensitive pressure plates 0.1.3

Post by Dr. Walrus »

Image
Type: Mod
Name: Pressure Plate
Description: Adds a pressure plate entity connectable to the circuit network
License: MIT
Version: 0.1.3
Release: 4/28/2016
Tested with Factorio version: 0.12.30
Category: Item
Tags: circuit network, entity, switch, button
Dependencies: Base [12.29+]
Download:
Pressure Plate_0.1.3.zip
(25.24 KiB) Downloaded 407 times
Long Description
People are racing to play this mod
Future Plans
I have to give a big thanks to Schorty who made the Pollution Detector mod and from whom I copied large amounts of code in order to get my pressure plate working for the first time, plus a fairly large thanks to all the guys in the mod help board who helped me out with my code. If anyone would like to help out with anything on the future plans list or offer suggestions for other future plans I would be very appreciative, and any comments/constructive criticisms/love letters are always welcome.
Changelog
Previous versions
Last edited by Dr. Walrus on Thu Apr 28, 2016 11:48 pm, edited 22 times in total.

User avatar
StanFear
Fast Inserter
Fast Inserter
Posts: 236
Joined: Sun Dec 15, 2013 2:49 pm
Contact:

Re: [Mod 12.20] Player sensitive pressure plates 0.0.1

Post by StanFear »

this is interesting, and definetly more interesting than some other mod that used concreete to just check presence ... (I think it's advenced logistics or something)

(what follows is only from reading the code, not 100% certains about what I will say)
it's just kinda sad it only works on player, would be interesting to know if an enemy is on it (do they attack it ?)
does it works in multiplayer ?

in your control.lua file, (function removeBPP)
you go through the whole table to know if the entity is a presure plate, (I know you want the id to remove it from the table but ...)
you could just create a pair table with the key being X,Y and then remove it much more easily

[when adding]

Code: Select all

global.sensor_list[entity.position.x .. "," .. entity.position.y] = entity
[when removing]

Code: Select all

global.sensor_list[entity.position.x .. "," .. entity.position.y] = nil
and to know if this is a presure plate : entity.name == "basic-pressure-plate"

Airat9000
Smart Inserter
Smart Inserter
Posts: 1418
Joined: Fri Mar 28, 2014 12:32 am
Contact:

Re: [Mod 12.20] Player sensitive pressure plates 0.0.1

Post by Airat9000 »

but you can make the underground pillars? that is, as the cables underground

User avatar
StanFear
Fast Inserter
Fast Inserter
Posts: 236
Joined: Sun Dec 15, 2013 2:49 pm
Contact:

Re: [Mod 12.20] Player sensitive pressure plates 0.0.1

Post by StanFear »

Airat9000 wrote:but you can make the underground pillars? that is, as the cables underground
do you mean having the cable not showing ? sadly, I havn't found a way to do that, maybe someone have but I doubt that ... (I actually have an idea, but it would be a pain in the *** to do and maintain)

and if it was possible, there would be the problem of knowing to which power pole the presure plate is connected

User avatar
Dr. Walrus
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Fri Nov 20, 2015 6:30 am
Contact:

Re: [Mod 12.20] Player sensitive pressure plates 0.0.1

Post by Dr. Walrus »

StanFear wrote:this is interesting, and definetly more interesting than some other mod that used concreete to just check presence ... (I think it's advenced logistics or something)

(what follows is only from reading the code, not 100% certains about what I will say)
it's just kinda sad it only works on player, would be interesting to know if an enemy is on it (do they attack it ?)
does it works in multiplayer ?

in your control.lua file, (function removeBPP)
you go through the whole table to know if the entity is a presure plate, (I know you want the id to remove it from the table but ...)
you could just create a pair table with the key being X,Y and then remove it much more easily

[when adding]

Code: Select all

global.sensor_list[entity.position.x .. "," .. entity.position.y] = entity
[when removing]

Code: Select all

global.sensor_list[entity.position.x .. "," .. entity.position.y] = nil
and to know if this is a pressure plate : entity.name == "basic-pressure-plate"
Thanks for the help dude. I redid the entire control.lua file from scratch and I now use the x and y position to point to another table that contains some info about the pressure plate. The game now no longer has to search the table when removing a pressure plate and my code overall has gotten a lot simpler.

Code: Select all

global.basic_pp_list[entity.position.x .. "," .. entity.position.y] = {basic_pp_entity = entity, mask_entity = pp_mask, x = entity.position.x, y = entity.position.y, active = false}
I got some help from some modders on another thread with my entity sprites render layer so that's one thing to check off my to do list. I should have a new version up in a day or so. It will be completely incompatible with the previous version so heads up. And TBH I'm not really sure I'm going to make a migration script if only nine people have downloaded my mod.

User avatar
StanFear
Fast Inserter
Fast Inserter
Posts: 236
Joined: Sun Dec 15, 2013 2:49 pm
Contact:

Re: [Mod 12.20] Player sensitive pressure plates 0.0.1

Post by StanFear »

Dr. Walrus wrote:And TBH I'm not really sure I'm going to make a migration script if only nine people have downloaded my mod.
yeah, they probably won't be mad at you (and actually, ..., I have downloaded it but have not yet made a play with it because I'm currently creating my own mod so I don't have anything to play with yet, so.... it's really only 8 people who've downloaded it and play with it.)

plus, if the changes you made are just to make the mod more cpu friendly, they won't need to update !

User avatar
Dr. Walrus
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Fri Nov 20, 2015 6:30 am
Contact:

Re: [Mod 12.20] Player sensitive pressure plates 0.1.0

Post by Dr. Walrus »

Updated to 0.1.0! Check out the changelog for what's new. I am going to ask the mods move this mod to the new items, entities, and extensions mods subforum.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5148
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [Mod 12.20] Player sensitive pressure plates 0.1.0

Post by Klonan »

Dr. Walrus wrote:Updated to 0.1.0! Check out the changelog for what's new. I am going to ask the mods move this mod to the new items, entities, and extensions mods subforum.
Congrats on the release, this mod looks really nice.

I moved it to new items forum for you.

PS your wire shadow offset is a little off ;)

User avatar
Dr. Walrus
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Fri Nov 20, 2015 6:30 am
Contact:

Re: [Mod 12.20+] Player sensitive pressure plates 0.1.0

Post by Dr. Walrus »

Klonan wrote:Congrats on the release, this mod looks really nice.

I moved it to new items forum for you.

PS your wire shadow offset is a little off ;)
Thank you Klonan! And congrats on the new job!

And you are right about the wire shadow offset, but you must forgive me because I my entity sprites are edits of the sprite for the small lamp and I took the wire offset from the small lamp entity data. So I looked into it and the wire shadow offset is off on the small lamp too :lol:
Image

malcmiller
Burner Inserter
Burner Inserter
Posts: 8
Joined: Sat Jan 23, 2016 4:27 am
Contact:

Re: [Mod 12.20+] Player sensitive pressure plates 0.1.0

Post by malcmiller »

This mod is really neat! Are you going to add other types of pressure plates in the future? You should make it so the signal it sends out is customizable like with a constant combinator.

User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1524
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: [Mod 12.20+] Player sensitive pressure plates 0.1.0

Post by binbinhfr »

Very nice mod, thanks !
I wish there was also a larger plate (2x2, 3x3 ?) because when you have a lot a exoskelets and move quick , it's not easy to position yourself on the little plate.

By the way, I have a map that makes a problem :
"Error while running the event handler: __Pressure Plate__/control.lua:84: LuaEntity API call when LuaEntity was invalid."

I tried to put 4 plates as a 2x2 pattern to have a better detection surface, but only 2 of them are visible and the invisible ones seems to produce the crash...
It crashs even with no other mod than yours.

I can send you the map if you want (5 mb size).
My mods on the Factorio Mod Portal :geek:

User avatar
Dr. Walrus
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Fri Nov 20, 2015 6:30 am
Contact:

Re: [Mod 12.20+] Player sensitive pressure plates 0.1.0

Post by Dr. Walrus »

binbinhfr wrote:Very nice mod, thanks !
I wish there was also a larger plate (2x2, 3x3 ?) because when you have a lot a exoskelets and move quick , it's not easy to position yourself on the little plate.

By the way, I have a map that makes a problem :
"Error while running the event handler: __Pressure Plate__/control.lua:84: LuaEntity API call when LuaEntity was invalid."

I tried to put 4 plates as a 2x2 pattern to have a better detection surface, but only 2 of them are visible and the invisible ones seems to produce the crash...
It crashs even with no other mod than yours.

I can send you the map if you want (5 mb size).
In response to having larger pressure plates, I think keeping them at 1x1 size makes more sense as a basic structure, and if you want a larger area you can just place them in a 2x2 grid as you did in your map. My goal for the future if I get back to developing more features is to have to plates link together if 2 are placed down next to each other, so that if you build a 2x2 grid of pressure plates they will visually link together and act as a single plate.

First off, did you use the 0.0.1 version and then switch to the 0.1.0 version by any chance? I should take the 0.0.1 version down from here because it is incompatible with the 0.1.0 version and updating from the old version can cause the old plates to crash the game.

If you did not update the mod from the old version, then I know exactly what caused the crash but I don't know how it arose in normal gameplay. The pressure plate that senses the player is actually invisible (which is why nothing shows up when you are trying to place one on the ground). The visual for the pressure plate you see is 2 separate decorative entities. When you place a pressure plate, the mod automatically creates a decoration in the same place. When you step on the plate, the mod deletes the old decoration and places a new one. Somehow when you built the pressure plates the decoration never got built by the mod (which is why they were invisible), and when you step on the plate there's no decoration to be deleted therefore the game crashes.

It would be very helpful if you sent me the map and tell me what version of Factorio you are playing on. I will try to have a fix in a few days. As for a solution right now, try mining and rebuilding the 2 invisible pressure plates to see if they become visible when you rebuild them. If they are visible it means that you can safely walk on them without crashing the game.

Thanks for using my mod. :mrgreen:

User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1524
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: [Mod 12.20+] Player sensitive pressure plates 0.1.0

Post by binbinhfr »

Hi and thanks for answer.

OK for enlarging the zone with several plates, it's ok for me and that's what I did here with a 2x2 pattern. It would be even better if you connect them automatically together as you want to do :-)

I did not use your old version, just the new one.
I am in last factorio 0.12.26

Please find the map as an attachement, with no other mods.
bug plate nomods.zip
(5.05 MiB) Downloaded 178 times
You'll see the plates just at the right of the player. There are 4 of them in a 2x2 pattern, but only the two on the right side of the square are visible. You go on them or try to mine them, it crashes. So I cannot fix them the way you said. Thanks for your help, and let me know if you have a fix.
My mods on the Factorio Mod Portal :geek:

User avatar
Dr. Walrus
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Fri Nov 20, 2015 6:30 am
Contact:

Re: [Mod 12.20+] Player sensitive pressure plates 0.1.1

Post by Dr. Walrus »

Updated to 0.1.1

Sorry for the delay. I've fixed the issue with the crash caused by stepping on invisible plates. If by some chance you manage to build an invisible pressure plate, you can now mine them and if you step on them then turn to normal.

Also I updated the technology icon from something I made in Microsoft paint to something I made in Microsoft word, and I increased the technology cost to 100 red and green for 60 seconds. I only had the technology cost very low for testing purposes at first and this new number seems like an appropriate amount for when you get pressure plates in game.

*EDIT* And now just after I posted the update, I found what caused your pressure plates to go invisible in the first place. If you place concrete or brick over the pressure plate, it automatically erases the pressure plate mask because it is a decorative object. I'll fix that in a bit, but at least it's not game breaking anymore, it just makes the pressure plates go invisible until you step on them again.

vanatteveldt
Filter Inserter
Filter Inserter
Posts: 945
Joined: Wed Nov 25, 2015 11:44 am
Contact:

Re: [Mod 12.20+] Player sensitive pressure plates 0.1.1

Post by vanatteveldt »

I'm an old DF player, so I have one comment and one question:

- Cool mod! We now have a turing complete system with goblins/biters, mine carts/trains, and pressure plates, so the only things missing in factorio except for ASCII graphics is magma!

- How do we militarize this? If it can detect biters, we need to be able to control something to defeat the biters as well. I'm thinking of controlling gates (to create a live biter trap - although contrary to goblins biters are smart enough to destroy walls), turrets, especially flame thrower turrets, mines, and trains. Wouldn't it be cool to use pressure plates to trap biters into a "kill zone" which is 'patrolled' by trains?

User avatar
Dr. Walrus
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Fri Nov 20, 2015 6:30 am
Contact:

Re: [Mod 12.29+] Player sensitive pressure plates 0.1.2

Post by Dr. Walrus »

Updated to 0.1.2! Now pressure plates don't turn invisible if you build concrete or any other floor covering over top of them.

Also a purple pressure plate that can detect biters is in the works. I'm not sure how useful it is because so far the biters just attack it. You win this time nature!

User avatar
Cyber_Garret
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sat Jan 31, 2015 10:51 pm
Contact:

Re: [Mod 12.29+] Player sensitive pressure plates 0.1.2

Post by Cyber_Garret »

Some bug of missing icon, on loading game.
Image
"What is locked, can be opened,
What is hidden, can be found,
What is yours, can be mine" (c) Garret

My English is very bad, sry.

User avatar
Dr. Walrus
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Fri Nov 20, 2015 6:30 am
Contact:

Re: [Mod 12.29+] Player sensitive pressure plates 0.1.2

Post by Dr. Walrus »

Cyber_Garret wrote:Some bug of missing icon, on loading game.
Oops. That was dumb of me. I accidentally deleted it when I was zipping up the mod. Fixed it and updated to v0.1.3

User avatar
sumdawgy
Inserter
Inserter
Posts: 43
Joined: Wed May 11, 2016 1:01 am
Contact:

Re: [Mod 12.29+] Player sensitive pressure plates 0.1.3

Post by sumdawgy »

:idea: can you make a train signal compatible version?

If you step on plate, it sets signal red for ....what..10 sec?

User avatar
Dr. Walrus
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Fri Nov 20, 2015 6:30 am
Contact:

Re: [Mod 12.29+] Player sensitive pressure plates 0.1.3

Post by Dr. Walrus »

sumdawgy wrote::idea: can you make a train signal compatible version?

If you step on plate, it sets signal red for ....what..10 sec?
Right now that's actually not possible to make with a mod because train signals can't interact with the circuit network. Fortunately in the 0.13 update train signals will be able to be controlled by the circuit network so you can make a contraption that does that with just a regular pressure plate and a few combinators. If it can't be built in vanilla then I'll add in a pressure plate train signal after the 0.13 update comes out.

Post Reply

Return to “Mods”