Skip to content

Commit 8e3f222

Browse files
committed
Added ID property controls for basic Detonator objects
detonMultiplier - If this property is found in a Detonator object (the trigger object), then its value will override the global Multiplier setting from the BCB menu. detonMaximum - If this property is found in a Detonator object (the trigger object), then its value will override the global Maximum setting from the BCB menu.
1 parent 2552f7a commit 8e3f222

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

kk_bullet_constraints_builder.zip

93 Bytes
Binary file not shown.

kk_bullet_constraints_builder/builder_setc.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,15 @@ def setConstraintSettings(objs, objsEGrp, emptyObjs, objsID, connectsPair, conne
241241
for detonatorObj in detonatorObjs:
242242
if detonatorObj.scale[0] > 0 and detonatorObj.scale[1] > 0 and detonatorObj.scale[2] > 0:
243243
if objA not in objsDetonSkip or objB not in objsDetonSkip:
244+
### Vars
245+
detonatorMul = props.detonatorMul # Multiplier
246+
detonatorMax = props.detonatorMax # Maximum
247+
# User definitions as possible property of the detonator object
248+
if "detonMultiplier" in detonatorObj.keys():
249+
detonatorMul = detonatorObj["detonMultiplier"]
250+
if "detonMaximum" in detonatorObj.keys():
251+
detonatorMax = detonatorObj["detonMaximum"]
252+
# Calculate distance to connection
244253
distVec = Vector(loc) -detonatorObj.location
245254
if detonatorObj.type == 'EMPTY' and detonatorObj.empty_draw_type == 'CUBE':
246255
# When empty is in Cube mode then use a cubic shape
@@ -253,7 +262,7 @@ def setConstraintSettings(objs, objsEGrp, emptyObjs, objsID, connectsPair, conne
253262
dist += (abs(distVec[1]) /abs(detonatorObj.scale[1]))**2
254263
dist += (abs(distVec[2]) /abs(detonatorObj.scale[2]))**2
255264
dist = dist**.5
256-
damageMul *= min(1, max(1 -props.detonatorMax, (dist -1) *2 *props.detonatorMul +1))
265+
damageMul *= min(1, max(1 -detonatorMax, (dist -1) *2 *detonatorMul +1))
257266
else: damageMul = 1
258267
if damageMul < 1:
259268
btMultiplier *= damageMul

0 commit comments

Comments
 (0)