Skip to content

Commit b0dae90

Browse files
committed
GRAPHICS!!!
(very ugly)
1 parent 7eac68e commit b0dae90

File tree

7 files changed

+91
-98
lines changed

7 files changed

+91
-98
lines changed

changelog.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@
1111
##0.1.3##
1212
* Switches don't emit light when on anymore
1313
* Reduced energy usage to 1kW to match the other combinators
14-
* Performance improvement
14+
* Performance improvement
15+
16+
##0.1.4##
17+
+ Added some sprites (bastardized deciders)
18+
* Fixed a crash?

data.lua

Lines changed: 67 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ data:extend({
1010
order = "itsdafirstman",
1111

1212
collision_box = {{-0.35, -0.35}, {0.35, 0.35}},
13-
selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
14-
13+
collision_mask = {},
14+
1515
item_slot_count = 0,
1616

1717
sprites =
@@ -123,13 +123,13 @@ data:extend({
123123
{
124124
shadow =
125125
{
126-
red = {0.75, -0.15625},
127-
green = {0.75, 0.25},
126+
red = {0.15, -0.15625},
127+
green = {0.15, 0.25},
128128
},
129129
wire =
130130
{
131-
red = {0.46875, -0.5},
132-
green = {0.46875, -0.09375},
131+
red = {-0.13125, -0.5},
132+
green = {-0.13125, -0.09375},
133133
}
134134
},
135135
{
@@ -147,18 +147,18 @@ data:extend({
147147
{
148148
shadow =
149149
{
150-
red = {-0.03125, 0.28125},
151-
green = {-0.03125, -0.125},
150+
red = {0.56875, 0.28125},
151+
green = {0.56875, -0.125},
152152
},
153153
wire =
154154
{
155-
red = {-0.46875, 0},
156-
green = {-0.46875, -0.40625},
155+
red = {0.13125, -0.05},
156+
green = {0.13125, -0.50625},
157157
}
158158
}
159159
},
160-
161-
circuit_wire_max_distance = 7.5
160+
161+
circuit_wire_max_distance = 3,
162162
},
163163
{
164164
type = "constant-combinator",
@@ -169,6 +169,7 @@ data:extend({
169169
order = "itsdafirstman",
170170

171171
collision_box = {{-0.35, -0.35}, {0.35, 0.35}},
172+
collision_mask = {},
172173
selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
173174

174175
item_slot_count = 0,
@@ -177,40 +178,40 @@ data:extend({
177178
{
178179
north =
179180
{
180-
filename = "__base__/graphics/entity/combinator/combinator-entities.png",
181-
x = 158,
182-
y = 126,
183-
width = 79,
184-
height = 63,
181+
filename = "__circuit-network-switch__/graphics/trans.png",
182+
x = 0,
183+
y = 0,
184+
width = 0,
185+
height = 0,
185186
frame_count = 1,
186187
shift = {0.140625, 0.140625},
187188
},
188189
east =
189190
{
190-
filename = "__base__/graphics/entity/combinator/combinator-entities.png",
191-
y = 126,
192-
width = 79,
193-
height = 63,
191+
filename = "__circuit-network-switch__/graphics/trans.png",
192+
y = 0,
193+
width = 0,
194+
height = 0,
194195
frame_count = 1,
195196
shift = {0.140625, 0.140625},
196197
},
197198
south =
198199
{
199-
filename = "__base__/graphics/entity/combinator/combinator-entities.png",
200-
x = 237,
201-
y = 126,
202-
width = 79,
203-
height = 63,
200+
filename = "__circuit-network-switch__/graphics/trans.png",
201+
x = 0,
202+
y = 0,
203+
width = 0,
204+
height = 0,
204205
frame_count = 1,
205206
shift = {0.140625, 0.140625},
206207
},
207208
west =
208209
{
209-
filename = "__base__/graphics/entity/combinator/combinator-entities.png",
210-
x = 79,
211-
y = 126,
212-
width = 79,
213-
height = 63,
210+
filename = "__circuit-network-switch__/graphics/trans.png",
211+
x = 0,
212+
y = 0,
213+
width = 0,
214+
height = 0,
214215
frame_count = 1,
215216
shift = {0.140625, 0.140625},
216217
}
@@ -220,42 +221,42 @@ data:extend({
220221
{
221222
north =
222223
{
223-
filename = "__base__/graphics/entity/combinator/activity-leds/combinator-led-constant-north.png",
224-
width = 11,
225-
height = 10,
224+
filename = "__circuit-network-switch__/graphics/trans.png",
225+
width = 0,
226+
height = 0,
226227
frame_count = 1,
227228
shift = {0.296875, -0.40625},
228229
},
229230
east =
230231
{
231-
filename = "__base__/graphics/entity/combinator/activity-leds/combinator-led-constant-east.png",
232-
width = 14,
233-
height = 12,
232+
filename = "__circuit-network-switch__/graphics/trans.png",
233+
width = 0,
234+
height = 0,
234235
frame_count = 1,
235236
shift = {0.25, -0.03125},
236237
},
237238
south =
238239
{
239-
filename = "__base__/graphics/entity/combinator/activity-leds/combinator-led-constant-south.png",
240-
width = 11,
241-
height = 11,
240+
filename = "__circuit-network-switch__/graphics/trans.png",
241+
width = 0,
242+
height = 0,
242243
frame_count = 1,
243244
shift = {-0.296875, -0.078125},
244245
},
245246
west =
246247
{
247-
filename = "__base__/graphics/entity/combinator/activity-leds/combinator-led-constant-west.png",
248-
width = 12,
249-
height = 12,
248+
filename = "__circuit-network-switch__/graphics/trans.png",
249+
width = 0,
250+
height = 0,
250251
frame_count = 1,
251252
shift = {-0.21875, -0.46875},
252253
}
253254
},
254255

255256
activity_led_light =
256257
{
257-
intensity = 0.8,
258-
size = 1,
258+
intensity = 0,
259+
size = 0,
259260
},
260261

261262
activity_led_light_offsets =
@@ -283,13 +284,13 @@ data:extend({
283284
{
284285
shadow =
285286
{
286-
red = {0.75, -0.15625},
287-
green = {0.75, 0.25},
287+
red = {0.15, -0.15625},
288+
green = {0.15, 0.25},
288289
},
289290
wire =
290291
{
291-
red = {0.46875, -0.5},
292-
green = {0.46875, -0.09375},
292+
red = {-0.13125, -0.5},
293+
green = {-0.13125, -0.09375},
293294
}
294295
},
295296
{
@@ -307,13 +308,13 @@ data:extend({
307308
{
308309
shadow =
309310
{
310-
red = {-0.03125, 0.28125},
311-
green = {-0.03125, -0.125},
311+
red = {0.56875, 0.28125},
312+
green = {0.56875, -0.125},
312313
},
313314
wire =
314315
{
315-
red = {-0.46875, 0},
316-
green = {-0.46875, -0.40625},
316+
red = {0.13125, -0.05},
317+
green = {0.13125, -0.50625},
317318
}
318319
}
319320
},
@@ -338,40 +339,30 @@ data:extend({
338339
usage_priority = "secondary-input"
339340
},
340341
energy_usage_per_tick = "1KW",
341-
--light = {intensity = 0.9, size = 40},
342-
--light_when_colored = {intensity = 1, size = 6},
343-
--glow_size = 6,
344-
--glow_color_intensity = 0.135,
342+
345343
picture_off =
346344
{
347-
filename = "__base__/graphics/entity/small-lamp/light-off.png",
345+
filename = "__circuit-network-switch__/graphics/switch/horizontal-off.png",
348346
priority = "high",
349-
width = 67,
350-
height = 58,
347+
width = 105,
348+
height = 51,
351349
frame_count = 1,
352350
axially_symmetrical = false,
353351
direction_count = 1,
354-
shift = {-0.015625, 0.15625},
352+
scale = 0.9,
353+
shift = {0.2, -0.1},
355354
},
356355
picture_on =
357356
{
358-
filename = "__base__/graphics/entity/small-lamp/light-on-patch.png",
357+
filename = "__circuit-network-switch__/graphics/switch/horizontal-on.png",
359358
priority = "high",
360-
width = 62,
361-
height = 62,
359+
width = 105,
360+
height = 51,
362361
frame_count = 1,
363362
axially_symmetrical = false,
364363
direction_count = 1,
365-
shift = {-0.03125, -0.03125},
366-
},
367-
signal_to_color_mapping =
368-
{
369-
{signal="signal-red", color={r=1,g=0,b=0}},
370-
{signal="signal-green", color={r=0,g=1,b=0}},
371-
{signal="signal-blue", color={r=0,g=0,b=1}},
372-
{signal="signal-yellow", color={r=1,g=1,b=0}},
373-
{signal="signal-pink", color={r=1,g=0,b=1}},
374-
{signal="signal-cyan", color={r=0,g=1,b=1}},
364+
scale = 0.9,
365+
shift = {0.2, -0.1},
375366
},
376367

377368
circuit_wire_connection_point =
@@ -383,11 +374,10 @@ data:extend({
383374
},
384375
wire =
385376
{
386-
red = {0.40625, 0.34375},
387-
green = {0.40625, 0.5},
377+
red = {-0.25, -0.65},
378+
green = {0.25, -0.65},
388379
}
389380
},
390-
circuit_connector_sprites = get_circuit_connector_sprites({0.1875, 0.28125}, {0.1875, 0.28125}, 18),
391381
circuit_wire_max_distance = 7.5
392382
},
393383
{

graphics/switch/horizontal-off.png

9.89 KB
Loading

graphics/switch/horizontal-on.png

8.81 KB
Loading

info.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "circuit-network-switch",
3-
"version": "0.1.3",
3+
"version": "0.1.4",
44
"factorio_version": "0.14",
55
"title": "Circuit Network Switch",
66
"author": "TheRustyKnife",
7-
"description": "Like the power switch but with red and green wires. Proof-of-concept stage - looking for feedback!",
7+
"description": "Like the power switch but with red and green wires. Now with sprites...",
88
"homepage": "http://mods.factorio.com/mods/theRustyKnife/circuit-network-switch",
9-
"date": "07.10.2016",
9+
"date": "09.10.2016",
1010
"dependencies": []
1111
}

script/events.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function on_built(event)
66
switch = event.created_entity,
77
proxies = util.create_proxies(event.created_entity),
88
state = true,
9-
control_behavior = switch.get_or_create_control_behavior()
9+
control_behavior = event.created_entity.get_or_create_control_behavior()
1010
}
1111
table.insert(global.switches, res)
1212
end

script/util.lua

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,34 @@ end
99

1010
function util.create_proxies(switch)
1111
return {
12-
util.create_proxy(switch, {x = 1, y = 0}),
13-
util.create_proxy(switch, {x = -1, y = 0})
12+
util.create_proxy(switch, {x = 1, y = 0}, defines.direction.west),
13+
util.create_proxy(switch, {x = -1, y = 0}, defines.direction.east)
1414
}
1515
end
1616

17-
function util.create_proxy(switch, offset)
18-
local res = {}
19-
res.out = switch.surface.create_entity{
17+
function util.create_proxy(switch, offset, direction)
18+
local out = switch.surface.create_entity{
2019
name = "circuit-network-switch-proxy",
2120
position = {switch.position.x + offset.x, switch.position.y + offset.y},
2221
force = switch.force
2322
}
23+
out.destructible = false
24+
out.operable = false
25+
out.direction = direction
2426

25-
res.inner = switch.surface.create_entity{
27+
local inner = switch.surface.create_entity{
2628
name = "circuit-network-switch-proxy-trans",
27-
position = {switch.position.x + offset.x, switch.position.y + offset.y},
29+
position = {switch.position.x, switch.position.y},
2830
force = switch.force
2931
}
32+
inner.destructible = false
33+
inner.operable = false
34+
inner.direction = defines.direction.south
3035

31-
res.out.destructible = false
32-
res.out.operable = false
33-
34-
res.inner.destructible = false
35-
res.inner.operable = false
36+
inner.connect_neighbour{target_entity = out, wire = defines.wire_type.red}
37+
inner.connect_neighbour{target_entity = out, wire = defines.wire_type.green}
3638

37-
res.inner.connect_neighbour{target_entity = res.out, wire = defines.wire_type.red}
38-
res.inner.connect_neighbour{target_entity = res.out, wire = defines.wire_type.green}
39-
40-
return res
39+
return {out = out, inner = inner}
4140
end
4241

4342
function util.find_switch_in_global(switch)

0 commit comments

Comments
 (0)