Skip to content

Comments

More gates#3532

Open
Strand8319 wants to merge 6 commits intowiremod:masterfrom
Strand8319:new-gates
Open

More gates#3532
Strand8319 wants to merge 6 commits intowiremod:masterfrom
Strand8319:new-gates

Conversation

@Strand8319
Copy link
Contributor

It might not be the end of the list, so feel free to suggest your ideas — what you’ve been missing in the gates and what would actually be useful in practice 🙃

Entity gates:

  • entity_vehicle: returns the vehicle a player is sitting in
  • entity_getmovetype: returns move type enum (WALK, NOCLIP, FLY, etc.)
  • entity_activeweapon: returns the weapon a player is currently holding
  • entity_weapons: returns an array of all weapons in player inventory
  • entity_eyepos: returns the world position of a player's eyes
  • entity_getchildren: returns an array of children parented to an entity

Ranger gates:

  • rd_hull_pos: hull trace between two positions with optional entity parenting
  • rd_hull_ang: hull trace by angle and distance with optional entity parenting
  • Both hull trace gates support Filter (ARRAY) and Parent (ENTITY) inputs

Misc:

  • frametime: returns the time in seconds it took to render the last frame
  • added reciever01d to interactive prop

if !F then F = Angle (0, 0, 0) end
if !G then G = Angle (0, 0, 0) end
if !H then H = Angle (0, 0, 0) end
if !A then A = ang0 end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not good since if the output angle is modified in some way, then all the ang0 will receive that modification.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same goes for vec0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is this the same issue as with the table? Is a link being passed into the variable instead of the vector value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gonna revert it then

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, all variables pointing to a same angle/vector will be changed if the values in one of them are changed.

@Strand8319 Strand8319 changed the title More gates & minor optimizations More gates Feb 18, 2026
Comment on lines 7 to 64
local speed = {
["u/s"] = 1 / 0.75,
["u/m"] = 60 * (1 / 0.75),
["u/h"] = 3600 * (1 / 0.75),
["mm/s"] = 25.4,
["cm/s"] = 2.54,
["dm/s"] = 0.254,
["m/s"] = 0.0254,
["km/s"] = 0.0000254,
["in/s"] = 1,
["ft/s"] = 1 / 12,
["yd/s"] = 1 / 36,
["mi/s"] = 1 / 63360,
["nmi/s"] = 127 / 9260000,
["mm/m"] = 60 * 25.4,
["cm/m"] = 60 * 2.54,
["dm/m"] = 60 * 0.254,
["m/m"] = 60 * 0.0254,
["km/m"] = 60 * 0.0000254,
["in/m"] = 60,
["ft/m"] = 60 / 12,
["yd/m"] = 60 / 36,
["mi/m"] = 60 / 63360,
["nmi/m"] = 60 * 127 / 9260000,
["mm/h"] = 3600 * 25.4,
["cm/h"] = 3600 * 2.54,
["dm/h"] = 3600 * 0.254,
["m/h"] = 3600 * 0.0254,
["km/h"] = 3600 * 0.0000254,
["in/h"] = 3600,
["ft/h"] = 3600 / 12,
["yd/h"] = 3600 / 36,
["mi/h"] = 3600 / 63360,
["nmi/h"] = 3600 * 127 / 9260000,
["mph"] = 3600 / 63360,
["knots"] = 3600 * 127 / 9260000,
["mach"] = 0.0254 / 295,
}
local length = {
["u"] = 1 / 0.75,
["mm"] = 25.4,
["cm"] = 2.54,
["dm"] = 0.254,
["m"] = 0.0254,
["km"] = 0.0000254,
["in"] = 1,
["ft"] = 1 / 12,
["yd"] = 1 / 36,
["mi"] = 1 / 63360,
["nmi"] = 127 / 9260000,
}
local weight = {
["g"] = 1000,
["kg"] = 1,
["t"] = 0.001,
["oz"] = 1 / 0.028349523125,
["lb"] = 1 / 0.45359237,
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these tables could be made global for use in E2/Gates instead of duplicating the code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I put them in WireLib?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also isn't how conversions should be done. It should be two parameters, a 'from' and 'to' which are simple conversions from natural units to unit and the resulting conversion factor is then x = to/from.

e.g.
Hours -> Minutes
from = Hours (Hours would be 1/(60*60) using seconds as natural unit)
to = Minutes (Minutes would be 1/(60) using seconds as natural unit)
conversion factor = to/from = 60

Copy link
Contributor

@thegrb93 thegrb93 Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess with gates the functionality would be a lot more limited though so maybe nvm.

Server Info
]]

