Hi all, I was curious on how I would go about adding light to a weapon, I need the same sort of light level as a flashlight but the beam needs to be 180 degrees (its for my holdable torch mod) Looking forward to some advice Thanks guys!
Not possible at the moment. Note last line of this news post. http://playstarbound.com/9th-june-leap-attack/
Thanks @lazarus78 I wanted to improve the position of the torch so I figured that if i made it a weapon, it'd have a more natural movement, guess I'll wait till the next major update...
The only way possible is to add it through lua. With that said - the basic concept is below to see how guns are modified through animators. Code: function init() self.fireOffset = item.instanceValue("fireOffset") updateAim() self.active = false storage.fireTimer = storage.fireTimer or 0 self.recoilTimer = 0 end function update(dt, fireMode, shiftHeld) updateAim() if fireMode == "none" then stopFiring() end storage.fireTimer = math.max(storage.fireTimer - dt, 0) self.recoilTimer = math.max(self.recoilTimer - dt, 0) if self.active and storage.fireTimer <= 0 then if not world.pointTileCollision(firePosition()) then storage.fireTimer = item.instanceValue("fireTime", 1.0) fire() end end activeItem.setRecoil(self.recoilTimer > 0) end function activate(fireMode, shiftHeld) if not self.active then startFiring() end end function startFiring() self.active = true end function stopFiring() self.active = false end function fire() world.spawnProjectile( item.instanceValue("projectileType"), firePosition(), activeItem.ownerEntityId(), aimVector(), false, item.instanceValue("projectileParameters", {}) ) animator.burstParticleEmitter("fireParticles") animator.playSound("fire") animator.setAnimationState("reload", "reload", true) self.recoilTimer = 0.12 end function updateAim() self.aimAngle, self.aimDirection = table.unpack(activeItem.aimAngleAndDirection(self.fireOffset[2], activeItem.ownerAimPosition())) activeItem.setArmAngle(self.aimAngle) activeItem.setFacingDirection(self.aimDirection) end function firePosition() return vec2.add(mcontroller.position(), activeItem.handPosition(self.fireOffset)) end function aimVector() local aimVector = vec2.rotate({1, 0}, self.aimAngle + sb.nrand(item.instanceValue("inaccuracy", 0), 0)) aimVector[1] = aimVector[1] * self.aimDirection return aimVector end