drawing and writing
-
- Long Handed Inserter
- Posts: 86
- Joined: Fri Jan 31, 2014 8:47 pm
- Contact:
drawing and writing
Is it possible to draw lines and print text on the ground? For example, connect two assemblers with a labeled arrow. I need some visualization for an algorithm I'm currently playing with.
- Attachments
-
- Untitled.png (363.55 KiB) Viewed 5991 times
Black blood of the factory
Re: drawing and writing
You can create a line or letter entity and give it the appropriate graphic.
-
- Long Handed Inserter
- Posts: 86
- Joined: Fri Jan 31, 2014 8:47 pm
- Contact:
Re: drawing and writing
Well, I cannot make smooth non-original lines that way like in the picture, can I
Black blood of the factory
Re: drawing and writing
You would need to make a separate line for every possible way of connecting two points.
-
- Long Handed Inserter
- Posts: 86
- Joined: Fri Jan 31, 2014 8:47 pm
- Contact:
Re: drawing and writing
As you can place assemblers anywhere relative to each other, the possibilities are infinite. There may be workarounds, like with the train network where there are 8 possible directions, but I'd need to spend a good couple of hours to implement that.
Anyway, since there is no easy way and creating a drawing library is a huge derailment, I have to abandon this idea and focus on my main task instead.
Anyway, since there is no easy way and creating a drawing library is a huge derailment, I have to abandon this idea and focus on my main task instead.
Black blood of the factory
- DedlySpyder
- Filter Inserter
- Posts: 253
- Joined: Fri Jun 20, 2014 11:42 am
- Contact:
Re: drawing and writing
Thought: make a small pixel like entity (like 5x5 or so) , make an algorithm to place a line of them between the two assemblers. It might take some work, but I think it could be doablePlop and run wrote:As you can place assemblers anywhere relative to each other, the possibilities are infinite. There may be workarounds, like with the train network where there are 8 possible directions, but I'd need to spend a good couple of hours to implement that.
Anyway, since there is no easy way and creating a drawing library is a huge derailment, I have to abandon this idea and focus on my main task instead.
- DedlySpyder
- Filter Inserter
- Posts: 253
- Joined: Fri Jun 20, 2014 11:42 am
- Contact:
Re: drawing and writing
So, this can totally work, here is an example of it in action. The trigger to draw the line in this mod is messed up, but the drawing function itself works fine.DedlySpyder wrote:Thought: make a small pixel like entity (like 5x5 or so) , make an algorithm to place a line of them between the two assemblers. It might take some work, but I think it could be doablePlop and run wrote:As you can place assemblers anywhere relative to each other, the possibilities are infinite. There may be workarounds, like with the train network where there are 8 possible directions, but I'd need to spend a good couple of hours to implement that.
Anyway, since there is no easy way and creating a drawing library is a huge derailment, I have to abandon this idea and focus on my main task instead.
Feel free to use it (credit would be appreciated, but not necessary )
Function in case someone can't open the mod:
Code: Select all
function drawLine(positionStart, positionEnd, surface)
--Find the total distance in each X and Y that has to be travelled
local xDistance = -(positionStart.x - positionEnd.x)
local yDistance = -(positionStart.y - positionEnd.y)
--Find the total distance of the line
local distance = math.sqrt((xDistance^2) + (yDistance^2))
--How close is each dot of the line?
local size = 1/32
--Find the number of steps to draw the line
local steps = math.ceil(distance/size)
--Find the distance between each step
local xStepDistance = xDistance/steps
local yStepDistance = yDistance/steps
--Start position
local xPlacement = positionStart.x
local yPlacement = positionStart.y
--For each step, place a dot step distance closer to the end point
for i=0, steps do
surface.create_entity{name="draw-line-dot", position={xPlacement+(i*xStepDistance), yPlacement+(i*yStepDistance)}}
end
end
- Attachments
-
- Draw_Line_0.1.0.zip
- (2.04 KiB) Downloaded 130 times
Re: drawing and writing
The labels should be fairly easy to create using entities. The arrows can be created using beam entities. Though, unfortunately, there seems to be a bug in the rendering of beams.
The mod I used to create this image:
the code
- aubergine18
- Smart Inserter
- Posts: 1264
- Joined: Fri Jul 22, 2016 8:51 pm
- Contact:
Re: drawing and writing
This is fantastic! You've just solved a roadblock I was having in one of my mods! Credit will be given!
If you have other gems like this floating around, please share!
If you have other gems like this floating around, please share!
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Re: drawing and writing
What mod are you working on and what problem did you have? Not, per chance, figuring out how to draw the wires/cables for the Ropeway conveyor above the factory...? I'm trying to make a proof of concept mod. Even though I don't care much about the graphics, being able to render the cables is kind of important.aubergine18 wrote:This is fantastic! You've just solved a roadblock I was having in one of my mods! Credit will be given!
If you have other gems like this floating around, please share!
The only other thing I've made so far is a script that, for every item in the game that can be contained in a blueprint, creates a blueprint containing that item (using pcall excessively). My goal was to create a mod that works around the problem that ghost building using shift+click doesn't work well when you have a personal roboport. The robots grab the item out of your hand, such that you can no longer use it to build ghosts. I might pick it up again and make a 'portable blueprint library'-mod out of it.
If you happen to find a fix for the bad rendering of the head and tail, please let me know.
Re: drawing and writing
For labels you can use the flying-text entity set to active=false
label=surface.create_entity{type="flying-text"..........blah blah}
label.active=false
label=surface.create_entity{type="flying-text"..........blah blah}
label.active=false
- aubergine18
- Smart Inserter
- Posts: 1264
- Joined: Fri Jul 22, 2016 8:51 pm
- Contact:
Re: drawing and writing
The mod where I need to draw lines is a wireless network mod, basically circuit network over various forms of radio (AM, FM, Digital Multicast, Cellular Wifi). I want to be able to show connections between antennas in much same way as logistic network shows links between roboports. The two methods of drawing lines posted earlier in this topic enable me to get lines after the antennas are placed, but not while placing them, but it's still a massive improvement on no lines at all.
Love the look of that Ropeway conveyor BTW. It's a shame we can't add custom wires - for example, if we could add a "metal rope" circuit wire, and special "power poles" to carry it, there's all sorts of stuff that could be done with that. Problem with the game rendered wires though: they are saggy, which wouldn't look good for a ropeway conveyor. An alternate to ropeway conveyor would be a dirigible (airship) which would get loaded like a train, then slowly fly to destination, get unloaded, etc. Benefit is that it wouldn't need tracks, disadvantage is that it's weak if attacked and much slower than train (could even make it get blown off course in high winds lol).
Love the look of that Ropeway conveyor BTW. It's a shame we can't add custom wires - for example, if we could add a "metal rope" circuit wire, and special "power poles" to carry it, there's all sorts of stuff that could be done with that. Problem with the game rendered wires though: they are saggy, which wouldn't look good for a ropeway conveyor. An alternate to ropeway conveyor would be a dirigible (airship) which would get loaded like a train, then slowly fly to destination, get unloaded, etc. Benefit is that it wouldn't need tracks, disadvantage is that it's weak if attacked and much slower than train (could even make it get blown off course in high winds lol).
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.