From 7ecb29e87f1f272f92d0fec871dd525a80a9537c Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Fri, 27 May 2016 16:08:53 -0700 Subject: Convert digilines to a mod (not modpack). (#32) Digilines is probably used by most people in its entirety. I've retained the ability to disable inventory, rtc, lightsensor and LCD by the minetest settings "diglines_enable_rtc" etc.. If set to "false", these components will not be loaded. It is assumed by default that these are enabled. In the conversion the digilines_lcd:lcd node was renamed to digilines:lcd (same for all the other nodes). To retain backwards compatibility I've provided aliases for each of these nodes. --- README.inventory | 62 +++++ characters | 282 +++++++++++++++++++++ depends.txt | 1 + digilines/depends.txt | 1 - digilines/init.lua | 25 -- digilines/internal.lua | 90 ------- digilines/presetrules.lua | 15 -- digilines/textures/digiline_std.png | Bin 446 -> 0 bytes digilines/textures/digiline_std_bump.png | Bin 410 -> 0 bytes digilines/textures/digiline_std_inv.png | Bin 196 -> 0 bytes digilines/textures/digiline_std_vertical.png | Bin 378 -> 0 bytes digilines/util.lua | 67 ----- digilines/wire_std.lua | 118 --------- digilines/wires_common.lua | 88 ------- digilines_inventory/README | 62 ----- digilines_inventory/depends.txt | 1 - digilines_inventory/init.lua | 150 ----------- digilines_lcd/characters | 282 --------------------- digilines_lcd/init.lua | 232 ----------------- digilines_lcd/textures/_0.png | Bin 239 -> 0 bytes digilines_lcd/textures/_1.png | Bin 238 -> 0 bytes digilines_lcd/textures/_2.png | Bin 235 -> 0 bytes digilines_lcd/textures/_3.png | Bin 241 -> 0 bytes digilines_lcd/textures/_4.png | Bin 240 -> 0 bytes digilines_lcd/textures/_5.png | Bin 237 -> 0 bytes digilines_lcd/textures/_6.png | Bin 246 -> 0 bytes digilines_lcd/textures/_7.png | Bin 243 -> 0 bytes digilines_lcd/textures/_8.png | Bin 235 -> 0 bytes digilines_lcd/textures/_9.png | Bin 245 -> 0 bytes digilines_lcd/textures/_a.png | Bin 238 -> 0 bytes digilines_lcd/textures/_a_.png | Bin 251 -> 0 bytes digilines_lcd/textures/_am.png | Bin 156 -> 0 bytes digilines_lcd/textures/_ap.png | Bin 228 -> 0 bytes digilines_lcd/textures/_as.png | Bin 238 -> 0 bytes digilines_lcd/textures/_at.png | Bin 254 -> 0 bytes digilines_lcd/textures/_b.png | Bin 249 -> 0 bytes digilines_lcd/textures/_b_.png | Bin 240 -> 0 bytes digilines_lcd/textures/_bl.png | Bin 237 -> 0 bytes digilines_lcd/textures/_br.png | Bin 237 -> 0 bytes digilines_lcd/textures/_c.png | Bin 236 -> 0 bytes digilines_lcd/textures/_c_.png | Bin 239 -> 0 bytes digilines_lcd/textures/_ca.png | Bin 231 -> 0 bytes digilines_lcd/textures/_cl.png | Bin 233 -> 0 bytes digilines_lcd/textures/_cm.png | Bin 226 -> 0 bytes digilines_lcd/textures/_co.png | Bin 135 -> 0 bytes digilines_lcd/textures/_cr.png | Bin 234 -> 0 bytes digilines_lcd/textures/_d.png | Bin 243 -> 0 bytes digilines_lcd/textures/_d_.png | Bin 239 -> 0 bytes digilines_lcd/textures/_dl.png | Bin 239 -> 0 bytes digilines_lcd/textures/_dt.png | Bin 224 -> 0 bytes digilines_lcd/textures/_dv.png | Bin 235 -> 0 bytes digilines_lcd/textures/_e.png | Bin 240 -> 0 bytes digilines_lcd/textures/_e_.png | Bin 242 -> 0 bytes digilines_lcd/textures/_eq.png | Bin 228 -> 0 bytes digilines_lcd/textures/_ex.png | Bin 230 -> 0 bytes digilines_lcd/textures/_f.png | Bin 244 -> 0 bytes digilines_lcd/textures/_f_.png | Bin 246 -> 0 bytes digilines_lcd/textures/_g.png | Bin 251 -> 0 bytes digilines_lcd/textures/_g_.png | Bin 243 -> 0 bytes digilines_lcd/textures/_gt.png | Bin 228 -> 0 bytes digilines_lcd/textures/_h.png | Bin 248 -> 0 bytes digilines_lcd/textures/_h_.png | Bin 252 -> 0 bytes digilines_lcd/textures/_ha.png | Bin 233 -> 0 bytes digilines_lcd/textures/_hs.png | Bin 144 -> 0 bytes digilines_lcd/textures/_i.png | Bin 237 -> 0 bytes digilines_lcd/textures/_i_.png | Bin 239 -> 0 bytes digilines_lcd/textures/_j.png | Bin 240 -> 0 bytes digilines_lcd/textures/_j_.png | Bin 243 -> 0 bytes digilines_lcd/textures/_k.png | Bin 247 -> 0 bytes digilines_lcd/textures/_k_.png | Bin 243 -> 0 bytes digilines_lcd/textures/_l.png | Bin 238 -> 0 bytes digilines_lcd/textures/_l_.png | Bin 242 -> 0 bytes digilines_lcd/textures/_lt.png | Bin 227 -> 0 bytes digilines_lcd/textures/_m.png | Bin 240 -> 0 bytes digilines_lcd/textures/_m_.png | Bin 244 -> 0 bytes digilines_lcd/textures/_mn.png | Bin 228 -> 0 bytes digilines_lcd/textures/_n.png | Bin 248 -> 0 bytes digilines_lcd/textures/_n_.png | Bin 252 -> 0 bytes digilines_lcd/textures/_o.png | Bin 238 -> 0 bytes digilines_lcd/textures/_o_.png | Bin 239 -> 0 bytes digilines_lcd/textures/_p.png | Bin 250 -> 0 bytes digilines_lcd/textures/_p_.png | Bin 246 -> 0 bytes digilines_lcd/textures/_pr.png | Bin 255 -> 0 bytes digilines_lcd/textures/_ps.png | Bin 235 -> 0 bytes digilines_lcd/textures/_q.png | Bin 251 -> 0 bytes digilines_lcd/textures/_q_.png | Bin 242 -> 0 bytes digilines_lcd/textures/_qo.png | Bin 232 -> 0 bytes digilines_lcd/textures/_qu.png | Bin 233 -> 0 bytes digilines_lcd/textures/_r.png | Bin 241 -> 0 bytes digilines_lcd/textures/_r_.png | Bin 248 -> 0 bytes digilines_lcd/textures/_re.png | Bin 243 -> 0 bytes digilines_lcd/textures/_s.png | Bin 239 -> 0 bytes digilines_lcd/textures/_s_.png | Bin 243 -> 0 bytes digilines_lcd/textures/_sl.png | Bin 240 -> 0 bytes digilines_lcd/textures/_sm.png | Bin 227 -> 0 bytes digilines_lcd/textures/_sp.png | Bin 215 -> 0 bytes digilines_lcd/textures/_sr.png | Bin 236 -> 0 bytes digilines_lcd/textures/_t.png | Bin 241 -> 0 bytes digilines_lcd/textures/_t_.png | Bin 249 -> 0 bytes digilines_lcd/textures/_tl.png | Bin 227 -> 0 bytes digilines_lcd/textures/_u.png | Bin 240 -> 0 bytes digilines_lcd/textures/_u_.png | Bin 252 -> 0 bytes digilines_lcd/textures/_un.png | Bin 226 -> 0 bytes digilines_lcd/textures/_v.png | Bin 249 -> 0 bytes digilines_lcd/textures/_v_.png | Bin 246 -> 0 bytes digilines_lcd/textures/_vb.png | Bin 229 -> 0 bytes digilines_lcd/textures/_w.png | Bin 238 -> 0 bytes digilines_lcd/textures/_w_.png | Bin 247 -> 0 bytes digilines_lcd/textures/_x.png | Bin 241 -> 0 bytes digilines_lcd/textures/_x_.png | Bin 246 -> 0 bytes digilines_lcd/textures/_y.png | Bin 246 -> 0 bytes digilines_lcd/textures/_y_.png | Bin 243 -> 0 bytes digilines_lcd/textures/_z.png | Bin 233 -> 0 bytes digilines_lcd/textures/_z_.png | Bin 235 -> 0 bytes digilines_lcd/textures/lcd_anyside.png | Bin 142 -> 0 bytes digilines_lcd/textures/lcd_lcd.png | Bin 189 -> 0 bytes digilines_lightsensor/depends.txt | 1 - digilines_lightsensor/init.lua | 62 ----- .../textures/digilines_lightsensor.png | Bin 218 -> 0 bytes digilines_rtc/depends.txt | 1 - digilines_rtc/init.lua | 58 ----- digilines_rtc/textures/digilines_rtc.png | Bin 248 -> 0 bytes init.lua | 44 ++++ internal.lua | 90 +++++++ inventory.lua | 151 +++++++++++ lcd.lua | 233 +++++++++++++++++ lightsensor.lua | 63 +++++ mod.conf | 1 + modpack.txt | 0 presetrules.lua | 15 ++ rtc.lua | 59 +++++ textures/_0.png | Bin 0 -> 239 bytes textures/_1.png | Bin 0 -> 238 bytes textures/_2.png | Bin 0 -> 235 bytes textures/_3.png | Bin 0 -> 241 bytes textures/_4.png | Bin 0 -> 240 bytes textures/_5.png | Bin 0 -> 237 bytes textures/_6.png | Bin 0 -> 246 bytes textures/_7.png | Bin 0 -> 243 bytes textures/_8.png | Bin 0 -> 235 bytes textures/_9.png | Bin 0 -> 245 bytes textures/_a.png | Bin 0 -> 238 bytes textures/_a_.png | Bin 0 -> 251 bytes textures/_am.png | Bin 0 -> 156 bytes textures/_ap.png | Bin 0 -> 228 bytes textures/_as.png | Bin 0 -> 238 bytes textures/_at.png | Bin 0 -> 254 bytes textures/_b.png | Bin 0 -> 249 bytes textures/_b_.png | Bin 0 -> 240 bytes textures/_bl.png | Bin 0 -> 237 bytes textures/_br.png | Bin 0 -> 237 bytes textures/_c.png | Bin 0 -> 236 bytes textures/_c_.png | Bin 0 -> 239 bytes textures/_ca.png | Bin 0 -> 231 bytes textures/_cl.png | Bin 0 -> 233 bytes textures/_cm.png | Bin 0 -> 226 bytes textures/_co.png | Bin 0 -> 135 bytes textures/_cr.png | Bin 0 -> 234 bytes textures/_d.png | Bin 0 -> 243 bytes textures/_d_.png | Bin 0 -> 239 bytes textures/_dl.png | Bin 0 -> 239 bytes textures/_dt.png | Bin 0 -> 224 bytes textures/_dv.png | Bin 0 -> 235 bytes textures/_e.png | Bin 0 -> 240 bytes textures/_e_.png | Bin 0 -> 242 bytes textures/_eq.png | Bin 0 -> 228 bytes textures/_ex.png | Bin 0 -> 230 bytes textures/_f.png | Bin 0 -> 244 bytes textures/_f_.png | Bin 0 -> 246 bytes textures/_g.png | Bin 0 -> 251 bytes textures/_g_.png | Bin 0 -> 243 bytes textures/_gt.png | Bin 0 -> 228 bytes textures/_h.png | Bin 0 -> 248 bytes textures/_h_.png | Bin 0 -> 252 bytes textures/_ha.png | Bin 0 -> 233 bytes textures/_hs.png | Bin 0 -> 144 bytes textures/_i.png | Bin 0 -> 237 bytes textures/_i_.png | Bin 0 -> 239 bytes textures/_j.png | Bin 0 -> 240 bytes textures/_j_.png | Bin 0 -> 243 bytes textures/_k.png | Bin 0 -> 247 bytes textures/_k_.png | Bin 0 -> 243 bytes textures/_l.png | Bin 0 -> 238 bytes textures/_l_.png | Bin 0 -> 242 bytes textures/_lt.png | Bin 0 -> 227 bytes textures/_m.png | Bin 0 -> 240 bytes textures/_m_.png | Bin 0 -> 244 bytes textures/_mn.png | Bin 0 -> 228 bytes textures/_n.png | Bin 0 -> 248 bytes textures/_n_.png | Bin 0 -> 252 bytes textures/_o.png | Bin 0 -> 238 bytes textures/_o_.png | Bin 0 -> 239 bytes textures/_p.png | Bin 0 -> 250 bytes textures/_p_.png | Bin 0 -> 246 bytes textures/_pr.png | Bin 0 -> 255 bytes textures/_ps.png | Bin 0 -> 235 bytes textures/_q.png | Bin 0 -> 251 bytes textures/_q_.png | Bin 0 -> 242 bytes textures/_qo.png | Bin 0 -> 232 bytes textures/_qu.png | Bin 0 -> 233 bytes textures/_r.png | Bin 0 -> 241 bytes textures/_r_.png | Bin 0 -> 248 bytes textures/_re.png | Bin 0 -> 243 bytes textures/_s.png | Bin 0 -> 239 bytes textures/_s_.png | Bin 0 -> 243 bytes textures/_sl.png | Bin 0 -> 240 bytes textures/_sm.png | Bin 0 -> 227 bytes textures/_sp.png | Bin 0 -> 215 bytes textures/_sr.png | Bin 0 -> 236 bytes textures/_t.png | Bin 0 -> 241 bytes textures/_t_.png | Bin 0 -> 249 bytes textures/_tl.png | Bin 0 -> 227 bytes textures/_u.png | Bin 0 -> 240 bytes textures/_u_.png | Bin 0 -> 252 bytes textures/_un.png | Bin 0 -> 226 bytes textures/_v.png | Bin 0 -> 249 bytes textures/_v_.png | Bin 0 -> 246 bytes textures/_vb.png | Bin 0 -> 229 bytes textures/_w.png | Bin 0 -> 238 bytes textures/_w_.png | Bin 0 -> 247 bytes textures/_x.png | Bin 0 -> 241 bytes textures/_x_.png | Bin 0 -> 246 bytes textures/_y.png | Bin 0 -> 246 bytes textures/_y_.png | Bin 0 -> 243 bytes textures/_z.png | Bin 0 -> 233 bytes textures/_z_.png | Bin 0 -> 235 bytes textures/digiline_std.png | Bin 0 -> 446 bytes textures/digiline_std_bump.png | Bin 0 -> 410 bytes textures/digiline_std_inv.png | Bin 0 -> 196 bytes textures/digiline_std_vertical.png | Bin 0 -> 378 bytes textures/digilines_lightsensor.png | Bin 0 -> 218 bytes textures/digilines_rtc.png | Bin 0 -> 248 bytes textures/lcd_anyside.png | Bin 0 -> 142 bytes textures/lcd_lcd.png | Bin 0 -> 189 bytes util.lua | 67 +++++ wire_std.lua | 118 +++++++++ wires_common.lua | 88 +++++++ 237 files changed, 1274 insertions(+), 1253 deletions(-) create mode 100644 README.inventory create mode 100644 characters create mode 100644 depends.txt delete mode 100644 digilines/depends.txt delete mode 100644 digilines/init.lua delete mode 100644 digilines/internal.lua delete mode 100644 digilines/presetrules.lua delete mode 100644 digilines/textures/digiline_std.png delete mode 100644 digilines/textures/digiline_std_bump.png delete mode 100644 digilines/textures/digiline_std_inv.png delete mode 100644 digilines/textures/digiline_std_vertical.png delete mode 100644 digilines/util.lua delete mode 100644 digilines/wire_std.lua delete mode 100644 digilines/wires_common.lua delete mode 100644 digilines_inventory/README delete mode 100644 digilines_inventory/depends.txt delete mode 100644 digilines_inventory/init.lua delete mode 100644 digilines_lcd/characters delete mode 100644 digilines_lcd/init.lua delete mode 100644 digilines_lcd/textures/_0.png delete mode 100644 digilines_lcd/textures/_1.png delete mode 100644 digilines_lcd/textures/_2.png delete mode 100644 digilines_lcd/textures/_3.png delete mode 100644 digilines_lcd/textures/_4.png delete mode 100644 digilines_lcd/textures/_5.png delete mode 100644 digilines_lcd/textures/_6.png delete mode 100644 digilines_lcd/textures/_7.png delete mode 100644 digilines_lcd/textures/_8.png delete mode 100644 digilines_lcd/textures/_9.png delete mode 100644 digilines_lcd/textures/_a.png delete mode 100644 digilines_lcd/textures/_a_.png delete mode 100644 digilines_lcd/textures/_am.png delete mode 100644 digilines_lcd/textures/_ap.png delete mode 100644 digilines_lcd/textures/_as.png delete mode 100644 digilines_lcd/textures/_at.png delete mode 100644 digilines_lcd/textures/_b.png delete mode 100644 digilines_lcd/textures/_b_.png delete mode 100644 digilines_lcd/textures/_bl.png delete mode 100644 digilines_lcd/textures/_br.png delete mode 100644 digilines_lcd/textures/_c.png delete mode 100644 digilines_lcd/textures/_c_.png delete mode 100644 digilines_lcd/textures/_ca.png delete mode 100644 digilines_lcd/textures/_cl.png delete mode 100644 digilines_lcd/textures/_cm.png delete mode 100644 digilines_lcd/textures/_co.png delete mode 100644 digilines_lcd/textures/_cr.png delete mode 100644 digilines_lcd/textures/_d.png delete mode 100644 digilines_lcd/textures/_d_.png delete mode 100644 digilines_lcd/textures/_dl.png delete mode 100644 digilines_lcd/textures/_dt.png delete mode 100644 digilines_lcd/textures/_dv.png delete mode 100644 digilines_lcd/textures/_e.png delete mode 100644 digilines_lcd/textures/_e_.png delete mode 100644 digilines_lcd/textures/_eq.png delete mode 100644 digilines_lcd/textures/_ex.png delete mode 100644 digilines_lcd/textures/_f.png delete mode 100644 digilines_lcd/textures/_f_.png delete mode 100644 digilines_lcd/textures/_g.png delete mode 100644 digilines_lcd/textures/_g_.png delete mode 100644 digilines_lcd/textures/_gt.png delete mode 100644 digilines_lcd/textures/_h.png delete mode 100644 digilines_lcd/textures/_h_.png delete mode 100644 digilines_lcd/textures/_ha.png delete mode 100644 digilines_lcd/textures/_hs.png delete mode 100644 digilines_lcd/textures/_i.png delete mode 100644 digilines_lcd/textures/_i_.png delete mode 100644 digilines_lcd/textures/_j.png delete mode 100644 digilines_lcd/textures/_j_.png delete mode 100644 digilines_lcd/textures/_k.png delete mode 100644 digilines_lcd/textures/_k_.png delete mode 100644 digilines_lcd/textures/_l.png delete mode 100644 digilines_lcd/textures/_l_.png delete mode 100644 digilines_lcd/textures/_lt.png delete mode 100644 digilines_lcd/textures/_m.png delete mode 100644 digilines_lcd/textures/_m_.png delete mode 100644 digilines_lcd/textures/_mn.png delete mode 100644 digilines_lcd/textures/_n.png delete mode 100644 digilines_lcd/textures/_n_.png delete mode 100644 digilines_lcd/textures/_o.png delete mode 100644 digilines_lcd/textures/_o_.png delete mode 100644 digilines_lcd/textures/_p.png delete mode 100644 digilines_lcd/textures/_p_.png delete mode 100644 digilines_lcd/textures/_pr.png delete mode 100644 digilines_lcd/textures/_ps.png delete mode 100644 digilines_lcd/textures/_q.png delete mode 100644 digilines_lcd/textures/_q_.png delete mode 100644 digilines_lcd/textures/_qo.png delete mode 100644 digilines_lcd/textures/_qu.png delete mode 100644 digilines_lcd/textures/_r.png delete mode 100644 digilines_lcd/textures/_r_.png delete mode 100644 digilines_lcd/textures/_re.png delete mode 100644 digilines_lcd/textures/_s.png delete mode 100644 digilines_lcd/textures/_s_.png delete mode 100644 digilines_lcd/textures/_sl.png delete mode 100644 digilines_lcd/textures/_sm.png delete mode 100644 digilines_lcd/textures/_sp.png delete mode 100644 digilines_lcd/textures/_sr.png delete mode 100644 digilines_lcd/textures/_t.png delete mode 100644 digilines_lcd/textures/_t_.png delete mode 100644 digilines_lcd/textures/_tl.png delete mode 100644 digilines_lcd/textures/_u.png delete mode 100644 digilines_lcd/textures/_u_.png delete mode 100644 digilines_lcd/textures/_un.png delete mode 100644 digilines_lcd/textures/_v.png delete mode 100644 digilines_lcd/textures/_v_.png delete mode 100644 digilines_lcd/textures/_vb.png delete mode 100644 digilines_lcd/textures/_w.png delete mode 100644 digilines_lcd/textures/_w_.png delete mode 100644 digilines_lcd/textures/_x.png delete mode 100644 digilines_lcd/textures/_x_.png delete mode 100644 digilines_lcd/textures/_y.png delete mode 100644 digilines_lcd/textures/_y_.png delete mode 100644 digilines_lcd/textures/_z.png delete mode 100644 digilines_lcd/textures/_z_.png delete mode 100644 digilines_lcd/textures/lcd_anyside.png delete mode 100644 digilines_lcd/textures/lcd_lcd.png delete mode 100644 digilines_lightsensor/depends.txt delete mode 100644 digilines_lightsensor/init.lua delete mode 100644 digilines_lightsensor/textures/digilines_lightsensor.png delete mode 100644 digilines_rtc/depends.txt delete mode 100644 digilines_rtc/init.lua delete mode 100644 digilines_rtc/textures/digilines_rtc.png create mode 100644 init.lua create mode 100644 internal.lua create mode 100644 inventory.lua create mode 100644 lcd.lua create mode 100644 lightsensor.lua create mode 100644 mod.conf delete mode 100644 modpack.txt create mode 100644 presetrules.lua create mode 100644 rtc.lua create mode 100644 textures/_0.png create mode 100644 textures/_1.png create mode 100644 textures/_2.png create mode 100644 textures/_3.png create mode 100644 textures/_4.png create mode 100644 textures/_5.png create mode 100644 textures/_6.png create mode 100644 textures/_7.png create mode 100644 textures/_8.png create mode 100644 textures/_9.png create mode 100644 textures/_a.png create mode 100644 textures/_a_.png create mode 100644 textures/_am.png create mode 100644 textures/_ap.png create mode 100644 textures/_as.png create mode 100644 textures/_at.png create mode 100644 textures/_b.png create mode 100644 textures/_b_.png create mode 100644 textures/_bl.png create mode 100644 textures/_br.png create mode 100644 textures/_c.png create mode 100644 textures/_c_.png create mode 100644 textures/_ca.png create mode 100644 textures/_cl.png create mode 100644 textures/_cm.png create mode 100644 textures/_co.png create mode 100644 textures/_cr.png create mode 100644 textures/_d.png create mode 100644 textures/_d_.png create mode 100644 textures/_dl.png create mode 100644 textures/_dt.png create mode 100644 textures/_dv.png create mode 100644 textures/_e.png create mode 100644 textures/_e_.png create mode 100644 textures/_eq.png create mode 100644 textures/_ex.png create mode 100644 textures/_f.png create mode 100644 textures/_f_.png create mode 100644 textures/_g.png create mode 100644 textures/_g_.png create mode 100644 textures/_gt.png create mode 100644 textures/_h.png create mode 100644 textures/_h_.png create mode 100644 textures/_ha.png create mode 100644 textures/_hs.png create mode 100644 textures/_i.png create mode 100644 textures/_i_.png create mode 100644 textures/_j.png create mode 100644 textures/_j_.png create mode 100644 textures/_k.png create mode 100644 textures/_k_.png create mode 100644 textures/_l.png create mode 100644 textures/_l_.png create mode 100644 textures/_lt.png create mode 100644 textures/_m.png create mode 100644 textures/_m_.png create mode 100644 textures/_mn.png create mode 100644 textures/_n.png create mode 100644 textures/_n_.png create mode 100644 textures/_o.png create mode 100644 textures/_o_.png create mode 100644 textures/_p.png create mode 100644 textures/_p_.png create mode 100644 textures/_pr.png create mode 100644 textures/_ps.png create mode 100644 textures/_q.png create mode 100644 textures/_q_.png create mode 100644 textures/_qo.png create mode 100644 textures/_qu.png create mode 100644 textures/_r.png create mode 100644 textures/_r_.png create mode 100644 textures/_re.png create mode 100644 textures/_s.png create mode 100644 textures/_s_.png create mode 100644 textures/_sl.png create mode 100644 textures/_sm.png create mode 100644 textures/_sp.png create mode 100644 textures/_sr.png create mode 100644 textures/_t.png create mode 100644 textures/_t_.png create mode 100644 textures/_tl.png create mode 100644 textures/_u.png create mode 100644 textures/_u_.png create mode 100644 textures/_un.png create mode 100644 textures/_v.png create mode 100644 textures/_v_.png create mode 100644 textures/_vb.png create mode 100644 textures/_w.png create mode 100644 textures/_w_.png create mode 100644 textures/_x.png create mode 100644 textures/_x_.png create mode 100644 textures/_y.png create mode 100644 textures/_y_.png create mode 100644 textures/_z.png create mode 100644 textures/_z_.png create mode 100644 textures/digiline_std.png create mode 100644 textures/digiline_std_bump.png create mode 100644 textures/digiline_std_inv.png create mode 100644 textures/digiline_std_vertical.png create mode 100644 textures/digilines_lightsensor.png create mode 100644 textures/digilines_rtc.png create mode 100644 textures/lcd_anyside.png create mode 100644 textures/lcd_lcd.png create mode 100644 util.lua create mode 100644 wire_std.lua create mode 100644 wires_common.lua diff --git a/README.inventory b/README.inventory new file mode 100644 index 0000000..a88115f --- /dev/null +++ b/README.inventory @@ -0,0 +1,62 @@ +Basic idea: place this chest down at the end of a pipeline. Feed stuff into it. Attach a luacontroller to it with a digiline in between. Program the luacontroller to turn on a wire to stop the pipeline when the chest is full. Don't put more than one kind of item down the pipeline into the chest, unless you want weird tricksy behavior. + +...[F]===[C]--{L} + |__________| + [B] +F: filter +B: blinky plant +C: digiline chest +L: luacontroller +==: pipe +__: mesecons +--: digiline + +Make sure you use mem in the luacontroller to keep the mesecon wire on indefinitely after the chest signals full. When it signals "take" someone took an item out and you can start the pipeline up again. +This may be a bad idea if they only take half a stack or something. Oh well. + +When you put something in, you get a "put" to indicate it's OK (sort of (still buggy)) and can fit inside the chest. When you get a "lost", that means it won't fit inside the chest, and will bounce, possibly popping out. When you get a "overflow" that means you tried to add something to a chest that just filled up, and the stack will bounce. When you get a "full" that means the chest just filled up. + +"Filled up" for all intents and purposes, means taking the type of whatever just went into the chest, and seeing if at least 1 of that type can be added to the chest. If it cannot, then it's filled up. That means a chest full of stacks of 30 copper and one spot of 98 gold, and you add one gold to that, it will say it's full. Add 30 copper to it, and it won't. + +Generally you'll be working with full stacks in pipeworks. Even the non-mese filters will accumulate items in a chest, and not spread them out into multiple stacks. And generally your destination chests will each have one of any kind of item. So all you have to worry about is when you've got 99 everywhere, and one space possibly free. A mese filter can fail on that in fact, for instance if you have room for 45 gold, and it tries to push a stack of 50 gold. All 50 will bounce! The code for chests isn't smart enough to add the 45 and bounce the leftover 5. So only use mese filters when you're sure a full stack has accumulated for the filter to push, and there are no partial stacks at the destination. + +For some reason when an "overflow" happens, when it checks if the stack can fit inside the chest, the answer is yes it can fit! Then it doesn't. Sort of buggy. + +itemstack - the qualified name, a space, then the amount. If the space and amount are ommitted, that represents just 1. + +examples: "default:chest 33" "default:coal" "default:axe_diamond" + +bounce + - when an item cannot enter the destination container it will travel back up the tube it came from, going along alternate routes if they exist, but otherwise popping out of the tube. + +popping out + - the little thingy travelling through the tube disappears, and an entity of the item appears, as if it was just dropped. This entity can expire, losing your items permanently! + + +The messages are: + + +put + - this means that the inventory claimed it could fit that stack of items inside it. Inventories lie. But with the above caveats this is quite usable. +lost + - the stack couldn't fit in the chest and bounces. +full + - the chest has been filled. The itemstack is what filled it. count is what's leftover. + until chests can suck up part of a stack and not bounce the whole stack, that count will + always be 0 +overflow + - generally this is the same as lost, except that the "put" event happened, meaning that the + itemstack was allowed in the chest. + - this will happen with two stacks in rapid succession, the first filling the chest, and the + second bouncing. the in this case will be the amount of the second. + - overflow can't happen with two different kinds of items, you'll get a put, maybe full, then lost for the second kind + +Tricky situation: +if you have a blank spot and put say 82 torches down your pipeline, followed by 99 coal, the 82 torches will go in the chest, and the chest will see that 1 more torch can fit since that would only go to 83. Since 1 more torch can fit, no "full" message will fire off. Then when the coal hits the chest, the "fail" message will fire and the coal will bounce out. The chest couldn't predict that coal would be coming next, so it couldn't know that the chest is full, for coal, while not full for torches. + +TODO: + - make chest.lua a mixin that gets both default and locked chests + - digiline aware furnaces + - digiline aware technic machines, grinders, alloy furnaces, etc + - the pipes going into the chests don't snap to the pipe holes in the digiline chests. They still act fine as pipeworks destinations though. + - digiline chests seem to be immune to filters. But it's late and I'm shipping this. Someone else can figure out why the chests aren't acting like pipeworks chests, despite cloning the pipeworks chest's object. Oh who am I kidding. I'll do it myself I guess, once I've lost hope of aid again. diff --git a/characters b/characters new file mode 100644 index 0000000..b36eea4 --- /dev/null +++ b/characters @@ -0,0 +1,282 @@ +A +_a_ +7 +B +_b_ +5 +C +_c_ +6 +D +_d_ +6 +E +_e_ +5 +F +_f_ +5 +G +_g_ +6 +H +_h_ +6 +I +_i_ +1 +J +_j_ +4 +K +_k_ +5 +L +_l_ +4 +M +_m_ +7 +N +_n_ +6 +O +_o_ +6 +P +_p_ +5 +Q +_q_ +7 +R +_r_ +5 +S +_s_ +5 +T +_t_ +5 +U +_u_ +6 +V +_v_ +7 +W +_w_ +9 +X +_x_ +5 +Y +_y_ +7 +Z +_z_ +5 +a +_a +5 +b +_b +5 +c +_c +4 +d +_d +5 +e +_e +4 +f +_f +4 +g +_g +5 +h +_h +5 +i +_i +1 +j +_j +1 +k +_k +4 +l +_l +1 +m +_m +7 +n +_n +5 +o +_o +5 +p +_p +5 +q +_q +5 +r +_r +3 +s +_s +4 +t +_t +3 +u +_u +4 +v +_v +5 +w +_w +7 +x +_x +5 +y +_y +4 +z +_z +4 + +_sp +2 +0 +_0 +4 +1 +_1 +2 +2 +_2 +4 +3 +_3 +4 +4 +_4 +4 +5 +_5 +4 +6 +_6 +4 +7 +_7 +4 +8 +_8 +4 +9 +_9 +4 +( +_bl +2 +) +_br +2 +{ +_cl +3 +} +_cr +3 +[ +_sl +2 +] +_sr +2 +' +_ap +1 +! +_ex +1 +? +_qu +4 +@ +_at +5 +# +_hs +5 +$ +_dl +4 +% +_pr +5 +^ +_ca +3 +& +_am +5 +* +_as +3 +_ +_un +3 ++ +_ps +3 +- +_mn +3 += +_eq +3 +; +_sm +1 +: +_co +1 +, +_cm +2 +" +_qo +3 +/ +_dv +5 +~ +_tl +4 +< +_lt +3 +> +_gt +3 +\ +_re +5 +| +_vb +1 +. +_dt +1 diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/depends.txt @@ -0,0 +1 @@ +default diff --git a/digilines/depends.txt b/digilines/depends.txt deleted file mode 100644 index 4ad96d5..0000000 --- a/digilines/depends.txt +++ /dev/null @@ -1 +0,0 @@ -default diff --git a/digilines/init.lua b/digilines/init.lua deleted file mode 100644 index 92f916d..0000000 --- a/digilines/init.lua +++ /dev/null @@ -1,25 +0,0 @@ -digiline = {} -dofile(minetest.get_modpath("digilines").."/presetrules.lua") -dofile(minetest.get_modpath("digilines").."/util.lua") -dofile(minetest.get_modpath("digilines").."/internal.lua") -dofile(minetest.get_modpath("digilines").."/wires_common.lua") -dofile(minetest.get_modpath("digilines").."/wire_std.lua") - -function digiline:receptor_send(pos, rules, channel, msg) - local checked = {} - checked[tostring(pos.x).."_"..tostring(pos.y).."_"..tostring(pos.z)] = true -- exclude itself - for _,rule in ipairs(rules) do - if digiline:rules_link(pos, digiline:addPosRule(pos, rule)) then - digiline:transmit(digiline:addPosRule(pos, rule), channel, msg, checked) - end - end -end - -minetest.register_craft({ - output = 'digilines:wire_std_00000000 2', - recipe = { - {'mesecons_materials:fiber', 'mesecons_materials:fiber', 'mesecons_materials:fiber'}, - {'mesecons_insulated:insulated_off', 'mesecons_insulated:insulated_off', 'default:gold_ingot'}, - {'mesecons_materials:fiber', 'mesecons_materials:fiber', 'mesecons_materials:fiber'}, - } -}) \ No newline at end of file diff --git a/digilines/internal.lua b/digilines/internal.lua deleted file mode 100644 index 2319c16..0000000 --- a/digilines/internal.lua +++ /dev/null @@ -1,90 +0,0 @@ -function digiline:getspec(node) - if not minetest.registered_nodes[node.name] then return false end - return minetest.registered_nodes[node.name].digiline -end - -function digiline:importrules(spec, node) - if type(spec) == 'function' then - return spec(node) - elseif spec then - return spec - else - return digiline.rules.default - end -end - -function digiline:getAnyInputRules(pos) - local node = minetest.get_node(pos) - local spec = digiline:getspec(node) - if not spec then return end - - if spec.wire then - return digiline:importrules(spec.wire.rules, node) - end - if spec.effector then - return digiline:importrules(spec.effector.rules, node) - end -end - -function digiline:getAnyOutputRules(pos) - local node = minetest.get_node(pos) - local spec = digiline:getspec(node) - if not spec then return end - - if spec.wire then - return digiline:importrules(spec.wire.rules, node) - end - if spec.receptor then - return digiline:importrules(spec.receptor.rules, node) - end -end - -function digiline:rules_link(output, input) - local outputrules = digiline:getAnyOutputRules(output) - local inputrules = digiline:getAnyInputRules (input) - - if not outputrules or not inputrules then return false end - - - for _, orule in ipairs(outputrules) do - if digiline:cmpPos(digiline:addPosRule(output, orule), input) then - for _, irule in ipairs(inputrules) do - if digiline:cmpPos(digiline:addPosRule(input, irule), output) then - return true - end - end - end - end - return false -end - -function digiline:rules_link_anydir(output, input) - return digiline:rules_link(output, input) - or digiline:rules_link(input, output) -end - -function digiline:transmit(pos, channel, msg, checked) - local checkedid = tostring(pos.x).."_"..tostring(pos.y).."_"..tostring(pos.z) - if checked[checkedid] then return end - checked[checkedid] = true - - local node = minetest.get_node(pos) - local spec = digiline:getspec(node) - if not spec then return end - - - -- Effector actions --> Receive - if spec.effector then - spec.effector.action(pos, node, channel, msg) - end - - -- Cable actions --> Transmit - if spec.wire then - local rules = digiline:importrules(spec.wire.rules, node) - for _,rule in ipairs(rules) do - if digiline:rules_link(pos, digiline:addPosRule(pos, rule)) then - digiline:transmit(digiline:addPosRule(pos, rule), channel, msg, checked) - end - end - end -end diff --git a/digilines/presetrules.lua b/digilines/presetrules.lua deleted file mode 100644 index 8d5e35b..0000000 --- a/digilines/presetrules.lua +++ /dev/null @@ -1,15 +0,0 @@ -digiline.rules = {} - -digiline.rules.default = -{{x=0, y=0, z=-1}, -{x=1, y=0, z=0}, -{x=-1, y=0, z=0}, -{x=0, y=0, z=1}, -{x=1, y=1, z=0}, -{x=1, y=-1, z=0}, -{x=-1, y=1, z=0}, -{x=-1, y=-1, z=0}, -{x=0, y=1, z=1}, -{x=0, y=-1, z=1}, -{x=0, y=1, z=-1}, -{x=0, y=-1, z=-1}} diff --git a/digilines/textures/digiline_std.png b/digilines/textures/digiline_std.png deleted file mode 100644 index 721797c..0000000 Binary files a/digilines/textures/digiline_std.png and /dev/null differ diff --git a/digilines/textures/digiline_std_bump.png b/digilines/textures/digiline_std_bump.png deleted file mode 100644 index 068a4a9..0000000 Binary files a/digilines/textures/digiline_std_bump.png and /dev/null differ diff --git a/digilines/textures/digiline_std_inv.png b/digilines/textures/digiline_std_inv.png deleted file mode 100644 index f66f6c7..0000000 Binary files a/digilines/textures/digiline_std_inv.png and /dev/null differ diff --git a/digilines/textures/digiline_std_vertical.png b/digilines/textures/digiline_std_vertical.png deleted file mode 100644 index 1de0ead..0000000 Binary files a/digilines/textures/digiline_std_vertical.png and /dev/null differ diff --git a/digilines/util.lua b/digilines/util.lua deleted file mode 100644 index d138d63..0000000 --- a/digilines/util.lua +++ /dev/null @@ -1,67 +0,0 @@ -function digiline:addPosRule(p, r) - return {x = p.x + r.x, y = p.y + r.y, z = p.z + r.z} -end - -function digiline:cmpPos(p1, p2) - return (p1.x == p2.x and p1.y == p2.y and p1.z == p2.z) -end - ---Rules rotation Functions: -function digiline:rotate_rules_right(rules) - local nr={} - for i, rule in ipairs(rules) do - nr[i]={} - nr[i].z=rule.x - nr[i].x=-rule.z - nr[i].y=rule.y - end - return nr -end - -function digiline:rotate_rules_left(rules) - local nr={} - for i, rule in ipairs(rules) do - nr[i]={} - nr[i].z=-rules[i].x - nr[i].x=rules[i].z - nr[i].y=rules[i].y - end - return nr -end - -function digiline:rotate_rules_down(rules) - local nr={} - for i, rule in ipairs(rules) do - nr[i]={} - nr[i].y=rule.x - nr[i].x=-rule.y - nr[i].z=rule.z - end - return nr -end - -function digiline:rotate_rules_up(rules) - local nr={} - for i, rule in ipairs(rules) do - nr[i]={} - nr[i].y=-rule.x - nr[i].x=rule.y - nr[i].z=rule.z - end - return nr -end - -function digiline:tablecopy(table) -- deep table copy - if type(table) ~= "table" then return table end -- no need to copy - local newtable = {} - - for idx, item in pairs(table) do - if type(item) == "table" then - newtable[idx] = digiline:tablecopy(item) - else - newtable[idx] = item - end - end - - return newtable -end diff --git a/digilines/wire_std.lua b/digilines/wire_std.lua deleted file mode 100644 index 71bbd0f..0000000 --- a/digilines/wire_std.lua +++ /dev/null @@ -1,118 +0,0 @@ --- naming scheme: wire:(xp)(zp)(xm)(zm)_on/off --- The conditions in brackets define whether there is a digiline at that place or not --- 1 = there is one; 0 = there is none --- y always means y+ - -box_center = {-1/16, -.5, -1/16, 1/16, -.5+1/16, 1/16} -box_bump1 = { -2/16, -8/16, -2/16, 2/16, -13/32, 2/16 } -box_bump2 = { -3/32, -13/32, -3/32, 3/32, -12/32, 3/32 } - -box_xp = {1/16, -.5, -1/16, 8/16, -.5+1/16, 1/16} -box_zp = {-1/16, -.5, 1/16, 1/16, -.5+1/16, 8/16} -box_xm = {-8/16, -.5, -1/16, -1/16, -.5+1/16, 1/16} -box_zm = {-1/16, -.5, -8/16, 1/16, -.5+1/16, -1/16} - -box_xpy = {.5-1/16, -.5+1/16, -1/16, .5, .4999+1/16, 1/16} -box_zpy = {-1/16, -.5+1/16, .5-1/16, 1/16, .4999+1/16, .5} -box_xmy = {-.5, -.5+1/16, -1/16, -.5+1/16, .4999+1/16, 1/16} -box_zmy = {-1/16, -.5+1/16, -.5, 1/16, .4999+1/16, -.5+1/16} - -for xp=0, 1 do -for zp=0, 1 do -for xm=0, 1 do -for zm=0, 1 do -for xpy=0, 1 do -for zpy=0, 1 do -for xmy=0, 1 do -for zmy=0, 1 do - if (xpy == 1 and xp == 0) or (zpy == 1 and zp == 0) - or (xmy == 1 and xm == 0) or (zmy == 1 and zm == 0) then break end - - local groups - local nodeid = tostring(xp )..tostring(zp )..tostring(xm )..tostring(zm ).. - tostring(xpy)..tostring(zpy)..tostring(xmy)..tostring(zmy) - - if nodeid == "00000000" then - groups = {dig_immediate = 3} - wiredesc = "Digiline" - else - groups = {dig_immediate = 3, not_in_creative_inventory = 1} - end - - local nodebox = {} - local adjx = false - local adjz = false - if xp == 1 then table.insert(nodebox, box_xp) adjx = true end - if zp == 1 then table.insert(nodebox, box_zp) adjz = true end - if xm == 1 then table.insert(nodebox, box_xm) adjx = true end - if zm == 1 then table.insert(nodebox, box_zm) adjz = true end - if xpy == 1 then table.insert(nodebox, box_xpy) end - if zpy == 1 then table.insert(nodebox, box_zpy) end - if xmy == 1 then table.insert(nodebox, box_xmy) end - if zmy == 1 then table.insert(nodebox, box_zmy) end - - if adjx and adjz and (xp + zp + xm + zm > 2) then - table.insert(nodebox, box_bump1) - table.insert(nodebox, box_bump2) - tiles = { - "digiline_std_bump.png", - "digiline_std_bump.png", - "digiline_std_vertical.png", - "digiline_std_vertical.png", - "digiline_std_vertical.png", - "digiline_std_vertical.png" - } - else - table.insert(nodebox, box_center) - tiles = { - "digiline_std.png", - "digiline_std.png", - "digiline_std_vertical.png", - "digiline_std_vertical.png", - "digiline_std_vertical.png", - "digiline_std_vertical.png" - } - end - - if nodeid == "00000000" then - nodebox = {-8/16, -.5, -1/16, 8/16, -.5+1/16, 1/16} - end - - minetest.register_node("digilines:wire_std_"..nodeid, { - description = wiredesc, - drawtype = "nodebox", - tiles = tiles, - inventory_image = "digiline_std_inv.png", - wield_image = "digiline_std_inv.png", - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, - digiline = - { - wire = - { - basename = "digilines:wire_std_", - use_autoconnect = true - } - }, - selection_box = { - type = "fixed", - fixed = {-.5, -.5, -.5, .5, -.5+1/16, .5} - }, - node_box = { - type = "fixed", - fixed = nodebox - }, - groups = groups, - walkable = false, - stack_max = 99, - drop = "digilines:wire_std_00000000" - }) -end -end -end -end -end -end -end -end diff --git a/digilines/wires_common.lua b/digilines/wires_common.lua deleted file mode 100644 index c5f761b..0000000 --- a/digilines/wires_common.lua +++ /dev/null @@ -1,88 +0,0 @@ -minetest.register_on_placenode(function(pos, node) - if minetest.registered_nodes[node.name].digiline then - digiline:update_autoconnect(pos) - end -end) - -minetest.register_on_dignode(function(pos, node) - if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].digiline then --- need to make sure that node exists (unknown nodes!) - digiline:update_autoconnect(pos) - end -end) - -function digiline:update_autoconnect(pos, secondcall) - local xppos = {x=pos.x+1, y=pos.y, z=pos.z} - local zppos = {x=pos.x, y=pos.y, z=pos.z+1} - local xmpos = {x=pos.x-1, y=pos.y, z=pos.z} - local zmpos = {x=pos.x, y=pos.y, z=pos.z-1} - local xpympos = {x=pos.x+1, y=pos.y-1, z=pos.z} - local zpympos = {x=pos.x, y=pos.y-1, z=pos.z+1} - local xmympos = {x=pos.x-1, y=pos.y-1, z=pos.z} - local zmympos = {x=pos.x, y=pos.y-1, z=pos.z-1} - local xpypos = {x=pos.x+1, y=pos.y+1, z=pos.z} - local zpypos = {x=pos.x, y=pos.y+1, z=pos.z+1} - local xmypos = {x=pos.x-1, y=pos.y+1, z=pos.z} - local zmypos = {x=pos.x, y=pos.y+1, z=pos.z-1} - - if secondcall == nil then - digiline:update_autoconnect(xppos, true) - digiline:update_autoconnect(zppos, true) - digiline:update_autoconnect(xmpos, true) - digiline:update_autoconnect(zmpos, true) - - digiline:update_autoconnect(xpypos, true) - digiline:update_autoconnect(zpypos, true) - digiline:update_autoconnect(xmypos, true) - digiline:update_autoconnect(zmypos, true) - - digiline:update_autoconnect(xpympos, true) - digiline:update_autoconnect(zpympos, true) - digiline:update_autoconnect(xmympos, true) - digiline:update_autoconnect(zmympos, true) - end - - local def = minetest.registered_nodes[minetest.get_node(pos).name] - local digilinespec = def and def.digiline - if not (digilinespec and digilinespec.wire and - digilinespec.wire.use_autoconnect) then - return nil - end - - local zmg = digiline:rules_link_anydir(pos, zmpos) - local zmymg = digiline:rules_link_anydir(pos, zmympos) - local xmg = digiline:rules_link_anydir(pos, xmpos) - local xmymg = digiline:rules_link_anydir(pos, xmympos) - local zpg = digiline:rules_link_anydir(pos, zppos) - local zpymg = digiline:rules_link_anydir(pos, zpympos) - local xpg = digiline:rules_link_anydir(pos, xppos) - local xpymg = digiline:rules_link_anydir(pos, xpympos) - - - local xpyg = digiline:rules_link_anydir(pos, xpypos) - local zpyg = digiline:rules_link_anydir(pos, zpypos) - local xmyg = digiline:rules_link_anydir(pos, xmypos) - local zmyg = digiline:rules_link_anydir(pos, zmypos) - - local zm, xm, zp, xp, xpy, zpy, xmy, zmy - if zmg or zmymg then zm = 1 else zm = 0 end - if xmg or xmymg then xm = 1 else xm = 0 end - if zpg or zpymg then zp = 1 else zp = 0 end - if xpg or xpymg then xp = 1 else xp = 0 end - - if xpyg then xpy = 1 else xpy = 0 end - if zpyg then zpy = 1 else zpy = 0 end - if xmyg then xmy = 1 else xmy = 0 end - if zmyg then zmy = 1 else zmy = 0 end - - if xpy == 1 then xp = 1 end - if zpy == 1 then zp = 1 end - if xmy == 1 then xm = 1 end - if zmy == 1 then zm = 1 end - - local nodeid = tostring(xp )..tostring(zp )..tostring(xm )..tostring(zm ).. - tostring(xpy)..tostring(zpy)..tostring(xmy)..tostring(zmy) - - - minetest.set_node(pos, {name = digilinespec.wire.basename..nodeid}) -end diff --git a/digilines_inventory/README b/digilines_inventory/README deleted file mode 100644 index a88115f..0000000 --- a/digilines_inventory/README +++ /dev/null @@ -1,62 +0,0 @@ -Basic idea: place this chest down at the end of a pipeline. Feed stuff into it. Attach a luacontroller to it with a digiline in between. Program the luacontroller to turn on a wire to stop the pipeline when the chest is full. Don't put more than one kind of item down the pipeline into the chest, unless you want weird tricksy behavior. - -...[F]===[C]--{L} - |__________| - [B] -F: filter -B: blinky plant -C: digiline chest -L: luacontroller -==: pipe -__: mesecons ---: digiline - -Make sure you use mem in the luacontroller to keep the mesecon wire on indefinitely after the chest signals full. When it signals "take" someone took an item out and you can start the pipeline up again. -This may be a bad idea if they only take half a stack or something. Oh well. - -When you put something in, you get a "put" to indicate it's OK (sort of (still buggy)) and can fit inside the chest. When you get a "lost", that means it won't fit inside the chest, and will bounce, possibly popping out. When you get a "overflow" that means you tried to add something to a chest that just filled up, and the stack will bounce. When you get a "full" that means the chest just filled up. - -"Filled up" for all intents and purposes, means taking the type of whatever just went into the chest, and seeing if at least 1 of that type can be added to the chest. If it cannot, then it's filled up. That means a chest full of stacks of 30 copper and one spot of 98 gold, and you add one gold to that, it will say it's full. Add 30 copper to it, and it won't. - -Generally you'll be working with full stacks in pipeworks. Even the non-mese filters will accumulate items in a chest, and not spread them out into multiple stacks. And generally your destination chests will each have one of any kind of item. So all you have to worry about is when you've got 99 everywhere, and one space possibly free. A mese filter can fail on that in fact, for instance if you have room for 45 gold, and it tries to push a stack of 50 gold. All 50 will bounce! The code for chests isn't smart enough to add the 45 and bounce the leftover 5. So only use mese filters when you're sure a full stack has accumulated for the filter to push, and there are no partial stacks at the destination. - -For some reason when an "overflow" happens, when it checks if the stack can fit inside the chest, the answer is yes it can fit! Then it doesn't. Sort of buggy. - -itemstack - the qualified name, a space, then the amount. If the space and amount are ommitted, that represents just 1. - -examples: "default:chest 33" "default:coal" "default:axe_diamond" - -bounce - - when an item cannot enter the destination container it will travel back up the tube it came from, going along alternate routes if they exist, but otherwise popping out of the tube. - -popping out - - the little thingy travelling through the tube disappears, and an entity of the item appears, as if it was just dropped. This entity can expire, losing your items permanently! - - -The messages are: - - -put - - this means that the inventory claimed it could fit that stack of items inside it. Inventories lie. But with the above caveats this is quite usable. -lost - - the stack couldn't fit in the chest and bounces. -full - - the chest has been filled. The itemstack is what filled it. count is what's leftover. - until chests can suck up part of a stack and not bounce the whole stack, that count will - always be 0 -overflow - - generally this is the same as lost, except that the "put" event happened, meaning that the - itemstack was allowed in the chest. - - this will happen with two stacks in rapid succession, the first filling the chest, and the - second bouncing. the in this case will be the amount of the second. - - overflow can't happen with two different kinds of items, you'll get a put, maybe full, then lost for the second kind - -Tricky situation: -if you have a blank spot and put say 82 torches down your pipeline, followed by 99 coal, the 82 torches will go in the chest, and the chest will see that 1 more torch can fit since that would only go to 83. Since 1 more torch can fit, no "full" message will fire off. Then when the coal hits the chest, the "fail" message will fire and the coal will bounce out. The chest couldn't predict that coal would be coming next, so it couldn't know that the chest is full, for coal, while not full for torches. - -TODO: - - make chest.lua a mixin that gets both default and locked chests - - digiline aware furnaces - - digiline aware technic machines, grinders, alloy furnaces, etc - - the pipes going into the chests don't snap to the pipe holes in the digiline chests. They still act fine as pipeworks destinations though. - - digiline chests seem to be immune to filters. But it's late and I'm shipping this. Someone else can figure out why the chests aren't acting like pipeworks chests, despite cloning the pipeworks chest's object. Oh who am I kidding. I'll do it myself I guess, once I've lost hope of aid again. diff --git a/digilines_inventory/depends.txt b/digilines_inventory/depends.txt deleted file mode 100644 index da1d119..0000000 --- a/digilines_inventory/depends.txt +++ /dev/null @@ -1 +0,0 @@ -digilines diff --git a/digilines_inventory/init.lua b/digilines_inventory/init.lua deleted file mode 100644 index 0269d4e..0000000 --- a/digilines_inventory/init.lua +++ /dev/null @@ -1,150 +0,0 @@ -local function sendMessage(pos, msg, channel) - if channel == nil then - channel = minetest.get_meta(pos):get_string("channel") - end - digiline:receptor_send(pos,digiline.rules.default,channel,msg) -end - -local function maybeString(stack) - if type(stack)=='string' then return stack - elseif type(stack)=='table' then return dump(stack) - else return stack:to_string() - end -end - -local function can_insert(pos, stack) - local can = minetest.get_meta(pos):get_inventory():room_for_item("main", stack) - if can then - sendMessage(pos,"put "..maybeString(stack)) - else - -- overflow and lost means that items are gonna be out as entities :/ - sendMessage(pos,"lost "..maybeString(stack)) - end - return can -end - -local tubeconn = minetest.get_modpath("pipeworks") and "^pipeworks_tube_connection_wooden.png" or "" -local tubescan = minetest.get_modpath("pipeworks") and function(pos) pipeworks.scan_for_tube_objects(pos) end or nil - -minetest.register_node("digilines_inventory:chest", { - description = "Digiline Chest", - tiles = { - "default_chest_top.png"..tubeconn, - "default_chest_top.png"..tubeconn, - "default_chest_side.png"..tubeconn, - "default_chest_side.png"..tubeconn, - "default_chest_side.png"..tubeconn, - "default_chest_front.png", - }, - paramtype2 = "facedir", - legacy_facedir_simple = true, - groups = {choppy=2, oddly_breakable_by_hand=2, tubedevice=1, tubedevice_receiver=1}, - sounds = default.node_sound_wood_defaults(), - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("infotext", "Digiline Chest") - meta:set_string("formspec", "size[8,10]".. - ((default and default.gui_bg) or "").. - ((default and default.gui_bg_img) or "").. - ((default and default.gui_slots) or "").. - "label[0,0;Digiline Chest]".. - "list[current_name;main;0,1;8,4;]".. - "field[2,5.5;5,1;channel;Channel;${channel}]".. - ((default and default.get_hotbar_bg) and default.get_hotbar_bg(0,6) or "").. - "list[current_player;main;0,6;8,4;]") - local inv = meta:get_inventory() - inv:set_size("main", 8*4) - end, - after_place_node = tubescan, - after_dig_node = tubescan, - can_dig = function(pos, player) - return minetest.get_meta(pos):get_inventory():is_empty("main") - end, - on_receive_fields = function(pos, formname, fields, sender) - local name = sender:get_player_name() - if minetest.is_protected(pos, name) and not minetest.check_player_privs(name, {protection_bypass=true}) then - minetest.record_protection_violation(pos, name) - return - end - if fields.channel ~= nil then - minetest.get_meta(pos):set_string("channel",fields.channel) - end - end, - digiline = { - receptor = {}, - effector = { - action = function(pos,node,channel,msg) end - } - }, - tube = { - connect_sides = {left=1, right=1, back=1, front=1, bottom=1, top=1}, - connects = function(i,param2) - return not pipeworks.connects.facingFront(i,param2) - end, - input_inventory = "main", - can_insert = function(pos, node, stack, direction) - return can_insert(pos, stack) - end, - insert_object = function(pos, node, stack, direction) - local inv = minetest.get_meta(pos):get_inventory() - local leftover = inv:add_item("main", stack) - local count = leftover:get_count() - if count == 0 then - local derpstack = stack:get_name()..' 1' - if not inv:room_for_item("main", derpstack) then - -- when you can't put a single more of whatever you just put, - -- you'll get a put for it, then a full - sendMessage(pos,"full "..maybeString(stack)..' '..tostring(count)) - end - else - -- this happens when the chest has received two stacks in a row and - -- filled up exactly with the first one. - -- You get a put for the first stack, a put for the second - -- and then a overflow with the first in stack and the second in leftover - -- and NO full? - sendMessage(pos,"overflow "..maybeString(stack)..' '..tostring(count)) - end - return leftover - end, - }, - allow_metadata_inventory_put = function(pos, listname, index, stack, player) - if not can_insert(pos, stack) then - sendMessage(pos,"uoverflow "..maybeString(stack)) - end - return stack:get_count() - end, - on_metadata_inventory_move = function(pos, fromlistname, fromindex, tolistname, toindex, count, player) - minetest.log("action", player:get_player_name().." moves stuff in chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_put = function(pos, listname, index, stack, player) - local channel = minetest.get_meta(pos):get_string("channel") - local send = function(msg) - sendMessage(pos,msg,channel) - end - -- direction is only for furnaces - -- as the item has already been put, can_insert should return false if the chest is now full. - local derpstack = stack:get_name()..' 1' - if can_insert(pos,derpstack) then - send("uput "..maybeString(stack)) - else - send("ufull "..maybeString(stack)) - end - minetest.log("action", player:get_player_name().." puts stuff into chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_take = function(pos, listname, index, stack, player) - local meta = minetest.get_meta(pos) - local channel = meta:get_string("channel") - local inv = meta:get_inventory() - if inv:is_empty(listname) then - sendMessage(pos, "empty", channel) - end - sendMessage(pos,"utake "..maybeString(stack)) - minetest.log("action", player:get_player_name().." takes stuff from chest at "..minetest.pos_to_string(pos)) - end -}) - -minetest.register_craft({ - type = "shapeless", - output = "digilines_inventory:chest", - recipe = {"default:chest", "digilines:wire_std_00000000"} -}) diff --git a/digilines_lcd/characters b/digilines_lcd/characters deleted file mode 100644 index b36eea4..0000000 --- a/digilines_lcd/characters +++ /dev/null @@ -1,282 +0,0 @@ -A -_a_ -7 -B -_b_ -5 -C -_c_ -6 -D -_d_ -6 -E -_e_ -5 -F -_f_ -5 -G -_g_ -6 -H -_h_ -6 -I -_i_ -1 -J -_j_ -4 -K -_k_ -5 -L -_l_ -4 -M -_m_ -7 -N -_n_ -6 -O -_o_ -6 -P -_p_ -5 -Q -_q_ -7 -R -_r_ -5 -S -_s_ -5 -T -_t_ -5 -U -_u_ -6 -V -_v_ -7 -W -_w_ -9 -X -_x_ -5 -Y -_y_ -7 -Z -_z_ -5 -a -_a -5 -b -_b -5 -c -_c -4 -d -_d -5 -e -_e -4 -f -_f -4 -g -_g -5 -h -_h -5 -i -_i -1 -j -_j -1 -k -_k -4 -l -_l -1 -m -_m -7 -n -_n -5 -o -_o -5 -p -_p -5 -q -_q -5 -r -_r -3 -s -_s -4 -t -_t -3 -u -_u -4 -v -_v -5 -w -_w -7 -x -_x -5 -y -_y -4 -z -_z -4 - -_sp -2 -0 -_0 -4 -1 -_1 -2 -2 -_2 -4 -3 -_3 -4 -4 -_4 -4 -5 -_5 -4 -6 -_6 -4 -7 -_7 -4 -8 -_8 -4 -9 -_9 -4 -( -_bl -2 -) -_br -2 -{ -_cl -3 -} -_cr -3 -[ -_sl -2 -] -_sr -2 -' -_ap -1 -! -_ex -1 -? -_qu -4 -@ -_at -5 -# -_hs -5 -$ -_dl -4 -% -_pr -5 -^ -_ca -3 -& -_am -5 -* -_as -3 -_ -_un -3 -+ -_ps -3 -- -_mn -3 -= -_eq -3 -; -_sm -1 -: -_co -1 -, -_cm -2 -" -_qo -3 -/ -_dv -5 -~ -_tl -4 -< -_lt -3 -> -_gt -3 -\ -_re -5 -| -_vb -1 -. -_dt -1 diff --git a/digilines_lcd/init.lua b/digilines_lcd/init.lua deleted file mode 100644 index fafa477..0000000 --- a/digilines_lcd/init.lua +++ /dev/null @@ -1,232 +0,0 @@ ---* parts are currently not possible because you cannot set the pitch of an entity from lua - --- Font: 04.jp.org - --- load characters map -local chars_file = io.open(minetest.get_modpath("digilines_lcd").."/characters", "r") -local charmap = {} -local max_chars = 12 -if not chars_file then - print("[digilines_lcd] E: character map file not found") -else - while true do - local char = chars_file:read("*l") - if char == nil then - break - end - local img = chars_file:read("*l") - chars_file:read("*l") - charmap[char] = img - end -end - -local lcds = { - -- on ceiling - --* [0] = {delta = {x = 0, y = 0.4, z = 0}, pitch = math.pi / -2}, - -- on ground - --* [1] = {delta = {x = 0, y =-0.4, z = 0}, pitch = math.pi / 2}, - -- sides - [2] = {delta = {x = 0.4, y = 0, z = 0}, yaw = math.pi / -2}, - [3] = {delta = {x = -0.4, y = 0, z = 0}, yaw = math.pi / 2}, - [4] = {delta = {x = 0, y = 0, z = 0.4}, yaw = 0}, - [5] = {delta = {x = 0, y = 0, z = -0.4}, yaw = math.pi}, -} - -local reset_meta = function(pos) - minetest.get_meta(pos):set_string("formspec", "field[channel;Channel;${channel}]") -end - -local clearscreen = function(pos) - local objects = minetest.get_objects_inside_radius(pos, 0.5) - for _, o in ipairs(objects) do - local o_entity = o:get_luaentity() - if o_entity and o_entity.name == "digilines_lcd:text" then - o:remove() - end - end -end - -local prepare_writing = function(pos) - local lcd_info = lcds[minetest.get_node(pos).param2] - if lcd_info == nil then return end - local text = minetest.add_entity( - {x = pos.x + lcd_info.delta.x, - y = pos.y + lcd_info.delta.y, - z = pos.z + lcd_info.delta.z}, "digilines_lcd:text") - text:setyaw(lcd_info.yaw or 0) - --* text:setpitch(lcd_info.yaw or 0) - return text -end - -local on_digiline_receive = function(pos, node, channel, msg) - local meta = minetest.get_meta(pos) - local setchan = meta:get_string("channel") - if setchan ~= channel then return end - - meta:set_string("text", msg) - meta:set_string("infotext", msg) - clearscreen(pos) - if msg ~= "" then - prepare_writing(pos) - end -end - -local lcd_box = { - type = "wallmounted", - wall_top = {-8/16, 7/16, -8/16, 8/16, 8/16, 8/16} -} - -minetest.register_node("digilines_lcd:lcd", { - drawtype = "nodebox", - description = "Digiline LCD", - inventory_image = "lcd_lcd.png", - wield_image = "lcd_lcd.png", - tiles = {"lcd_anyside.png"}, - - paramtype = "light", - sunlight_propagates = true, - paramtype2 = "wallmounted", - node_box = lcd_box, - selection_box = lcd_box, - groups = {choppy = 3, dig_immediate = 2}, - - after_place_node = function (pos, placer, itemstack) - local param2 = minetest.get_node(pos).param2 - if param2 == 0 or param2 == 1 then - minetest.add_node(pos, {name = "digilines_lcd:lcd", param2 = 3}) - end - prepare_writing (pos) - end, - - on_construct = function(pos) - reset_meta(pos) - end, - - on_destruct = function(pos) - clearscreen(pos) - end, - - on_receive_fields = function(pos, formname, fields, sender) - local name = sender:get_player_name() - if minetest.is_protected(pos, name) and not minetest.check_player_privs(name, {protection_bypass=true}) then - minetest.record_protection_violation(pos, name) - return - end - if (fields.channel) then - minetest.get_meta(pos):set_string("channel", fields.channel) - end - end, - - digiline = - { - receptor = {}, - effector = { - action = on_digiline_receive - }, - }, - - light_source = 6, -}) - -minetest.register_entity("digilines_lcd:text", { - collisionbox = { 0, 0, 0, 0, 0, 0 }, - visual = "upright_sprite", - textures = {}, - - on_activate = function(self) - local meta = minetest.get_meta(self.object:getpos()) - local text = meta:get_string("text") - self.object:set_properties({textures={generate_texture(create_lines(text))}}) - end -}) - --- CONSTANTS -local LCD_WITH = 100 -local LCD_PADDING = 8 - -local LINE_LENGTH = 12 -local NUMBER_OF_LINES = 5 - -local LINE_HEIGHT = 14 -local CHAR_WIDTH = 5 - -create_lines = function(text) - local line = "" - local line_num = 1 - local tab = {} - for word in string.gmatch(text, "%S+") do - if string.len(line)+string.len(word) < LINE_LENGTH and word ~= "|" then - if line ~= "" then - line = line.." "..word - else - line = word - end - else - table.insert(tab, line) - if word ~= "|" then - line = word - else - line = "" - end - line_num = line_num+1 - if line_num > NUMBER_OF_LINES then - return tab - end - end - end - table.insert(tab, line) - return tab -end - -generate_texture = function(lines) - local texture = "[combine:"..LCD_WITH.."x"..LCD_WITH - local ypos = 16 - for i = 1, #lines do - texture = texture..generate_line(lines[i], ypos) - ypos = ypos + LINE_HEIGHT - end - return texture -end - -generate_line = function(s, ypos) - local i = 1 - local parsed = {} - local width = 0 - local chars = 0 - while chars < max_chars and i <= #s do - local file = nil - if charmap[s:sub(i, i)] ~= nil then - file = charmap[s:sub(i, i)] - i = i + 1 - elseif i < #s and charmap[s:sub(i, i + 1)] ~= nil then - file = charmap[s:sub(i, i + 1)] - i = i + 2 - else - print("[digilines_lcd] W: unknown symbol in '"..s.."' at "..i) - i = i + 1 - end - if file ~= nil then - width = width + CHAR_WIDTH - table.insert(parsed, file) - chars = chars + 1 - end - end - width = width - 1 - - local texture = "" - local xpos = math.floor((LCD_WITH - 2 * LCD_PADDING - width) / 2 + LCD_PADDING) - for i = 1, #parsed do - texture = texture..":"..xpos..","..ypos.."="..parsed[i]..".png" - xpos = xpos + CHAR_WIDTH + 1 - end - return texture -end - -minetest.register_craft({ - output = "digilines_lcd:lcd 2", - recipe = { - {"default:steel_ingot", "digilines:wire_std_00000000", "default:steel_ingot"}, - {"mesecons_lightstone:lightstone_green_off","mesecons_lightstone:lightstone_green_off","mesecons_lightstone:lightstone_green_off"}, - {"default:glass","default:glass","default:glass"} - } -}) diff --git a/digilines_lcd/textures/_0.png b/digilines_lcd/textures/_0.png deleted file mode 100644 index b030879..0000000 Binary files a/digilines_lcd/textures/_0.png and /dev/null differ diff --git a/digilines_lcd/textures/_1.png b/digilines_lcd/textures/_1.png deleted file mode 100644 index ae28369..0000000 Binary files a/digilines_lcd/textures/_1.png and /dev/null differ diff --git a/digilines_lcd/textures/_2.png b/digilines_lcd/textures/_2.png deleted file mode 100644 index 7375c68..0000000 Binary files a/digilines_lcd/textures/_2.png and /dev/null differ diff --git a/digilines_lcd/textures/_3.png b/digilines_lcd/textures/_3.png deleted file mode 100644 index d724811..0000000 Binary files a/digilines_lcd/textures/_3.png and /dev/null differ diff --git a/digilines_lcd/textures/_4.png b/digilines_lcd/textures/_4.png deleted file mode 100644 index 0fff433..0000000 Binary files a/digilines_lcd/textures/_4.png and /dev/null differ diff --git a/digilines_lcd/textures/_5.png b/digilines_lcd/textures/_5.png deleted file mode 100644 index 43010df..0000000 Binary files a/digilines_lcd/textures/_5.png and /dev/null differ diff --git a/digilines_lcd/textures/_6.png b/digilines_lcd/textures/_6.png deleted file mode 100644 index 1eba38c..0000000 Binary files a/digilines_lcd/textures/_6.png and /dev/null differ diff --git a/digilines_lcd/textures/_7.png b/digilines_lcd/textures/_7.png deleted file mode 100644 index dbcd2d1..0000000 Binary files a/digilines_lcd/textures/_7.png and /dev/null differ diff --git a/digilines_lcd/textures/_8.png b/digilines_lcd/textures/_8.png deleted file mode 100644 index edf6ef5..0000000 Binary files a/digilines_lcd/textures/_8.png and /dev/null differ diff --git a/digilines_lcd/textures/_9.png b/digilines_lcd/textures/_9.png deleted file mode 100644 index c276c11..0000000 Binary files a/digilines_lcd/textures/_9.png and /dev/null differ diff --git a/digilines_lcd/textures/_a.png b/digilines_lcd/textures/_a.png deleted file mode 100644 index 8f3f59c..0000000 Binary files a/digilines_lcd/textures/_a.png and /dev/null differ diff --git a/digilines_lcd/textures/_a_.png b/digilines_lcd/textures/_a_.png deleted file mode 100644 index 4da193c..0000000 Binary files a/digilines_lcd/textures/_a_.png and /dev/null differ diff --git a/digilines_lcd/textures/_am.png b/digilines_lcd/textures/_am.png deleted file mode 100644 index 75d0287..0000000 Binary files a/digilines_lcd/textures/_am.png and /dev/null differ diff --git a/digilines_lcd/textures/_ap.png b/digilines_lcd/textures/_ap.png deleted file mode 100644 index 5dd3325..0000000 Binary files a/digilines_lcd/textures/_ap.png and /dev/null differ diff --git a/digilines_lcd/textures/_as.png b/digilines_lcd/textures/_as.png deleted file mode 100644 index 3c7a25a..0000000 Binary files a/digilines_lcd/textures/_as.png and /dev/null differ diff --git a/digilines_lcd/textures/_at.png b/digilines_lcd/textures/_at.png deleted file mode 100644 index 4f9841c..0000000 Binary files a/digilines_lcd/textures/_at.png and /dev/null differ diff --git a/digilines_lcd/textures/_b.png b/digilines_lcd/textures/_b.png deleted file mode 100644 index baf4eaa..0000000 Binary files a/digilines_lcd/textures/_b.png and /dev/null differ diff --git a/digilines_lcd/textures/_b_.png b/digilines_lcd/textures/_b_.png deleted file mode 100644 index b00a378..0000000 Binary files a/digilines_lcd/textures/_b_.png and /dev/null differ diff --git a/digilines_lcd/textures/_bl.png b/digilines_lcd/textures/_bl.png deleted file mode 100644 index 546ca4e..0000000 Binary files a/digilines_lcd/textures/_bl.png and /dev/null differ diff --git a/digilines_lcd/textures/_br.png b/digilines_lcd/textures/_br.png deleted file mode 100644 index 5700fa6..0000000 Binary files a/digilines_lcd/textures/_br.png and /dev/null differ diff --git a/digilines_lcd/textures/_c.png b/digilines_lcd/textures/_c.png deleted file mode 100644 index eedd639..0000000 Binary files a/digilines_lcd/textures/_c.png and /dev/null differ diff --git a/digilines_lcd/textures/_c_.png b/digilines_lcd/textures/_c_.png deleted file mode 100644 index cab6518..0000000 Binary files a/digilines_lcd/textures/_c_.png and /dev/null differ diff --git a/digilines_lcd/textures/_ca.png b/digilines_lcd/textures/_ca.png deleted file mode 100644 index d359c88..0000000 Binary files a/digilines_lcd/textures/_ca.png and /dev/null differ diff --git a/digilines_lcd/textures/_cl.png b/digilines_lcd/textures/_cl.png deleted file mode 100644 index 55396b9..0000000 Binary files a/digilines_lcd/textures/_cl.png and /dev/null differ diff --git a/digilines_lcd/textures/_cm.png b/digilines_lcd/textures/_cm.png deleted file mode 100644 index 28beedf..0000000 Binary files a/digilines_lcd/textures/_cm.png and /dev/null differ diff --git a/digilines_lcd/textures/_co.png b/digilines_lcd/textures/_co.png deleted file mode 100644 index b161819..0000000 Binary files a/digilines_lcd/textures/_co.png and /dev/null differ diff --git a/digilines_lcd/textures/_cr.png b/digilines_lcd/textures/_cr.png deleted file mode 100644 index ac466a9..0000000 Binary files a/digilines_lcd/textures/_cr.png and /dev/null differ diff --git a/digilines_lcd/textures/_d.png b/digilines_lcd/textures/_d.png deleted file mode 100644 index a5f0699..0000000 Binary files a/digilines_lcd/textures/_d.png and /dev/null differ diff --git a/digilines_lcd/textures/_d_.png b/digilines_lcd/textures/_d_.png deleted file mode 100644 index 9a0e3ed..0000000 Binary files a/digilines_lcd/textures/_d_.png and /dev/null differ diff --git a/digilines_lcd/textures/_dl.png b/digilines_lcd/textures/_dl.png deleted file mode 100644 index 72184ad..0000000 Binary files a/digilines_lcd/textures/_dl.png and /dev/null differ diff --git a/digilines_lcd/textures/_dt.png b/digilines_lcd/textures/_dt.png deleted file mode 100644 index 61c1e4a..0000000 Binary files a/digilines_lcd/textures/_dt.png and /dev/null differ diff --git a/digilines_lcd/textures/_dv.png b/digilines_lcd/textures/_dv.png deleted file mode 100644 index 996d7cd..0000000 Binary files a/digilines_lcd/textures/_dv.png and /dev/null differ diff --git a/digilines_lcd/textures/_e.png b/digilines_lcd/textures/_e.png deleted file mode 100644 index 29e32e6..0000000 Binary files a/digilines_lcd/textures/_e.png and /dev/null differ diff --git a/digilines_lcd/textures/_e_.png b/digilines_lcd/textures/_e_.png deleted file mode 100644 index c7f19c1..0000000 Binary files a/digilines_lcd/textures/_e_.png and /dev/null differ diff --git a/digilines_lcd/textures/_eq.png b/digilines_lcd/textures/_eq.png deleted file mode 100644 index daf8424..0000000 Binary files a/digilines_lcd/textures/_eq.png and /dev/null differ diff --git a/digilines_lcd/textures/_ex.png b/digilines_lcd/textures/_ex.png deleted file mode 100644 index b5da8e9..0000000 Binary files a/digilines_lcd/textures/_ex.png and /dev/null differ diff --git a/digilines_lcd/textures/_f.png b/digilines_lcd/textures/_f.png deleted file mode 100644 index 6835912..0000000 Binary files a/digilines_lcd/textures/_f.png and /dev/null differ diff --git a/digilines_lcd/textures/_f_.png b/digilines_lcd/textures/_f_.png deleted file mode 100644 index 3698ed2..0000000 Binary files a/digilines_lcd/textures/_f_.png and /dev/null differ diff --git a/digilines_lcd/textures/_g.png b/digilines_lcd/textures/_g.png deleted file mode 100644 index 5a85cde..0000000 Binary files a/digilines_lcd/textures/_g.png and /dev/null differ diff --git a/digilines_lcd/textures/_g_.png b/digilines_lcd/textures/_g_.png deleted file mode 100644 index cc7bbc5..0000000 Binary files a/digilines_lcd/textures/_g_.png and /dev/null differ diff --git a/digilines_lcd/textures/_gt.png b/digilines_lcd/textures/_gt.png deleted file mode 100644 index f30855a..0000000 Binary files a/digilines_lcd/textures/_gt.png and /dev/null differ diff --git a/digilines_lcd/textures/_h.png b/digilines_lcd/textures/_h.png deleted file mode 100644 index 1a66a9e..0000000 Binary files a/digilines_lcd/textures/_h.png and /dev/null differ diff --git a/digilines_lcd/textures/_h_.png b/digilines_lcd/textures/_h_.png deleted file mode 100644 index 87beafc..0000000 Binary files a/digilines_lcd/textures/_h_.png and /dev/null differ diff --git a/digilines_lcd/textures/_ha.png b/digilines_lcd/textures/_ha.png deleted file mode 100644 index 4618ced..0000000 Binary files a/digilines_lcd/textures/_ha.png and /dev/null differ diff --git a/digilines_lcd/textures/_hs.png b/digilines_lcd/textures/_hs.png deleted file mode 100644 index 6f12bec..0000000 Binary files a/digilines_lcd/textures/_hs.png and /dev/null differ diff --git a/digilines_lcd/textures/_i.png b/digilines_lcd/textures/_i.png deleted file mode 100644 index f001142..0000000 Binary files a/digilines_lcd/textures/_i.png and /dev/null differ diff --git a/digilines_lcd/textures/_i_.png b/digilines_lcd/textures/_i_.png deleted file mode 100644 index fc658b8..0000000 Binary files a/digilines_lcd/textures/_i_.png and /dev/null differ diff --git a/digilines_lcd/textures/_j.png b/digilines_lcd/textures/_j.png deleted file mode 100644 index 87d2f26..0000000 Binary files a/digilines_lcd/textures/_j.png and /dev/null differ diff --git a/digilines_lcd/textures/_j_.png b/digilines_lcd/textures/_j_.png deleted file mode 100644 index c0d9ac2..0000000 Binary files a/digilines_lcd/textures/_j_.png and /dev/null differ diff --git a/digilines_lcd/textures/_k.png b/digilines_lcd/textures/_k.png deleted file mode 100644 index 34f9336..0000000 Binary files a/digilines_lcd/textures/_k.png and /dev/null differ diff --git a/digilines_lcd/textures/_k_.png b/digilines_lcd/textures/_k_.png deleted file mode 100644 index 86b623d..0000000 Binary files a/digilines_lcd/textures/_k_.png and /dev/null differ diff --git a/digilines_lcd/textures/_l.png b/digilines_lcd/textures/_l.png deleted file mode 100644 index defe7ec..0000000 Binary files a/digilines_lcd/textures/_l.png and /dev/null differ diff --git a/digilines_lcd/textures/_l_.png b/digilines_lcd/textures/_l_.png deleted file mode 100644 index 3fe1de2..0000000 Binary files a/digilines_lcd/textures/_l_.png and /dev/null differ diff --git a/digilines_lcd/textures/_lt.png b/digilines_lcd/textures/_lt.png deleted file mode 100644 index ec7219d..0000000 Binary files a/digilines_lcd/textures/_lt.png and /dev/null differ diff --git a/digilines_lcd/textures/_m.png b/digilines_lcd/textures/_m.png deleted file mode 100644 index e0fe039..0000000 Binary files a/digilines_lcd/textures/_m.png and /dev/null differ diff --git a/digilines_lcd/textures/_m_.png b/digilines_lcd/textures/_m_.png deleted file mode 100644 index 9164da6..0000000 Binary files a/digilines_lcd/textures/_m_.png and /dev/null differ diff --git a/digilines_lcd/textures/_mn.png b/digilines_lcd/textures/_mn.png deleted file mode 100644 index 935a2fe..0000000 Binary files a/digilines_lcd/textures/_mn.png and /dev/null differ diff --git a/digilines_lcd/textures/_n.png b/digilines_lcd/textures/_n.png deleted file mode 100644 index ac10fd9..0000000 Binary files a/digilines_lcd/textures/_n.png and /dev/null differ diff --git a/digilines_lcd/textures/_n_.png b/digilines_lcd/textures/_n_.png deleted file mode 100644 index d4355c1..0000000 Binary files a/digilines_lcd/textures/_n_.png and /dev/null differ diff --git a/digilines_lcd/textures/_o.png b/digilines_lcd/textures/_o.png deleted file mode 100644 index 080e99d..0000000 Binary files a/digilines_lcd/textures/_o.png and /dev/null differ diff --git a/digilines_lcd/textures/_o_.png b/digilines_lcd/textures/_o_.png deleted file mode 100644 index 2d19051..0000000 Binary files a/digilines_lcd/textures/_o_.png and /dev/null differ diff --git a/digilines_lcd/textures/_p.png b/digilines_lcd/textures/_p.png deleted file mode 100644 index 3050959..0000000 Binary files a/digilines_lcd/textures/_p.png and /dev/null differ diff --git a/digilines_lcd/textures/_p_.png b/digilines_lcd/textures/_p_.png deleted file mode 100644 index 0cca011..0000000 Binary files a/digilines_lcd/textures/_p_.png and /dev/null differ diff --git a/digilines_lcd/textures/_pr.png b/digilines_lcd/textures/_pr.png deleted file mode 100644 index b835141..0000000 Binary files a/digilines_lcd/textures/_pr.png and /dev/null differ diff --git a/digilines_lcd/textures/_ps.png b/digilines_lcd/textures/_ps.png deleted file mode 100644 index 1f4b5c1..0000000 Binary files a/digilines_lcd/textures/_ps.png and /dev/null differ diff --git a/digilines_lcd/textures/_q.png b/digilines_lcd/textures/_q.png deleted file mode 100644 index 945b6cf..0000000 Binary files a/digilines_lcd/textures/_q.png and /dev/null differ diff --git a/digilines_lcd/textures/_q_.png b/digilines_lcd/textures/_q_.png deleted file mode 100644 index f3bf455..0000000 Binary files a/digilines_lcd/textures/_q_.png and /dev/null differ diff --git a/digilines_lcd/textures/_qo.png b/digilines_lcd/textures/_qo.png deleted file mode 100644 index 5d261e3..0000000 Binary files a/digilines_lcd/textures/_qo.png and /dev/null differ diff --git a/digilines_lcd/textures/_qu.png b/digilines_lcd/textures/_qu.png deleted file mode 100644 index 5eb597a..0000000 Binary files a/digilines_lcd/textures/_qu.png and /dev/null differ diff --git a/digilines_lcd/textures/_r.png b/digilines_lcd/textures/_r.png deleted file mode 100644 index 39e9fce..0000000 Binary files a/digilines_lcd/textures/_r.png and /dev/null differ diff --git a/digilines_lcd/textures/_r_.png b/digilines_lcd/textures/_r_.png deleted file mode 100644 index 6c71c1e..0000000 Binary files a/digilines_lcd/textures/_r_.png and /dev/null differ diff --git a/digilines_lcd/textures/_re.png b/digilines_lcd/textures/_re.png deleted file mode 100644 index 1614837..0000000 Binary files a/digilines_lcd/textures/_re.png and /dev/null differ diff --git a/digilines_lcd/textures/_s.png b/digilines_lcd/textures/_s.png deleted file mode 100644 index a0ada1a..0000000 Binary files a/digilines_lcd/textures/_s.png and /dev/null differ diff --git a/digilines_lcd/textures/_s_.png b/digilines_lcd/textures/_s_.png deleted file mode 100644 index 9b018bb..0000000 Binary files a/digilines_lcd/textures/_s_.png and /dev/null differ diff --git a/digilines_lcd/textures/_sl.png b/digilines_lcd/textures/_sl.png deleted file mode 100644 index 08c9547..0000000 Binary files a/digilines_lcd/textures/_sl.png and /dev/null differ diff --git a/digilines_lcd/textures/_sm.png b/digilines_lcd/textures/_sm.png deleted file mode 100644 index 385c64f..0000000 Binary files a/digilines_lcd/textures/_sm.png and /dev/null differ diff --git a/digilines_lcd/textures/_sp.png b/digilines_lcd/textures/_sp.png deleted file mode 100644 index 4f38a35..0000000 Binary files a/digilines_lcd/textures/_sp.png and /dev/null differ diff --git a/digilines_lcd/textures/_sr.png b/digilines_lcd/textures/_sr.png deleted file mode 100644 index bc9c0a2..0000000 Binary files a/digilines_lcd/textures/_sr.png and /dev/null differ diff --git a/digilines_lcd/textures/_t.png b/digilines_lcd/textures/_t.png deleted file mode 100644 index c55731a..0000000 Binary files a/digilines_lcd/textures/_t.png and /dev/null differ diff --git a/digilines_lcd/textures/_t_.png b/digilines_lcd/textures/_t_.png deleted file mode 100644 index 773e666..0000000 Binary files a/digilines_lcd/textures/_t_.png and /dev/null differ diff --git a/digilines_lcd/textures/_tl.png b/digilines_lcd/textures/_tl.png deleted file mode 100644 index 059fe68..0000000 Binary files a/digilines_lcd/textures/_tl.png and /dev/null differ diff --git a/digilines_lcd/textures/_u.png b/digilines_lcd/textures/_u.png deleted file mode 100644 index 98bf8e6..0000000 Binary files a/digilines_lcd/textures/_u.png and /dev/null differ diff --git a/digilines_lcd/textures/_u_.png b/digilines_lcd/textures/_u_.png deleted file mode 100644 index 35ce915..0000000 Binary files a/digilines_lcd/textures/_u_.png and /dev/null differ diff --git a/digilines_lcd/textures/_un.png b/digilines_lcd/textures/_un.png deleted file mode 100644 index 01f547a..0000000 Binary files a/digilines_lcd/textures/_un.png and /dev/null differ diff --git a/digilines_lcd/textures/_v.png b/digilines_lcd/textures/_v.png deleted file mode 100644 index b692d11..0000000 Binary files a/digilines_lcd/textures/_v.png and /dev/null differ diff --git a/digilines_lcd/textures/_v_.png b/digilines_lcd/textures/_v_.png deleted file mode 100644 index 8049771..0000000 Binary files a/digilines_lcd/textures/_v_.png and /dev/null differ diff --git a/digilines_lcd/textures/_vb.png b/digilines_lcd/textures/_vb.png deleted file mode 100644 index 7fed7dc..0000000 Binary files a/digilines_lcd/textures/_vb.png and /dev/null differ diff --git a/digilines_lcd/textures/_w.png b/digilines_lcd/textures/_w.png deleted file mode 100644 index 6a58b07..0000000 Binary files a/digilines_lcd/textures/_w.png and /dev/null differ diff --git a/digilines_lcd/textures/_w_.png b/digilines_lcd/textures/_w_.png deleted file mode 100644 index 64904de..0000000 Binary files a/digilines_lcd/textures/_w_.png and /dev/null differ diff --git a/digilines_lcd/textures/_x.png b/digilines_lcd/textures/_x.png deleted file mode 100644 index b769e13..0000000 Binary files a/digilines_lcd/textures/_x.png and /dev/null differ diff --git a/digilines_lcd/textures/_x_.png b/digilines_lcd/textures/_x_.png deleted file mode 100644 index 2f6d067..0000000 Binary files a/digilines_lcd/textures/_x_.png and /dev/null differ diff --git a/digilines_lcd/textures/_y.png b/digilines_lcd/textures/_y.png deleted file mode 100644 index 777b55e..0000000 Binary files a/digilines_lcd/textures/_y.png and /dev/null differ diff --git a/digilines_lcd/textures/_y_.png b/digilines_lcd/textures/_y_.png deleted file mode 100644 index 0c40de9..0000000 Binary files a/digilines_lcd/textures/_y_.png and /dev/null differ diff --git a/digilines_lcd/textures/_z.png b/digilines_lcd/textures/_z.png deleted file mode 100644 index ae010fe..0000000 Binary files a/digilines_lcd/textures/_z.png and /dev/null differ diff --git a/digilines_lcd/textures/_z_.png b/digilines_lcd/textures/_z_.png deleted file mode 100644 index 1c3e053..0000000 Binary files a/digilines_lcd/textures/_z_.png and /dev/null differ diff --git a/digilines_lcd/textures/lcd_anyside.png b/digilines_lcd/textures/lcd_anyside.png deleted file mode 100644 index fe88e8d..0000000 Binary files a/digilines_lcd/textures/lcd_anyside.png and /dev/null differ diff --git a/digilines_lcd/textures/lcd_lcd.png b/digilines_lcd/textures/lcd_lcd.png deleted file mode 100644 index c959fa1..0000000 Binary files a/digilines_lcd/textures/lcd_lcd.png and /dev/null differ diff --git a/digilines_lightsensor/depends.txt b/digilines_lightsensor/depends.txt deleted file mode 100644 index da1d119..0000000 --- a/digilines_lightsensor/depends.txt +++ /dev/null @@ -1 +0,0 @@ -digilines diff --git a/digilines_lightsensor/init.lua b/digilines_lightsensor/init.lua deleted file mode 100644 index 914899b..0000000 --- a/digilines_lightsensor/init.lua +++ /dev/null @@ -1,62 +0,0 @@ -local GET_COMMAND = "GET" - -local lsensor_nodebox = -{ - type = "fixed", - fixed = { - { -8/16, -8/16, -8/16, 8/16, -7/16, 8/16 }, -- bottom slab - - { -7/16, -7/16, -7/16, -4/16, -5/16, 7/16 }, -- bonds - { 4/16, -7/16, -7/16, 7/16, -5/16, 7/16 }, - { -7/16, -7/16, -7/16, 7/16, -5/16, -4/16 }, - { -7/16, -7/16, 4/16, 7/16, -5/16, 7/16 }, - - { -1/16, -7/16, -1/16, 1/16, -5/16, 1/16 }, -- pin thing in the middle - } -} - -local lsensor_selbox = -{ - type = "fixed", - fixed = {{ -8/16, -8/16, -8/16, 8/16, -3/16, 8/16 }} -} - -local on_digiline_receive = function (pos, node, channel, msg) - local setchan = minetest.get_meta(pos):get_string("channel") - if channel == setchan and msg == GET_COMMAND then - local lightval = minetest.get_node_light(pos) - digiline:receptor_send(pos, digiline.rules.default, channel, lightval) - end -end - -minetest.register_node("digilines_lightsensor:lightsensor", { - description = "Digiline Lightsensor", - drawtype = "nodebox", - tiles = {"digilines_lightsensor.png"}, - - paramtype = "light", - groups = {dig_immediate=2}, - selection_box = lsensor_selbox, - node_box = lsensor_nodebox, - digiline = - { - receptor = {}, - effector = { - action = on_digiline_receive - }, - }, - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("formspec", "field[channel;Channel;${channel}]") - end, - on_receive_fields = function(pos, formname, fields, sender) - local name = sender:get_player_name() - if minetest.is_protected(pos, name) and not minetest.check_player_privs(name, {protection_bypass=true}) then - minetest.record_protection_violation(pos, name) - return - end - if (fields.channel) then - minetest.get_meta(pos):set_string("channel", fields.channel) - end - end, -}) diff --git a/digilines_lightsensor/textures/digilines_lightsensor.png b/digilines_lightsensor/textures/digilines_lightsensor.png deleted file mode 100644 index aa88495..0000000 Binary files a/digilines_lightsensor/textures/digilines_lightsensor.png and /dev/null differ diff --git a/digilines_rtc/depends.txt b/digilines_rtc/depends.txt deleted file mode 100644 index da1d119..0000000 --- a/digilines_rtc/depends.txt +++ /dev/null @@ -1 +0,0 @@ -digilines diff --git a/digilines_rtc/init.lua b/digilines_rtc/init.lua deleted file mode 100644 index 5abafc1..0000000 --- a/digilines_rtc/init.lua +++ /dev/null @@ -1,58 +0,0 @@ -local GET_COMMAND = "GET" - -local rtc_nodebox = -{ - type = "fixed", - fixed = { - { -8/16, -8/16, -8/16, 8/16, -7/16, 8/16 }, -- bottom slab - - { -7/16, -7/16, -7/16, 7/16, -5/16, 7/16 }, - } -} - -local rtc_selbox = -{ - type = "fixed", - fixed = {{ -8/16, -8/16, -8/16, 8/16, -3/16, 8/16 }} -} - -local on_digiline_receive = function (pos, node, channel, msg) - local setchan = minetest.get_meta(pos):get_string("channel") - if channel == setchan and msg == GET_COMMAND then - local timeofday = minetest.get_timeofday() - digiline:receptor_send(pos, digiline.rules.default, channel, timeofday) - end -end - -minetest.register_node("digilines_rtc:rtc", { - description = "Digiline Real Time Clock (RTC)", - drawtype = "nodebox", - tiles = {"digilines_rtc.png"}, - - paramtype = "light", - paramtype2 = "facedir", - groups = {dig_immediate=2}, - selection_box = rtc_selbox, - node_box = rtc_nodebox, - digiline = - { - receptor = {}, - effector = { - action = on_digiline_receive - }, - }, - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("formspec", "field[channel;Channel;${channel}]") - end, - on_receive_fields = function(pos, formname, fields, sender) - local name = sender:get_player_name() - if minetest.is_protected(pos, name) and not minetest.check_player_privs(name, {protection_bypass=true}) then - minetest.record_protection_violation(pos, name) - return - end - if (fields.channel) then - minetest.get_meta(pos):set_string("channel", fields.channel) - end - end, -}) diff --git a/digilines_rtc/textures/digilines_rtc.png b/digilines_rtc/textures/digilines_rtc.png deleted file mode 100644 index a7b1d84..0000000 Binary files a/digilines_rtc/textures/digilines_rtc.png and /dev/null differ diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..2f48a73 --- /dev/null +++ b/init.lua @@ -0,0 +1,44 @@ +digiline = {} + +local modpath = minetest.get_modpath("digilines") +dofile(modpath .. "/presetrules.lua") +dofile(modpath .. "/util.lua") +dofile(modpath .. "/internal.lua") +dofile(modpath .. "/wires_common.lua") +dofile(modpath .. "/wire_std.lua") + +function digiline:receptor_send(pos, rules, channel, msg) + local checked = {} + checked[tostring(pos.x).."_"..tostring(pos.y).."_"..tostring(pos.z)] = true -- exclude itself + for _,rule in ipairs(rules) do + if digiline:rules_link(pos, digiline:addPosRule(pos, rule)) then + digiline:transmit(digiline:addPosRule(pos, rule), channel, msg, checked) + end + end +end + +minetest.register_craft({ + output = 'digilines:wire_std_00000000 2', + recipe = { + {'mesecons_materials:fiber', 'mesecons_materials:fiber', 'mesecons_materials:fiber'}, + {'mesecons_insulated:insulated_off', 'mesecons_insulated:insulated_off', 'default:gold_ingot'}, + {'mesecons_materials:fiber', 'mesecons_materials:fiber', 'mesecons_materials:fiber'}, + } +}) + +-- former submods +if minetest.is_yes(minetest.setting_get("digilines_enable_inventory") or true) then + dofile(modpath .. "/inventory.lua") +end + +if minetest.is_yes(minetest.setting_get("digilines_enable_lcd") or true) then + dofile(modpath .. "/lcd.lua") +end + +if minetest.is_yes(minetest.setting_get("digilines_enable_lightsensor") or true) then + dofile(modpath .. "/lightsensor.lua") +end + +if minetest.is_yes(minetest.setting_get("digilines_enable_rtc") or true) then + dofile(modpath .. "/rtc.lua") +end diff --git a/internal.lua b/internal.lua new file mode 100644 index 0000000..2319c16 --- /dev/null +++ b/internal.lua @@ -0,0 +1,90 @@ +function digiline:getspec(node) + if not minetest.registered_nodes[node.name] then return false end + return minetest.registered_nodes[node.name].digiline +end + +function digiline:importrules(spec, node) + if type(spec) == 'function' then + return spec(node) + elseif spec then + return spec + else + return digiline.rules.default + end +end + +function digiline:getAnyInputRules(pos) + local node = minetest.get_node(pos) + local spec = digiline:getspec(node) + if not spec then return end + + if spec.wire then + return digiline:importrules(spec.wire.rules, node) + end + if spec.effector then + return digiline:importrules(spec.effector.rules, node) + end +end + +function digiline:getAnyOutputRules(pos) + local node = minetest.get_node(pos) + local spec = digiline:getspec(node) + if not spec then return end + + if spec.wire then + return digiline:importrules(spec.wire.rules, node) + end + if spec.receptor then + return digiline:importrules(spec.receptor.rules, node) + end +end + +function digiline:rules_link(output, input) + local outputrules = digiline:getAnyOutputRules(output) + local inputrules = digiline:getAnyInputRules (input) + + if not outputrules or not inputrules then return false end + + + for _, orule in ipairs(outputrules) do + if digiline:cmpPos(digiline:addPosRule(output, orule), input) then + for _, irule in ipairs(inputrules) do + if digiline:cmpPos(digiline:addPosRule(input, irule), output) then + return true + end + end + end + end + return false +end + +function digiline:rules_link_anydir(output, input) + return digiline:rules_link(output, input) + or digiline:rules_link(input, output) +end + +function digiline:transmit(pos, channel, msg, checked) + local checkedid = tostring(pos.x).."_"..tostring(pos.y).."_"..tostring(pos.z) + if checked[checkedid] then return end + checked[checkedid] = true + + local node = minetest.get_node(pos) + local spec = digiline:getspec(node) + if not spec then return end + + + -- Effector actions --> Receive + if spec.effector then + spec.effector.action(pos, node, channel, msg) + end + + -- Cable actions --> Transmit + if spec.wire then + local rules = digiline:importrules(spec.wire.rules, node) + for _,rule in ipairs(rules) do + if digiline:rules_link(pos, digiline:addPosRule(pos, rule)) then + digiline:transmit(digiline:addPosRule(pos, rule), channel, msg, checked) + end + end + end +end diff --git a/inventory.lua b/inventory.lua new file mode 100644 index 0000000..0134e5c --- /dev/null +++ b/inventory.lua @@ -0,0 +1,151 @@ +local function sendMessage(pos, msg, channel) + if channel == nil then + channel = minetest.get_meta(pos):get_string("channel") + end + digiline:receptor_send(pos,digiline.rules.default,channel,msg) +end + +local function maybeString(stack) + if type(stack)=='string' then return stack + elseif type(stack)=='table' then return dump(stack) + else return stack:to_string() + end +end + +local function can_insert(pos, stack) + local can = minetest.get_meta(pos):get_inventory():room_for_item("main", stack) + if can then + sendMessage(pos,"put "..maybeString(stack)) + else + -- overflow and lost means that items are gonna be out as entities :/ + sendMessage(pos,"lost "..maybeString(stack)) + end + return can +end + +local tubeconn = minetest.get_modpath("pipeworks") and "^pipeworks_tube_connection_wooden.png" or "" +local tubescan = minetest.get_modpath("pipeworks") and function(pos) pipeworks.scan_for_tube_objects(pos) end or nil + +minetest.register_alias("digilines_inventory:chest", "digilines:chest") +minetest.register_node("digilines:chest", { + description = "Digiline Chest", + tiles = { + "default_chest_top.png"..tubeconn, + "default_chest_top.png"..tubeconn, + "default_chest_side.png"..tubeconn, + "default_chest_side.png"..tubeconn, + "default_chest_side.png"..tubeconn, + "default_chest_front.png", + }, + paramtype2 = "facedir", + legacy_facedir_simple = true, + groups = {choppy=2, oddly_breakable_by_hand=2, tubedevice=1, tubedevice_receiver=1}, + sounds = default.node_sound_wood_defaults(), + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("infotext", "Digiline Chest") + meta:set_string("formspec", "size[8,10]".. + ((default and default.gui_bg) or "").. + ((default and default.gui_bg_img) or "").. + ((default and default.gui_slots) or "").. + "label[0,0;Digiline Chest]".. + "list[current_name;main;0,1;8,4;]".. + "field[2,5.5;5,1;channel;Channel;${channel}]".. + ((default and default.get_hotbar_bg) and default.get_hotbar_bg(0,6) or "").. + "list[current_player;main;0,6;8,4;]") + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + end, + after_place_node = tubescan, + after_dig_node = tubescan, + can_dig = function(pos, player) + return minetest.get_meta(pos):get_inventory():is_empty("main") + end, + on_receive_fields = function(pos, formname, fields, sender) + local name = sender:get_player_name() + if minetest.is_protected(pos, name) and not minetest.check_player_privs(name, {protection_bypass=true}) then + minetest.record_protection_violation(pos, name) + return + end + if fields.channel ~= nil then + minetest.get_meta(pos):set_string("channel",fields.channel) + end + end, + digiline = { + receptor = {}, + effector = { + action = function(pos,node,channel,msg) end + } + }, + tube = { + connect_sides = {left=1, right=1, back=1, front=1, bottom=1, top=1}, + connects = function(i,param2) + return not pipeworks.connects.facingFront(i,param2) + end, + input_inventory = "main", + can_insert = function(pos, node, stack, direction) + return can_insert(pos, stack) + end, + insert_object = function(pos, node, stack, direction) + local inv = minetest.get_meta(pos):get_inventory() + local leftover = inv:add_item("main", stack) + local count = leftover:get_count() + if count == 0 then + local derpstack = stack:get_name()..' 1' + if not inv:room_for_item("main", derpstack) then + -- when you can't put a single more of whatever you just put, + -- you'll get a put for it, then a full + sendMessage(pos,"full "..maybeString(stack)..' '..tostring(count)) + end + else + -- this happens when the chest has received two stacks in a row and + -- filled up exactly with the first one. + -- You get a put for the first stack, a put for the second + -- and then a overflow with the first in stack and the second in leftover + -- and NO full? + sendMessage(pos,"overflow "..maybeString(stack)..' '..tostring(count)) + end + return leftover + end, + }, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + if not can_insert(pos, stack) then + sendMessage(pos,"uoverflow "..maybeString(stack)) + end + return stack:get_count() + end, + on_metadata_inventory_move = function(pos, fromlistname, fromindex, tolistname, toindex, count, player) + minetest.log("action", player:get_player_name().." moves stuff in chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + local channel = minetest.get_meta(pos):get_string("channel") + local send = function(msg) + sendMessage(pos,msg,channel) + end + -- direction is only for furnaces + -- as the item has already been put, can_insert should return false if the chest is now full. + local derpstack = stack:get_name()..' 1' + if can_insert(pos,derpstack) then + send("uput "..maybeString(stack)) + else + send("ufull "..maybeString(stack)) + end + minetest.log("action", player:get_player_name().." puts stuff into chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.get_meta(pos) + local channel = meta:get_string("channel") + local inv = meta:get_inventory() + if inv:is_empty(listname) then + sendMessage(pos, "empty", channel) + end + sendMessage(pos,"utake "..maybeString(stack)) + minetest.log("action", player:get_player_name().." takes stuff from chest at "..minetest.pos_to_string(pos)) + end +}) + +minetest.register_craft({ + type = "shapeless", + output = "digilines:chest", + recipe = {"default:chest", "digilines:wire_std_00000000"} +}) diff --git a/lcd.lua b/lcd.lua new file mode 100644 index 0000000..3370a31 --- /dev/null +++ b/lcd.lua @@ -0,0 +1,233 @@ +--* parts are currently not possible because you cannot set the pitch of an entity from lua + +-- Font: 04.jp.org + +-- load characters map +local chars_file = io.open(minetest.get_modpath("digilines").."/characters", "r") +local charmap = {} +local max_chars = 12 +if not chars_file then + print("[digilines] E: LCD: character map file not found") +else + while true do + local char = chars_file:read("*l") + if char == nil then + break + end + local img = chars_file:read("*l") + chars_file:read("*l") + charmap[char] = img + end +end + +local lcds = { + -- on ceiling + --* [0] = {delta = {x = 0, y = 0.4, z = 0}, pitch = math.pi / -2}, + -- on ground + --* [1] = {delta = {x = 0, y =-0.4, z = 0}, pitch = math.pi / 2}, + -- sides + [2] = {delta = {x = 0.4, y = 0, z = 0}, yaw = math.pi / -2}, + [3] = {delta = {x = -0.4, y = 0, z = 0}, yaw = math.pi / 2}, + [4] = {delta = {x = 0, y = 0, z = 0.4}, yaw = 0}, + [5] = {delta = {x = 0, y = 0, z = -0.4}, yaw = math.pi}, +} + +local reset_meta = function(pos) + minetest.get_meta(pos):set_string("formspec", "field[channel;Channel;${channel}]") +end + +local clearscreen = function(pos) + local objects = minetest.get_objects_inside_radius(pos, 0.5) + for _, o in ipairs(objects) do + local o_entity = o:get_luaentity() + if o_entity and o_entity.name == "digilines_lcd:text" then + o:remove() + end + end +end + +local prepare_writing = function(pos) + local lcd_info = lcds[minetest.get_node(pos).param2] + if lcd_info == nil then return end + local text = minetest.add_entity( + {x = pos.x + lcd_info.delta.x, + y = pos.y + lcd_info.delta.y, + z = pos.z + lcd_info.delta.z}, "digilines_lcd:text") + text:setyaw(lcd_info.yaw or 0) + --* text:setpitch(lcd_info.yaw or 0) + return text +end + +local on_digiline_receive = function(pos, node, channel, msg) + local meta = minetest.get_meta(pos) + local setchan = meta:get_string("channel") + if setchan ~= channel then return end + + meta:set_string("text", msg) + meta:set_string("infotext", msg) + clearscreen(pos) + if msg ~= "" then + prepare_writing(pos) + end +end + +local lcd_box = { + type = "wallmounted", + wall_top = {-8/16, 7/16, -8/16, 8/16, 8/16, 8/16} +} + +minetest.register_alias("digilines_lcd:lcd", "digilines:lcd") +minetest.register_node("digilines:lcd", { + drawtype = "nodebox", + description = "Digiline LCD", + inventory_image = "lcd_lcd.png", + wield_image = "lcd_lcd.png", + tiles = {"lcd_anyside.png"}, + + paramtype = "light", + sunlight_propagates = true, + paramtype2 = "wallmounted", + node_box = lcd_box, + selection_box = lcd_box, + groups = {choppy = 3, dig_immediate = 2}, + + after_place_node = function (pos, placer, itemstack) + local param2 = minetest.get_node(pos).param2 + if param2 == 0 or param2 == 1 then + minetest.add_node(pos, {name = "digilines:lcd", param2 = 3}) + end + prepare_writing (pos) + end, + + on_construct = function(pos) + reset_meta(pos) + end, + + on_destruct = function(pos) + clearscreen(pos) + end, + + on_receive_fields = function(pos, formname, fields, sender) + local name = sender:get_player_name() + if minetest.is_protected(pos, name) and not minetest.check_player_privs(name, {protection_bypass=true}) then + minetest.record_protection_violation(pos, name) + return + end + if (fields.channel) then + minetest.get_meta(pos):set_string("channel", fields.channel) + end + end, + + digiline = + { + receptor = {}, + effector = { + action = on_digiline_receive + }, + }, + + light_source = 6, +}) + +minetest.register_entity(":digilines_lcd:text", { + collisionbox = { 0, 0, 0, 0, 0, 0 }, + visual = "upright_sprite", + textures = {}, + + on_activate = function(self) + local meta = minetest.get_meta(self.object:getpos()) + local text = meta:get_string("text") + self.object:set_properties({textures={generate_texture(create_lines(text))}}) + end +}) + +-- CONSTANTS +local LCD_WITH = 100 +local LCD_PADDING = 8 + +local LINE_LENGTH = 12 +local NUMBER_OF_LINES = 5 + +local LINE_HEIGHT = 14 +local CHAR_WIDTH = 5 + +create_lines = function(text) + local line = "" + local line_num = 1 + local tab = {} + for word in string.gmatch(text, "%S+") do + if string.len(line)+string.len(word) < LINE_LENGTH and word ~= "|" then + if line ~= "" then + line = line.." "..word + else + line = word + end + else + table.insert(tab, line) + if word ~= "|" then + line = word + else + line = "" + end + line_num = line_num+1 + if line_num > NUMBER_OF_LINES then + return tab + end + end + end + table.insert(tab, line) + return tab +end + +generate_texture = function(lines) + local texture = "[combine:"..LCD_WITH.."x"..LCD_WITH + local ypos = 16 + for i = 1, #lines do + texture = texture..generate_line(lines[i], ypos) + ypos = ypos + LINE_HEIGHT + end + return texture +end + +generate_line = function(s, ypos) + local i = 1 + local parsed = {} + local width = 0 + local chars = 0 + while chars < max_chars and i <= #s do + local file = nil + if charmap[s:sub(i, i)] ~= nil then + file = charmap[s:sub(i, i)] + i = i + 1 + elseif i < #s and charmap[s:sub(i, i + 1)] ~= nil then + file = charmap[s:sub(i, i + 1)] + i = i + 2 + else + print("[digilines] W: LCD: unknown symbol in '"..s.."' at "..i) + i = i + 1 + end + if file ~= nil then + width = width + CHAR_WIDTH + table.insert(parsed, file) + chars = chars + 1 + end + end + width = width - 1 + + local texture = "" + local xpos = math.floor((LCD_WITH - 2 * LCD_PADDING - width) / 2 + LCD_PADDING) + for i = 1, #parsed do + texture = texture..":"..xpos..","..ypos.."="..parsed[i]..".png" + xpos = xpos + CHAR_WIDTH + 1 + end + return texture +end + +minetest.register_craft({ + output = "digilines:lcd 2", + recipe = { + {"default:steel_ingot", "digilines:wire_std_00000000", "default:steel_ingot"}, + {"mesecons_lightstone:lightstone_green_off","mesecons_lightstone:lightstone_green_off","mesecons_lightstone:lightstone_green_off"}, + {"default:glass","default:glass","default:glass"} + } +}) diff --git a/lightsensor.lua b/lightsensor.lua new file mode 100644 index 0000000..86a29c9 --- /dev/null +++ b/lightsensor.lua @@ -0,0 +1,63 @@ +local GET_COMMAND = "GET" + +local lsensor_nodebox = +{ + type = "fixed", + fixed = { + { -8/16, -8/16, -8/16, 8/16, -7/16, 8/16 }, -- bottom slab + + { -7/16, -7/16, -7/16, -4/16, -5/16, 7/16 }, -- bonds + { 4/16, -7/16, -7/16, 7/16, -5/16, 7/16 }, + { -7/16, -7/16, -7/16, 7/16, -5/16, -4/16 }, + { -7/16, -7/16, 4/16, 7/16, -5/16, 7/16 }, + + { -1/16, -7/16, -1/16, 1/16, -5/16, 1/16 }, -- pin thing in the middle + } +} + +local lsensor_selbox = +{ + type = "fixed", + fixed = {{ -8/16, -8/16, -8/16, 8/16, -3/16, 8/16 }} +} + +local on_digiline_receive = function (pos, node, channel, msg) + local setchan = minetest.get_meta(pos):get_string("channel") + if channel == setchan and msg == GET_COMMAND then + local lightval = minetest.get_node_light(pos) + digiline:receptor_send(pos, digiline.rules.default, channel, lightval) + end +end + +minetest.register_alias("digilines_lightsensor:lightsensor", "digilines:lightsensor") +minetest.register_node("digilines:lightsensor", { + description = "Digiline Lightsensor", + drawtype = "nodebox", + tiles = {"digilines_lightsensor.png"}, + + paramtype = "light", + groups = {dig_immediate=2}, + selection_box = lsensor_selbox, + node_box = lsensor_nodebox, + digiline = + { + receptor = {}, + effector = { + action = on_digiline_receive + }, + }, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", "field[channel;Channel;${channel}]") + end, + on_receive_fields = function(pos, formname, fields, sender) + local name = sender:get_player_name() + if minetest.is_protected(pos, name) and not minetest.check_player_privs(name, {protection_bypass=true}) then + minetest.record_protection_violation(pos, name) + return + end + if (fields.channel) then + minetest.get_meta(pos):set_string("channel", fields.channel) + end + end, +}) diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..0b01ac5 --- /dev/null +++ b/mod.conf @@ -0,0 +1 @@ +name = digilines diff --git a/modpack.txt b/modpack.txt deleted file mode 100644 index e69de29..0000000 diff --git a/presetrules.lua b/presetrules.lua new file mode 100644 index 0000000..8d5e35b --- /dev/null +++ b/presetrules.lua @@ -0,0 +1,15 @@ +digiline.rules = {} + +digiline.rules.default = +{{x=0, y=0, z=-1}, +{x=1, y=0, z=0}, +{x=-1, y=0, z=0}, +{x=0, y=0, z=1}, +{x=1, y=1, z=0}, +{x=1, y=-1, z=0}, +{x=-1, y=1, z=0}, +{x=-1, y=-1, z=0}, +{x=0, y=1, z=1}, +{x=0, y=-1, z=1}, +{x=0, y=1, z=-1}, +{x=0, y=-1, z=-1}} diff --git a/rtc.lua b/rtc.lua new file mode 100644 index 0000000..f8f6af4 --- /dev/null +++ b/rtc.lua @@ -0,0 +1,59 @@ +local GET_COMMAND = "GET" + +local rtc_nodebox = +{ + type = "fixed", + fixed = { + { -8/16, -8/16, -8/16, 8/16, -7/16, 8/16 }, -- bottom slab + + { -7/16, -7/16, -7/16, 7/16, -5/16, 7/16 }, + } +} + +local rtc_selbox = +{ + type = "fixed", + fixed = {{ -8/16, -8/16, -8/16, 8/16, -3/16, 8/16 }} +} + +local on_digiline_receive = function (pos, node, channel, msg) + local setchan = minetest.get_meta(pos):get_string("channel") + if channel == setchan and msg == GET_COMMAND then + local timeofday = minetest.get_timeofday() + digiline:receptor_send(pos, digiline.rules.default, channel, timeofday) + end +end + +minetest.register_alias("digilines_rtc:rtc", "digilines:rtc") +minetest.register_node("digilines:rtc", { + description = "Digiline Real Time Clock (RTC)", + drawtype = "nodebox", + tiles = {"digilines_rtc.png"}, + + paramtype = "light", + paramtype2 = "facedir", + groups = {dig_immediate=2}, + selection_box = rtc_selbox, + node_box = rtc_nodebox, + digiline = + { + receptor = {}, + effector = { + action = on_digiline_receive + }, + }, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", "field[channel;Channel;${channel}]") + end, + on_receive_fields = function(pos, formname, fields, sender) + local name = sender:get_player_name() + if minetest.is_protected(pos, name) and not minetest.check_player_privs(name, {protection_bypass=true}) then + minetest.record_protection_violation(pos, name) + return + end + if (fields.channel) then + minetest.get_meta(pos):set_string("channel", fields.channel) + end + end, +}) diff --git a/textures/_0.png b/textures/_0.png new file mode 100644 index 0000000..b030879 Binary files /dev/null and b/textures/_0.png differ diff --git a/textures/_1.png b/textures/_1.png new file mode 100644 index 0000000..ae28369 Binary files /dev/null and b/textures/_1.png differ diff --git a/textures/_2.png b/textures/_2.png new file mode 100644 index 0000000..7375c68 Binary files /dev/null and b/textures/_2.png differ diff --git a/textures/_3.png b/textures/_3.png new file mode 100644 index 0000000..d724811 Binary files /dev/null and b/textures/_3.png differ diff --git a/textures/_4.png b/textures/_4.png new file mode 100644 index 0000000..0fff433 Binary files /dev/null and b/textures/_4.png differ diff --git a/textures/_5.png b/textures/_5.png new file mode 100644 index 0000000..43010df Binary files /dev/null and b/textures/_5.png differ diff --git a/textures/_6.png b/textures/_6.png new file mode 100644 index 0000000..1eba38c Binary files /dev/null and b/textures/_6.png differ diff --git a/textures/_7.png b/textures/_7.png new file mode 100644 index 0000000..dbcd2d1 Binary files /dev/null and b/textures/_7.png differ diff --git a/textures/_8.png b/textures/_8.png new file mode 100644 index 0000000..edf6ef5 Binary files /dev/null and b/textures/_8.png differ diff --git a/textures/_9.png b/textures/_9.png new file mode 100644 index 0000000..c276c11 Binary files /dev/null and b/textures/_9.png differ diff --git a/textures/_a.png b/textures/_a.png new file mode 100644 index 0000000..8f3f59c Binary files /dev/null and b/textures/_a.png differ diff --git a/textures/_a_.png b/textures/_a_.png new file mode 100644 index 0000000..4da193c Binary files /dev/null and b/textures/_a_.png differ diff --git a/textures/_am.png b/textures/_am.png new file mode 100644 index 0000000..75d0287 Binary files /dev/null and b/textures/_am.png differ diff --git a/textures/_ap.png b/textures/_ap.png new file mode 100644 index 0000000..5dd3325 Binary files /dev/null and b/textures/_ap.png differ diff --git a/textures/_as.png b/textures/_as.png new file mode 100644 index 0000000..3c7a25a Binary files /dev/null and b/textures/_as.png differ diff --git a/textures/_at.png b/textures/_at.png new file mode 100644 index 0000000..4f9841c Binary files /dev/null and b/textures/_at.png differ diff --git a/textures/_b.png b/textures/_b.png new file mode 100644 index 0000000..baf4eaa Binary files /dev/null and b/textures/_b.png differ diff --git a/textures/_b_.png b/textures/_b_.png new file mode 100644 index 0000000..b00a378 Binary files /dev/null and b/textures/_b_.png differ diff --git a/textures/_bl.png b/textures/_bl.png new file mode 100644 index 0000000..546ca4e Binary files /dev/null and b/textures/_bl.png differ diff --git a/textures/_br.png b/textures/_br.png new file mode 100644 index 0000000..5700fa6 Binary files /dev/null and b/textures/_br.png differ diff --git a/textures/_c.png b/textures/_c.png new file mode 100644 index 0000000..eedd639 Binary files /dev/null and b/textures/_c.png differ diff --git a/textures/_c_.png b/textures/_c_.png new file mode 100644 index 0000000..cab6518 Binary files /dev/null and b/textures/_c_.png differ diff --git a/textures/_ca.png b/textures/_ca.png new file mode 100644 index 0000000..d359c88 Binary files /dev/null and b/textures/_ca.png differ diff --git a/textures/_cl.png b/textures/_cl.png new file mode 100644 index 0000000..55396b9 Binary files /dev/null and b/textures/_cl.png differ diff --git a/textures/_cm.png b/textures/_cm.png new file mode 100644 index 0000000..28beedf Binary files /dev/null and b/textures/_cm.png differ diff --git a/textures/_co.png b/textures/_co.png new file mode 100644 index 0000000..b161819 Binary files /dev/null and b/textures/_co.png differ diff --git a/textures/_cr.png b/textures/_cr.png new file mode 100644 index 0000000..ac466a9 Binary files /dev/null and b/textures/_cr.png differ diff --git a/textures/_d.png b/textures/_d.png new file mode 100644 index 0000000..a5f0699 Binary files /dev/null and b/textures/_d.png differ diff --git a/textures/_d_.png b/textures/_d_.png new file mode 100644 index 0000000..9a0e3ed Binary files /dev/null and b/textures/_d_.png differ diff --git a/textures/_dl.png b/textures/_dl.png new file mode 100644 index 0000000..72184ad Binary files /dev/null and b/textures/_dl.png differ diff --git a/textures/_dt.png b/textures/_dt.png new file mode 100644 index 0000000..61c1e4a Binary files /dev/null and b/textures/_dt.png differ diff --git a/textures/_dv.png b/textures/_dv.png new file mode 100644 index 0000000..996d7cd Binary files /dev/null and b/textures/_dv.png differ diff --git a/textures/_e.png b/textures/_e.png new file mode 100644 index 0000000..29e32e6 Binary files /dev/null and b/textures/_e.png differ diff --git a/textures/_e_.png b/textures/_e_.png new file mode 100644 index 0000000..c7f19c1 Binary files /dev/null and b/textures/_e_.png differ diff --git a/textures/_eq.png b/textures/_eq.png new file mode 100644 index 0000000..daf8424 Binary files /dev/null and b/textures/_eq.png differ diff --git a/textures/_ex.png b/textures/_ex.png new file mode 100644 index 0000000..b5da8e9 Binary files /dev/null and b/textures/_ex.png differ diff --git a/textures/_f.png b/textures/_f.png new file mode 100644 index 0000000..6835912 Binary files /dev/null and b/textures/_f.png differ diff --git a/textures/_f_.png b/textures/_f_.png new file mode 100644 index 0000000..3698ed2 Binary files /dev/null and b/textures/_f_.png differ diff --git a/textures/_g.png b/textures/_g.png new file mode 100644 index 0000000..5a85cde Binary files /dev/null and b/textures/_g.png differ diff --git a/textures/_g_.png b/textures/_g_.png new file mode 100644 index 0000000..cc7bbc5 Binary files /dev/null and b/textures/_g_.png differ diff --git a/textures/_gt.png b/textures/_gt.png new file mode 100644 index 0000000..f30855a Binary files /dev/null and b/textures/_gt.png differ diff --git a/textures/_h.png b/textures/_h.png new file mode 100644 index 0000000..1a66a9e Binary files /dev/null and b/textures/_h.png differ diff --git a/textures/_h_.png b/textures/_h_.png new file mode 100644 index 0000000..87beafc Binary files /dev/null and b/textures/_h_.png differ diff --git a/textures/_ha.png b/textures/_ha.png new file mode 100644 index 0000000..4618ced Binary files /dev/null and b/textures/_ha.png differ diff --git a/textures/_hs.png b/textures/_hs.png new file mode 100644 index 0000000..6f12bec Binary files /dev/null and b/textures/_hs.png differ diff --git a/textures/_i.png b/textures/_i.png new file mode 100644 index 0000000..f001142 Binary files /dev/null and b/textures/_i.png differ diff --git a/textures/_i_.png b/textures/_i_.png new file mode 100644 index 0000000..fc658b8 Binary files /dev/null and b/textures/_i_.png differ diff --git a/textures/_j.png b/textures/_j.png new file mode 100644 index 0000000..87d2f26 Binary files /dev/null and b/textures/_j.png differ diff --git a/textures/_j_.png b/textures/_j_.png new file mode 100644 index 0000000..c0d9ac2 Binary files /dev/null and b/textures/_j_.png differ diff --git a/textures/_k.png b/textures/_k.png new file mode 100644 index 0000000..34f9336 Binary files /dev/null and b/textures/_k.png differ diff --git a/textures/_k_.png b/textures/_k_.png new file mode 100644 index 0000000..86b623d Binary files /dev/null and b/textures/_k_.png differ diff --git a/textures/_l.png b/textures/_l.png new file mode 100644 index 0000000..defe7ec Binary files /dev/null and b/textures/_l.png differ diff --git a/textures/_l_.png b/textures/_l_.png new file mode 100644 index 0000000..3fe1de2 Binary files /dev/null and b/textures/_l_.png differ diff --git a/textures/_lt.png b/textures/_lt.png new file mode 100644 index 0000000..ec7219d Binary files /dev/null and b/textures/_lt.png differ diff --git a/textures/_m.png b/textures/_m.png new file mode 100644 index 0000000..e0fe039 Binary files /dev/null and b/textures/_m.png differ diff --git a/textures/_m_.png b/textures/_m_.png new file mode 100644 index 0000000..9164da6 Binary files /dev/null and b/textures/_m_.png differ diff --git a/textures/_mn.png b/textures/_mn.png new file mode 100644 index 0000000..935a2fe Binary files /dev/null and b/textures/_mn.png differ diff --git a/textures/_n.png b/textures/_n.png new file mode 100644 index 0000000..ac10fd9 Binary files /dev/null and b/textures/_n.png differ diff --git a/textures/_n_.png b/textures/_n_.png new file mode 100644 index 0000000..d4355c1 Binary files /dev/null and b/textures/_n_.png differ diff --git a/textures/_o.png b/textures/_o.png new file mode 100644 index 0000000..080e99d Binary files /dev/null and b/textures/_o.png differ diff --git a/textures/_o_.png b/textures/_o_.png new file mode 100644 index 0000000..2d19051 Binary files /dev/null and b/textures/_o_.png differ diff --git a/textures/_p.png b/textures/_p.png new file mode 100644 index 0000000..3050959 Binary files /dev/null and b/textures/_p.png differ diff --git a/textures/_p_.png b/textures/_p_.png new file mode 100644 index 0000000..0cca011 Binary files /dev/null and b/textures/_p_.png differ diff --git a/textures/_pr.png b/textures/_pr.png new file mode 100644 index 0000000..b835141 Binary files /dev/null and b/textures/_pr.png differ diff --git a/textures/_ps.png b/textures/_ps.png new file mode 100644 index 0000000..1f4b5c1 Binary files /dev/null and b/textures/_ps.png differ diff --git a/textures/_q.png b/textures/_q.png new file mode 100644 index 0000000..945b6cf Binary files /dev/null and b/textures/_q.png differ diff --git a/textures/_q_.png b/textures/_q_.png new file mode 100644 index 0000000..f3bf455 Binary files /dev/null and b/textures/_q_.png differ diff --git a/textures/_qo.png b/textures/_qo.png new file mode 100644 index 0000000..5d261e3 Binary files /dev/null and b/textures/_qo.png differ diff --git a/textures/_qu.png b/textures/_qu.png new file mode 100644 index 0000000..5eb597a Binary files /dev/null and b/textures/_qu.png differ diff --git a/textures/_r.png b/textures/_r.png new file mode 100644 index 0000000..39e9fce Binary files /dev/null and b/textures/_r.png differ diff --git a/textures/_r_.png b/textures/_r_.png new file mode 100644 index 0000000..6c71c1e Binary files /dev/null and b/textures/_r_.png differ diff --git a/textures/_re.png b/textures/_re.png new file mode 100644 index 0000000..1614837 Binary files /dev/null and b/textures/_re.png differ diff --git a/textures/_s.png b/textures/_s.png new file mode 100644 index 0000000..a0ada1a Binary files /dev/null and b/textures/_s.png differ diff --git a/textures/_s_.png b/textures/_s_.png new file mode 100644 index 0000000..9b018bb Binary files /dev/null and b/textures/_s_.png differ diff --git a/textures/_sl.png b/textures/_sl.png new file mode 100644 index 0000000..08c9547 Binary files /dev/null and b/textures/_sl.png differ diff --git a/textures/_sm.png b/textures/_sm.png new file mode 100644 index 0000000..385c64f Binary files /dev/null and b/textures/_sm.png differ diff --git a/textures/_sp.png b/textures/_sp.png new file mode 100644 index 0000000..4f38a35 Binary files /dev/null and b/textures/_sp.png differ diff --git a/textures/_sr.png b/textures/_sr.png new file mode 100644 index 0000000..bc9c0a2 Binary files /dev/null and b/textures/_sr.png differ diff --git a/textures/_t.png b/textures/_t.png new file mode 100644 index 0000000..c55731a Binary files /dev/null and b/textures/_t.png differ diff --git a/textures/_t_.png b/textures/_t_.png new file mode 100644 index 0000000..773e666 Binary files /dev/null and b/textures/_t_.png differ diff --git a/textures/_tl.png b/textures/_tl.png new file mode 100644 index 0000000..059fe68 Binary files /dev/null and b/textures/_tl.png differ diff --git a/textures/_u.png b/textures/_u.png new file mode 100644 index 0000000..98bf8e6 Binary files /dev/null and b/textures/_u.png differ diff --git a/textures/_u_.png b/textures/_u_.png new file mode 100644 index 0000000..35ce915 Binary files /dev/null and b/textures/_u_.png differ diff --git a/textures/_un.png b/textures/_un.png new file mode 100644 index 0000000..01f547a Binary files /dev/null and b/textures/_un.png differ diff --git a/textures/_v.png b/textures/_v.png new file mode 100644 index 0000000..b692d11 Binary files /dev/null and b/textures/_v.png differ diff --git a/textures/_v_.png b/textures/_v_.png new file mode 100644 index 0000000..8049771 Binary files /dev/null and b/textures/_v_.png differ diff --git a/textures/_vb.png b/textures/_vb.png new file mode 100644 index 0000000..7fed7dc Binary files /dev/null and b/textures/_vb.png differ diff --git a/textures/_w.png b/textures/_w.png new file mode 100644 index 0000000..6a58b07 Binary files /dev/null and b/textures/_w.png differ diff --git a/textures/_w_.png b/textures/_w_.png new file mode 100644 index 0000000..64904de Binary files /dev/null and b/textures/_w_.png differ diff --git a/textures/_x.png b/textures/_x.png new file mode 100644 index 0000000..b769e13 Binary files /dev/null and b/textures/_x.png differ diff --git a/textures/_x_.png b/textures/_x_.png new file mode 100644 index 0000000..2f6d067 Binary files /dev/null and b/textures/_x_.png differ diff --git a/textures/_y.png b/textures/_y.png new file mode 100644 index 0000000..777b55e Binary files /dev/null and b/textures/_y.png differ diff --git a/textures/_y_.png b/textures/_y_.png new file mode 100644 index 0000000..0c40de9 Binary files /dev/null and b/textures/_y_.png differ diff --git a/textures/_z.png b/textures/_z.png new file mode 100644 index 0000000..ae010fe Binary files /dev/null and b/textures/_z.png differ diff --git a/textures/_z_.png b/textures/_z_.png new file mode 100644 index 0000000..1c3e053 Binary files /dev/null and b/textures/_z_.png differ diff --git a/textures/digiline_std.png b/textures/digiline_std.png new file mode 100644 index 0000000..721797c Binary files /dev/null and b/textures/digiline_std.png differ diff --git a/textures/digiline_std_bump.png b/textures/digiline_std_bump.png new file mode 100644 index 0000000..068a4a9 Binary files /dev/null and b/textures/digiline_std_bump.png differ diff --git a/textures/digiline_std_inv.png b/textures/digiline_std_inv.png new file mode 100644 index 0000000..f66f6c7 Binary files /dev/null and b/textures/digiline_std_inv.png differ diff --git a/textures/digiline_std_vertical.png b/textures/digiline_std_vertical.png new file mode 100644 index 0000000..1de0ead Binary files /dev/null and b/textures/digiline_std_vertical.png differ diff --git a/textures/digilines_lightsensor.png b/textures/digilines_lightsensor.png new file mode 100644 index 0000000..aa88495 Binary files /dev/null and b/textures/digilines_lightsensor.png differ diff --git a/textures/digilines_rtc.png b/textures/digilines_rtc.png new file mode 100644 index 0000000..a7b1d84 Binary files /dev/null and b/textures/digilines_rtc.png differ diff --git a/textures/lcd_anyside.png b/textures/lcd_anyside.png new file mode 100644 index 0000000..fe88e8d Binary files /dev/null and b/textures/lcd_anyside.png differ diff --git a/textures/lcd_lcd.png b/textures/lcd_lcd.png new file mode 100644 index 0000000..c959fa1 Binary files /dev/null and b/textures/lcd_lcd.png differ diff --git a/util.lua b/util.lua new file mode 100644 index 0000000..d138d63 --- /dev/null +++ b/util.lua @@ -0,0 +1,67 @@ +function digiline:addPosRule(p, r) + return {x = p.x + r.x, y = p.y + r.y, z = p.z + r.z} +end + +function digiline:cmpPos(p1, p2) + return (p1.x == p2.x and p1.y == p2.y and p1.z == p2.z) +end + +--Rules rotation Functions: +function digiline:rotate_rules_right(rules) + local nr={} + for i, rule in ipairs(rules) do + nr[i]={} + nr[i].z=rule.x + nr[i].x=-rule.z + nr[i].y=rule.y + end + return nr +end + +function digiline:rotate_rules_left(rules) + local nr={} + for i, rule in ipairs(rules) do + nr[i]={} + nr[i].z=-rules[i].x + nr[i].x=rules[i].z + nr[i].y=rules[i].y + end + return nr +end + +function digiline:rotate_rules_down(rules) + local nr={} + for i, rule in ipairs(rules) do + nr[i]={} + nr[i].y=rule.x + nr[i].x=-rule.y + nr[i].z=rule.z + end + return nr +end + +function digiline:rotate_rules_up(rules) + local nr={} + for i, rule in ipairs(rules) do + nr[i]={} + nr[i].y=-rule.x + nr[i].x=rule.y + nr[i].z=rule.z + end + return nr +end + +function digiline:tablecopy(table) -- deep table copy + if type(table) ~= "table" then return table end -- no need to copy + local newtable = {} + + for idx, item in pairs(table) do + if type(item) == "table" then + newtable[idx] = digiline:tablecopy(item) + else + newtable[idx] = item + end + end + + return newtable +end diff --git a/wire_std.lua b/wire_std.lua new file mode 100644 index 0000000..71bbd0f --- /dev/null +++ b/wire_std.lua @@ -0,0 +1,118 @@ +-- naming scheme: wire:(xp)(zp)(xm)(zm)_on/off +-- The conditions in brackets define whether there is a digiline at that place or not +-- 1 = there is one; 0 = there is none +-- y always means y+ + +box_center = {-1/16, -.5, -1/16, 1/16, -.5+1/16, 1/16} +box_bump1 = { -2/16, -8/16, -2/16, 2/16, -13/32, 2/16 } +box_bump2 = { -3/32, -13/32, -3/32, 3/32, -12/32, 3/32 } + +box_xp = {1/16, -.5, -1/16, 8/16, -.5+1/16, 1/16} +box_zp = {-1/16, -.5, 1/16, 1/16, -.5+1/16, 8/16} +box_xm = {-8/16, -.5, -1/16, -1/16, -.5+1/16, 1/16} +box_zm = {-1/16, -.5, -8/16, 1/16, -.5+1/16, -1/16} + +box_xpy = {.5-1/16, -.5+1/16, -1/16, .5, .4999+1/16, 1/16} +box_zpy = {-1/16, -.5+1/16, .5-1/16, 1/16, .4999+1/16, .5} +box_xmy = {-.5, -.5+1/16, -1/16, -.5+1/16, .4999+1/16, 1/16} +box_zmy = {-1/16, -.5+1/16, -.5, 1/16, .4999+1/16, -.5+1/16} + +for xp=0, 1 do +for zp=0, 1 do +for xm=0, 1 do +for zm=0, 1 do +for xpy=0, 1 do +for zpy=0, 1 do +for xmy=0, 1 do +for zmy=0, 1 do + if (xpy == 1 and xp == 0) or (zpy == 1 and zp == 0) + or (xmy == 1 and xm == 0) or (zmy == 1 and zm == 0) then break end + + local groups + local nodeid = tostring(xp )..tostring(zp )..tostring(xm )..tostring(zm ).. + tostring(xpy)..tostring(zpy)..tostring(xmy)..tostring(zmy) + + if nodeid == "00000000" then + groups = {dig_immediate = 3} + wiredesc = "Digiline" + else + groups = {dig_immediate = 3, not_in_creative_inventory = 1} + end + + local nodebox = {} + local adjx = false + local adjz = false + if xp == 1 then table.insert(nodebox, box_xp) adjx = true end + if zp == 1 then table.insert(nodebox, box_zp) adjz = true end + if xm == 1 then table.insert(nodebox, box_xm) adjx = true end + if zm == 1 then table.insert(nodebox, box_zm) adjz = true end + if xpy == 1 then table.insert(nodebox, box_xpy) end + if zpy == 1 then table.insert(nodebox, box_zpy) end + if xmy == 1 then table.insert(nodebox, box_xmy) end + if zmy == 1 then table.insert(nodebox, box_zmy) end + + if adjx and adjz and (xp + zp + xm + zm > 2) then + table.insert(nodebox, box_bump1) + table.insert(nodebox, box_bump2) + tiles = { + "digiline_std_bump.png", + "digiline_std_bump.png", + "digiline_std_vertical.png", + "digiline_std_vertical.png", + "digiline_std_vertical.png", + "digiline_std_vertical.png" + } + else + table.insert(nodebox, box_center) + tiles = { + "digiline_std.png", + "digiline_std.png", + "digiline_std_vertical.png", + "digiline_std_vertical.png", + "digiline_std_vertical.png", + "digiline_std_vertical.png" + } + end + + if nodeid == "00000000" then + nodebox = {-8/16, -.5, -1/16, 8/16, -.5+1/16, 1/16} + end + + minetest.register_node("digilines:wire_std_"..nodeid, { + description = wiredesc, + drawtype = "nodebox", + tiles = tiles, + inventory_image = "digiline_std_inv.png", + wield_image = "digiline_std_inv.png", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + digiline = + { + wire = + { + basename = "digilines:wire_std_", + use_autoconnect = true + } + }, + selection_box = { + type = "fixed", + fixed = {-.5, -.5, -.5, .5, -.5+1/16, .5} + }, + node_box = { + type = "fixed", + fixed = nodebox + }, + groups = groups, + walkable = false, + stack_max = 99, + drop = "digilines:wire_std_00000000" + }) +end +end +end +end +end +end +end +end diff --git a/wires_common.lua b/wires_common.lua new file mode 100644 index 0000000..c5f761b --- /dev/null +++ b/wires_common.lua @@ -0,0 +1,88 @@ +minetest.register_on_placenode(function(pos, node) + if minetest.registered_nodes[node.name].digiline then + digiline:update_autoconnect(pos) + end +end) + +minetest.register_on_dignode(function(pos, node) + if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].digiline then +-- need to make sure that node exists (unknown nodes!) + digiline:update_autoconnect(pos) + end +end) + +function digiline:update_autoconnect(pos, secondcall) + local xppos = {x=pos.x+1, y=pos.y, z=pos.z} + local zppos = {x=pos.x, y=pos.y, z=pos.z+1} + local xmpos = {x=pos.x-1, y=pos.y, z=pos.z} + local zmpos = {x=pos.x, y=pos.y, z=pos.z-1} + local xpympos = {x=pos.x+1, y=pos.y-1, z=pos.z} + local zpympos = {x=pos.x, y=pos.y-1, z=pos.z+1} + local xmympos = {x=pos.x-1, y=pos.y-1, z=pos.z} + local zmympos = {x=pos.x, y=pos.y-1, z=pos.z-1} + local xpypos = {x=pos.x+1, y=pos.y+1, z=pos.z} + local zpypos = {x=pos.x, y=pos.y+1, z=pos.z+1} + local xmypos = {x=pos.x-1, y=pos.y+1, z=pos.z} + local zmypos = {x=pos.x, y=pos.y+1, z=pos.z-1} + + if secondcall == nil then + digiline:update_autoconnect(xppos, true) + digiline:update_autoconnect(zppos, true) + digiline:update_autoconnect(xmpos, true) + digiline:update_autoconnect(zmpos, true) + + digiline:update_autoconnect(xpypos, true) + digiline:update_autoconnect(zpypos, true) + digiline:update_autoconnect(xmypos, true) + digiline:update_autoconnect(zmypos, true) + + digiline:update_autoconnect(xpympos, true) + digiline:update_autoconnect(zpympos, true) + digiline:update_autoconnect(xmympos, true) + digiline:update_autoconnect(zmympos, true) + end + + local def = minetest.registered_nodes[minetest.get_node(pos).name] + local digilinespec = def and def.digiline + if not (digilinespec and digilinespec.wire and + digilinespec.wire.use_autoconnect) then + return nil + end + + local zmg = digiline:rules_link_anydir(pos, zmpos) + local zmymg = digiline:rules_link_anydir(pos, zmympos) + local xmg = digiline:rules_link_anydir(pos, xmpos) + local xmymg = digiline:rules_link_anydir(pos, xmympos) + local zpg = digiline:rules_link_anydir(pos, zppos) + local zpymg = digiline:rules_link_anydir(pos, zpympos) + local xpg = digiline:rules_link_anydir(pos, xppos) + local xpymg = digiline:rules_link_anydir(pos, xpympos) + + + local xpyg = digiline:rules_link_anydir(pos, xpypos) + local zpyg = digiline:rules_link_anydir(pos, zpypos) + local xmyg = digiline:rules_link_anydir(pos, xmypos) + local zmyg = digiline:rules_link_anydir(pos, zmypos) + + local zm, xm, zp, xp, xpy, zpy, xmy, zmy + if zmg or zmymg then zm = 1 else zm = 0 end + if xmg or xmymg then xm = 1 else xm = 0 end + if zpg or zpymg then zp = 1 else zp = 0 end + if xpg or xpymg then xp = 1 else xp = 0 end + + if xpyg then xpy = 1 else xpy = 0 end + if zpyg then zpy = 1 else zpy = 0 end + if xmyg then xmy = 1 else xmy = 0 end + if zmyg then zmy = 1 else zmy = 0 end + + if xpy == 1 then xp = 1 end + if zpy == 1 then zp = 1 end + if xmy == 1 then xm = 1 end + if zmy == 1 then zm = 1 end + + local nodeid = tostring(xp )..tostring(zp )..tostring(xm )..tostring(zm ).. + tostring(xpy)..tostring(zpy)..tostring(xmy)..tostring(zmy) + + + minetest.set_node(pos, {name = digilinespec.wire.basename..nodeid}) +end -- cgit v1.2.3