-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from cyb3rpsych0s1s/feat/tobacco
Tobacco
- Loading branch information
Showing
10 changed files
with
355 additions
and
35 deletions.
There are no files selected for viewing
Binary file modified
BIN
+516 Bytes
(110%)
archives/Addicted.Translations/source/archive/addicted/localization/en-us.json
Binary file not shown.
Binary file modified
BIN
+569 Bytes
(110%)
archives/Addicted.Translations/source/archive/addicted/localization/es-es.json
Binary file not shown.
Binary file modified
BIN
+574 Bytes
(110%)
archives/Addicted.Translations/source/archive/addicted/localization/fr-fr.json
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
module Addicted.Manager | ||
|
||
import Addicted.System.AddictedSystem | ||
import Addicted.Helper | ||
import Addicted.Helpers.Generic | ||
import Addicted.{Threshold, Addiction, Consumable} | ||
import Addicted.Utils.E | ||
|
||
public class CigaretteAttachment extends AttachmentSlotsScriptCallback { | ||
public let owner: ref<PlayerPuppet>; | ||
public func OnItemEquipped(slot: TweakDBID, item: ItemID) -> Void { | ||
let system: ref<AddictedSystem>; | ||
let threshold: Threshold; | ||
let notable: Bool; | ||
let severe: Bool; | ||
let id: TweakDBID; | ||
if Generic.IsTobacco(ItemID.GetTDBID(item)) | ||
|| Generic.IsLighter(ItemID.GetTDBID(item)) { | ||
E(s"cigarette attachment"); | ||
system = AddictedSystem.GetInstance(this.owner.GetGame()); | ||
system.OnConsumeItem(item); | ||
threshold = system.Threshold(Addiction.Tobacco); | ||
notable = EnumInt(threshold) == EnumInt(Threshold.Notably); | ||
severe = EnumInt(threshold) == EnumInt(Threshold.Severely); | ||
if notable || severe { | ||
if notable { id = t"BaseStatusEffect.ShortBreath"; } | ||
else { id = t"BaseStatusEffect.BreathLess"; } | ||
StatusEffectHelper.ApplyStatusEffect(this.owner, id, 0.2); | ||
} | ||
} | ||
} | ||
} | ||
|
||
public class TobaccoManager extends IScriptable { | ||
private let listener: ref<AttachmentSlotsScriptListener>; | ||
public func Register(player: ref<PlayerPuppet>) -> Void { | ||
let transactions: ref<TransactionSystem>; | ||
if player != null && !IsDefined(this.listener) { | ||
E(s"register tobacco manager"); | ||
transactions = GameInstance.GetTransactionSystem(player.GetGame()); | ||
let callback = new CigaretteAttachment(); | ||
callback.owner = player; | ||
this.listener = transactions.RegisterAttachmentSlotListener(player, callback); | ||
} | ||
} | ||
public func Unregister(player: ref<PlayerPuppet>) -> Void { | ||
let transactions: ref<TransactionSystem>; | ||
if player != null && IsDefined(this.listener) { | ||
E(s"unregister tobacco manager"); | ||
transactions = GameInstance.GetTransactionSystem(player.GetGame()); | ||
transactions.UnregisterAttachmentSlotListener(player, this.listener); | ||
} | ||
} | ||
} |
Oops, something went wrong.