Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function swol_torchImage::onMount(%db,%pl,%slot)
- {
- if(%im = %pl.getMountedImage(0))
- {
- if(%im.armReady)
- {
- %pl.playThread(1,armReadyBoth);
- }
- else
- {
- %pl.playThread(1,armReadyLeft);
- }
- }
- else
- {
- %pl.playThread(1,armReadyLeft);
- }
- %pl.lastTorchTime = getSimTime();
- }
- function swol_torchImage::onIgnite(%db,%pl,%slot)
- {
- serverPlay3D(swol_torchIgniteSound,%pl.getPosition());
- %pl.playThread(3,plant);
- %pl.startTorchSched = %db.schedule(150,mountLight,%pl,%slot);
- }
- function swol_torchImage::mountLight(%db,%pl,%slot)
- {
- %pl.light = new fxLight()
- {
- datablock = swol_torchLight;
- };
- missionCleanup.add(%pl.light);
- %pl.light.setTransform(%pl.getPosition());
- %pl.light.attachToObject(%pl);
- %pl.light.player = %pl;
- %pl.playAudio(2,swol_torchLoopSound);
- }
- function swol_torchImage::putOutTorch(%db,%pl,%slot)
- {
- if(isObject(%pl.light))
- {
- %pl.light.delete();
- %pl.playAudio(2,swol_torchEndSound);
- %pl.schedule(1,mountImage,swol_torchImageEnd,1);
- %db.schedule(1800,unMountEnd,%pl,%slot);
- %pl.playThread(3,plant);
- }
- else
- {
- cancel(%pl.startTorchSched);
- }
- }
- function swol_torchImage::unMountEnd(%db,%pl,%slot)
- {
- if(%im = %pl.getMountedImage(1))
- {
- if(%im == nameToId(swol_torchImageEnd))
- {
- %pl.unMountImage(1);
- %pl.playThread(1,root);
- if(%im = %pl.getMountedImage(0))
- {
- if(%im.armReady)
- {
- %pl.playThread(1,armReadyRight);
- }
- }
- }
- }
- }
- function swol_torchImage::unMountCheck(%db,%pl,%slot)
- {
- if(!isObject(%pl.getMountedImage(0)))
- %pl.playThread(1,armReadyLeft);
- }
- function swol_torchImageEnd::unMountCheck(%db,%pl,%slot)
- {
- if(!isObject(%pl.getMountedImage(0)))
- %pl.playThread(1,armReadyLeft);
- }
- function swol_torchImage::onUnMount(%db,%pl,%slot)
- {
- if(isObject(%pl.light))
- {
- %pl.light.delete();
- %pl.playAudio(2,swol_torchEndSound);
- }
- else
- {
- cancel(%pl.startTorchSched);
- }
- %pl.lastTorchTime = getSimTime();
- }
- package swol_torchLightReplace
- {
- function player::updateArm(%pl,%image)
- {
- if(!%leftimage = %pl.getMountedImage(1))
- return parent::updateArm(%pl,%image);
- if(!%leftimage.isLeftHandLight && !%leftimage.leftHandKeepUp)
- return parent::updateArm(%pl,%image);
- if(%image.armReady)
- {
- if(!isObject(%pl.getMountedImage(0)))
- %pl.playThread(1,armReadyBoth);
- }
- }
- function WeaponImage::onUnMount(%db,%pl,%slot)
- {
- if(%slot != 0)
- return parent::onUnMount(%db,%pl,%slot);
- if(!%leftimage = %pl.getMountedImage(1))
- return parent::onUnMount(%db,%pl,%slot);
- if(!%leftimage.isLeftHandLight && !%leftimage.leftHandKeepUp)
- return parent::onUnMount(%db,%pl,%slot);
- %leftimage.schedule(1,unMountCheck,%pl,%slot);
- if(%db.showBricks)
- {
- if(isObject(%cl = %pl.client))
- commandToClient(%cl,'ShowBricks',0);
- }
- }
- function player::hideNode(%pl,%node)
- {
- if(%node $= "lhook" || %node $= "lhand")
- {
- if(isObject(%im = %pl.getMountedImage(1)))
- {
- if(%im.isLeftHandLight)
- {
- %pl.unMountImage(1);
- %pl.playThread(2,root);
- }
- }
- }
- parent::hideNode(%pl,%node);
- }
- function serverCmdLight(%cl)
- {
- if(!isObject(%pl = %cl.player))
- return parent::serverCmdLight(%cl);
- if(isObject(%im = %pl.getMountedImage(0)))
- {
- if(isObject(%im.item))
- {
- if(%im.item $= ND_Item)
- return parent::serverCmdLight(%cl);
- }
- }
- if(!isObject(%im = %pl.getMountedImage(1)))
- {
- if(getSimTime()-%pl.lastTorchTime > 2500)
- {
- if(%pl.isNodeVisible("lhand")+%pl.isNodeVisible("lhook") > 0)
- %pl.mountImage(swol_torchImage,1);
- }
- }
- else if(%im == nameToId(swol_torchImage))
- {
- if(getSimTime()-%pl.lastTorchTime > 1100)
- {
- swol_torchImage.putOutTorch(%pl,1);
- }
- }
- }
- };
- activatePackage(swol_torchLightReplace);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement