Finally, I found a solution.
It was quite... complicated to find out.
You only need to outfit the four items Shuriken, Darts, Rocks and Arrows with a CollisionMask. And you have to manually disable the cmtimer-checkmark when you have placed the item in your dungeon so that the timer does not count right from the beginning.
I placed a lot of the four items im my dungeon and threw them around and measured with Fraps if it will kill performance. There is no measured Framedrop so I think the combined solution of minmay and me is good.
Here is the solution.
For example: the Shuriken. (Do the same to Rocks, Darts and Arrows)
Put this script in your weapons.lua:
defineObject{
name = "dm_shuriken",
baseObject = "base_item",
components = {
{
class = "Model",
model = "assets/models/items/shuriken.fbx",
},
{
class = "Item",
uiName = "Shuriken",
gfxIndex = 12,
gfxIndexPowerAttack = 447,
impactSound = "impact_blade",
stackable = true,
sharpProjectile = true,
projectileRotationSpeed = 12,
projectileRotationX = 90,
projectileRotationY = -90,
weight = 0.1,
traits = { "throwing_weapon" },
secondaryAction = "volley",
},
{
class = "Timer",
name = "cmtimer",
timerInterval = 0,
DisableSelf = true,
TriggerOnStart = false,
CurrentLevelOnly = true,
CurrentLevelOnly = true,
onActivate = function(self)
if self.go.projectile then self.go.projectile:setCollisionMask(4) end
end,
},
{
class = "ThrowAttack",
attackPower = 13,
cooldown = 3.5,
},
{
class = "ThrowAttack",
uiName = "Volley of Stars",
name = "volley",
attackPower = 14,
cooldown = 3.5,
energyCost = 30,
repeatCount = 3,
spread = 0.4,
requirements = { "throwing", 3 },
gameEffect = "Quickly throw three shurikens at once."
},
},
tags = { "weapon", "weapon_throwing" },
}
Now,
every door will ignore the four items with the collisionMask 4. BUT, we want this ONLY on portculli-doors to happen, so for all other massive doors we need an additionally doorCollider.
Therefore you need a ProjectileCollider with the same collisionGroup 4.
Put this in your trigger.lua or door.lua or whatever lua-file you prefere for this:
defineObject{
name = "dm_throw_collider",
components = {
{
class = "ProjectileCollider",
collisionGroup = 4,
size = vec(2.5, 3, 0.5),
offset = vec(0, 1.5, 0.7),
debugDraw = true,
},
{
class = "Controller",
onActivate = function(self)
self.go.projectilecollider:enable()
end,
onDeactivate = function(self)
self.go.projectilecollider:disable()
end,
onToggle = function(self)
if self.go.projectilecollider:isEnabled() then
self.go.projectilecollider:disable()
else
self.go.projectilecollider:enable()
end
end,
},
},
placement = "wall",
editorIcon = 72,
}
Than place the new ProjectileCollider-object on the doors in the editor you don't want to let pass the four thrown items (perhaps you have to play around a little with the size- and offset-vectors of the "dm-throw-collider").
And now, one important thing:
You can only deactivate the "dm_throw_collider" by a button or lever or a script. And you must deactivate the collider or all four items are still blocked when the door is open! I have no "PullChain"-object on my doors, instead I have a separate custom door button sitting on my doorframe to open and close the door. You have to connect the custom button with the door and the "dm_throw_collider". When you press the door-button, it toggles the door open and toggles (deactivates) the "dm-throw-collider". When you press again, the door closes and activates the "dm-throw-collider" again.
That's it!
Perhaps, there is a more confortable way to reach this goal, but I have not found out yet.
If anybody has a better solution, your ideas are very welcome!
But for me, my goal is satisfactorily reached.