public override bool onPickup(Item obj, ShapeBase user, int amount) { if (base.onPickup(obj, user, amount)) { Audio.AudioServerPlay3D("AmmoPickupSound", user.getTransform()); return true; } return false; }
/*note In torquescript they used a classname call to the weapon class to perform * the onPickUp and onUse. Unfortunately, we don't have that ability in CSharp. */ public override bool onPickup(Item obj, ShapeBase user, int amount) { if (!base.onPickup(obj, user, amount)) return false; Audio.AudioServerPlay3D("WeaponPickupSound", user.getTransform()); //todo do really like this, I guess they didn't want aiPlayer picking shit up. if (user.getClassName() == "Player" && user.getMountedImage(Constants.WeaponSlot) == 0) return user.Use(this); return false; }
/*note In torquescript they used a classname call to the weapon class to perform * the onPickUp and onUse. Unfortunately, we don't have that ability in CSharp. */ public override bool onPickup(Item obj, ShapeBase user, int amount) { if (!base.onPickup(obj, user, amount)) { return(false); } Audio.AudioServerPlay3D("WeaponPickupSound", user.getTransform()); //todo do really like this, I guess they didn't want aiPlayer picking shit up. if (user.getClassName() == "Player" && user.getMountedImage(Constants.WeaponSlot) == 0) { return(user.Use(this)); } return(false); }
public override bool onUse(ShapeBase obj) { if (obj.getMountedImage(Constants.WeaponSlot) == this["image"].AsInt()) return false; Audio.AudioServerPlay3D("WeaponUseSound", obj.getTransform()); obj.mountImage(this["image"], Constants.WeaponSlot, true, string.Empty); if (obj["client"].AsBool()) { if (this["description"] != string.Empty) message.MessageClient(obj["client"], "MsgWeaponUsed", "\\c3%1 \\c5 selected.", this["description"]); else message.MessageClient(obj["client"], "MsgWeaponUsed", console.addTaggedString(@"\c0Weapon selected")); } if (obj.isInNamespaceHierarchy("Player")) return false; Player player = obj._ID; player.allowAllPoses(); SimObject image = this["image"]; if (image["jumpingDisallowed"].AsBool()) player.allowJumping(false); if (image["jetJumpingDisallowed"].AsBool()) player.allowJetJumping(false); if (image["sprintDisallowed"].AsBool()) player.allowSprinting(false); if (image["crouchDisallowed"].AsBool()) player.allowCrouching(false); if (image["proneDisallowed"].AsBool()) player.allowProne(false); if (image["swimmingDisallowed"].AsBool()) player.allowSwimming(false); return true; }
public override bool onPickup(Item obj, ShapeBase user, int amount) { if (!base.onPickup(obj, user, amount)) return false; Audio.AudioServerPlay3D("WeaponPickupSound", user.getTransform()); ShapeBaseImageData image = user.getMountedImage(Constants.WeaponSlot); if (image == 0) return false; if (!console.isField(image, "clip") || image["clip"].getID() != getId()) return false; bool outOfAmmo = !user.getImageAmmo(Constants.WeaponSlot); int amountInClips = 0; int currentAmmo = user.getInventory(image["ammo"]); if (console.isObject(image["clip"])) amountInClips = user.getInventory(image["clip"]); int t = console.GetVarInt(string.Format("{0}.ammo.maxInventory", image)); amountInClips *= t; int amountloadedingun = console.GetVarInt(string.Format("{0}.remaining{1}", obj, console.GetVarString(string.Format("{0}.ammo", this)))); amountInClips += amountloadedingun; GameConnection client = user["client"]; client.setAmmoAmountHud(currentAmmo, amountInClips); if (outOfAmmo) ((WeaponImage) image.ID).onClipEmpty(user, Constants.WeaponSlot); return true; }
public override void onDestroyed(ShapeBase obj, string lastState) { // This method is invoked by the ShapeBase code whenever the // object's damage state changes. // Fade out the destroyed object. Then schedule a return. int destroydelay = iGlobal["$TurretShape::DestroyedFadeDelay"]; obj.startFade(1000, destroydelay, true); obj.schedule((destroydelay + 1000).AsString(), "delete"); TurretShape ts = obj.ID; if (ts.doRespawn()) { ((SimSet)"MissionGroup").schedule(sGlobal["$TurretShape::RespawnTime"], "respawnTurret", this, console.GetClassName(obj), obj.getTransform().AsString(), true.AsString(), true.AsString()); } }
public override void onDestroyed(ShapeBase obj, string lastState) { // This method is invoked by the ShapeBase code whenever the // object's damage state changes. // Fade out the destroyed object. Then schedule a return. int destroydelay = iGlobal["$TurretShape::DestroyedFadeDelay"]; obj.startFade(1000, destroydelay, true); obj.schedule((destroydelay + 1000).AsString(), "delete"); TurretShape ts = obj.ID; if (ts.doRespawn()) ((SimSet) "MissionGroup").schedule(sGlobal["$TurretShape::RespawnTime"], "respawnTurret", this, console.GetClassName(obj), obj.getTransform().AsString(), true.AsString(), true.AsString()); }
public override bool onUse(ShapeBase obj) { if (obj.getMountedImage(Constants.WeaponSlot) == this["image"].AsInt()) { return(false); } Audio.AudioServerPlay3D("WeaponUseSound", obj.getTransform()); obj.mountImage(this["image"], Constants.WeaponSlot, true, string.Empty); if (obj["client"].AsBool()) { if (this["description"] != string.Empty) { message.MessageClient(obj["client"], "MsgWeaponUsed", "\\c3%1 \\c5 selected.", this["description"]); } else { message.MessageClient(obj["client"], "MsgWeaponUsed", console.addTaggedString(@"\c0Weapon selected")); } } if (obj.isInNamespaceHierarchy("Player")) { return(false); } Player player = obj._ID; player.allowAllPoses(); SimObject image = this["image"]; if (image["jumpingDisallowed"].AsBool()) { player.allowJumping(false); } if (image["jetJumpingDisallowed"].AsBool()) { player.allowJetJumping(false); } if (image["sprintDisallowed"].AsBool()) { player.allowSprinting(false); } if (image["crouchDisallowed"].AsBool()) { player.allowCrouching(false); } if (image["proneDisallowed"].AsBool()) { player.allowProne(false); } if (image["swimmingDisallowed"].AsBool()) { player.allowSwimming(false); } return(true); }