local sv_hostip = game.GetIPAddress()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't cache ip because of this issue:
Facepunch/garrysmod-issues#3001

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be fixed

Entity gates:
- entity_vehicle: returns the vehicle a player is sitting in
- entity_getmovetype: returns move type enum (WALK, NOCLIP, FLY, etc.)
- entity_activeweapon: returns the weapon a player is currently holding
- entity_weapons: returns an array of all weapons in player inventory
- entity_eyepos: returns the world position of a player's eyes
- entity_getchildren: returns an array of children parented to an entity

Ranger gates:
- rd_hull_pos: hull trace between two positions with optional entity parenting
- rd_hull_ang: hull trace by angle and distance with optional entity parenting
- Both hull trace gates support Filter (ARRAY) and Parent (ENTITY) inputs

Misc:
- frametime: returns the time in seconds it took to render the last frame
Server info gates (serverinfo.lua):
- sv_hostname: returns server hostname via GetHostName()
- sv_hostip: returns server IP via game.GetIPAddress()
- sv_map: returns current map name
- sv_maxplayers: returns max player slot count
- sv_numplayers: returns current player count
- sv_gravity: returns gravity via sv_gravity convar
- sv_airdensity: returns physics air density
- sv_propgravity: returns gravity as a vector
- sv_tickinterval: returns server tick interval

Unit conversion gates (unitconv.lua):
- unit_tounit: converts from Source units to a named unit
- unit_fromunit: converts from a named unit back to Source units
- unit_convertunit: converts between two named units of the same type
@Strand8319
Copy link
Contributor Author

Not sure whether to keep these as gates or add these settings to the Target Finder instead.

@Anticept
Copy link
Member

Anticept commented Feb 19, 2026

Some make sense in target finder, others... I wouldn't expect to see them in it, like "entity_getchildren".

The target finder is more or less mainly about finding a target and feeding data to a targeting computer for the purpose of guidance.

I think maybe this would be more of an "entity info gate" if you wanted to roll them together. As far as selecting what entity, defaults might be what its attached to or owner of the ship/fpga as appropriate, but to target another entity, feeding target finder data into it would be needed (i cant remember, doesn't target finder have an entity output?)

@Strand8319
Copy link
Contributor Author

Some make sense in target finder, others... I wouldn't expect to see them in it, like "entity_getchildren".

The target finder is more or less mainly about finding a target and feeding data to a targeting computer for the purpose of guidance.

I think maybe this would be more of an "entity info gate" if you wanted to roll them together. As far as selecting what entity, defaults might be what its attached to or owner of the ship/fpga as appropriate, but to target another entity, feeding target finder data into it would be needed (i cant remember, doesn't target finder have an entity output?)

Some make sense in target finder, others... I wouldn't expect to see them in it, like "entity_getchildren".

The target finder is more or less mainly about finding a target and feeding data to a targeting computer for the purpose of guidance.

I think maybe this would be more of an "entity info gate" if you wanted to roll them together. As far as selecting what entity, defaults might be what its attached to or owner of the ship/fpga as appropriate, but to target another entity, feeding target finder data into it would be needed (i cant remember, doesn't target finder have an entity output?)

Specifically, I’m thinking about removing the separate find gates and instead modifying the Target Finder so that in the Filter you can specify a string with Lua patterns and choose the search shape — cone, box, or circle.

Right now, Target Finder has as many Entity outputs as configured in its settings, but it doesn’t have an Array output.

I’d like to change the way it works internally, but I’m worried that would break backward compatibility.

@Anticept
Copy link
Member

Worst case scenario, you end up creating target finder 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants