// Function from file: energy.dm public override int suicide_act(Mob_Living_Carbon_Human user = null) { Obj_Item_AmmoCasing_Energy shot = null; if (Lang13.Bool(this.can_shoot())) { user.visible_message(new Txt("<span class='suicide'>").item(user).str(" is putting the barrel of the ").item(this.name).str(" in ").his_her_its_their().str(" mouth. It looks like ").he_she_it_they().str("'s trying to commit suicide.</span>").ToString()); Task13.Sleep(25); if (user.l_hand == this || user.r_hand == this) { user.visible_message(new Txt("<span class='suicide'>").item(user).str(" melts ").his_her_its_their().str(" face off with the ").item(this.name).str("!</span>").ToString()); GlobalFuncs.playsound(this.loc, this.fire_sound, 50, 1, -1); shot = this.ammo_type[this.select]; ((Obj_Item_Weapon_StockParts_Cell)this.power_supply).use(shot.e_cost); this.update_icon(); return(2); } else { user.visible_message("<span class='suicide'>" + user + " panics and starts choking to death!</span>"); return(8); } } else { user.visible_message(new Txt("<span class='suicide'>").item(user).str(" is pretending to blow ").his_her_its_their().str(" brains out with the ").item(this.name).str("! It looks like ").he_she_it_they().str("'s trying to commit suicide!</b></span>").ToString()); GlobalFuncs.playsound(this.loc, "sound/weapons/empty.ogg", 50, 1, -1); return(8); } return(0); }
// Function from file: robot_modules.dm public override void respawn_consumable(dynamic R = null, double?coeff = null) { coeff = coeff ?? 1; dynamic T = null; Obj_Item_AmmoCasing_Energy S = null; base.respawn_consumable((object)(R), coeff); T = Lang13.FindIn(typeof(Obj_Item_Weapon_Gun_Energy_Gun_Advtaser_Cyborg), this.get_usable_modules()); if (Lang13.Bool(T)) { if (Convert.ToDouble(T.power_supply.charge) < (T.power_supply.maxcharge ?? 0)) { S = T.ammo_type[T.select]; ((Obj_Item_Weapon_StockParts_Cell)T.power_supply).give((S.e_cost ?? 0) * (coeff ?? 0)); T.update_icon(); } else { T.charge_tick = 0; } } return; }
// Function from file: energy.dm public override dynamic can_shoot( ) { Obj_Item_AmmoCasing_Energy shot = null; shot = this.ammo_type[this.select]; return(Convert.ToDouble(this.power_supply.charge) >= (shot.e_cost ?? 0)); }
// Function from file: special.dm public override bool update_icon(dynamic new_state = null, dynamic new_icon = null, int?new_px = null, int?new_py = null) { Obj_Item_AmmoCasing_Energy shot = null; base.update_icon((object)(new_state), (object)(new_icon), new_px, new_py); shot = this.ammo_type[this.select]; if (Convert.ToDouble(this.power_supply.charge) > (shot.e_cost ?? 0)) { this.overlays.Add("decloner_spin"); } return(false); }
// Function from file: special.dm public override bool update_icon(dynamic new_state = null, dynamic new_icon = null, int?new_px = null, int?new_py = null) { Obj_Item_AmmoCasing_Energy shot = null; shot = this.ammo_type[this.select]; if (Convert.ToDouble(this.power_supply.charge) < (shot.e_cost ?? 0)) { this.icon_state = "" + Lang13.Initial(this, "icon_state") + "_empty"; } else { this.icon_state = Lang13.Initial(this, "icon_state"); } return(false); }
// Function from file: energy.dm public override void newshot( ) { Obj_Item_AmmoCasing_Energy shot = null; if (!(this.ammo_type != null) || !Lang13.Bool(this.power_supply)) { return; } shot = this.ammo_type[this.select]; if (Convert.ToDouble(this.power_supply.charge) >= (shot.e_cost ?? 0)) { this.chambered = shot; this.chambered.newshot(); } return; }
// Function from file: energy.dm public void select_fire(dynamic user = null) { Obj_Item_AmmoCasing_Energy shot = null; this.select++; if (this.select > this.ammo_type.len) { this.select = 1; } shot = this.ammo_type[this.select]; this.fire_sound = shot.fire_sound; this.fire_delay = shot.delay; if (Lang13.Bool(shot.select_name)) { user.WriteMsg("<span class='notice'>" + this + " is now set to " + shot.select_name + ".</span>"); } this.update_icon(); return; }
// Function from file: energy.dm public void robocharge( ) { Ent_Static R = null; Obj_Item_AmmoCasing_Energy shot = null; if (this.loc is Mob_Living_Silicon_Robot) { R = this.loc; if (R != null && Lang13.Bool(((dynamic)R).cell)) { shot = this.ammo_type[this.select]; if (((Obj_Item_Weapon_StockParts_Cell)((dynamic)R).cell).use(shot.e_cost)) { ((Obj_Item_Weapon_StockParts_Cell)this.power_supply).give(shot.e_cost); } } } return; }
// Function from file: energy.dm public override bool update_icon(dynamic new_state = null, dynamic new_icon = null, int?new_px = null, int?new_py = null) { int ratio = 0; Obj_Item_AmmoCasing_Energy shot = null; string iconState = null; string itemState = null; int? i = null; string iconF = null; this.overlays.Cut(); ratio = GlobalFuncs.Ceiling(this.power_supply.charge / this.power_supply.maxcharge * 4); shot = this.ammo_type[this.select]; iconState = "" + this.icon_state + "_charge"; itemState = null; if (!Lang13.Bool(Lang13.Initial(this, "item_state"))) { itemState = this.icon_state; } if (this.modifystate != 0) { this.overlays.Add("" + this.icon_state + "_" + shot.select_name); iconState += "_" + shot.select_name; if (Lang13.Bool(itemState)) { itemState += "" + shot.select_name; } } if (Convert.ToDouble(this.power_supply.charge) < (shot.e_cost ?? 0)) { this.overlays.Add("" + this.icon_state + "_empty"); } else if (!this.shaded_charge) { i = null; i = ratio; while ((i ?? 0) >= 1) { this.overlays.Add(new Image(this.icon, null, iconState, null, null, this.ammo_x_offset * ((i ?? 0) - 1))); i--; } } else { this.overlays.Add(new Image(this.icon, null, "" + this.icon_state + "_charge" + ratio)); } if (Lang13.Bool(this.F)) { iconF = "flight"; if (Lang13.Bool(this.F.on)) { iconF = "flight_on"; } this.overlays.Add(new Image(this.icon, null, iconF, null, null, this.flight_x_offset, this.flight_y_offset)); } if (Lang13.Bool(itemState)) { itemState += "" + ratio; this.item_state = itemState; } return(false); }
// Function from file: mimic.dm public override void OpenFire(dynamic A = null) { Obj_Item_AmmoCasing_Energy shot = null; if (this.Zapgun != null) { if (Lang13.Bool(((dynamic)this.Zapgun).power_supply)) { shot = ((dynamic)this.Zapgun).ammo_type[((dynamic)this.Zapgun).select]; if (Convert.ToDouble(((dynamic)this.Zapgun).power_supply.charge) >= (shot.e_cost ?? 0)) { ((dynamic)this.Zapgun).power_supply.use(shot.e_cost); ((dynamic)this.Zapgun).update_icon(); base.OpenFire((object)(A)); } } } else if (this.Zapstick != null) { if (Lang13.Bool(((dynamic)this.Zapstick).charges)) { ((dynamic)this.Zapstick).charges--; ((dynamic)this.Zapstick).update_icon(); base.OpenFire((object)(A)); } } else if (this.Pewgun != null) { if (Lang13.Bool(((dynamic)this.Pewgun).chambered)) { if (Lang13.Bool(((dynamic)this.Pewgun).chambered.BB)) { GlobalFuncs.qdel(((dynamic)this.Pewgun).chambered.BB); ((dynamic)this.Pewgun).chambered.BB = null; ((dynamic)this.Pewgun).chambered.update_icon(); base.OpenFire((object)(A)); } else { this.visible_message("<span class='danger'>The <b>" + this + "</b> clears a jam!</span>"); } ((dynamic)this.Pewgun).chambered.loc = this.loc; ((dynamic)this.Pewgun).chambered = null; if (Lang13.Bool(((dynamic)this.Pewgun).magazine) && ((dynamic)this.Pewgun).magazine.stored_ammo.len != 0) { ((dynamic)this.Pewgun).chambered = ((Obj_Item_AmmoBox)((dynamic)this.Pewgun).magazine).get_round(false); ((dynamic)this.Pewgun).chambered.loc = this.Pewgun; } ((dynamic)this.Pewgun).update_icon(); } else if (Lang13.Bool(((dynamic)this.Pewgun).magazine) && ((dynamic)this.Pewgun).magazine.stored_ammo.len != 0) { ((dynamic)this.Pewgun).chambered = ((Obj_Item_AmmoBox)((dynamic)this.Pewgun).magazine).get_round(false); ((dynamic)this.Pewgun).chambered.loc = this.Pewgun; this.visible_message("<span class='danger'>The <b>" + this + "</b> cocks itself!</span>"); } } else { this.ranged = false; this.retreat_distance = 0; this.minimum_distance = 1; return; } this.icon_state = this.TrueGun.icon_state; this.icon_living = this.TrueGun.icon_state; return; }